worker-html.js 330 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615
  1. "no use strict";
  2. !(function(window) {
  3. if (typeof window.window != "undefined" && window.document)
  4. return;
  5. if (window.require && window.define)
  6. return;
  7. if (!window.console) {
  8. window.console = function() {
  9. var msgs = Array.prototype.slice.call(arguments, 0);
  10. postMessage({type: "log", data: msgs});
  11. };
  12. window.console.error =
  13. window.console.warn =
  14. window.console.log =
  15. window.console.trace = window.console;
  16. }
  17. window.window = window;
  18. window.ace = window;
  19. window.onerror = function(message, file, line, col, err) {
  20. postMessage({type: "error", data: {
  21. message: message,
  22. data: err.data,
  23. file: file,
  24. line: line,
  25. col: col,
  26. stack: err.stack
  27. }});
  28. };
  29. window.normalizeModule = function(parentId, moduleName) {
  30. // normalize plugin requires
  31. if (moduleName.indexOf("!") !== -1) {
  32. var chunks = moduleName.split("!");
  33. return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]);
  34. }
  35. // normalize relative requires
  36. if (moduleName.charAt(0) == ".") {
  37. var base = parentId.split("/").slice(0, -1).join("/");
  38. moduleName = (base ? base + "/" : "") + moduleName;
  39. while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
  40. var previous = moduleName;
  41. moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
  42. }
  43. }
  44. return moduleName;
  45. };
  46. window.require = function require(parentId, id) {
  47. if (!id) {
  48. id = parentId;
  49. parentId = null;
  50. }
  51. if (!id.charAt)
  52. throw new Error("worker.js require() accepts only (parentId, id) as arguments");
  53. id = window.normalizeModule(parentId, id);
  54. var module = window.require.modules[id];
  55. if (module) {
  56. if (!module.initialized) {
  57. module.initialized = true;
  58. module.exports = module.factory().exports;
  59. }
  60. return module.exports;
  61. }
  62. if (!window.require.tlns)
  63. return console.log("unable to load " + id);
  64. var path = resolveModuleId(id, window.require.tlns);
  65. if (path.slice(-3) != ".js") path += ".js";
  66. window.require.id = id;
  67. window.require.modules[id] = {}; // prevent infinite loop on broken modules
  68. importScripts(path);
  69. return window.require(parentId, id);
  70. };
  71. function resolveModuleId(id, paths) {
  72. var testPath = id, tail = "";
  73. while (testPath) {
  74. var alias = paths[testPath];
  75. if (typeof alias == "string") {
  76. return alias + tail;
  77. } else if (alias) {
  78. return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name);
  79. } else if (alias === false) {
  80. return "";
  81. }
  82. var i = testPath.lastIndexOf("/");
  83. if (i === -1) break;
  84. tail = testPath.substr(i) + tail;
  85. testPath = testPath.slice(0, i);
  86. }
  87. return id;
  88. }
  89. window.require.modules = {};
  90. window.require.tlns = {};
  91. window.define = function(id, deps, factory) {
  92. if (arguments.length == 2) {
  93. factory = deps;
  94. if (typeof id != "string") {
  95. deps = id;
  96. id = window.require.id;
  97. }
  98. } else if (arguments.length == 1) {
  99. factory = id;
  100. deps = [];
  101. id = window.require.id;
  102. }
  103. if (typeof factory != "function") {
  104. window.require.modules[id] = {
  105. exports: factory,
  106. initialized: true
  107. };
  108. return;
  109. }
  110. if (!deps.length)
  111. // If there is no dependencies, we inject "require", "exports" and
  112. // "module" as dependencies, to provide CommonJS compatibility.
  113. deps = ["require", "exports", "module"];
  114. var req = function(childId) {
  115. return window.require(id, childId);
  116. };
  117. window.require.modules[id] = {
  118. exports: {},
  119. factory: function() {
  120. var module = this;
  121. var returnExports = factory.apply(this, deps.map(function(dep) {
  122. switch (dep) {
  123. // Because "require", "exports" and "module" aren't actual
  124. // dependencies, we must handle them seperately.
  125. case "require": return req;
  126. case "exports": return module.exports;
  127. case "module": return module;
  128. // But for all other dependencies, we can just go ahead and
  129. // require them.
  130. default: return req(dep);
  131. }
  132. }));
  133. if (returnExports)
  134. module.exports = returnExports;
  135. return module;
  136. }
  137. };
  138. };
  139. window.define.amd = {};
  140. require.tlns = {};
  141. window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
  142. for (var i in topLevelNamespaces)
  143. require.tlns[i] = topLevelNamespaces[i];
  144. };
  145. window.initSender = function initSender() {
  146. var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter;
  147. var oop = window.require("ace/lib/oop");
  148. var Sender = function() {};
  149. (function() {
  150. oop.implement(this, EventEmitter);
  151. this.callback = function(data, callbackId) {
  152. postMessage({
  153. type: "call",
  154. id: callbackId,
  155. data: data
  156. });
  157. };
  158. this.emit = function(name, data) {
  159. postMessage({
  160. type: "event",
  161. name: name,
  162. data: data
  163. });
  164. };
  165. }).call(Sender.prototype);
  166. return new Sender();
  167. };
  168. var main = window.main = null;
  169. var sender = window.sender = null;
  170. window.onmessage = function(e) {
  171. var msg = e.data;
  172. if (msg.event && sender) {
  173. sender._signal(msg.event, msg.data);
  174. }
  175. else if (msg.command) {
  176. if (main[msg.command])
  177. main[msg.command].apply(main, msg.args);
  178. else if (window[msg.command])
  179. window[msg.command].apply(window, msg.args);
  180. else
  181. throw new Error("Unknown command:" + msg.command);
  182. }
  183. else if (msg.init) {
  184. window.initBaseUrls(msg.tlns);
  185. require("ace/lib/es5-shim");
  186. sender = window.sender = window.initSender();
  187. var clazz = require(msg.module)[msg.classname];
  188. main = window.main = new clazz(sender);
  189. }
  190. };
  191. })(this);
  192. ace.define("ace/lib/oop",[], function(require, exports, module) {
  193. "use strict";
  194. exports.inherits = function(ctor, superCtor) {
  195. ctor.super_ = superCtor;
  196. ctor.prototype = Object.create(superCtor.prototype, {
  197. constructor: {
  198. value: ctor,
  199. enumerable: false,
  200. writable: true,
  201. configurable: true
  202. }
  203. });
  204. };
  205. exports.mixin = function(obj, mixin) {
  206. for (var key in mixin) {
  207. obj[key] = mixin[key];
  208. }
  209. return obj;
  210. };
  211. exports.implement = function(proto, mixin) {
  212. exports.mixin(proto, mixin);
  213. };
  214. });
  215. ace.define("ace/lib/lang",[], function(require, exports, module) {
  216. "use strict";
  217. exports.last = function(a) {
  218. return a[a.length - 1];
  219. };
  220. exports.stringReverse = function(string) {
  221. return string.split("").reverse().join("");
  222. };
  223. exports.stringRepeat = function (string, count) {
  224. var result = '';
  225. while (count > 0) {
  226. if (count & 1)
  227. result += string;
  228. if (count >>= 1)
  229. string += string;
  230. }
  231. return result;
  232. };
  233. var trimBeginRegexp = /^\s\s*/;
  234. var trimEndRegexp = /\s\s*$/;
  235. exports.stringTrimLeft = function (string) {
  236. return string.replace(trimBeginRegexp, '');
  237. };
  238. exports.stringTrimRight = function (string) {
  239. return string.replace(trimEndRegexp, '');
  240. };
  241. exports.copyObject = function(obj) {
  242. var copy = {};
  243. for (var key in obj) {
  244. copy[key] = obj[key];
  245. }
  246. return copy;
  247. };
  248. exports.copyArray = function(array){
  249. var copy = [];
  250. for (var i=0, l=array.length; i<l; i++) {
  251. if (array[i] && typeof array[i] == "object")
  252. copy[i] = this.copyObject(array[i]);
  253. else
  254. copy[i] = array[i];
  255. }
  256. return copy;
  257. };
  258. exports.deepCopy = function deepCopy(obj) {
  259. if (typeof obj !== "object" || !obj)
  260. return obj;
  261. var copy;
  262. if (Array.isArray(obj)) {
  263. copy = [];
  264. for (var key = 0; key < obj.length; key++) {
  265. copy[key] = deepCopy(obj[key]);
  266. }
  267. return copy;
  268. }
  269. if (Object.prototype.toString.call(obj) !== "[object Object]")
  270. return obj;
  271. copy = {};
  272. for (var key in obj)
  273. copy[key] = deepCopy(obj[key]);
  274. return copy;
  275. };
  276. exports.arrayToMap = function(arr) {
  277. var map = {};
  278. for (var i=0; i<arr.length; i++) {
  279. map[arr[i]] = 1;
  280. }
  281. return map;
  282. };
  283. exports.createMap = function(props) {
  284. var map = Object.create(null);
  285. for (var i in props) {
  286. map[i] = props[i];
  287. }
  288. return map;
  289. };
  290. exports.arrayRemove = function(array, value) {
  291. for (var i = 0; i <= array.length; i++) {
  292. if (value === array[i]) {
  293. array.splice(i, 1);
  294. }
  295. }
  296. };
  297. exports.escapeRegExp = function(str) {
  298. return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
  299. };
  300. exports.escapeHTML = function(str) {
  301. return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
  302. };
  303. exports.getMatchOffsets = function(string, regExp) {
  304. var matches = [];
  305. string.replace(regExp, function(str) {
  306. matches.push({
  307. offset: arguments[arguments.length-2],
  308. length: str.length
  309. });
  310. });
  311. return matches;
  312. };
  313. exports.deferredCall = function(fcn) {
  314. var timer = null;
  315. var callback = function() {
  316. timer = null;
  317. fcn();
  318. };
  319. var deferred = function(timeout) {
  320. deferred.cancel();
  321. timer = setTimeout(callback, timeout || 0);
  322. return deferred;
  323. };
  324. deferred.schedule = deferred;
  325. deferred.call = function() {
  326. this.cancel();
  327. fcn();
  328. return deferred;
  329. };
  330. deferred.cancel = function() {
  331. clearTimeout(timer);
  332. timer = null;
  333. return deferred;
  334. };
  335. deferred.isPending = function() {
  336. return timer;
  337. };
  338. return deferred;
  339. };
  340. exports.delayedCall = function(fcn, defaultTimeout) {
  341. var timer = null;
  342. var callback = function() {
  343. timer = null;
  344. fcn();
  345. };
  346. var _self = function(timeout) {
  347. if (timer == null)
  348. timer = setTimeout(callback, timeout || defaultTimeout);
  349. };
  350. _self.delay = function(timeout) {
  351. timer && clearTimeout(timer);
  352. timer = setTimeout(callback, timeout || defaultTimeout);
  353. };
  354. _self.schedule = _self;
  355. _self.call = function() {
  356. this.cancel();
  357. fcn();
  358. };
  359. _self.cancel = function() {
  360. timer && clearTimeout(timer);
  361. timer = null;
  362. };
  363. _self.isPending = function() {
  364. return timer;
  365. };
  366. return _self;
  367. };
  368. });
  369. ace.define("ace/range",[], function(require, exports, module) {
  370. "use strict";
  371. var comparePoints = function(p1, p2) {
  372. return p1.row - p2.row || p1.column - p2.column;
  373. };
  374. var Range = function(startRow, startColumn, endRow, endColumn) {
  375. this.start = {
  376. row: startRow,
  377. column: startColumn
  378. };
  379. this.end = {
  380. row: endRow,
  381. column: endColumn
  382. };
  383. };
  384. (function() {
  385. this.isEqual = function(range) {
  386. return this.start.row === range.start.row &&
  387. this.end.row === range.end.row &&
  388. this.start.column === range.start.column &&
  389. this.end.column === range.end.column;
  390. };
  391. this.toString = function() {
  392. return ("Range: [" + this.start.row + "/" + this.start.column +
  393. "] -> [" + this.end.row + "/" + this.end.column + "]");
  394. };
  395. this.contains = function(row, column) {
  396. return this.compare(row, column) == 0;
  397. };
  398. this.compareRange = function(range) {
  399. var cmp,
  400. end = range.end,
  401. start = range.start;
  402. cmp = this.compare(end.row, end.column);
  403. if (cmp == 1) {
  404. cmp = this.compare(start.row, start.column);
  405. if (cmp == 1) {
  406. return 2;
  407. } else if (cmp == 0) {
  408. return 1;
  409. } else {
  410. return 0;
  411. }
  412. } else if (cmp == -1) {
  413. return -2;
  414. } else {
  415. cmp = this.compare(start.row, start.column);
  416. if (cmp == -1) {
  417. return -1;
  418. } else if (cmp == 1) {
  419. return 42;
  420. } else {
  421. return 0;
  422. }
  423. }
  424. };
  425. this.comparePoint = function(p) {
  426. return this.compare(p.row, p.column);
  427. };
  428. this.containsRange = function(range) {
  429. return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
  430. };
  431. this.intersects = function(range) {
  432. var cmp = this.compareRange(range);
  433. return (cmp == -1 || cmp == 0 || cmp == 1);
  434. };
  435. this.isEnd = function(row, column) {
  436. return this.end.row == row && this.end.column == column;
  437. };
  438. this.isStart = function(row, column) {
  439. return this.start.row == row && this.start.column == column;
  440. };
  441. this.setStart = function(row, column) {
  442. if (typeof row == "object") {
  443. this.start.column = row.column;
  444. this.start.row = row.row;
  445. } else {
  446. this.start.row = row;
  447. this.start.column = column;
  448. }
  449. };
  450. this.setEnd = function(row, column) {
  451. if (typeof row == "object") {
  452. this.end.column = row.column;
  453. this.end.row = row.row;
  454. } else {
  455. this.end.row = row;
  456. this.end.column = column;
  457. }
  458. };
  459. this.inside = function(row, column) {
  460. if (this.compare(row, column) == 0) {
  461. if (this.isEnd(row, column) || this.isStart(row, column)) {
  462. return false;
  463. } else {
  464. return true;
  465. }
  466. }
  467. return false;
  468. };
  469. this.insideStart = function(row, column) {
  470. if (this.compare(row, column) == 0) {
  471. if (this.isEnd(row, column)) {
  472. return false;
  473. } else {
  474. return true;
  475. }
  476. }
  477. return false;
  478. };
  479. this.insideEnd = function(row, column) {
  480. if (this.compare(row, column) == 0) {
  481. if (this.isStart(row, column)) {
  482. return false;
  483. } else {
  484. return true;
  485. }
  486. }
  487. return false;
  488. };
  489. this.compare = function(row, column) {
  490. if (!this.isMultiLine()) {
  491. if (row === this.start.row) {
  492. return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
  493. }
  494. }
  495. if (row < this.start.row)
  496. return -1;
  497. if (row > this.end.row)
  498. return 1;
  499. if (this.start.row === row)
  500. return column >= this.start.column ? 0 : -1;
  501. if (this.end.row === row)
  502. return column <= this.end.column ? 0 : 1;
  503. return 0;
  504. };
  505. this.compareStart = function(row, column) {
  506. if (this.start.row == row && this.start.column == column) {
  507. return -1;
  508. } else {
  509. return this.compare(row, column);
  510. }
  511. };
  512. this.compareEnd = function(row, column) {
  513. if (this.end.row == row && this.end.column == column) {
  514. return 1;
  515. } else {
  516. return this.compare(row, column);
  517. }
  518. };
  519. this.compareInside = function(row, column) {
  520. if (this.end.row == row && this.end.column == column) {
  521. return 1;
  522. } else if (this.start.row == row && this.start.column == column) {
  523. return -1;
  524. } else {
  525. return this.compare(row, column);
  526. }
  527. };
  528. this.clipRows = function(firstRow, lastRow) {
  529. if (this.end.row > lastRow)
  530. var end = {row: lastRow + 1, column: 0};
  531. else if (this.end.row < firstRow)
  532. var end = {row: firstRow, column: 0};
  533. if (this.start.row > lastRow)
  534. var start = {row: lastRow + 1, column: 0};
  535. else if (this.start.row < firstRow)
  536. var start = {row: firstRow, column: 0};
  537. return Range.fromPoints(start || this.start, end || this.end);
  538. };
  539. this.extend = function(row, column) {
  540. var cmp = this.compare(row, column);
  541. if (cmp == 0)
  542. return this;
  543. else if (cmp == -1)
  544. var start = {row: row, column: column};
  545. else
  546. var end = {row: row, column: column};
  547. return Range.fromPoints(start || this.start, end || this.end);
  548. };
  549. this.isEmpty = function() {
  550. return (this.start.row === this.end.row && this.start.column === this.end.column);
  551. };
  552. this.isMultiLine = function() {
  553. return (this.start.row !== this.end.row);
  554. };
  555. this.clone = function() {
  556. return Range.fromPoints(this.start, this.end);
  557. };
  558. this.collapseRows = function() {
  559. if (this.end.column == 0)
  560. return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0);
  561. else
  562. return new Range(this.start.row, 0, this.end.row, 0);
  563. };
  564. this.toScreenRange = function(session) {
  565. var screenPosStart = session.documentToScreenPosition(this.start);
  566. var screenPosEnd = session.documentToScreenPosition(this.end);
  567. return new Range(
  568. screenPosStart.row, screenPosStart.column,
  569. screenPosEnd.row, screenPosEnd.column
  570. );
  571. };
  572. this.moveBy = function(row, column) {
  573. this.start.row += row;
  574. this.start.column += column;
  575. this.end.row += row;
  576. this.end.column += column;
  577. };
  578. }).call(Range.prototype);
  579. Range.fromPoints = function(start, end) {
  580. return new Range(start.row, start.column, end.row, end.column);
  581. };
  582. Range.comparePoints = comparePoints;
  583. Range.comparePoints = function(p1, p2) {
  584. return p1.row - p2.row || p1.column - p2.column;
  585. };
  586. exports.Range = Range;
  587. });
  588. ace.define("ace/apply_delta",[], function(require, exports, module) {
  589. "use strict";
  590. function throwDeltaError(delta, errorText){
  591. console.log("Invalid Delta:", delta);
  592. throw "Invalid Delta: " + errorText;
  593. }
  594. function positionInDocument(docLines, position) {
  595. return position.row >= 0 && position.row < docLines.length &&
  596. position.column >= 0 && position.column <= docLines[position.row].length;
  597. }
  598. function validateDelta(docLines, delta) {
  599. if (delta.action != "insert" && delta.action != "remove")
  600. throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
  601. if (!(delta.lines instanceof Array))
  602. throwDeltaError(delta, "delta.lines must be an Array");
  603. if (!delta.start || !delta.end)
  604. throwDeltaError(delta, "delta.start/end must be an present");
  605. var start = delta.start;
  606. if (!positionInDocument(docLines, delta.start))
  607. throwDeltaError(delta, "delta.start must be contained in document");
  608. var end = delta.end;
  609. if (delta.action == "remove" && !positionInDocument(docLines, end))
  610. throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
  611. var numRangeRows = end.row - start.row;
  612. var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
  613. if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
  614. throwDeltaError(delta, "delta.range must match delta lines");
  615. }
  616. exports.applyDelta = function(docLines, delta, doNotValidate) {
  617. var row = delta.start.row;
  618. var startColumn = delta.start.column;
  619. var line = docLines[row] || "";
  620. switch (delta.action) {
  621. case "insert":
  622. var lines = delta.lines;
  623. if (lines.length === 1) {
  624. docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
  625. } else {
  626. var args = [row, 1].concat(delta.lines);
  627. docLines.splice.apply(docLines, args);
  628. docLines[row] = line.substring(0, startColumn) + docLines[row];
  629. docLines[row + delta.lines.length - 1] += line.substring(startColumn);
  630. }
  631. break;
  632. case "remove":
  633. var endColumn = delta.end.column;
  634. var endRow = delta.end.row;
  635. if (row === endRow) {
  636. docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
  637. } else {
  638. docLines.splice(
  639. row, endRow - row + 1,
  640. line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
  641. );
  642. }
  643. break;
  644. }
  645. };
  646. });
  647. ace.define("ace/lib/event_emitter",[], function(require, exports, module) {
  648. "use strict";
  649. var EventEmitter = {};
  650. var stopPropagation = function() { this.propagationStopped = true; };
  651. var preventDefault = function() { this.defaultPrevented = true; };
  652. EventEmitter._emit =
  653. EventEmitter._dispatchEvent = function(eventName, e) {
  654. this._eventRegistry || (this._eventRegistry = {});
  655. this._defaultHandlers || (this._defaultHandlers = {});
  656. var listeners = this._eventRegistry[eventName] || [];
  657. var defaultHandler = this._defaultHandlers[eventName];
  658. if (!listeners.length && !defaultHandler)
  659. return;
  660. if (typeof e != "object" || !e)
  661. e = {};
  662. if (!e.type)
  663. e.type = eventName;
  664. if (!e.stopPropagation)
  665. e.stopPropagation = stopPropagation;
  666. if (!e.preventDefault)
  667. e.preventDefault = preventDefault;
  668. listeners = listeners.slice();
  669. for (var i=0; i<listeners.length; i++) {
  670. listeners[i](e, this);
  671. if (e.propagationStopped)
  672. break;
  673. }
  674. if (defaultHandler && !e.defaultPrevented)
  675. return defaultHandler(e, this);
  676. };
  677. EventEmitter._signal = function(eventName, e) {
  678. var listeners = (this._eventRegistry || {})[eventName];
  679. if (!listeners)
  680. return;
  681. listeners = listeners.slice();
  682. for (var i=0; i<listeners.length; i++)
  683. listeners[i](e, this);
  684. };
  685. EventEmitter.once = function(eventName, callback) {
  686. var _self = this;
  687. callback && this.addEventListener(eventName, function newCallback() {
  688. _self.removeEventListener(eventName, newCallback);
  689. callback.apply(null, arguments);
  690. });
  691. };
  692. EventEmitter.setDefaultHandler = function(eventName, callback) {
  693. var handlers = this._defaultHandlers;
  694. if (!handlers)
  695. handlers = this._defaultHandlers = {_disabled_: {}};
  696. if (handlers[eventName]) {
  697. var old = handlers[eventName];
  698. var disabled = handlers._disabled_[eventName];
  699. if (!disabled)
  700. handlers._disabled_[eventName] = disabled = [];
  701. disabled.push(old);
  702. var i = disabled.indexOf(callback);
  703. if (i != -1)
  704. disabled.splice(i, 1);
  705. }
  706. handlers[eventName] = callback;
  707. };
  708. EventEmitter.removeDefaultHandler = function(eventName, callback) {
  709. var handlers = this._defaultHandlers;
  710. if (!handlers)
  711. return;
  712. var disabled = handlers._disabled_[eventName];
  713. if (handlers[eventName] == callback) {
  714. var old = handlers[eventName];
  715. if (disabled)
  716. this.setDefaultHandler(eventName, disabled.pop());
  717. } else if (disabled) {
  718. var i = disabled.indexOf(callback);
  719. if (i != -1)
  720. disabled.splice(i, 1);
  721. }
  722. };
  723. EventEmitter.on =
  724. EventEmitter.addEventListener = function(eventName, callback, capturing) {
  725. this._eventRegistry = this._eventRegistry || {};
  726. var listeners = this._eventRegistry[eventName];
  727. if (!listeners)
  728. listeners = this._eventRegistry[eventName] = [];
  729. if (listeners.indexOf(callback) == -1)
  730. listeners[capturing ? "unshift" : "push"](callback);
  731. return callback;
  732. };
  733. EventEmitter.off =
  734. EventEmitter.removeListener =
  735. EventEmitter.removeEventListener = function(eventName, callback) {
  736. this._eventRegistry = this._eventRegistry || {};
  737. var listeners = this._eventRegistry[eventName];
  738. if (!listeners)
  739. return;
  740. var index = listeners.indexOf(callback);
  741. if (index !== -1)
  742. listeners.splice(index, 1);
  743. };
  744. EventEmitter.removeAllListeners = function(eventName) {
  745. if (this._eventRegistry) this._eventRegistry[eventName] = [];
  746. };
  747. exports.EventEmitter = EventEmitter;
  748. });
  749. ace.define("ace/anchor",[], function(require, exports, module) {
  750. "use strict";
  751. var oop = require("./lib/oop");
  752. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  753. var Anchor = exports.Anchor = function(doc, row, column) {
  754. this.$onChange = this.onChange.bind(this);
  755. this.attach(doc);
  756. if (typeof column == "undefined")
  757. this.setPosition(row.row, row.column);
  758. else
  759. this.setPosition(row, column);
  760. };
  761. (function() {
  762. oop.implement(this, EventEmitter);
  763. this.getPosition = function() {
  764. return this.$clipPositionToDocument(this.row, this.column);
  765. };
  766. this.getDocument = function() {
  767. return this.document;
  768. };
  769. this.$insertRight = false;
  770. this.onChange = function(delta) {
  771. if (delta.start.row == delta.end.row && delta.start.row != this.row)
  772. return;
  773. if (delta.start.row > this.row)
  774. return;
  775. var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
  776. this.setPosition(point.row, point.column, true);
  777. };
  778. function $pointsInOrder(point1, point2, equalPointsInOrder) {
  779. var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
  780. return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
  781. }
  782. function $getTransformedPoint(delta, point, moveIfEqual) {
  783. var deltaIsInsert = delta.action == "insert";
  784. var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
  785. var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
  786. var deltaStart = delta.start;
  787. var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
  788. if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
  789. return {
  790. row: point.row,
  791. column: point.column
  792. };
  793. }
  794. if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
  795. return {
  796. row: point.row + deltaRowShift,
  797. column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
  798. };
  799. }
  800. return {
  801. row: deltaStart.row,
  802. column: deltaStart.column
  803. };
  804. }
  805. this.setPosition = function(row, column, noClip) {
  806. var pos;
  807. if (noClip) {
  808. pos = {
  809. row: row,
  810. column: column
  811. };
  812. } else {
  813. pos = this.$clipPositionToDocument(row, column);
  814. }
  815. if (this.row == pos.row && this.column == pos.column)
  816. return;
  817. var old = {
  818. row: this.row,
  819. column: this.column
  820. };
  821. this.row = pos.row;
  822. this.column = pos.column;
  823. this._signal("change", {
  824. old: old,
  825. value: pos
  826. });
  827. };
  828. this.detach = function() {
  829. this.document.removeEventListener("change", this.$onChange);
  830. };
  831. this.attach = function(doc) {
  832. this.document = doc || this.document;
  833. this.document.on("change", this.$onChange);
  834. };
  835. this.$clipPositionToDocument = function(row, column) {
  836. var pos = {};
  837. if (row >= this.document.getLength()) {
  838. pos.row = Math.max(0, this.document.getLength() - 1);
  839. pos.column = this.document.getLine(pos.row).length;
  840. }
  841. else if (row < 0) {
  842. pos.row = 0;
  843. pos.column = 0;
  844. }
  845. else {
  846. pos.row = row;
  847. pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
  848. }
  849. if (column < 0)
  850. pos.column = 0;
  851. return pos;
  852. };
  853. }).call(Anchor.prototype);
  854. });
  855. ace.define("ace/document",[], function(require, exports, module) {
  856. "use strict";
  857. var oop = require("./lib/oop");
  858. var applyDelta = require("./apply_delta").applyDelta;
  859. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  860. var Range = require("./range").Range;
  861. var Anchor = require("./anchor").Anchor;
  862. var Document = function(textOrLines) {
  863. this.$lines = [""];
  864. if (textOrLines.length === 0) {
  865. this.$lines = [""];
  866. } else if (Array.isArray(textOrLines)) {
  867. this.insertMergedLines({row: 0, column: 0}, textOrLines);
  868. } else {
  869. this.insert({row: 0, column:0}, textOrLines);
  870. }
  871. };
  872. (function() {
  873. oop.implement(this, EventEmitter);
  874. this.setValue = function(text) {
  875. var len = this.getLength() - 1;
  876. this.remove(new Range(0, 0, len, this.getLine(len).length));
  877. this.insert({row: 0, column: 0}, text);
  878. };
  879. this.getValue = function() {
  880. return this.getAllLines().join(this.getNewLineCharacter());
  881. };
  882. this.createAnchor = function(row, column) {
  883. return new Anchor(this, row, column);
  884. };
  885. if ("aaa".split(/a/).length === 0) {
  886. this.$split = function(text) {
  887. return text.replace(/\r\n|\r/g, "\n").split("\n");
  888. };
  889. } else {
  890. this.$split = function(text) {
  891. return text.split(/\r\n|\r|\n/);
  892. };
  893. }
  894. this.$detectNewLine = function(text) {
  895. var match = text.match(/^.*?(\r\n|\r|\n)/m);
  896. this.$autoNewLine = match ? match[1] : "\n";
  897. this._signal("changeNewLineMode");
  898. };
  899. this.getNewLineCharacter = function() {
  900. switch (this.$newLineMode) {
  901. case "windows":
  902. return "\r\n";
  903. case "unix":
  904. return "\n";
  905. default:
  906. return this.$autoNewLine || "\n";
  907. }
  908. };
  909. this.$autoNewLine = "";
  910. this.$newLineMode = "auto";
  911. this.setNewLineMode = function(newLineMode) {
  912. if (this.$newLineMode === newLineMode)
  913. return;
  914. this.$newLineMode = newLineMode;
  915. this._signal("changeNewLineMode");
  916. };
  917. this.getNewLineMode = function() {
  918. return this.$newLineMode;
  919. };
  920. this.isNewLine = function(text) {
  921. return (text == "\r\n" || text == "\r" || text == "\n");
  922. };
  923. this.getLine = function(row) {
  924. return this.$lines[row] || "";
  925. };
  926. this.getLines = function(firstRow, lastRow) {
  927. return this.$lines.slice(firstRow, lastRow + 1);
  928. };
  929. this.getAllLines = function() {
  930. return this.getLines(0, this.getLength());
  931. };
  932. this.getLength = function() {
  933. return this.$lines.length;
  934. };
  935. this.getTextRange = function(range) {
  936. return this.getLinesForRange(range).join(this.getNewLineCharacter());
  937. };
  938. this.getLinesForRange = function(range) {
  939. var lines;
  940. if (range.start.row === range.end.row) {
  941. lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
  942. } else {
  943. lines = this.getLines(range.start.row, range.end.row);
  944. lines[0] = (lines[0] || "").substring(range.start.column);
  945. var l = lines.length - 1;
  946. if (range.end.row - range.start.row == l)
  947. lines[l] = lines[l].substring(0, range.end.column);
  948. }
  949. return lines;
  950. };
  951. this.insertLines = function(row, lines) {
  952. console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
  953. return this.insertFullLines(row, lines);
  954. };
  955. this.removeLines = function(firstRow, lastRow) {
  956. console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
  957. return this.removeFullLines(firstRow, lastRow);
  958. };
  959. this.insertNewLine = function(position) {
  960. console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
  961. return this.insertMergedLines(position, ["", ""]);
  962. };
  963. this.insert = function(position, text) {
  964. if (this.getLength() <= 1)
  965. this.$detectNewLine(text);
  966. return this.insertMergedLines(position, this.$split(text));
  967. };
  968. this.insertInLine = function(position, text) {
  969. var start = this.clippedPos(position.row, position.column);
  970. var end = this.pos(position.row, position.column + text.length);
  971. this.applyDelta({
  972. start: start,
  973. end: end,
  974. action: "insert",
  975. lines: [text]
  976. }, true);
  977. return this.clonePos(end);
  978. };
  979. this.clippedPos = function(row, column) {
  980. var length = this.getLength();
  981. if (row === undefined) {
  982. row = length;
  983. } else if (row < 0) {
  984. row = 0;
  985. } else if (row >= length) {
  986. row = length - 1;
  987. column = undefined;
  988. }
  989. var line = this.getLine(row);
  990. if (column == undefined)
  991. column = line.length;
  992. column = Math.min(Math.max(column, 0), line.length);
  993. return {row: row, column: column};
  994. };
  995. this.clonePos = function(pos) {
  996. return {row: pos.row, column: pos.column};
  997. };
  998. this.pos = function(row, column) {
  999. return {row: row, column: column};
  1000. };
  1001. this.$clipPosition = function(position) {
  1002. var length = this.getLength();
  1003. if (position.row >= length) {
  1004. position.row = Math.max(0, length - 1);
  1005. position.column = this.getLine(length - 1).length;
  1006. } else {
  1007. position.row = Math.max(0, position.row);
  1008. position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
  1009. }
  1010. return position;
  1011. };
  1012. this.insertFullLines = function(row, lines) {
  1013. row = Math.min(Math.max(row, 0), this.getLength());
  1014. var column = 0;
  1015. if (row < this.getLength()) {
  1016. lines = lines.concat([""]);
  1017. column = 0;
  1018. } else {
  1019. lines = [""].concat(lines);
  1020. row--;
  1021. column = this.$lines[row].length;
  1022. }
  1023. this.insertMergedLines({row: row, column: column}, lines);
  1024. };
  1025. this.insertMergedLines = function(position, lines) {
  1026. var start = this.clippedPos(position.row, position.column);
  1027. var end = {
  1028. row: start.row + lines.length - 1,
  1029. column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
  1030. };
  1031. this.applyDelta({
  1032. start: start,
  1033. end: end,
  1034. action: "insert",
  1035. lines: lines
  1036. });
  1037. return this.clonePos(end);
  1038. };
  1039. this.remove = function(range) {
  1040. var start = this.clippedPos(range.start.row, range.start.column);
  1041. var end = this.clippedPos(range.end.row, range.end.column);
  1042. this.applyDelta({
  1043. start: start,
  1044. end: end,
  1045. action: "remove",
  1046. lines: this.getLinesForRange({start: start, end: end})
  1047. });
  1048. return this.clonePos(start);
  1049. };
  1050. this.removeInLine = function(row, startColumn, endColumn) {
  1051. var start = this.clippedPos(row, startColumn);
  1052. var end = this.clippedPos(row, endColumn);
  1053. this.applyDelta({
  1054. start: start,
  1055. end: end,
  1056. action: "remove",
  1057. lines: this.getLinesForRange({start: start, end: end})
  1058. }, true);
  1059. return this.clonePos(start);
  1060. };
  1061. this.removeFullLines = function(firstRow, lastRow) {
  1062. firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
  1063. lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
  1064. var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
  1065. var deleteLastNewLine = lastRow < this.getLength() - 1;
  1066. var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
  1067. var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
  1068. var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
  1069. var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
  1070. var range = new Range(startRow, startCol, endRow, endCol);
  1071. var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
  1072. this.applyDelta({
  1073. start: range.start,
  1074. end: range.end,
  1075. action: "remove",
  1076. lines: this.getLinesForRange(range)
  1077. });
  1078. return deletedLines;
  1079. };
  1080. this.removeNewLine = function(row) {
  1081. if (row < this.getLength() - 1 && row >= 0) {
  1082. this.applyDelta({
  1083. start: this.pos(row, this.getLine(row).length),
  1084. end: this.pos(row + 1, 0),
  1085. action: "remove",
  1086. lines: ["", ""]
  1087. });
  1088. }
  1089. };
  1090. this.replace = function(range, text) {
  1091. if (!(range instanceof Range))
  1092. range = Range.fromPoints(range.start, range.end);
  1093. if (text.length === 0 && range.isEmpty())
  1094. return range.start;
  1095. if (text == this.getTextRange(range))
  1096. return range.end;
  1097. this.remove(range);
  1098. var end;
  1099. if (text) {
  1100. end = this.insert(range.start, text);
  1101. }
  1102. else {
  1103. end = range.start;
  1104. }
  1105. return end;
  1106. };
  1107. this.applyDeltas = function(deltas) {
  1108. for (var i=0; i<deltas.length; i++) {
  1109. this.applyDelta(deltas[i]);
  1110. }
  1111. };
  1112. this.revertDeltas = function(deltas) {
  1113. for (var i=deltas.length-1; i>=0; i--) {
  1114. this.revertDelta(deltas[i]);
  1115. }
  1116. };
  1117. this.applyDelta = function(delta, doNotValidate) {
  1118. var isInsert = delta.action == "insert";
  1119. if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
  1120. : !Range.comparePoints(delta.start, delta.end)) {
  1121. return;
  1122. }
  1123. if (isInsert && delta.lines.length > 20000) {
  1124. this.$splitAndapplyLargeDelta(delta, 20000);
  1125. }
  1126. else {
  1127. applyDelta(this.$lines, delta, doNotValidate);
  1128. this._signal("change", delta);
  1129. }
  1130. };
  1131. this.$splitAndapplyLargeDelta = function(delta, MAX) {
  1132. var lines = delta.lines;
  1133. var l = lines.length - MAX + 1;
  1134. var row = delta.start.row;
  1135. var column = delta.start.column;
  1136. for (var from = 0, to = 0; from < l; from = to) {
  1137. to += MAX - 1;
  1138. var chunk = lines.slice(from, to);
  1139. chunk.push("");
  1140. this.applyDelta({
  1141. start: this.pos(row + from, column),
  1142. end: this.pos(row + to, column = 0),
  1143. action: delta.action,
  1144. lines: chunk
  1145. }, true);
  1146. }
  1147. delta.lines = lines.slice(from);
  1148. delta.start.row = row + from;
  1149. delta.start.column = column;
  1150. this.applyDelta(delta, true);
  1151. };
  1152. this.revertDelta = function(delta) {
  1153. this.applyDelta({
  1154. start: this.clonePos(delta.start),
  1155. end: this.clonePos(delta.end),
  1156. action: (delta.action == "insert" ? "remove" : "insert"),
  1157. lines: delta.lines.slice()
  1158. });
  1159. };
  1160. this.indexToPosition = function(index, startRow) {
  1161. var lines = this.$lines || this.getAllLines();
  1162. var newlineLength = this.getNewLineCharacter().length;
  1163. for (var i = startRow || 0, l = lines.length; i < l; i++) {
  1164. index -= lines[i].length + newlineLength;
  1165. if (index < 0)
  1166. return {row: i, column: index + lines[i].length + newlineLength};
  1167. }
  1168. return {row: l-1, column: index + lines[l-1].length + newlineLength};
  1169. };
  1170. this.positionToIndex = function(pos, startRow) {
  1171. var lines = this.$lines || this.getAllLines();
  1172. var newlineLength = this.getNewLineCharacter().length;
  1173. var index = 0;
  1174. var row = Math.min(pos.row, lines.length);
  1175. for (var i = startRow || 0; i < row; ++i)
  1176. index += lines[i].length + newlineLength;
  1177. return index + pos.column;
  1178. };
  1179. }).call(Document.prototype);
  1180. exports.Document = Document;
  1181. });
  1182. ace.define("ace/worker/mirror",[], function(require, exports, module) {
  1183. "use strict";
  1184. var Range = require("../range").Range;
  1185. var Document = require("../document").Document;
  1186. var lang = require("../lib/lang");
  1187. var Mirror = exports.Mirror = function(sender) {
  1188. this.sender = sender;
  1189. var doc = this.doc = new Document("");
  1190. var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
  1191. var _self = this;
  1192. sender.on("change", function(e) {
  1193. var data = e.data;
  1194. if (data[0].start) {
  1195. doc.applyDeltas(data);
  1196. } else {
  1197. for (var i = 0; i < data.length; i += 2) {
  1198. if (Array.isArray(data[i+1])) {
  1199. var d = {action: "insert", start: data[i], lines: data[i+1]};
  1200. } else {
  1201. var d = {action: "remove", start: data[i], end: data[i+1]};
  1202. }
  1203. doc.applyDelta(d, true);
  1204. }
  1205. }
  1206. if (_self.$timeout)
  1207. return deferredUpdate.schedule(_self.$timeout);
  1208. _self.onUpdate();
  1209. });
  1210. };
  1211. (function() {
  1212. this.$timeout = 500;
  1213. this.setTimeout = function(timeout) {
  1214. this.$timeout = timeout;
  1215. };
  1216. this.setValue = function(value) {
  1217. this.doc.setValue(value);
  1218. this.deferredUpdate.schedule(this.$timeout);
  1219. };
  1220. this.getValue = function(callbackId) {
  1221. this.sender.callback(this.doc.getValue(), callbackId);
  1222. };
  1223. this.onUpdate = function() {
  1224. };
  1225. this.isPending = function() {
  1226. return this.deferredUpdate.isPending();
  1227. };
  1228. }).call(Mirror.prototype);
  1229. });
  1230. ace.define("ace/mode/html/saxparser",[], function(require, exports, module) {
  1231. module.exports = (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({
  1232. 1:[function(_dereq_,module,exports){
  1233. function isScopeMarker(node) {
  1234. if (node.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1235. return node.localName === "applet"
  1236. || node.localName === "caption"
  1237. || node.localName === "marquee"
  1238. || node.localName === "object"
  1239. || node.localName === "table"
  1240. || node.localName === "td"
  1241. || node.localName === "th";
  1242. }
  1243. if (node.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1244. return node.localName === "mi"
  1245. || node.localName === "mo"
  1246. || node.localName === "mn"
  1247. || node.localName === "ms"
  1248. || node.localName === "mtext"
  1249. || node.localName === "annotation-xml";
  1250. }
  1251. if (node.namespaceURI === "http://www.w3.org/2000/svg") {
  1252. return node.localName === "foreignObject"
  1253. || node.localName === "desc"
  1254. || node.localName === "title";
  1255. }
  1256. }
  1257. function isListItemScopeMarker(node) {
  1258. return isScopeMarker(node)
  1259. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ol')
  1260. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ul');
  1261. }
  1262. function isTableScopeMarker(node) {
  1263. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'table')
  1264. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1265. }
  1266. function isTableBodyScopeMarker(node) {
  1267. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tbody')
  1268. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tfoot')
  1269. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'thead')
  1270. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1271. }
  1272. function isTableRowScopeMarker(node) {
  1273. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tr')
  1274. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1275. }
  1276. function isButtonScopeMarker(node) {
  1277. return isScopeMarker(node)
  1278. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'button');
  1279. }
  1280. function isSelectScopeMarker(node) {
  1281. return !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'optgroup')
  1282. && !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'option');
  1283. }
  1284. function ElementStack() {
  1285. this.elements = [];
  1286. this.rootNode = null;
  1287. this.headElement = null;
  1288. this.bodyElement = null;
  1289. }
  1290. ElementStack.prototype._inScope = function(localName, isMarker) {
  1291. for (var i = this.elements.length - 1; i >= 0; i--) {
  1292. var node = this.elements[i];
  1293. if (node.localName === localName)
  1294. return true;
  1295. if (isMarker(node))
  1296. return false;
  1297. }
  1298. };
  1299. ElementStack.prototype.push = function(item) {
  1300. this.elements.push(item);
  1301. };
  1302. ElementStack.prototype.pushHtmlElement = function(item) {
  1303. this.rootNode = item.node;
  1304. this.push(item);
  1305. };
  1306. ElementStack.prototype.pushHeadElement = function(item) {
  1307. this.headElement = item.node;
  1308. this.push(item);
  1309. };
  1310. ElementStack.prototype.pushBodyElement = function(item) {
  1311. this.bodyElement = item.node;
  1312. this.push(item);
  1313. };
  1314. ElementStack.prototype.pop = function() {
  1315. return this.elements.pop();
  1316. };
  1317. ElementStack.prototype.remove = function(item) {
  1318. this.elements.splice(this.elements.indexOf(item), 1);
  1319. };
  1320. ElementStack.prototype.popUntilPopped = function(localName) {
  1321. var element;
  1322. do {
  1323. element = this.pop();
  1324. } while (element.localName != localName);
  1325. };
  1326. ElementStack.prototype.popUntilTableScopeMarker = function() {
  1327. while (!isTableScopeMarker(this.top))
  1328. this.pop();
  1329. };
  1330. ElementStack.prototype.popUntilTableBodyScopeMarker = function() {
  1331. while (!isTableBodyScopeMarker(this.top))
  1332. this.pop();
  1333. };
  1334. ElementStack.prototype.popUntilTableRowScopeMarker = function() {
  1335. while (!isTableRowScopeMarker(this.top))
  1336. this.pop();
  1337. };
  1338. ElementStack.prototype.item = function(index) {
  1339. return this.elements[index];
  1340. };
  1341. ElementStack.prototype.contains = function(element) {
  1342. return this.elements.indexOf(element) !== -1;
  1343. };
  1344. ElementStack.prototype.inScope = function(localName) {
  1345. return this._inScope(localName, isScopeMarker);
  1346. };
  1347. ElementStack.prototype.inListItemScope = function(localName) {
  1348. return this._inScope(localName, isListItemScopeMarker);
  1349. };
  1350. ElementStack.prototype.inTableScope = function(localName) {
  1351. return this._inScope(localName, isTableScopeMarker);
  1352. };
  1353. ElementStack.prototype.inButtonScope = function(localName) {
  1354. return this._inScope(localName, isButtonScopeMarker);
  1355. };
  1356. ElementStack.prototype.inSelectScope = function(localName) {
  1357. return this._inScope(localName, isSelectScopeMarker);
  1358. };
  1359. ElementStack.prototype.hasNumberedHeaderElementInScope = function() {
  1360. for (var i = this.elements.length - 1; i >= 0; i--) {
  1361. var node = this.elements[i];
  1362. if (node.isNumberedHeader())
  1363. return true;
  1364. if (isScopeMarker(node))
  1365. return false;
  1366. }
  1367. };
  1368. ElementStack.prototype.furthestBlockForFormattingElement = function(element) {
  1369. var furthestBlock = null;
  1370. for (var i = this.elements.length - 1; i >= 0; i--) {
  1371. var node = this.elements[i];
  1372. if (node.node === element)
  1373. break;
  1374. if (node.isSpecial())
  1375. furthestBlock = node;
  1376. }
  1377. return furthestBlock;
  1378. };
  1379. ElementStack.prototype.findIndex = function(localName) {
  1380. for (var i = this.elements.length - 1; i >= 0; i--) {
  1381. if (this.elements[i].localName == localName)
  1382. return i;
  1383. }
  1384. return -1;
  1385. };
  1386. ElementStack.prototype.remove_openElements_until = function(callback) {
  1387. var finished = false;
  1388. var element;
  1389. while (!finished) {
  1390. element = this.elements.pop();
  1391. finished = callback(element);
  1392. }
  1393. return element;
  1394. };
  1395. Object.defineProperty(ElementStack.prototype, 'top', {
  1396. get: function() {
  1397. return this.elements[this.elements.length - 1];
  1398. }
  1399. });
  1400. Object.defineProperty(ElementStack.prototype, 'length', {
  1401. get: function() {
  1402. return this.elements.length;
  1403. }
  1404. });
  1405. exports.ElementStack = ElementStack;
  1406. },
  1407. {}],
  1408. 2:[function(_dereq_,module,exports){
  1409. var entities = _dereq_('html5-entities');
  1410. var InputStream = _dereq_('./InputStream').InputStream;
  1411. var namedEntityPrefixes = {};
  1412. Object.keys(entities).forEach(function (entityKey) {
  1413. for (var i = 0; i < entityKey.length; i++) {
  1414. namedEntityPrefixes[entityKey.substring(0, i + 1)] = true;
  1415. }
  1416. });
  1417. function isAlphaNumeric(c) {
  1418. return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
  1419. }
  1420. function isHexDigit(c) {
  1421. return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
  1422. }
  1423. function isDecimalDigit(c) {
  1424. return (c >= '0' && c <= '9');
  1425. }
  1426. var EntityParser = {};
  1427. EntityParser.consumeEntity = function(buffer, tokenizer, additionalAllowedCharacter) {
  1428. var decodedCharacter = '';
  1429. var consumedCharacters = '';
  1430. var ch = buffer.char();
  1431. if (ch === InputStream.EOF)
  1432. return false;
  1433. consumedCharacters += ch;
  1434. if (ch == '\t' || ch == '\n' || ch == '\v' || ch == ' ' || ch == '<' || ch == '&') {
  1435. buffer.unget(consumedCharacters);
  1436. return false;
  1437. }
  1438. if (additionalAllowedCharacter === ch) {
  1439. buffer.unget(consumedCharacters);
  1440. return false;
  1441. }
  1442. if (ch == '#') {
  1443. ch = buffer.shift(1);
  1444. if (ch === InputStream.EOF) {
  1445. tokenizer._parseError("expected-numeric-entity-but-got-eof");
  1446. buffer.unget(consumedCharacters);
  1447. return false;
  1448. }
  1449. consumedCharacters += ch;
  1450. var radix = 10;
  1451. var isDigit = isDecimalDigit;
  1452. if (ch == 'x' || ch == 'X') {
  1453. radix = 16;
  1454. isDigit = isHexDigit;
  1455. ch = buffer.shift(1);
  1456. if (ch === InputStream.EOF) {
  1457. tokenizer._parseError("expected-numeric-entity-but-got-eof");
  1458. buffer.unget(consumedCharacters);
  1459. return false;
  1460. }
  1461. consumedCharacters += ch;
  1462. }
  1463. if (isDigit(ch)) {
  1464. var code = '';
  1465. while (ch !== InputStream.EOF && isDigit(ch)) {
  1466. code += ch;
  1467. ch = buffer.char();
  1468. }
  1469. code = parseInt(code, radix);
  1470. var replacement = this.replaceEntityNumbers(code);
  1471. if (replacement) {
  1472. tokenizer._parseError("invalid-numeric-entity-replaced");
  1473. code = replacement;
  1474. }
  1475. if (code > 0xFFFF && code <= 0x10FFFF) {
  1476. code -= 0x10000;
  1477. var first = ((0xffc00 & code) >> 10) + 0xD800;
  1478. var second = (0x3ff & code) + 0xDC00;
  1479. decodedCharacter = String.fromCharCode(first, second);
  1480. } else
  1481. decodedCharacter = String.fromCharCode(code);
  1482. if (ch !== ';') {
  1483. tokenizer._parseError("numeric-entity-without-semicolon");
  1484. buffer.unget(ch);
  1485. }
  1486. return decodedCharacter;
  1487. }
  1488. buffer.unget(consumedCharacters);
  1489. tokenizer._parseError("expected-numeric-entity");
  1490. return false;
  1491. }
  1492. if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
  1493. var mostRecentMatch = '';
  1494. while (namedEntityPrefixes[consumedCharacters]) {
  1495. if (entities[consumedCharacters]) {
  1496. mostRecentMatch = consumedCharacters;
  1497. }
  1498. if (ch == ';')
  1499. break;
  1500. ch = buffer.char();
  1501. if (ch === InputStream.EOF)
  1502. break;
  1503. consumedCharacters += ch;
  1504. }
  1505. if (!mostRecentMatch) {
  1506. tokenizer._parseError("expected-named-entity");
  1507. buffer.unget(consumedCharacters);
  1508. return false;
  1509. }
  1510. decodedCharacter = entities[mostRecentMatch];
  1511. if (ch === ';' || !additionalAllowedCharacter || !(isAlphaNumeric(ch) || ch === '=')) {
  1512. if (consumedCharacters.length > mostRecentMatch.length) {
  1513. buffer.unget(consumedCharacters.substring(mostRecentMatch.length));
  1514. }
  1515. if (ch !== ';') {
  1516. tokenizer._parseError("named-entity-without-semicolon");
  1517. }
  1518. return decodedCharacter;
  1519. }
  1520. buffer.unget(consumedCharacters);
  1521. return false;
  1522. }
  1523. };
  1524. EntityParser.replaceEntityNumbers = function(c) {
  1525. switch(c) {
  1526. case 0x00: return 0xFFFD; // REPLACEMENT CHARACTER
  1527. case 0x13: return 0x0010; // Carriage return
  1528. case 0x80: return 0x20AC; // EURO SIGN
  1529. case 0x81: return 0x0081; // <control>
  1530. case 0x82: return 0x201A; // SINGLE LOW-9 QUOTATION MARK
  1531. case 0x83: return 0x0192; // LATIN SMALL LETTER F WITH HOOK
  1532. case 0x84: return 0x201E; // DOUBLE LOW-9 QUOTATION MARK
  1533. case 0x85: return 0x2026; // HORIZONTAL ELLIPSIS
  1534. case 0x86: return 0x2020; // DAGGER
  1535. case 0x87: return 0x2021; // DOUBLE DAGGER
  1536. case 0x88: return 0x02C6; // MODIFIER LETTER CIRCUMFLEX ACCENT
  1537. case 0x89: return 0x2030; // PER MILLE SIGN
  1538. case 0x8A: return 0x0160; // LATIN CAPITAL LETTER S WITH CARON
  1539. case 0x8B: return 0x2039; // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
  1540. case 0x8C: return 0x0152; // LATIN CAPITAL LIGATURE OE
  1541. case 0x8D: return 0x008D; // <control>
  1542. case 0x8E: return 0x017D; // LATIN CAPITAL LETTER Z WITH CARON
  1543. case 0x8F: return 0x008F; // <control>
  1544. case 0x90: return 0x0090; // <control>
  1545. case 0x91: return 0x2018; // LEFT SINGLE QUOTATION MARK
  1546. case 0x92: return 0x2019; // RIGHT SINGLE QUOTATION MARK
  1547. case 0x93: return 0x201C; // LEFT DOUBLE QUOTATION MARK
  1548. case 0x94: return 0x201D; // RIGHT DOUBLE QUOTATION MARK
  1549. case 0x95: return 0x2022; // BULLET
  1550. case 0x96: return 0x2013; // EN DASH
  1551. case 0x97: return 0x2014; // EM DASH
  1552. case 0x98: return 0x02DC; // SMALL TILDE
  1553. case 0x99: return 0x2122; // TRADE MARK SIGN
  1554. case 0x9A: return 0x0161; // LATIN SMALL LETTER S WITH CARON
  1555. case 0x9B: return 0x203A; // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
  1556. case 0x9C: return 0x0153; // LATIN SMALL LIGATURE OE
  1557. case 0x9D: return 0x009D; // <control>
  1558. case 0x9E: return 0x017E; // LATIN SMALL LETTER Z WITH CARON
  1559. case 0x9F: return 0x0178; // LATIN CAPITAL LETTER Y WITH DIAERESIS
  1560. default:
  1561. if ((c >= 0xD800 && c <= 0xDFFF) || c > 0x10FFFF) {
  1562. return 0xFFFD;
  1563. } else if ((c >= 0x0001 && c <= 0x0008) || (c >= 0x000E && c <= 0x001F) ||
  1564. (c >= 0x007F && c <= 0x009F) || (c >= 0xFDD0 && c <= 0xFDEF) ||
  1565. c == 0x000B || c == 0xFFFE || c == 0x1FFFE || c == 0x2FFFFE ||
  1566. c == 0x2FFFF || c == 0x3FFFE || c == 0x3FFFF || c == 0x4FFFE ||
  1567. c == 0x4FFFF || c == 0x5FFFE || c == 0x5FFFF || c == 0x6FFFE ||
  1568. c == 0x6FFFF || c == 0x7FFFE || c == 0x7FFFF || c == 0x8FFFE ||
  1569. c == 0x8FFFF || c == 0x9FFFE || c == 0x9FFFF || c == 0xAFFFE ||
  1570. c == 0xAFFFF || c == 0xBFFFE || c == 0xBFFFF || c == 0xCFFFE ||
  1571. c == 0xCFFFF || c == 0xDFFFE || c == 0xDFFFF || c == 0xEFFFE ||
  1572. c == 0xEFFFF || c == 0xFFFFE || c == 0xFFFFF || c == 0x10FFFE ||
  1573. c == 0x10FFFF) {
  1574. return c;
  1575. }
  1576. }
  1577. };
  1578. exports.EntityParser = EntityParser;
  1579. },
  1580. {"./InputStream":3,"html5-entities":12}],
  1581. 3:[function(_dereq_,module,exports){
  1582. function InputStream() {
  1583. this.data = '';
  1584. this.start = 0;
  1585. this.committed = 0;
  1586. this.eof = false;
  1587. this.lastLocation = {line: 0, column: 0};
  1588. }
  1589. InputStream.EOF = -1;
  1590. InputStream.DRAIN = -2;
  1591. InputStream.prototype = {
  1592. slice: function() {
  1593. if(this.start >= this.data.length) {
  1594. if(!this.eof) throw InputStream.DRAIN;
  1595. return InputStream.EOF;
  1596. }
  1597. return this.data.slice(this.start, this.data.length);
  1598. },
  1599. char: function() {
  1600. if(!this.eof && this.start >= this.data.length - 1) throw InputStream.DRAIN;
  1601. if(this.start >= this.data.length) {
  1602. return InputStream.EOF;
  1603. }
  1604. var ch = this.data[this.start++];
  1605. if (ch === '\r')
  1606. ch = '\n';
  1607. return ch;
  1608. },
  1609. advance: function(amount) {
  1610. this.start += amount;
  1611. if(this.start >= this.data.length) {
  1612. if(!this.eof) throw InputStream.DRAIN;
  1613. return InputStream.EOF;
  1614. } else {
  1615. if(this.committed > this.data.length / 2) {
  1616. this.lastLocation = this.location();
  1617. this.data = this.data.slice(this.committed);
  1618. this.start = this.start - this.committed;
  1619. this.committed = 0;
  1620. }
  1621. }
  1622. },
  1623. matchWhile: function(re) {
  1624. if(this.eof && this.start >= this.data.length ) return '';
  1625. var r = new RegExp("^"+re+"+");
  1626. var m = r.exec(this.slice());
  1627. if(m) {
  1628. if(!this.eof && m[0].length == this.data.length - this.start) throw InputStream.DRAIN;
  1629. this.advance(m[0].length);
  1630. return m[0];
  1631. } else {
  1632. return '';
  1633. }
  1634. },
  1635. matchUntil: function(re) {
  1636. var m, s;
  1637. s = this.slice();
  1638. if(s === InputStream.EOF) {
  1639. return '';
  1640. } else if(m = new RegExp(re + (this.eof ? "|$" : "")).exec(s)) {
  1641. var t = this.data.slice(this.start, this.start + m.index);
  1642. this.advance(m.index);
  1643. return t.replace(/\r/g, '\n').replace(/\n{2,}/g, '\n');
  1644. } else {
  1645. throw InputStream.DRAIN;
  1646. }
  1647. },
  1648. append: function(data) {
  1649. this.data += data;
  1650. },
  1651. shift: function(n) {
  1652. if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN;
  1653. if(this.eof && this.start >= this.data.length) return InputStream.EOF;
  1654. var d = this.data.slice(this.start, this.start + n).toString();
  1655. this.advance(Math.min(n, this.data.length - this.start));
  1656. return d;
  1657. },
  1658. peek: function(n) {
  1659. if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN;
  1660. if(this.eof && this.start >= this.data.length) return InputStream.EOF;
  1661. return this.data.slice(this.start, Math.min(this.start + n, this.data.length)).toString();
  1662. },
  1663. length: function() {
  1664. return this.data.length - this.start - 1;
  1665. },
  1666. unget: function(d) {
  1667. if(d === InputStream.EOF) return;
  1668. this.start -= (d.length);
  1669. },
  1670. undo: function() {
  1671. this.start = this.committed;
  1672. },
  1673. commit: function() {
  1674. this.committed = this.start;
  1675. },
  1676. location: function() {
  1677. var lastLine = this.lastLocation.line;
  1678. var lastColumn = this.lastLocation.column;
  1679. var read = this.data.slice(0, this.committed);
  1680. var newlines = read.match(/\n/g);
  1681. var line = newlines ? lastLine + newlines.length : lastLine;
  1682. var column = newlines ? read.length - read.lastIndexOf('\n') - 1 : lastColumn + read.length;
  1683. return {line: line, column: column};
  1684. }
  1685. };
  1686. exports.InputStream = InputStream;
  1687. },
  1688. {}],
  1689. 4:[function(_dereq_,module,exports){
  1690. var SpecialElements = {
  1691. "http://www.w3.org/1999/xhtml": [
  1692. 'address',
  1693. 'applet',
  1694. 'area',
  1695. 'article',
  1696. 'aside',
  1697. 'base',
  1698. 'basefont',
  1699. 'bgsound',
  1700. 'blockquote',
  1701. 'body',
  1702. 'br',
  1703. 'button',
  1704. 'caption',
  1705. 'center',
  1706. 'col',
  1707. 'colgroup',
  1708. 'dd',
  1709. 'details',
  1710. 'dir',
  1711. 'div',
  1712. 'dl',
  1713. 'dt',
  1714. 'embed',
  1715. 'fieldset',
  1716. 'figcaption',
  1717. 'figure',
  1718. 'footer',
  1719. 'form',
  1720. 'frame',
  1721. 'frameset',
  1722. 'h1',
  1723. 'h2',
  1724. 'h3',
  1725. 'h4',
  1726. 'h5',
  1727. 'h6',
  1728. 'head',
  1729. 'header',
  1730. 'hgroup',
  1731. 'hr',
  1732. 'html',
  1733. 'iframe',
  1734. 'img',
  1735. 'input',
  1736. 'isindex',
  1737. 'li',
  1738. 'link',
  1739. 'listing',
  1740. 'main',
  1741. 'marquee',
  1742. 'menu',
  1743. 'menuitem',
  1744. 'meta',
  1745. 'nav',
  1746. 'noembed',
  1747. 'noframes',
  1748. 'noscript',
  1749. 'object',
  1750. 'ol',
  1751. 'p',
  1752. 'param',
  1753. 'plaintext',
  1754. 'pre',
  1755. 'script',
  1756. 'section',
  1757. 'select',
  1758. 'source',
  1759. 'style',
  1760. 'summary',
  1761. 'table',
  1762. 'tbody',
  1763. 'td',
  1764. 'textarea',
  1765. 'tfoot',
  1766. 'th',
  1767. 'thead',
  1768. 'title',
  1769. 'tr',
  1770. 'track',
  1771. 'ul',
  1772. 'wbr',
  1773. 'xmp'
  1774. ],
  1775. "http://www.w3.org/1998/Math/MathML": [
  1776. 'mi',
  1777. 'mo',
  1778. 'mn',
  1779. 'ms',
  1780. 'mtext',
  1781. 'annotation-xml'
  1782. ],
  1783. "http://www.w3.org/2000/svg": [
  1784. 'foreignObject',
  1785. 'desc',
  1786. 'title'
  1787. ]
  1788. };
  1789. function StackItem(namespaceURI, localName, attributes, node) {
  1790. this.localName = localName;
  1791. this.namespaceURI = namespaceURI;
  1792. this.attributes = attributes;
  1793. this.node = node;
  1794. }
  1795. StackItem.prototype.isSpecial = function() {
  1796. return this.namespaceURI in SpecialElements &&
  1797. SpecialElements[this.namespaceURI].indexOf(this.localName) > -1;
  1798. };
  1799. StackItem.prototype.isFosterParenting = function() {
  1800. if (this.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1801. return this.localName === 'table' ||
  1802. this.localName === 'tbody' ||
  1803. this.localName === 'tfoot' ||
  1804. this.localName === 'thead' ||
  1805. this.localName === 'tr';
  1806. }
  1807. return false;
  1808. };
  1809. StackItem.prototype.isNumberedHeader = function() {
  1810. if (this.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1811. return this.localName === 'h1' ||
  1812. this.localName === 'h2' ||
  1813. this.localName === 'h3' ||
  1814. this.localName === 'h4' ||
  1815. this.localName === 'h5' ||
  1816. this.localName === 'h6';
  1817. }
  1818. return false;
  1819. };
  1820. StackItem.prototype.isForeign = function() {
  1821. return this.namespaceURI != "http://www.w3.org/1999/xhtml";
  1822. };
  1823. function getAttribute(item, name) {
  1824. for (var i = 0; i < item.attributes.length; i++) {
  1825. if (item.attributes[i].nodeName == name)
  1826. return item.attributes[i].nodeValue;
  1827. }
  1828. return null;
  1829. }
  1830. StackItem.prototype.isHtmlIntegrationPoint = function() {
  1831. if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1832. if (this.localName !== "annotation-xml")
  1833. return false;
  1834. var encoding = getAttribute(this, 'encoding');
  1835. if (!encoding)
  1836. return false;
  1837. encoding = encoding.toLowerCase();
  1838. return encoding === "text/html" || encoding === "application/xhtml+xml";
  1839. }
  1840. if (this.namespaceURI === "http://www.w3.org/2000/svg") {
  1841. return this.localName === "foreignObject"
  1842. || this.localName === "desc"
  1843. || this.localName === "title";
  1844. }
  1845. return false;
  1846. };
  1847. StackItem.prototype.isMathMLTextIntegrationPoint = function() {
  1848. if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1849. return this.localName === "mi"
  1850. || this.localName === "mo"
  1851. || this.localName === "mn"
  1852. || this.localName === "ms"
  1853. || this.localName === "mtext";
  1854. }
  1855. return false;
  1856. };
  1857. exports.StackItem = StackItem;
  1858. },
  1859. {}],
  1860. 5:[function(_dereq_,module,exports){
  1861. var InputStream = _dereq_('./InputStream').InputStream;
  1862. var EntityParser = _dereq_('./EntityParser').EntityParser;
  1863. function isWhitespace(c){
  1864. return c === " " || c === "\n" || c === "\t" || c === "\r" || c === "\f";
  1865. }
  1866. function isAlpha(c) {
  1867. return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
  1868. }
  1869. function Tokenizer(tokenHandler) {
  1870. this._tokenHandler = tokenHandler;
  1871. this._state = Tokenizer.DATA;
  1872. this._inputStream = new InputStream();
  1873. this._currentToken = null;
  1874. this._temporaryBuffer = '';
  1875. this._additionalAllowedCharacter = '';
  1876. }
  1877. Tokenizer.prototype._parseError = function(code, args) {
  1878. this._tokenHandler.parseError(code, args);
  1879. };
  1880. Tokenizer.prototype._emitToken = function(token) {
  1881. if (token.type === 'StartTag') {
  1882. for (var i = 1; i < token.data.length; i++) {
  1883. if (!token.data[i].nodeName)
  1884. token.data.splice(i--, 1);
  1885. }
  1886. } else if (token.type === 'EndTag') {
  1887. if (token.selfClosing) {
  1888. this._parseError('self-closing-flag-on-end-tag');
  1889. }
  1890. if (token.data.length !== 0) {
  1891. this._parseError('attributes-in-end-tag');
  1892. }
  1893. }
  1894. this._tokenHandler.processToken(token);
  1895. if (token.type === 'StartTag' && token.selfClosing && !this._tokenHandler.isSelfClosingFlagAcknowledged()) {
  1896. this._parseError('non-void-element-with-trailing-solidus', {name: token.name});
  1897. }
  1898. };
  1899. Tokenizer.prototype._emitCurrentToken = function() {
  1900. this._state = Tokenizer.DATA;
  1901. this._emitToken(this._currentToken);
  1902. };
  1903. Tokenizer.prototype._currentAttribute = function() {
  1904. return this._currentToken.data[this._currentToken.data.length - 1];
  1905. };
  1906. Tokenizer.prototype.setState = function(state) {
  1907. this._state = state;
  1908. };
  1909. Tokenizer.prototype.tokenize = function(source) {
  1910. Tokenizer.DATA = data_state;
  1911. Tokenizer.RCDATA = rcdata_state;
  1912. Tokenizer.RAWTEXT = rawtext_state;
  1913. Tokenizer.SCRIPT_DATA = script_data_state;
  1914. Tokenizer.PLAINTEXT = plaintext_state;
  1915. this._state = Tokenizer.DATA;
  1916. this._inputStream.append(source);
  1917. this._tokenHandler.startTokenization(this);
  1918. this._inputStream.eof = true;
  1919. var tokenizer = this;
  1920. while (this._state.call(this, this._inputStream));
  1921. function data_state(buffer) {
  1922. var data = buffer.char();
  1923. if (data === InputStream.EOF) {
  1924. tokenizer._emitToken({type: 'EOF', data: null});
  1925. return false;
  1926. } else if (data === '&') {
  1927. tokenizer.setState(character_reference_in_data_state);
  1928. } else if (data === '<') {
  1929. tokenizer.setState(tag_open_state);
  1930. } else if (data === '\u0000') {
  1931. tokenizer._emitToken({type: 'Characters', data: data});
  1932. buffer.commit();
  1933. } else {
  1934. var chars = buffer.matchUntil("&|<|\u0000");
  1935. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1936. buffer.commit();
  1937. }
  1938. return true;
  1939. }
  1940. function character_reference_in_data_state(buffer) {
  1941. var character = EntityParser.consumeEntity(buffer, tokenizer);
  1942. tokenizer.setState(data_state);
  1943. tokenizer._emitToken({type: 'Characters', data: character || '&'});
  1944. return true;
  1945. }
  1946. function rcdata_state(buffer) {
  1947. var data = buffer.char();
  1948. if (data === InputStream.EOF) {
  1949. tokenizer._emitToken({type: 'EOF', data: null});
  1950. return false;
  1951. } else if (data === '&') {
  1952. tokenizer.setState(character_reference_in_rcdata_state);
  1953. } else if (data === '<') {
  1954. tokenizer.setState(rcdata_less_than_sign_state);
  1955. } else if (data === "\u0000") {
  1956. tokenizer._parseError("invalid-codepoint");
  1957. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1958. buffer.commit();
  1959. } else {
  1960. var chars = buffer.matchUntil("&|<|\u0000");
  1961. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1962. buffer.commit();
  1963. }
  1964. return true;
  1965. }
  1966. function character_reference_in_rcdata_state(buffer) {
  1967. var character = EntityParser.consumeEntity(buffer, tokenizer);
  1968. tokenizer.setState(rcdata_state);
  1969. tokenizer._emitToken({type: 'Characters', data: character || '&'});
  1970. return true;
  1971. }
  1972. function rawtext_state(buffer) {
  1973. var data = buffer.char();
  1974. if (data === InputStream.EOF) {
  1975. tokenizer._emitToken({type: 'EOF', data: null});
  1976. return false;
  1977. } else if (data === '<') {
  1978. tokenizer.setState(rawtext_less_than_sign_state);
  1979. } else if (data === "\u0000") {
  1980. tokenizer._parseError("invalid-codepoint");
  1981. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1982. buffer.commit();
  1983. } else {
  1984. var chars = buffer.matchUntil("<|\u0000");
  1985. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1986. }
  1987. return true;
  1988. }
  1989. function plaintext_state(buffer) {
  1990. var data = buffer.char();
  1991. if (data === InputStream.EOF) {
  1992. tokenizer._emitToken({type: 'EOF', data: null});
  1993. return false;
  1994. } else if (data === "\u0000") {
  1995. tokenizer._parseError("invalid-codepoint");
  1996. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1997. buffer.commit();
  1998. } else {
  1999. var chars = buffer.matchUntil("\u0000");
  2000. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2001. }
  2002. return true;
  2003. }
  2004. function script_data_state(buffer) {
  2005. var data = buffer.char();
  2006. if (data === InputStream.EOF) {
  2007. tokenizer._emitToken({type: 'EOF', data: null});
  2008. return false;
  2009. } else if (data === '<') {
  2010. tokenizer.setState(script_data_less_than_sign_state);
  2011. } else if (data === '\u0000') {
  2012. tokenizer._parseError("invalid-codepoint");
  2013. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2014. buffer.commit();
  2015. } else {
  2016. var chars = buffer.matchUntil("<|\u0000");
  2017. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2018. }
  2019. return true;
  2020. }
  2021. function rcdata_less_than_sign_state(buffer) {
  2022. var data = buffer.char();
  2023. if (data === "/") {
  2024. this._temporaryBuffer = '';
  2025. tokenizer.setState(rcdata_end_tag_open_state);
  2026. } else {
  2027. tokenizer._emitToken({type: 'Characters', data: '<'});
  2028. buffer.unget(data);
  2029. tokenizer.setState(rcdata_state);
  2030. }
  2031. return true;
  2032. }
  2033. function rcdata_end_tag_open_state(buffer) {
  2034. var data = buffer.char();
  2035. if (isAlpha(data)) {
  2036. this._temporaryBuffer += data;
  2037. tokenizer.setState(rcdata_end_tag_name_state);
  2038. } else {
  2039. tokenizer._emitToken({type: 'Characters', data: '</'});
  2040. buffer.unget(data);
  2041. tokenizer.setState(rcdata_state);
  2042. }
  2043. return true;
  2044. }
  2045. function rcdata_end_tag_name_state(buffer) {
  2046. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2047. var data = buffer.char();
  2048. if (isWhitespace(data) && appropriate) {
  2049. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2050. tokenizer.setState(before_attribute_name_state);
  2051. } else if (data === '/' && appropriate) {
  2052. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2053. tokenizer.setState(self_closing_tag_state);
  2054. } else if (data === '>' && appropriate) {
  2055. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2056. tokenizer._emitCurrentToken();
  2057. tokenizer.setState(data_state);
  2058. } else if (isAlpha(data)) {
  2059. this._temporaryBuffer += data;
  2060. buffer.commit();
  2061. } else {
  2062. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2063. buffer.unget(data);
  2064. tokenizer.setState(rcdata_state);
  2065. }
  2066. return true;
  2067. }
  2068. function rawtext_less_than_sign_state(buffer) {
  2069. var data = buffer.char();
  2070. if (data === "/") {
  2071. this._temporaryBuffer = '';
  2072. tokenizer.setState(rawtext_end_tag_open_state);
  2073. } else {
  2074. tokenizer._emitToken({type: 'Characters', data: '<'});
  2075. buffer.unget(data);
  2076. tokenizer.setState(rawtext_state);
  2077. }
  2078. return true;
  2079. }
  2080. function rawtext_end_tag_open_state(buffer) {
  2081. var data = buffer.char();
  2082. if (isAlpha(data)) {
  2083. this._temporaryBuffer += data;
  2084. tokenizer.setState(rawtext_end_tag_name_state);
  2085. } else {
  2086. tokenizer._emitToken({type: 'Characters', data: '</'});
  2087. buffer.unget(data);
  2088. tokenizer.setState(rawtext_state);
  2089. }
  2090. return true;
  2091. }
  2092. function rawtext_end_tag_name_state(buffer) {
  2093. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2094. var data = buffer.char();
  2095. if (isWhitespace(data) && appropriate) {
  2096. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2097. tokenizer.setState(before_attribute_name_state);
  2098. } else if (data === '/' && appropriate) {
  2099. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2100. tokenizer.setState(self_closing_tag_state);
  2101. } else if (data === '>' && appropriate) {
  2102. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2103. tokenizer._emitCurrentToken();
  2104. tokenizer.setState(data_state);
  2105. } else if (isAlpha(data)) {
  2106. this._temporaryBuffer += data;
  2107. buffer.commit();
  2108. } else {
  2109. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2110. buffer.unget(data);
  2111. tokenizer.setState(rawtext_state);
  2112. }
  2113. return true;
  2114. }
  2115. function script_data_less_than_sign_state(buffer) {
  2116. var data = buffer.char();
  2117. if (data === "/") {
  2118. this._temporaryBuffer = '';
  2119. tokenizer.setState(script_data_end_tag_open_state);
  2120. } else if (data === '!') {
  2121. tokenizer._emitToken({type: 'Characters', data: '<!'});
  2122. tokenizer.setState(script_data_escape_start_state);
  2123. } else {
  2124. tokenizer._emitToken({type: 'Characters', data: '<'});
  2125. buffer.unget(data);
  2126. tokenizer.setState(script_data_state);
  2127. }
  2128. return true;
  2129. }
  2130. function script_data_end_tag_open_state(buffer) {
  2131. var data = buffer.char();
  2132. if (isAlpha(data)) {
  2133. this._temporaryBuffer += data;
  2134. tokenizer.setState(script_data_end_tag_name_state);
  2135. } else {
  2136. tokenizer._emitToken({type: 'Characters', data: '</'});
  2137. buffer.unget(data);
  2138. tokenizer.setState(script_data_state);
  2139. }
  2140. return true;
  2141. }
  2142. function script_data_end_tag_name_state(buffer) {
  2143. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2144. var data = buffer.char();
  2145. if (isWhitespace(data) && appropriate) {
  2146. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2147. tokenizer.setState(before_attribute_name_state);
  2148. } else if (data === '/' && appropriate) {
  2149. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2150. tokenizer.setState(self_closing_tag_state);
  2151. } else if (data === '>' && appropriate) {
  2152. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2153. tokenizer._emitCurrentToken();
  2154. } else if (isAlpha(data)) {
  2155. this._temporaryBuffer += data;
  2156. buffer.commit();
  2157. } else {
  2158. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2159. buffer.unget(data);
  2160. tokenizer.setState(script_data_state);
  2161. }
  2162. return true;
  2163. }
  2164. function script_data_escape_start_state(buffer) {
  2165. var data = buffer.char();
  2166. if (data === '-') {
  2167. tokenizer._emitToken({type: 'Characters', data: '-'});
  2168. tokenizer.setState(script_data_escape_start_dash_state);
  2169. } else {
  2170. buffer.unget(data);
  2171. tokenizer.setState(script_data_state);
  2172. }
  2173. return true;
  2174. }
  2175. function script_data_escape_start_dash_state(buffer) {
  2176. var data = buffer.char();
  2177. if (data === '-') {
  2178. tokenizer._emitToken({type: 'Characters', data: '-'});
  2179. tokenizer.setState(script_data_escaped_dash_dash_state);
  2180. } else {
  2181. buffer.unget(data);
  2182. tokenizer.setState(script_data_state);
  2183. }
  2184. return true;
  2185. }
  2186. function script_data_escaped_state(buffer) {
  2187. var data = buffer.char();
  2188. if (data === InputStream.EOF) {
  2189. buffer.unget(data);
  2190. tokenizer.setState(data_state);
  2191. } else if (data === '-') {
  2192. tokenizer._emitToken({type: 'Characters', data: '-'});
  2193. tokenizer.setState(script_data_escaped_dash_state);
  2194. } else if (data === '<') {
  2195. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2196. } else if (data === '\u0000') {
  2197. tokenizer._parseError("invalid-codepoint");
  2198. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2199. buffer.commit();
  2200. } else {
  2201. var chars = buffer.matchUntil('<|-|\u0000');
  2202. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2203. }
  2204. return true;
  2205. }
  2206. function script_data_escaped_dash_state(buffer) {
  2207. var data = buffer.char();
  2208. if (data === InputStream.EOF) {
  2209. buffer.unget(data);
  2210. tokenizer.setState(data_state);
  2211. } else if (data === '-') {
  2212. tokenizer._emitToken({type: 'Characters', data: '-'});
  2213. tokenizer.setState(script_data_escaped_dash_dash_state);
  2214. } else if (data === '<') {
  2215. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2216. } else if (data === '\u0000') {
  2217. tokenizer._parseError("invalid-codepoint");
  2218. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2219. tokenizer.setState(script_data_escaped_state);
  2220. } else {
  2221. tokenizer._emitToken({type: 'Characters', data: data});
  2222. tokenizer.setState(script_data_escaped_state);
  2223. }
  2224. return true;
  2225. }
  2226. function script_data_escaped_dash_dash_state(buffer) {
  2227. var data = buffer.char();
  2228. if (data === InputStream.EOF) {
  2229. tokenizer._parseError('eof-in-script');
  2230. buffer.unget(data);
  2231. tokenizer.setState(data_state);
  2232. } else if (data === '<') {
  2233. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2234. } else if (data === '>') {
  2235. tokenizer._emitToken({type: 'Characters', data: '>'});
  2236. tokenizer.setState(script_data_state);
  2237. } else if (data === '\u0000') {
  2238. tokenizer._parseError("invalid-codepoint");
  2239. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2240. tokenizer.setState(script_data_escaped_state);
  2241. } else {
  2242. tokenizer._emitToken({type: 'Characters', data: data});
  2243. tokenizer.setState(script_data_escaped_state);
  2244. }
  2245. return true;
  2246. }
  2247. function script_data_escaped_less_then_sign_state(buffer) {
  2248. var data = buffer.char();
  2249. if (data === '/') {
  2250. this._temporaryBuffer = '';
  2251. tokenizer.setState(script_data_escaped_end_tag_open_state);
  2252. } else if (isAlpha(data)) {
  2253. tokenizer._emitToken({type: 'Characters', data: '<' + data});
  2254. this._temporaryBuffer = data;
  2255. tokenizer.setState(script_data_double_escape_start_state);
  2256. } else {
  2257. tokenizer._emitToken({type: 'Characters', data: '<'});
  2258. buffer.unget(data);
  2259. tokenizer.setState(script_data_escaped_state);
  2260. }
  2261. return true;
  2262. }
  2263. function script_data_escaped_end_tag_open_state(buffer) {
  2264. var data = buffer.char();
  2265. if (isAlpha(data)) {
  2266. this._temporaryBuffer = data;
  2267. tokenizer.setState(script_data_escaped_end_tag_name_state);
  2268. } else {
  2269. tokenizer._emitToken({type: 'Characters', data: '</'});
  2270. buffer.unget(data);
  2271. tokenizer.setState(script_data_escaped_state);
  2272. }
  2273. return true;
  2274. }
  2275. function script_data_escaped_end_tag_name_state(buffer) {
  2276. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2277. var data = buffer.char();
  2278. if (isWhitespace(data) && appropriate) {
  2279. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2280. tokenizer.setState(before_attribute_name_state);
  2281. } else if (data === '/' && appropriate) {
  2282. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2283. tokenizer.setState(self_closing_tag_state);
  2284. } else if (data === '>' && appropriate) {
  2285. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2286. tokenizer.setState(data_state);
  2287. tokenizer._emitCurrentToken();
  2288. } else if (isAlpha(data)) {
  2289. this._temporaryBuffer += data;
  2290. buffer.commit();
  2291. } else {
  2292. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2293. buffer.unget(data);
  2294. tokenizer.setState(script_data_escaped_state);
  2295. }
  2296. return true;
  2297. }
  2298. function script_data_double_escape_start_state(buffer) {
  2299. var data = buffer.char();
  2300. if (isWhitespace(data) || data === '/' || data === '>') {
  2301. tokenizer._emitToken({type: 'Characters', data: data});
  2302. if (this._temporaryBuffer.toLowerCase() === 'script')
  2303. tokenizer.setState(script_data_double_escaped_state);
  2304. else
  2305. tokenizer.setState(script_data_escaped_state);
  2306. } else if (isAlpha(data)) {
  2307. tokenizer._emitToken({type: 'Characters', data: data});
  2308. this._temporaryBuffer += data;
  2309. buffer.commit();
  2310. } else {
  2311. buffer.unget(data);
  2312. tokenizer.setState(script_data_escaped_state);
  2313. }
  2314. return true;
  2315. }
  2316. function script_data_double_escaped_state(buffer) {
  2317. var data = buffer.char();
  2318. if (data === InputStream.EOF) {
  2319. tokenizer._parseError('eof-in-script');
  2320. buffer.unget(data);
  2321. tokenizer.setState(data_state);
  2322. } else if (data === '-') {
  2323. tokenizer._emitToken({type: 'Characters', data: '-'});
  2324. tokenizer.setState(script_data_double_escaped_dash_state);
  2325. } else if (data === '<') {
  2326. tokenizer._emitToken({type: 'Characters', data: '<'});
  2327. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2328. } else if (data === '\u0000') {
  2329. tokenizer._parseError('invalid-codepoint');
  2330. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2331. buffer.commit();
  2332. } else {
  2333. tokenizer._emitToken({type: 'Characters', data: data});
  2334. buffer.commit();
  2335. }
  2336. return true;
  2337. }
  2338. function script_data_double_escaped_dash_state(buffer) {
  2339. var data = buffer.char();
  2340. if (data === InputStream.EOF) {
  2341. tokenizer._parseError('eof-in-script');
  2342. buffer.unget(data);
  2343. tokenizer.setState(data_state);
  2344. } else if (data === '-') {
  2345. tokenizer._emitToken({type: 'Characters', data: '-'});
  2346. tokenizer.setState(script_data_double_escaped_dash_dash_state);
  2347. } else if (data === '<') {
  2348. tokenizer._emitToken({type: 'Characters', data: '<'});
  2349. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2350. } else if (data === '\u0000') {
  2351. tokenizer._parseError('invalid-codepoint');
  2352. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2353. tokenizer.setState(script_data_double_escaped_state);
  2354. } else {
  2355. tokenizer._emitToken({type: 'Characters', data: data});
  2356. tokenizer.setState(script_data_double_escaped_state);
  2357. }
  2358. return true;
  2359. }
  2360. function script_data_double_escaped_dash_dash_state(buffer) {
  2361. var data = buffer.char();
  2362. if (data === InputStream.EOF) {
  2363. tokenizer._parseError('eof-in-script');
  2364. buffer.unget(data);
  2365. tokenizer.setState(data_state);
  2366. } else if (data === '-') {
  2367. tokenizer._emitToken({type: 'Characters', data: '-'});
  2368. buffer.commit();
  2369. } else if (data === '<') {
  2370. tokenizer._emitToken({type: 'Characters', data: '<'});
  2371. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2372. } else if (data === '>') {
  2373. tokenizer._emitToken({type: 'Characters', data: '>'});
  2374. tokenizer.setState(script_data_state);
  2375. } else if (data === '\u0000') {
  2376. tokenizer._parseError('invalid-codepoint');
  2377. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2378. tokenizer.setState(script_data_double_escaped_state);
  2379. } else {
  2380. tokenizer._emitToken({type: 'Characters', data: data});
  2381. tokenizer.setState(script_data_double_escaped_state);
  2382. }
  2383. return true;
  2384. }
  2385. function script_data_double_escaped_less_than_sign_state(buffer) {
  2386. var data = buffer.char();
  2387. if (data === '/') {
  2388. tokenizer._emitToken({type: 'Characters', data: '/'});
  2389. this._temporaryBuffer = '';
  2390. tokenizer.setState(script_data_double_escape_end_state);
  2391. } else {
  2392. buffer.unget(data);
  2393. tokenizer.setState(script_data_double_escaped_state);
  2394. }
  2395. return true;
  2396. }
  2397. function script_data_double_escape_end_state(buffer) {
  2398. var data = buffer.char();
  2399. if (isWhitespace(data) || data === '/' || data === '>') {
  2400. tokenizer._emitToken({type: 'Characters', data: data});
  2401. if (this._temporaryBuffer.toLowerCase() === 'script')
  2402. tokenizer.setState(script_data_escaped_state);
  2403. else
  2404. tokenizer.setState(script_data_double_escaped_state);
  2405. } else if (isAlpha(data)) {
  2406. tokenizer._emitToken({type: 'Characters', data: data});
  2407. this._temporaryBuffer += data;
  2408. buffer.commit();
  2409. } else {
  2410. buffer.unget(data);
  2411. tokenizer.setState(script_data_double_escaped_state);
  2412. }
  2413. return true;
  2414. }
  2415. function tag_open_state(buffer) {
  2416. var data = buffer.char();
  2417. if (data === InputStream.EOF) {
  2418. tokenizer._parseError("bare-less-than-sign-at-eof");
  2419. tokenizer._emitToken({type: 'Characters', data: '<'});
  2420. buffer.unget(data);
  2421. tokenizer.setState(data_state);
  2422. } else if (isAlpha(data)) {
  2423. tokenizer._currentToken = {type: 'StartTag', name: data.toLowerCase(), data: []};
  2424. tokenizer.setState(tag_name_state);
  2425. } else if (data === '!') {
  2426. tokenizer.setState(markup_declaration_open_state);
  2427. } else if (data === '/') {
  2428. tokenizer.setState(close_tag_open_state);
  2429. } else if (data === '>') {
  2430. tokenizer._parseError("expected-tag-name-but-got-right-bracket");
  2431. tokenizer._emitToken({type: 'Characters', data: "<>"});
  2432. tokenizer.setState(data_state);
  2433. } else if (data === '?') {
  2434. tokenizer._parseError("expected-tag-name-but-got-question-mark");
  2435. buffer.unget(data);
  2436. tokenizer.setState(bogus_comment_state);
  2437. } else {
  2438. tokenizer._parseError("expected-tag-name");
  2439. tokenizer._emitToken({type: 'Characters', data: "<"});
  2440. buffer.unget(data);
  2441. tokenizer.setState(data_state);
  2442. }
  2443. return true;
  2444. }
  2445. function close_tag_open_state(buffer) {
  2446. var data = buffer.char();
  2447. if (data === InputStream.EOF) {
  2448. tokenizer._parseError("expected-closing-tag-but-got-eof");
  2449. tokenizer._emitToken({type: 'Characters', data: '</'});
  2450. buffer.unget(data);
  2451. tokenizer.setState(data_state);
  2452. } else if (isAlpha(data)) {
  2453. tokenizer._currentToken = {type: 'EndTag', name: data.toLowerCase(), data: []};
  2454. tokenizer.setState(tag_name_state);
  2455. } else if (data === '>') {
  2456. tokenizer._parseError("expected-closing-tag-but-got-right-bracket");
  2457. tokenizer.setState(data_state);
  2458. } else {
  2459. tokenizer._parseError("expected-closing-tag-but-got-char", {data: data}); // param 1 is datavars:
  2460. buffer.unget(data);
  2461. tokenizer.setState(bogus_comment_state);
  2462. }
  2463. return true;
  2464. }
  2465. function tag_name_state(buffer) {
  2466. var data = buffer.char();
  2467. if (data === InputStream.EOF) {
  2468. tokenizer._parseError('eof-in-tag-name');
  2469. buffer.unget(data);
  2470. tokenizer.setState(data_state);
  2471. } else if (isWhitespace(data)) {
  2472. tokenizer.setState(before_attribute_name_state);
  2473. } else if (isAlpha(data)) {
  2474. tokenizer._currentToken.name += data.toLowerCase();
  2475. } else if (data === '>') {
  2476. tokenizer._emitCurrentToken();
  2477. } else if (data === '/') {
  2478. tokenizer.setState(self_closing_tag_state);
  2479. } else if (data === '\u0000') {
  2480. tokenizer._parseError("invalid-codepoint");
  2481. tokenizer._currentToken.name += "\uFFFD";
  2482. } else {
  2483. tokenizer._currentToken.name += data;
  2484. }
  2485. buffer.commit();
  2486. return true;
  2487. }
  2488. function before_attribute_name_state(buffer) {
  2489. var data = buffer.char();
  2490. if (data === InputStream.EOF) {
  2491. tokenizer._parseError("expected-attribute-name-but-got-eof");
  2492. buffer.unget(data);
  2493. tokenizer.setState(data_state);
  2494. } else if (isWhitespace(data)) {
  2495. return true;
  2496. } else if (isAlpha(data)) {
  2497. tokenizer._currentToken.data.push({nodeName: data.toLowerCase(), nodeValue: ""});
  2498. tokenizer.setState(attribute_name_state);
  2499. } else if (data === '>') {
  2500. tokenizer._emitCurrentToken();
  2501. } else if (data === '/') {
  2502. tokenizer.setState(self_closing_tag_state);
  2503. } else if (data === "'" || data === '"' || data === '=' || data === '<') {
  2504. tokenizer._parseError("invalid-character-in-attribute-name");
  2505. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2506. tokenizer.setState(attribute_name_state);
  2507. } else if (data === '\u0000') {
  2508. tokenizer._parseError("invalid-codepoint");
  2509. tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""});
  2510. } else {
  2511. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2512. tokenizer.setState(attribute_name_state);
  2513. }
  2514. return true;
  2515. }
  2516. function attribute_name_state(buffer) {
  2517. var data = buffer.char();
  2518. var leavingThisState = true;
  2519. var shouldEmit = false;
  2520. if (data === InputStream.EOF) {
  2521. tokenizer._parseError("eof-in-attribute-name");
  2522. buffer.unget(data);
  2523. tokenizer.setState(data_state);
  2524. shouldEmit = true;
  2525. } else if (data === '=') {
  2526. tokenizer.setState(before_attribute_value_state);
  2527. } else if (isAlpha(data)) {
  2528. tokenizer._currentAttribute().nodeName += data.toLowerCase();
  2529. leavingThisState = false;
  2530. } else if (data === '>') {
  2531. shouldEmit = true;
  2532. } else if (isWhitespace(data)) {
  2533. tokenizer.setState(after_attribute_name_state);
  2534. } else if (data === '/') {
  2535. tokenizer.setState(self_closing_tag_state);
  2536. } else if (data === "'" || data === '"') {
  2537. tokenizer._parseError("invalid-character-in-attribute-name");
  2538. tokenizer._currentAttribute().nodeName += data;
  2539. leavingThisState = false;
  2540. } else if (data === '\u0000') {
  2541. tokenizer._parseError("invalid-codepoint");
  2542. tokenizer._currentAttribute().nodeName += "\uFFFD";
  2543. } else {
  2544. tokenizer._currentAttribute().nodeName += data;
  2545. leavingThisState = false;
  2546. }
  2547. if (leavingThisState) {
  2548. var attributes = tokenizer._currentToken.data;
  2549. var currentAttribute = attributes[attributes.length - 1];
  2550. for (var i = attributes.length - 2; i >= 0; i--) {
  2551. if (currentAttribute.nodeName === attributes[i].nodeName) {
  2552. tokenizer._parseError("duplicate-attribute", {name: currentAttribute.nodeName});
  2553. currentAttribute.nodeName = null;
  2554. break;
  2555. }
  2556. }
  2557. if (shouldEmit)
  2558. tokenizer._emitCurrentToken();
  2559. } else {
  2560. buffer.commit();
  2561. }
  2562. return true;
  2563. }
  2564. function after_attribute_name_state(buffer) {
  2565. var data = buffer.char();
  2566. if (data === InputStream.EOF) {
  2567. tokenizer._parseError("expected-end-of-tag-but-got-eof");
  2568. buffer.unget(data);
  2569. tokenizer.setState(data_state);
  2570. } else if (isWhitespace(data)) {
  2571. return true;
  2572. } else if (data === '=') {
  2573. tokenizer.setState(before_attribute_value_state);
  2574. } else if (data === '>') {
  2575. tokenizer._emitCurrentToken();
  2576. } else if (isAlpha(data)) {
  2577. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2578. tokenizer.setState(attribute_name_state);
  2579. } else if (data === '/') {
  2580. tokenizer.setState(self_closing_tag_state);
  2581. } else if (data === "'" || data === '"' || data === '<') {
  2582. tokenizer._parseError("invalid-character-after-attribute-name");
  2583. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2584. tokenizer.setState(attribute_name_state);
  2585. } else if (data === '\u0000') {
  2586. tokenizer._parseError("invalid-codepoint");
  2587. tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""});
  2588. } else {
  2589. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2590. tokenizer.setState(attribute_name_state);
  2591. }
  2592. return true;
  2593. }
  2594. function before_attribute_value_state(buffer) {
  2595. var data = buffer.char();
  2596. if (data === InputStream.EOF) {
  2597. tokenizer._parseError("expected-attribute-value-but-got-eof");
  2598. buffer.unget(data);
  2599. tokenizer.setState(data_state);
  2600. } else if (isWhitespace(data)) {
  2601. return true;
  2602. } else if (data === '"') {
  2603. tokenizer.setState(attribute_value_double_quoted_state);
  2604. } else if (data === '&') {
  2605. tokenizer.setState(attribute_value_unquoted_state);
  2606. buffer.unget(data);
  2607. } else if (data === "'") {
  2608. tokenizer.setState(attribute_value_single_quoted_state);
  2609. } else if (data === '>') {
  2610. tokenizer._parseError("expected-attribute-value-but-got-right-bracket");
  2611. tokenizer._emitCurrentToken();
  2612. } else if (data === '=' || data === '<' || data === '`') {
  2613. tokenizer._parseError("unexpected-character-in-unquoted-attribute-value");
  2614. tokenizer._currentAttribute().nodeValue += data;
  2615. tokenizer.setState(attribute_value_unquoted_state);
  2616. } else if (data === '\u0000') {
  2617. tokenizer._parseError("invalid-codepoint");
  2618. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2619. } else {
  2620. tokenizer._currentAttribute().nodeValue += data;
  2621. tokenizer.setState(attribute_value_unquoted_state);
  2622. }
  2623. return true;
  2624. }
  2625. function attribute_value_double_quoted_state(buffer) {
  2626. var data = buffer.char();
  2627. if (data === InputStream.EOF) {
  2628. tokenizer._parseError("eof-in-attribute-value-double-quote");
  2629. buffer.unget(data);
  2630. tokenizer.setState(data_state);
  2631. } else if (data === '"') {
  2632. tokenizer.setState(after_attribute_value_state);
  2633. } else if (data === '&') {
  2634. this._additionalAllowedCharacter = '"';
  2635. tokenizer.setState(character_reference_in_attribute_value_state);
  2636. } else if (data === '\u0000') {
  2637. tokenizer._parseError("invalid-codepoint");
  2638. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2639. } else {
  2640. var s = buffer.matchUntil('[\0"&]');
  2641. data = data + s;
  2642. tokenizer._currentAttribute().nodeValue += data;
  2643. }
  2644. return true;
  2645. }
  2646. function attribute_value_single_quoted_state(buffer) {
  2647. var data = buffer.char();
  2648. if (data === InputStream.EOF) {
  2649. tokenizer._parseError("eof-in-attribute-value-single-quote");
  2650. buffer.unget(data);
  2651. tokenizer.setState(data_state);
  2652. } else if (data === "'") {
  2653. tokenizer.setState(after_attribute_value_state);
  2654. } else if (data === '&') {
  2655. this._additionalAllowedCharacter = "'";
  2656. tokenizer.setState(character_reference_in_attribute_value_state);
  2657. } else if (data === '\u0000') {
  2658. tokenizer._parseError("invalid-codepoint");
  2659. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2660. } else {
  2661. tokenizer._currentAttribute().nodeValue += data + buffer.matchUntil("\u0000|['&]");
  2662. }
  2663. return true;
  2664. }
  2665. function attribute_value_unquoted_state(buffer) {
  2666. var data = buffer.char();
  2667. if (data === InputStream.EOF) {
  2668. tokenizer._parseError("eof-after-attribute-value");
  2669. buffer.unget(data);
  2670. tokenizer.setState(data_state);
  2671. } else if (isWhitespace(data)) {
  2672. tokenizer.setState(before_attribute_name_state);
  2673. } else if (data === '&') {
  2674. this._additionalAllowedCharacter = ">";
  2675. tokenizer.setState(character_reference_in_attribute_value_state);
  2676. } else if (data === '>') {
  2677. tokenizer._emitCurrentToken();
  2678. } else if (data === '"' || data === "'" || data === '=' || data === '`' || data === '<') {
  2679. tokenizer._parseError("unexpected-character-in-unquoted-attribute-value");
  2680. tokenizer._currentAttribute().nodeValue += data;
  2681. buffer.commit();
  2682. } else if (data === '\u0000') {
  2683. tokenizer._parseError("invalid-codepoint");
  2684. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2685. } else {
  2686. var o = buffer.matchUntil("\u0000|["+ "\t\n\v\f\x20\r" + "&<>\"'=`" +"]");
  2687. if (o === InputStream.EOF) {
  2688. tokenizer._parseError("eof-in-attribute-value-no-quotes");
  2689. tokenizer._emitCurrentToken();
  2690. }
  2691. buffer.commit();
  2692. tokenizer._currentAttribute().nodeValue += data + o;
  2693. }
  2694. return true;
  2695. }
  2696. function character_reference_in_attribute_value_state(buffer) {
  2697. var character = EntityParser.consumeEntity(buffer, tokenizer, this._additionalAllowedCharacter);
  2698. this._currentAttribute().nodeValue += character || '&';
  2699. if (this._additionalAllowedCharacter === '"')
  2700. tokenizer.setState(attribute_value_double_quoted_state);
  2701. else if (this._additionalAllowedCharacter === '\'')
  2702. tokenizer.setState(attribute_value_single_quoted_state);
  2703. else if (this._additionalAllowedCharacter === '>')
  2704. tokenizer.setState(attribute_value_unquoted_state);
  2705. return true;
  2706. }
  2707. function after_attribute_value_state(buffer) {
  2708. var data = buffer.char();
  2709. if (data === InputStream.EOF) {
  2710. tokenizer._parseError("eof-after-attribute-value");
  2711. buffer.unget(data);
  2712. tokenizer.setState(data_state);
  2713. } else if (isWhitespace(data)) {
  2714. tokenizer.setState(before_attribute_name_state);
  2715. } else if (data === '>') {
  2716. tokenizer.setState(data_state);
  2717. tokenizer._emitCurrentToken();
  2718. } else if (data === '/') {
  2719. tokenizer.setState(self_closing_tag_state);
  2720. } else {
  2721. tokenizer._parseError("unexpected-character-after-attribute-value");
  2722. buffer.unget(data);
  2723. tokenizer.setState(before_attribute_name_state);
  2724. }
  2725. return true;
  2726. }
  2727. function self_closing_tag_state(buffer) {
  2728. var c = buffer.char();
  2729. if (c === InputStream.EOF) {
  2730. tokenizer._parseError("unexpected-eof-after-solidus-in-tag");
  2731. buffer.unget(c);
  2732. tokenizer.setState(data_state);
  2733. } else if (c === '>') {
  2734. tokenizer._currentToken.selfClosing = true;
  2735. tokenizer.setState(data_state);
  2736. tokenizer._emitCurrentToken();
  2737. } else {
  2738. tokenizer._parseError("unexpected-character-after-solidus-in-tag");
  2739. buffer.unget(c);
  2740. tokenizer.setState(before_attribute_name_state);
  2741. }
  2742. return true;
  2743. }
  2744. function bogus_comment_state(buffer) {
  2745. var data = buffer.matchUntil('>');
  2746. data = data.replace(/\u0000/g, "\uFFFD");
  2747. buffer.char();
  2748. tokenizer._emitToken({type: 'Comment', data: data});
  2749. tokenizer.setState(data_state);
  2750. return true;
  2751. }
  2752. function markup_declaration_open_state(buffer) {
  2753. var chars = buffer.shift(2);
  2754. if (chars === '--') {
  2755. tokenizer._currentToken = {type: 'Comment', data: ''};
  2756. tokenizer.setState(comment_start_state);
  2757. } else {
  2758. var newchars = buffer.shift(5);
  2759. if (newchars === InputStream.EOF || chars === InputStream.EOF) {
  2760. tokenizer._parseError("expected-dashes-or-doctype");
  2761. tokenizer.setState(bogus_comment_state);
  2762. buffer.unget(chars);
  2763. return true;
  2764. }
  2765. chars += newchars;
  2766. if (chars.toUpperCase() === 'DOCTYPE') {
  2767. tokenizer._currentToken = {type: 'Doctype', name: '', publicId: null, systemId: null, forceQuirks: false};
  2768. tokenizer.setState(doctype_state);
  2769. } else if (tokenizer._tokenHandler.isCdataSectionAllowed() && chars === '[CDATA[') {
  2770. tokenizer.setState(cdata_section_state);
  2771. } else {
  2772. tokenizer._parseError("expected-dashes-or-doctype");
  2773. buffer.unget(chars);
  2774. tokenizer.setState(bogus_comment_state);
  2775. }
  2776. }
  2777. return true;
  2778. }
  2779. function cdata_section_state(buffer) {
  2780. var data = buffer.matchUntil(']]>');
  2781. buffer.shift(3);
  2782. if (data) {
  2783. tokenizer._emitToken({type: 'Characters', data: data});
  2784. }
  2785. tokenizer.setState(data_state);
  2786. return true;
  2787. }
  2788. function comment_start_state(buffer) {
  2789. var data = buffer.char();
  2790. if (data === InputStream.EOF) {
  2791. tokenizer._parseError("eof-in-comment");
  2792. tokenizer._emitToken(tokenizer._currentToken);
  2793. buffer.unget(data);
  2794. tokenizer.setState(data_state);
  2795. } else if (data === '-') {
  2796. tokenizer.setState(comment_start_dash_state);
  2797. } else if (data === '>') {
  2798. tokenizer._parseError("incorrect-comment");
  2799. tokenizer._emitToken(tokenizer._currentToken);
  2800. tokenizer.setState(data_state);
  2801. } else if (data === '\u0000') {
  2802. tokenizer._parseError("invalid-codepoint");
  2803. tokenizer._currentToken.data += "\uFFFD";
  2804. } else {
  2805. tokenizer._currentToken.data += data;
  2806. tokenizer.setState(comment_state);
  2807. }
  2808. return true;
  2809. }
  2810. function comment_start_dash_state(buffer) {
  2811. var data = buffer.char();
  2812. if (data === InputStream.EOF) {
  2813. tokenizer._parseError("eof-in-comment");
  2814. tokenizer._emitToken(tokenizer._currentToken);
  2815. buffer.unget(data);
  2816. tokenizer.setState(data_state);
  2817. } else if (data === '-') {
  2818. tokenizer.setState(comment_end_state);
  2819. } else if (data === '>') {
  2820. tokenizer._parseError("incorrect-comment");
  2821. tokenizer._emitToken(tokenizer._currentToken);
  2822. tokenizer.setState(data_state);
  2823. } else if (data === '\u0000') {
  2824. tokenizer._parseError("invalid-codepoint");
  2825. tokenizer._currentToken.data += "\uFFFD";
  2826. } else {
  2827. tokenizer._currentToken.data += '-' + data;
  2828. tokenizer.setState(comment_state);
  2829. }
  2830. return true;
  2831. }
  2832. function comment_state(buffer) {
  2833. var data = buffer.char();
  2834. if (data === InputStream.EOF) {
  2835. tokenizer._parseError("eof-in-comment");
  2836. tokenizer._emitToken(tokenizer._currentToken);
  2837. buffer.unget(data);
  2838. tokenizer.setState(data_state);
  2839. } else if (data === '-') {
  2840. tokenizer.setState(comment_end_dash_state);
  2841. } else if (data === '\u0000') {
  2842. tokenizer._parseError("invalid-codepoint");
  2843. tokenizer._currentToken.data += "\uFFFD";
  2844. } else {
  2845. tokenizer._currentToken.data += data;
  2846. buffer.commit();
  2847. }
  2848. return true;
  2849. }
  2850. function comment_end_dash_state(buffer) {
  2851. var data = buffer.char();
  2852. if (data === InputStream.EOF) {
  2853. tokenizer._parseError("eof-in-comment-end-dash");
  2854. tokenizer._emitToken(tokenizer._currentToken);
  2855. buffer.unget(data);
  2856. tokenizer.setState(data_state);
  2857. } else if (data === '-') {
  2858. tokenizer.setState(comment_end_state);
  2859. } else if (data === '\u0000') {
  2860. tokenizer._parseError("invalid-codepoint");
  2861. tokenizer._currentToken.data += "-\uFFFD";
  2862. tokenizer.setState(comment_state);
  2863. } else {
  2864. tokenizer._currentToken.data += '-' + data + buffer.matchUntil('\u0000|-');
  2865. buffer.char();
  2866. }
  2867. return true;
  2868. }
  2869. function comment_end_state(buffer) {
  2870. var data = buffer.char();
  2871. if (data === InputStream.EOF) {
  2872. tokenizer._parseError("eof-in-comment-double-dash");
  2873. tokenizer._emitToken(tokenizer._currentToken);
  2874. buffer.unget(data);
  2875. tokenizer.setState(data_state);
  2876. } else if (data === '>') {
  2877. tokenizer._emitToken(tokenizer._currentToken);
  2878. tokenizer.setState(data_state);
  2879. } else if (data === '!') {
  2880. tokenizer._parseError("unexpected-bang-after-double-dash-in-comment");
  2881. tokenizer.setState(comment_end_bang_state);
  2882. } else if (data === '-') {
  2883. tokenizer._parseError("unexpected-dash-after-double-dash-in-comment");
  2884. tokenizer._currentToken.data += data;
  2885. } else if (data === '\u0000') {
  2886. tokenizer._parseError("invalid-codepoint");
  2887. tokenizer._currentToken.data += "--\uFFFD";
  2888. tokenizer.setState(comment_state);
  2889. } else {
  2890. tokenizer._parseError("unexpected-char-in-comment");
  2891. tokenizer._currentToken.data += '--' + data;
  2892. tokenizer.setState(comment_state);
  2893. }
  2894. return true;
  2895. }
  2896. function comment_end_bang_state(buffer) {
  2897. var data = buffer.char();
  2898. if (data === InputStream.EOF) {
  2899. tokenizer._parseError("eof-in-comment-end-bang-state");
  2900. tokenizer._emitToken(tokenizer._currentToken);
  2901. buffer.unget(data);
  2902. tokenizer.setState(data_state);
  2903. } else if (data === '>') {
  2904. tokenizer._emitToken(tokenizer._currentToken);
  2905. tokenizer.setState(data_state);
  2906. } else if (data === '-') {
  2907. tokenizer._currentToken.data += '--!';
  2908. tokenizer.setState(comment_end_dash_state);
  2909. } else {
  2910. tokenizer._currentToken.data += '--!' + data;
  2911. tokenizer.setState(comment_state);
  2912. }
  2913. return true;
  2914. }
  2915. function doctype_state(buffer) {
  2916. var data = buffer.char();
  2917. if (data === InputStream.EOF) {
  2918. tokenizer._parseError("expected-doctype-name-but-got-eof");
  2919. tokenizer._currentToken.forceQuirks = true;
  2920. buffer.unget(data);
  2921. tokenizer.setState(data_state);
  2922. tokenizer._emitCurrentToken();
  2923. } else if (isWhitespace(data)) {
  2924. tokenizer.setState(before_doctype_name_state);
  2925. } else {
  2926. tokenizer._parseError("need-space-after-doctype");
  2927. buffer.unget(data);
  2928. tokenizer.setState(before_doctype_name_state);
  2929. }
  2930. return true;
  2931. }
  2932. function before_doctype_name_state(buffer) {
  2933. var data = buffer.char();
  2934. if (data === InputStream.EOF) {
  2935. tokenizer._parseError("expected-doctype-name-but-got-eof");
  2936. tokenizer._currentToken.forceQuirks = true;
  2937. buffer.unget(data);
  2938. tokenizer.setState(data_state);
  2939. tokenizer._emitCurrentToken();
  2940. } else if (isWhitespace(data)) {
  2941. } else if (data === '>') {
  2942. tokenizer._parseError("expected-doctype-name-but-got-right-bracket");
  2943. tokenizer._currentToken.forceQuirks = true;
  2944. tokenizer.setState(data_state);
  2945. tokenizer._emitCurrentToken();
  2946. } else {
  2947. if (isAlpha(data))
  2948. data = data.toLowerCase();
  2949. tokenizer._currentToken.name = data;
  2950. tokenizer.setState(doctype_name_state);
  2951. }
  2952. return true;
  2953. }
  2954. function doctype_name_state(buffer) {
  2955. var data = buffer.char();
  2956. if (data === InputStream.EOF) {
  2957. tokenizer._currentToken.forceQuirks = true;
  2958. buffer.unget(data);
  2959. tokenizer._parseError("eof-in-doctype-name");
  2960. tokenizer.setState(data_state);
  2961. tokenizer._emitCurrentToken();
  2962. } else if (isWhitespace(data)) {
  2963. tokenizer.setState(after_doctype_name_state);
  2964. } else if (data === '>') {
  2965. tokenizer.setState(data_state);
  2966. tokenizer._emitCurrentToken();
  2967. } else {
  2968. if (isAlpha(data))
  2969. data = data.toLowerCase();
  2970. tokenizer._currentToken.name += data;
  2971. buffer.commit();
  2972. }
  2973. return true;
  2974. }
  2975. function after_doctype_name_state(buffer) {
  2976. var data = buffer.char();
  2977. if (data === InputStream.EOF) {
  2978. tokenizer._currentToken.forceQuirks = true;
  2979. buffer.unget(data);
  2980. tokenizer._parseError("eof-in-doctype");
  2981. tokenizer.setState(data_state);
  2982. tokenizer._emitCurrentToken();
  2983. } else if (isWhitespace(data)) {
  2984. } else if (data === '>') {
  2985. tokenizer.setState(data_state);
  2986. tokenizer._emitCurrentToken();
  2987. } else {
  2988. if (['p', 'P'].indexOf(data) > -1) {
  2989. var expected = [['u', 'U'], ['b', 'B'], ['l', 'L'], ['i', 'I'], ['c', 'C']];
  2990. var matched = expected.every(function(expected){
  2991. data = buffer.char();
  2992. return expected.indexOf(data) > -1;
  2993. });
  2994. if (matched) {
  2995. tokenizer.setState(after_doctype_public_keyword_state);
  2996. return true;
  2997. }
  2998. } else if (['s', 'S'].indexOf(data) > -1) {
  2999. var expected = [['y', 'Y'], ['s', 'S'], ['t', 'T'], ['e', 'E'], ['m', 'M']];
  3000. var matched = expected.every(function(expected){
  3001. data = buffer.char();
  3002. return expected.indexOf(data) > -1;
  3003. });
  3004. if (matched) {
  3005. tokenizer.setState(after_doctype_system_keyword_state);
  3006. return true;
  3007. }
  3008. }
  3009. buffer.unget(data);
  3010. tokenizer._currentToken.forceQuirks = true;
  3011. if (data === InputStream.EOF) {
  3012. tokenizer._parseError("eof-in-doctype");
  3013. buffer.unget(data);
  3014. tokenizer.setState(data_state);
  3015. tokenizer._emitCurrentToken();
  3016. } else {
  3017. tokenizer._parseError("expected-space-or-right-bracket-in-doctype", {data: data});
  3018. tokenizer.setState(bogus_doctype_state);
  3019. }
  3020. }
  3021. return true;
  3022. }
  3023. function after_doctype_public_keyword_state(buffer) {
  3024. var data = buffer.char();
  3025. if (data === InputStream.EOF) {
  3026. tokenizer._parseError("eof-in-doctype");
  3027. tokenizer._currentToken.forceQuirks = true;
  3028. buffer.unget(data);
  3029. tokenizer.setState(data_state);
  3030. tokenizer._emitCurrentToken();
  3031. } else if (isWhitespace(data)) {
  3032. tokenizer.setState(before_doctype_public_identifier_state);
  3033. } else if (data === "'" || data === '"') {
  3034. tokenizer._parseError("unexpected-char-in-doctype");
  3035. buffer.unget(data);
  3036. tokenizer.setState(before_doctype_public_identifier_state);
  3037. } else {
  3038. buffer.unget(data);
  3039. tokenizer.setState(before_doctype_public_identifier_state);
  3040. }
  3041. return true;
  3042. }
  3043. function before_doctype_public_identifier_state(buffer) {
  3044. var data = buffer.char();
  3045. if (data === InputStream.EOF) {
  3046. tokenizer._parseError("eof-in-doctype");
  3047. tokenizer._currentToken.forceQuirks = true;
  3048. buffer.unget(data);
  3049. tokenizer.setState(data_state);
  3050. tokenizer._emitCurrentToken();
  3051. } else if (isWhitespace(data)) {
  3052. } else if (data === '"') {
  3053. tokenizer._currentToken.publicId = '';
  3054. tokenizer.setState(doctype_public_identifier_double_quoted_state);
  3055. } else if (data === "'") {
  3056. tokenizer._currentToken.publicId = '';
  3057. tokenizer.setState(doctype_public_identifier_single_quoted_state);
  3058. } else if (data === '>') {
  3059. tokenizer._parseError("unexpected-end-of-doctype");
  3060. tokenizer._currentToken.forceQuirks = true;
  3061. tokenizer.setState(data_state);
  3062. tokenizer._emitCurrentToken();
  3063. } else {
  3064. tokenizer._parseError("unexpected-char-in-doctype");
  3065. tokenizer._currentToken.forceQuirks = true;
  3066. tokenizer.setState(bogus_doctype_state);
  3067. }
  3068. return true;
  3069. }
  3070. function doctype_public_identifier_double_quoted_state(buffer) {
  3071. var data = buffer.char();
  3072. if (data === InputStream.EOF) {
  3073. tokenizer._parseError("eof-in-doctype");
  3074. tokenizer._currentToken.forceQuirks = true;
  3075. buffer.unget(data);
  3076. tokenizer.setState(data_state);
  3077. tokenizer._emitCurrentToken();
  3078. } else if (data === '"') {
  3079. tokenizer.setState(after_doctype_public_identifier_state);
  3080. } else if (data === '>') {
  3081. tokenizer._parseError("unexpected-end-of-doctype");
  3082. tokenizer._currentToken.forceQuirks = true;
  3083. tokenizer.setState(data_state);
  3084. tokenizer._emitCurrentToken();
  3085. } else {
  3086. tokenizer._currentToken.publicId += data;
  3087. }
  3088. return true;
  3089. }
  3090. function doctype_public_identifier_single_quoted_state(buffer) {
  3091. var data = buffer.char();
  3092. if (data === InputStream.EOF) {
  3093. tokenizer._parseError("eof-in-doctype");
  3094. tokenizer._currentToken.forceQuirks = true;
  3095. buffer.unget(data);
  3096. tokenizer.setState(data_state);
  3097. tokenizer._emitCurrentToken();
  3098. } else if (data === "'") {
  3099. tokenizer.setState(after_doctype_public_identifier_state);
  3100. } else if (data === '>') {
  3101. tokenizer._parseError("unexpected-end-of-doctype");
  3102. tokenizer._currentToken.forceQuirks = true;
  3103. tokenizer.setState(data_state);
  3104. tokenizer._emitCurrentToken();
  3105. } else {
  3106. tokenizer._currentToken.publicId += data;
  3107. }
  3108. return true;
  3109. }
  3110. function after_doctype_public_identifier_state(buffer) {
  3111. var data = buffer.char();
  3112. if (data === InputStream.EOF) {
  3113. tokenizer._parseError("eof-in-doctype");
  3114. tokenizer._currentToken.forceQuirks = true;
  3115. tokenizer._emitCurrentToken();
  3116. buffer.unget(data);
  3117. tokenizer.setState(data_state);
  3118. } else if (isWhitespace(data)) {
  3119. tokenizer.setState(between_doctype_public_and_system_identifiers_state);
  3120. } else if (data === '>') {
  3121. tokenizer.setState(data_state);
  3122. tokenizer._emitCurrentToken();
  3123. } else if (data === '"') {
  3124. tokenizer._parseError("unexpected-char-in-doctype");
  3125. tokenizer._currentToken.systemId = '';
  3126. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3127. } else if (data === "'") {
  3128. tokenizer._parseError("unexpected-char-in-doctype");
  3129. tokenizer._currentToken.systemId = '';
  3130. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3131. } else {
  3132. tokenizer._parseError("unexpected-char-in-doctype");
  3133. tokenizer._currentToken.forceQuirks = true;
  3134. tokenizer.setState(bogus_doctype_state);
  3135. }
  3136. return true;
  3137. }
  3138. function between_doctype_public_and_system_identifiers_state(buffer) {
  3139. var data = buffer.char();
  3140. if (data === InputStream.EOF) {
  3141. tokenizer._parseError("eof-in-doctype");
  3142. tokenizer._currentToken.forceQuirks = true;
  3143. tokenizer._emitCurrentToken();
  3144. buffer.unget(data);
  3145. tokenizer.setState(data_state);
  3146. } else if (isWhitespace(data)) {
  3147. } else if (data === '>') {
  3148. tokenizer._emitCurrentToken();
  3149. tokenizer.setState(data_state);
  3150. } else if (data === '"') {
  3151. tokenizer._currentToken.systemId = '';
  3152. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3153. } else if (data === "'") {
  3154. tokenizer._currentToken.systemId = '';
  3155. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3156. } else {
  3157. tokenizer._parseError("unexpected-char-in-doctype");
  3158. tokenizer._currentToken.forceQuirks = true;
  3159. tokenizer.setState(bogus_doctype_state);
  3160. }
  3161. return true;
  3162. }
  3163. function after_doctype_system_keyword_state(buffer) {
  3164. var data = buffer.char();
  3165. if (data === InputStream.EOF) {
  3166. tokenizer._parseError("eof-in-doctype");
  3167. tokenizer._currentToken.forceQuirks = true;
  3168. tokenizer._emitCurrentToken();
  3169. buffer.unget(data);
  3170. tokenizer.setState(data_state);
  3171. } else if (isWhitespace(data)) {
  3172. tokenizer.setState(before_doctype_system_identifier_state);
  3173. } else if (data === "'" || data === '"') {
  3174. tokenizer._parseError("unexpected-char-in-doctype");
  3175. buffer.unget(data);
  3176. tokenizer.setState(before_doctype_system_identifier_state);
  3177. } else {
  3178. buffer.unget(data);
  3179. tokenizer.setState(before_doctype_system_identifier_state);
  3180. }
  3181. return true;
  3182. }
  3183. function before_doctype_system_identifier_state(buffer) {
  3184. var data = buffer.char();
  3185. if (data === InputStream.EOF) {
  3186. tokenizer._parseError("eof-in-doctype");
  3187. tokenizer._currentToken.forceQuirks = true;
  3188. tokenizer._emitCurrentToken();
  3189. buffer.unget(data);
  3190. tokenizer.setState(data_state);
  3191. } else if (isWhitespace(data)) {
  3192. } else if (data === '"') {
  3193. tokenizer._currentToken.systemId = '';
  3194. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3195. } else if (data === "'") {
  3196. tokenizer._currentToken.systemId = '';
  3197. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3198. } else if (data === '>') {
  3199. tokenizer._parseError("unexpected-end-of-doctype");
  3200. tokenizer._currentToken.forceQuirks = true;
  3201. tokenizer._emitCurrentToken();
  3202. tokenizer.setState(data_state);
  3203. } else {
  3204. tokenizer._parseError("unexpected-char-in-doctype");
  3205. tokenizer._currentToken.forceQuirks = true;
  3206. tokenizer.setState(bogus_doctype_state);
  3207. }
  3208. return true;
  3209. }
  3210. function doctype_system_identifier_double_quoted_state(buffer) {
  3211. var data = buffer.char();
  3212. if (data === InputStream.EOF) {
  3213. tokenizer._parseError("eof-in-doctype");
  3214. tokenizer._currentToken.forceQuirks = true;
  3215. tokenizer._emitCurrentToken();
  3216. buffer.unget(data);
  3217. tokenizer.setState(data_state);
  3218. } else if (data === '"') {
  3219. tokenizer.setState(after_doctype_system_identifier_state);
  3220. } else if (data === '>') {
  3221. tokenizer._parseError("unexpected-end-of-doctype");
  3222. tokenizer._currentToken.forceQuirks = true;
  3223. tokenizer._emitCurrentToken();
  3224. tokenizer.setState(data_state);
  3225. } else {
  3226. tokenizer._currentToken.systemId += data;
  3227. }
  3228. return true;
  3229. }
  3230. function doctype_system_identifier_single_quoted_state(buffer) {
  3231. var data = buffer.char();
  3232. if (data === InputStream.EOF) {
  3233. tokenizer._parseError("eof-in-doctype");
  3234. tokenizer._currentToken.forceQuirks = true;
  3235. tokenizer._emitCurrentToken();
  3236. buffer.unget(data);
  3237. tokenizer.setState(data_state);
  3238. } else if (data === "'") {
  3239. tokenizer.setState(after_doctype_system_identifier_state);
  3240. } else if (data === '>') {
  3241. tokenizer._parseError("unexpected-end-of-doctype");
  3242. tokenizer._currentToken.forceQuirks = true;
  3243. tokenizer._emitCurrentToken();
  3244. tokenizer.setState(data_state);
  3245. } else {
  3246. tokenizer._currentToken.systemId += data;
  3247. }
  3248. return true;
  3249. }
  3250. function after_doctype_system_identifier_state(buffer) {
  3251. var data = buffer.char();
  3252. if (data === InputStream.EOF) {
  3253. tokenizer._parseError("eof-in-doctype");
  3254. tokenizer._currentToken.forceQuirks = true;
  3255. tokenizer._emitCurrentToken();
  3256. buffer.unget(data);
  3257. tokenizer.setState(data_state);
  3258. } else if (isWhitespace(data)) {
  3259. } else if (data === '>') {
  3260. tokenizer._emitCurrentToken();
  3261. tokenizer.setState(data_state);
  3262. } else {
  3263. tokenizer._parseError("unexpected-char-in-doctype");
  3264. tokenizer.setState(bogus_doctype_state);
  3265. }
  3266. return true;
  3267. }
  3268. function bogus_doctype_state(buffer) {
  3269. var data = buffer.char();
  3270. if (data === InputStream.EOF) {
  3271. buffer.unget(data);
  3272. tokenizer._emitCurrentToken();
  3273. tokenizer.setState(data_state);
  3274. } else if (data === '>') {
  3275. tokenizer._emitCurrentToken();
  3276. tokenizer.setState(data_state);
  3277. }
  3278. return true;
  3279. }
  3280. };
  3281. Object.defineProperty(Tokenizer.prototype, 'lineNumber', {
  3282. get: function() {
  3283. return this._inputStream.location().line;
  3284. }
  3285. });
  3286. Object.defineProperty(Tokenizer.prototype, 'columnNumber', {
  3287. get: function() {
  3288. return this._inputStream.location().column;
  3289. }
  3290. });
  3291. exports.Tokenizer = Tokenizer;
  3292. },
  3293. {"./EntityParser":2,"./InputStream":3}],
  3294. 6:[function(_dereq_,module,exports){
  3295. var assert = _dereq_('assert');
  3296. var messages = _dereq_('./messages.json');
  3297. var constants = _dereq_('./constants');
  3298. var EventEmitter = _dereq_('events').EventEmitter;
  3299. var Tokenizer = _dereq_('./Tokenizer').Tokenizer;
  3300. var ElementStack = _dereq_('./ElementStack').ElementStack;
  3301. var StackItem = _dereq_('./StackItem').StackItem;
  3302. var Marker = {};
  3303. function isWhitespace(ch) {
  3304. return ch === " " || ch === "\n" || ch === "\t" || ch === "\r" || ch === "\f";
  3305. }
  3306. function isWhitespaceOrReplacementCharacter(ch) {
  3307. return isWhitespace(ch) || ch === '\uFFFD';
  3308. }
  3309. function isAllWhitespace(characters) {
  3310. for (var i = 0; i < characters.length; i++) {
  3311. var ch = characters[i];
  3312. if (!isWhitespace(ch))
  3313. return false;
  3314. }
  3315. return true;
  3316. }
  3317. function isAllWhitespaceOrReplacementCharacters(characters) {
  3318. for (var i = 0; i < characters.length; i++) {
  3319. var ch = characters[i];
  3320. if (!isWhitespaceOrReplacementCharacter(ch))
  3321. return false;
  3322. }
  3323. return true;
  3324. }
  3325. function getAttribute(node, name) {
  3326. for (var i = 0; i < node.attributes.length; i++) {
  3327. var attribute = node.attributes[i];
  3328. if (attribute.nodeName === name) {
  3329. return attribute;
  3330. }
  3331. }
  3332. return null;
  3333. }
  3334. function CharacterBuffer(characters) {
  3335. this.characters = characters;
  3336. this.current = 0;
  3337. this.end = this.characters.length;
  3338. }
  3339. CharacterBuffer.prototype.skipAtMostOneLeadingNewline = function() {
  3340. if (this.characters[this.current] === '\n')
  3341. this.current++;
  3342. };
  3343. CharacterBuffer.prototype.skipLeadingWhitespace = function() {
  3344. while (isWhitespace(this.characters[this.current])) {
  3345. if (++this.current == this.end)
  3346. return;
  3347. }
  3348. };
  3349. CharacterBuffer.prototype.skipLeadingNonWhitespace = function() {
  3350. while (!isWhitespace(this.characters[this.current])) {
  3351. if (++this.current == this.end)
  3352. return;
  3353. }
  3354. };
  3355. CharacterBuffer.prototype.takeRemaining = function() {
  3356. return this.characters.substring(this.current);
  3357. };
  3358. CharacterBuffer.prototype.takeLeadingWhitespace = function() {
  3359. var start = this.current;
  3360. this.skipLeadingWhitespace();
  3361. if (start === this.current)
  3362. return "";
  3363. return this.characters.substring(start, this.current - start);
  3364. };
  3365. Object.defineProperty(CharacterBuffer.prototype, 'length', {
  3366. get: function(){
  3367. return this.end - this.current;
  3368. }
  3369. });
  3370. function TreeBuilder() {
  3371. this.tokenizer = null;
  3372. this.errorHandler = null;
  3373. this.scriptingEnabled = false;
  3374. this.document = null;
  3375. this.head = null;
  3376. this.form = null;
  3377. this.openElements = new ElementStack();
  3378. this.activeFormattingElements = [];
  3379. this.insertionMode = null;
  3380. this.insertionModeName = "";
  3381. this.originalInsertionMode = "";
  3382. this.inQuirksMode = false; // TODO quirks mode
  3383. this.compatMode = "no quirks";
  3384. this.framesetOk = true;
  3385. this.redirectAttachToFosterParent = false;
  3386. this.selfClosingFlagAcknowledged = false;
  3387. this.context = "";
  3388. this.pendingTableCharacters = [];
  3389. this.shouldSkipLeadingNewline = false;
  3390. var tree = this;
  3391. var modes = this.insertionModes = {};
  3392. modes.base = {
  3393. end_tag_handlers: {"-default": 'endTagOther'},
  3394. start_tag_handlers: {"-default": 'startTagOther'},
  3395. processEOF: function() {
  3396. tree.generateImpliedEndTags();
  3397. if (tree.openElements.length > 2) {
  3398. tree.parseError('expected-closing-tag-but-got-eof');
  3399. } else if (tree.openElements.length == 2 &&
  3400. tree.openElements.item(1).localName != 'body') {
  3401. tree.parseError('expected-closing-tag-but-got-eof');
  3402. } else if (tree.context && tree.openElements.length > 1) {
  3403. }
  3404. },
  3405. processComment: function(data) {
  3406. tree.insertComment(data, tree.currentStackItem().node);
  3407. },
  3408. processDoctype: function(name, publicId, systemId, forceQuirks) {
  3409. tree.parseError('unexpected-doctype');
  3410. },
  3411. processStartTag: function(name, attributes, selfClosing) {
  3412. if (this[this.start_tag_handlers[name]]) {
  3413. this[this.start_tag_handlers[name]](name, attributes, selfClosing);
  3414. } else if (this[this.start_tag_handlers["-default"]]) {
  3415. this[this.start_tag_handlers["-default"]](name, attributes, selfClosing);
  3416. } else {
  3417. throw(new Error("No handler found for "+name));
  3418. }
  3419. },
  3420. processEndTag: function(name) {
  3421. if (this[this.end_tag_handlers[name]]) {
  3422. this[this.end_tag_handlers[name]](name);
  3423. } else if (this[this.end_tag_handlers["-default"]]) {
  3424. this[this.end_tag_handlers["-default"]](name);
  3425. } else {
  3426. throw(new Error("No handler found for "+name));
  3427. }
  3428. },
  3429. startTagHtml: function(name, attributes) {
  3430. modes.inBody.startTagHtml(name, attributes);
  3431. }
  3432. };
  3433. modes.initial = Object.create(modes.base);
  3434. modes.initial.processEOF = function() {
  3435. tree.parseError("expected-doctype-but-got-eof");
  3436. this.anythingElse();
  3437. tree.insertionMode.processEOF();
  3438. };
  3439. modes.initial.processComment = function(data) {
  3440. tree.insertComment(data, tree.document);
  3441. };
  3442. modes.initial.processDoctype = function(name, publicId, systemId, forceQuirks) {
  3443. tree.insertDoctype(name || '', publicId || '', systemId || '');
  3444. if (forceQuirks || name != 'html' || (publicId != null && ([
  3445. "+//silmaril//dtd html pro v0r11 19970101//",
  3446. "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
  3447. "-//as//dtd html 3.0 aswedit + extensions//",
  3448. "-//ietf//dtd html 2.0 level 1//",
  3449. "-//ietf//dtd html 2.0 level 2//",
  3450. "-//ietf//dtd html 2.0 strict level 1//",
  3451. "-//ietf//dtd html 2.0 strict level 2//",
  3452. "-//ietf//dtd html 2.0 strict//",
  3453. "-//ietf//dtd html 2.0//",
  3454. "-//ietf//dtd html 2.1e//",
  3455. "-//ietf//dtd html 3.0//",
  3456. "-//ietf//dtd html 3.0//",
  3457. "-//ietf//dtd html 3.2 final//",
  3458. "-//ietf//dtd html 3.2//",
  3459. "-//ietf//dtd html 3//",
  3460. "-//ietf//dtd html level 0//",
  3461. "-//ietf//dtd html level 0//",
  3462. "-//ietf//dtd html level 1//",
  3463. "-//ietf//dtd html level 1//",
  3464. "-//ietf//dtd html level 2//",
  3465. "-//ietf//dtd html level 2//",
  3466. "-//ietf//dtd html level 3//",
  3467. "-//ietf//dtd html level 3//",
  3468. "-//ietf//dtd html strict level 0//",
  3469. "-//ietf//dtd html strict level 0//",
  3470. "-//ietf//dtd html strict level 1//",
  3471. "-//ietf//dtd html strict level 1//",
  3472. "-//ietf//dtd html strict level 2//",
  3473. "-//ietf//dtd html strict level 2//",
  3474. "-//ietf//dtd html strict level 3//",
  3475. "-//ietf//dtd html strict level 3//",
  3476. "-//ietf//dtd html strict//",
  3477. "-//ietf//dtd html strict//",
  3478. "-//ietf//dtd html strict//",
  3479. "-//ietf//dtd html//",
  3480. "-//ietf//dtd html//",
  3481. "-//ietf//dtd html//",
  3482. "-//metrius//dtd metrius presentational//",
  3483. "-//microsoft//dtd internet explorer 2.0 html strict//",
  3484. "-//microsoft//dtd internet explorer 2.0 html//",
  3485. "-//microsoft//dtd internet explorer 2.0 tables//",
  3486. "-//microsoft//dtd internet explorer 3.0 html strict//",
  3487. "-//microsoft//dtd internet explorer 3.0 html//",
  3488. "-//microsoft//dtd internet explorer 3.0 tables//",
  3489. "-//netscape comm. corp.//dtd html//",
  3490. "-//netscape comm. corp.//dtd strict html//",
  3491. "-//o'reilly and associates//dtd html 2.0//",
  3492. "-//o'reilly and associates//dtd html extended 1.0//",
  3493. "-//spyglass//dtd html 2.0 extended//",
  3494. "-//sq//dtd html 2.0 hotmetal + extensions//",
  3495. "-//sun microsystems corp.//dtd hotjava html//",
  3496. "-//sun microsystems corp.//dtd hotjava strict html//",
  3497. "-//w3c//dtd html 3 1995-03-24//",
  3498. "-//w3c//dtd html 3.2 draft//",
  3499. "-//w3c//dtd html 3.2 final//",
  3500. "-//w3c//dtd html 3.2//",
  3501. "-//w3c//dtd html 3.2s draft//",
  3502. "-//w3c//dtd html 4.0 frameset//",
  3503. "-//w3c//dtd html 4.0 transitional//",
  3504. "-//w3c//dtd html experimental 19960712//",
  3505. "-//w3c//dtd html experimental 970421//",
  3506. "-//w3c//dtd w3 html//",
  3507. "-//w3o//dtd w3 html 3.0//",
  3508. "-//webtechs//dtd mozilla html 2.0//",
  3509. "-//webtechs//dtd mozilla html//",
  3510. "html"
  3511. ].some(publicIdStartsWith)
  3512. || [
  3513. "-//w3o//dtd w3 html strict 3.0//en//",
  3514. "-/w3c/dtd html 4.0 transitional/en",
  3515. "html"
  3516. ].indexOf(publicId.toLowerCase()) > -1
  3517. || (systemId == null && [
  3518. "-//w3c//dtd html 4.01 transitional//",
  3519. "-//w3c//dtd html 4.01 frameset//"
  3520. ].some(publicIdStartsWith)))
  3521. )
  3522. || (systemId != null && (systemId.toLowerCase() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"))
  3523. ) {
  3524. tree.compatMode = "quirks";
  3525. tree.parseError("quirky-doctype");
  3526. } else if (publicId != null && ([
  3527. "-//w3c//dtd xhtml 1.0 transitional//",
  3528. "-//w3c//dtd xhtml 1.0 frameset//"
  3529. ].some(publicIdStartsWith)
  3530. || (systemId != null && [
  3531. "-//w3c//dtd html 4.01 transitional//",
  3532. "-//w3c//dtd html 4.01 frameset//"
  3533. ].indexOf(publicId.toLowerCase()) > -1))
  3534. ) {
  3535. tree.compatMode = "limited quirks";
  3536. tree.parseError("almost-standards-doctype");
  3537. } else {
  3538. if ((publicId == "-//W3C//DTD HTML 4.0//EN" && (systemId == null || systemId == "http://www.w3.org/TR/REC-html40/strict.dtd"))
  3539. || (publicId == "-//W3C//DTD HTML 4.01//EN" && (systemId == null || systemId == "http://www.w3.org/TR/html4/strict.dtd"))
  3540. || (publicId == "-//W3C//DTD XHTML 1.0 Strict//EN" && (systemId == "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"))
  3541. || (publicId == "-//W3C//DTD XHTML 1.1//EN" && (systemId == "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"))
  3542. ) {
  3543. } else if (!((systemId == null || systemId == "about:legacy-compat") && publicId == null)) {
  3544. tree.parseError("unknown-doctype");
  3545. }
  3546. }
  3547. tree.setInsertionMode('beforeHTML');
  3548. function publicIdStartsWith(string) {
  3549. return publicId.toLowerCase().indexOf(string) === 0;
  3550. }
  3551. };
  3552. modes.initial.processCharacters = function(buffer) {
  3553. buffer.skipLeadingWhitespace();
  3554. if (!buffer.length)
  3555. return;
  3556. tree.parseError('expected-doctype-but-got-chars');
  3557. this.anythingElse();
  3558. tree.insertionMode.processCharacters(buffer);
  3559. };
  3560. modes.initial.processStartTag = function(name, attributes, selfClosing) {
  3561. tree.parseError('expected-doctype-but-got-start-tag', {name: name});
  3562. this.anythingElse();
  3563. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3564. };
  3565. modes.initial.processEndTag = function(name) {
  3566. tree.parseError('expected-doctype-but-got-end-tag', {name: name});
  3567. this.anythingElse();
  3568. tree.insertionMode.processEndTag(name);
  3569. };
  3570. modes.initial.anythingElse = function() {
  3571. tree.compatMode = 'quirks';
  3572. tree.setInsertionMode('beforeHTML');
  3573. };
  3574. modes.beforeHTML = Object.create(modes.base);
  3575. modes.beforeHTML.start_tag_handlers = {
  3576. html: 'startTagHtml',
  3577. '-default': 'startTagOther'
  3578. };
  3579. modes.beforeHTML.processEOF = function() {
  3580. this.anythingElse();
  3581. tree.insertionMode.processEOF();
  3582. };
  3583. modes.beforeHTML.processComment = function(data) {
  3584. tree.insertComment(data, tree.document);
  3585. };
  3586. modes.beforeHTML.processCharacters = function(buffer) {
  3587. buffer.skipLeadingWhitespace();
  3588. if (!buffer.length)
  3589. return;
  3590. this.anythingElse();
  3591. tree.insertionMode.processCharacters(buffer);
  3592. };
  3593. modes.beforeHTML.startTagHtml = function(name, attributes, selfClosing) {
  3594. tree.insertHtmlElement(attributes);
  3595. tree.setInsertionMode('beforeHead');
  3596. };
  3597. modes.beforeHTML.startTagOther = function(name, attributes, selfClosing) {
  3598. this.anythingElse();
  3599. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3600. };
  3601. modes.beforeHTML.processEndTag = function(name) {
  3602. this.anythingElse();
  3603. tree.insertionMode.processEndTag(name);
  3604. };
  3605. modes.beforeHTML.anythingElse = function() {
  3606. tree.insertHtmlElement();
  3607. tree.setInsertionMode('beforeHead');
  3608. };
  3609. modes.afterAfterBody = Object.create(modes.base);
  3610. modes.afterAfterBody.start_tag_handlers = {
  3611. html: 'startTagHtml',
  3612. '-default': 'startTagOther'
  3613. };
  3614. modes.afterAfterBody.processComment = function(data) {
  3615. tree.insertComment(data, tree.document);
  3616. };
  3617. modes.afterAfterBody.processDoctype = function(data) {
  3618. modes.inBody.processDoctype(data);
  3619. };
  3620. modes.afterAfterBody.startTagHtml = function(data, attributes) {
  3621. modes.inBody.startTagHtml(data, attributes);
  3622. };
  3623. modes.afterAfterBody.startTagOther = function(name, attributes, selfClosing) {
  3624. tree.parseError('unexpected-start-tag', {name: name});
  3625. tree.setInsertionMode('inBody');
  3626. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3627. };
  3628. modes.afterAfterBody.endTagOther = function(name) {
  3629. tree.parseError('unexpected-end-tag', {name: name});
  3630. tree.setInsertionMode('inBody');
  3631. tree.insertionMode.processEndTag(name);
  3632. };
  3633. modes.afterAfterBody.processCharacters = function(data) {
  3634. if (!isAllWhitespace(data.characters)) {
  3635. tree.parseError('unexpected-char-after-body');
  3636. tree.setInsertionMode('inBody');
  3637. return tree.insertionMode.processCharacters(data);
  3638. }
  3639. modes.inBody.processCharacters(data);
  3640. };
  3641. modes.afterBody = Object.create(modes.base);
  3642. modes.afterBody.end_tag_handlers = {
  3643. html: 'endTagHtml',
  3644. '-default': 'endTagOther'
  3645. };
  3646. modes.afterBody.processComment = function(data) {
  3647. tree.insertComment(data, tree.openElements.rootNode);
  3648. };
  3649. modes.afterBody.processCharacters = function(data) {
  3650. if (!isAllWhitespace(data.characters)) {
  3651. tree.parseError('unexpected-char-after-body');
  3652. tree.setInsertionMode('inBody');
  3653. return tree.insertionMode.processCharacters(data);
  3654. }
  3655. modes.inBody.processCharacters(data);
  3656. };
  3657. modes.afterBody.processStartTag = function(name, attributes, selfClosing) {
  3658. tree.parseError('unexpected-start-tag-after-body', {name: name});
  3659. tree.setInsertionMode('inBody');
  3660. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3661. };
  3662. modes.afterBody.endTagHtml = function(name) {
  3663. if (tree.context) {
  3664. tree.parseError('end-html-in-innerhtml');
  3665. } else {
  3666. tree.setInsertionMode('afterAfterBody');
  3667. }
  3668. };
  3669. modes.afterBody.endTagOther = function(name) {
  3670. tree.parseError('unexpected-end-tag-after-body', {name: name});
  3671. tree.setInsertionMode('inBody');
  3672. tree.insertionMode.processEndTag(name);
  3673. };
  3674. modes.afterFrameset = Object.create(modes.base);
  3675. modes.afterFrameset.start_tag_handlers = {
  3676. html: 'startTagHtml',
  3677. noframes: 'startTagNoframes',
  3678. '-default': 'startTagOther'
  3679. };
  3680. modes.afterFrameset.end_tag_handlers = {
  3681. html: 'endTagHtml',
  3682. '-default': 'endTagOther'
  3683. };
  3684. modes.afterFrameset.processCharacters = function(buffer) {
  3685. var characters = buffer.takeRemaining();
  3686. var whitespace = "";
  3687. for (var i = 0; i < characters.length; i++) {
  3688. var ch = characters[i];
  3689. if (isWhitespace(ch))
  3690. whitespace += ch;
  3691. }
  3692. if (whitespace) {
  3693. tree.insertText(whitespace);
  3694. }
  3695. if (whitespace.length < characters.length)
  3696. tree.parseError('expected-eof-but-got-char');
  3697. };
  3698. modes.afterFrameset.startTagNoframes = function(name, attributes) {
  3699. modes.inHead.processStartTag(name, attributes);
  3700. };
  3701. modes.afterFrameset.startTagOther = function(name, attributes) {
  3702. tree.parseError("unexpected-start-tag-after-frameset", {name: name});
  3703. };
  3704. modes.afterFrameset.endTagHtml = function(name) {
  3705. tree.setInsertionMode('afterAfterFrameset');
  3706. };
  3707. modes.afterFrameset.endTagOther = function(name) {
  3708. tree.parseError("unexpected-end-tag-after-frameset", {name: name});
  3709. };
  3710. modes.beforeHead = Object.create(modes.base);
  3711. modes.beforeHead.start_tag_handlers = {
  3712. html: 'startTagHtml',
  3713. head: 'startTagHead',
  3714. '-default': 'startTagOther'
  3715. };
  3716. modes.beforeHead.end_tag_handlers = {
  3717. html: 'endTagImplyHead',
  3718. head: 'endTagImplyHead',
  3719. body: 'endTagImplyHead',
  3720. br: 'endTagImplyHead',
  3721. '-default': 'endTagOther'
  3722. };
  3723. modes.beforeHead.processEOF = function() {
  3724. this.startTagHead('head', []);
  3725. tree.insertionMode.processEOF();
  3726. };
  3727. modes.beforeHead.processCharacters = function(buffer) {
  3728. buffer.skipLeadingWhitespace();
  3729. if (!buffer.length)
  3730. return;
  3731. this.startTagHead('head', []);
  3732. tree.insertionMode.processCharacters(buffer);
  3733. };
  3734. modes.beforeHead.startTagHead = function(name, attributes) {
  3735. tree.insertHeadElement(attributes);
  3736. tree.setInsertionMode('inHead');
  3737. };
  3738. modes.beforeHead.startTagOther = function(name, attributes, selfClosing) {
  3739. this.startTagHead('head', []);
  3740. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3741. };
  3742. modes.beforeHead.endTagImplyHead = function(name) {
  3743. this.startTagHead('head', []);
  3744. tree.insertionMode.processEndTag(name);
  3745. };
  3746. modes.beforeHead.endTagOther = function(name) {
  3747. tree.parseError('end-tag-after-implied-root', {name: name});
  3748. };
  3749. modes.inHead = Object.create(modes.base);
  3750. modes.inHead.start_tag_handlers = {
  3751. html: 'startTagHtml',
  3752. head: 'startTagHead',
  3753. title: 'startTagTitle',
  3754. script: 'startTagScript',
  3755. style: 'startTagNoFramesStyle',
  3756. noscript: 'startTagNoScript',
  3757. noframes: 'startTagNoFramesStyle',
  3758. base: 'startTagBaseBasefontBgsoundLink',
  3759. basefont: 'startTagBaseBasefontBgsoundLink',
  3760. bgsound: 'startTagBaseBasefontBgsoundLink',
  3761. link: 'startTagBaseBasefontBgsoundLink',
  3762. meta: 'startTagMeta',
  3763. "-default": 'startTagOther'
  3764. };
  3765. modes.inHead.end_tag_handlers = {
  3766. head: 'endTagHead',
  3767. html: 'endTagHtmlBodyBr',
  3768. body: 'endTagHtmlBodyBr',
  3769. br: 'endTagHtmlBodyBr',
  3770. "-default": 'endTagOther'
  3771. };
  3772. modes.inHead.processEOF = function() {
  3773. var name = tree.currentStackItem().localName;
  3774. if (['title', 'style', 'script'].indexOf(name) != -1) {
  3775. tree.parseError("expected-named-closing-tag-but-got-eof", {name: name});
  3776. tree.popElement();
  3777. }
  3778. this.anythingElse();
  3779. tree.insertionMode.processEOF();
  3780. };
  3781. modes.inHead.processCharacters = function(buffer) {
  3782. var leadingWhitespace = buffer.takeLeadingWhitespace();
  3783. if (leadingWhitespace)
  3784. tree.insertText(leadingWhitespace);
  3785. if (!buffer.length)
  3786. return;
  3787. this.anythingElse();
  3788. tree.insertionMode.processCharacters(buffer);
  3789. };
  3790. modes.inHead.startTagHtml = function(name, attributes) {
  3791. modes.inBody.processStartTag(name, attributes);
  3792. };
  3793. modes.inHead.startTagHead = function(name, attributes) {
  3794. tree.parseError('two-heads-are-not-better-than-one');
  3795. };
  3796. modes.inHead.startTagTitle = function(name, attributes) {
  3797. tree.processGenericRCDATAStartTag(name, attributes);
  3798. };
  3799. modes.inHead.startTagNoScript = function(name, attributes) {
  3800. if (tree.scriptingEnabled)
  3801. return tree.processGenericRawTextStartTag(name, attributes);
  3802. tree.insertElement(name, attributes);
  3803. tree.setInsertionMode('inHeadNoscript');
  3804. };
  3805. modes.inHead.startTagNoFramesStyle = function(name, attributes) {
  3806. tree.processGenericRawTextStartTag(name, attributes);
  3807. };
  3808. modes.inHead.startTagScript = function(name, attributes) {
  3809. tree.insertElement(name, attributes);
  3810. tree.tokenizer.setState(Tokenizer.SCRIPT_DATA);
  3811. tree.originalInsertionMode = tree.insertionModeName;
  3812. tree.setInsertionMode('text');
  3813. };
  3814. modes.inHead.startTagBaseBasefontBgsoundLink = function(name, attributes) {
  3815. tree.insertSelfClosingElement(name, attributes);
  3816. };
  3817. modes.inHead.startTagMeta = function(name, attributes) {
  3818. tree.insertSelfClosingElement(name, attributes);
  3819. };
  3820. modes.inHead.startTagOther = function(name, attributes, selfClosing) {
  3821. this.anythingElse();
  3822. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3823. };
  3824. modes.inHead.endTagHead = function(name) {
  3825. if (tree.openElements.item(tree.openElements.length - 1).localName == 'head') {
  3826. tree.openElements.pop();
  3827. } else {
  3828. tree.parseError('unexpected-end-tag', {name: 'head'});
  3829. }
  3830. tree.setInsertionMode('afterHead');
  3831. };
  3832. modes.inHead.endTagHtmlBodyBr = function(name) {
  3833. this.anythingElse();
  3834. tree.insertionMode.processEndTag(name);
  3835. };
  3836. modes.inHead.endTagOther = function(name) {
  3837. tree.parseError('unexpected-end-tag', {name: name});
  3838. };
  3839. modes.inHead.anythingElse = function() {
  3840. this.endTagHead('head');
  3841. };
  3842. modes.afterHead = Object.create(modes.base);
  3843. modes.afterHead.start_tag_handlers = {
  3844. html: 'startTagHtml',
  3845. head: 'startTagHead',
  3846. body: 'startTagBody',
  3847. frameset: 'startTagFrameset',
  3848. base: 'startTagFromHead',
  3849. link: 'startTagFromHead',
  3850. meta: 'startTagFromHead',
  3851. script: 'startTagFromHead',
  3852. style: 'startTagFromHead',
  3853. title: 'startTagFromHead',
  3854. "-default": 'startTagOther'
  3855. };
  3856. modes.afterHead.end_tag_handlers = {
  3857. body: 'endTagBodyHtmlBr',
  3858. html: 'endTagBodyHtmlBr',
  3859. br: 'endTagBodyHtmlBr',
  3860. "-default": 'endTagOther'
  3861. };
  3862. modes.afterHead.processEOF = function() {
  3863. this.anythingElse();
  3864. tree.insertionMode.processEOF();
  3865. };
  3866. modes.afterHead.processCharacters = function(buffer) {
  3867. var leadingWhitespace = buffer.takeLeadingWhitespace();
  3868. if (leadingWhitespace)
  3869. tree.insertText(leadingWhitespace);
  3870. if (!buffer.length)
  3871. return;
  3872. this.anythingElse();
  3873. tree.insertionMode.processCharacters(buffer);
  3874. };
  3875. modes.afterHead.startTagHtml = function(name, attributes) {
  3876. modes.inBody.processStartTag(name, attributes);
  3877. };
  3878. modes.afterHead.startTagBody = function(name, attributes) {
  3879. tree.framesetOk = false;
  3880. tree.insertBodyElement(attributes);
  3881. tree.setInsertionMode('inBody');
  3882. };
  3883. modes.afterHead.startTagFrameset = function(name, attributes) {
  3884. tree.insertElement(name, attributes);
  3885. tree.setInsertionMode('inFrameset');
  3886. };
  3887. modes.afterHead.startTagFromHead = function(name, attributes, selfClosing) {
  3888. tree.parseError("unexpected-start-tag-out-of-my-head", {name: name});
  3889. tree.openElements.push(tree.head);
  3890. modes.inHead.processStartTag(name, attributes, selfClosing);
  3891. tree.openElements.remove(tree.head);
  3892. };
  3893. modes.afterHead.startTagHead = function(name, attributes, selfClosing) {
  3894. tree.parseError('unexpected-start-tag', {name: name});
  3895. };
  3896. modes.afterHead.startTagOther = function(name, attributes, selfClosing) {
  3897. this.anythingElse();
  3898. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3899. };
  3900. modes.afterHead.endTagBodyHtmlBr = function(name) {
  3901. this.anythingElse();
  3902. tree.insertionMode.processEndTag(name);
  3903. };
  3904. modes.afterHead.endTagOther = function(name) {
  3905. tree.parseError('unexpected-end-tag', {name: name});
  3906. };
  3907. modes.afterHead.anythingElse = function() {
  3908. tree.insertBodyElement([]);
  3909. tree.setInsertionMode('inBody');
  3910. tree.framesetOk = true;
  3911. }
  3912. modes.inBody = Object.create(modes.base);
  3913. modes.inBody.start_tag_handlers = {
  3914. html: 'startTagHtml',
  3915. head: 'startTagMisplaced',
  3916. base: 'startTagProcessInHead',
  3917. basefont: 'startTagProcessInHead',
  3918. bgsound: 'startTagProcessInHead',
  3919. link: 'startTagProcessInHead',
  3920. meta: 'startTagProcessInHead',
  3921. noframes: 'startTagProcessInHead',
  3922. script: 'startTagProcessInHead',
  3923. style: 'startTagProcessInHead',
  3924. title: 'startTagProcessInHead',
  3925. body: 'startTagBody',
  3926. form: 'startTagForm',
  3927. plaintext: 'startTagPlaintext',
  3928. a: 'startTagA',
  3929. button: 'startTagButton',
  3930. xmp: 'startTagXmp',
  3931. table: 'startTagTable',
  3932. hr: 'startTagHr',
  3933. image: 'startTagImage',
  3934. input: 'startTagInput',
  3935. textarea: 'startTagTextarea',
  3936. select: 'startTagSelect',
  3937. isindex: 'startTagIsindex',
  3938. applet: 'startTagAppletMarqueeObject',
  3939. marquee: 'startTagAppletMarqueeObject',
  3940. object: 'startTagAppletMarqueeObject',
  3941. li: 'startTagListItem',
  3942. dd: 'startTagListItem',
  3943. dt: 'startTagListItem',
  3944. address: 'startTagCloseP',
  3945. article: 'startTagCloseP',
  3946. aside: 'startTagCloseP',
  3947. blockquote: 'startTagCloseP',
  3948. center: 'startTagCloseP',
  3949. details: 'startTagCloseP',
  3950. dir: 'startTagCloseP',
  3951. div: 'startTagCloseP',
  3952. dl: 'startTagCloseP',
  3953. fieldset: 'startTagCloseP',
  3954. figcaption: 'startTagCloseP',
  3955. figure: 'startTagCloseP',
  3956. footer: 'startTagCloseP',
  3957. header: 'startTagCloseP',
  3958. hgroup: 'startTagCloseP',
  3959. main: 'startTagCloseP',
  3960. menu: 'startTagCloseP',
  3961. nav: 'startTagCloseP',
  3962. ol: 'startTagCloseP',
  3963. p: 'startTagCloseP',
  3964. section: 'startTagCloseP',
  3965. summary: 'startTagCloseP',
  3966. ul: 'startTagCloseP',
  3967. listing: 'startTagPreListing',
  3968. pre: 'startTagPreListing',
  3969. b: 'startTagFormatting',
  3970. big: 'startTagFormatting',
  3971. code: 'startTagFormatting',
  3972. em: 'startTagFormatting',
  3973. font: 'startTagFormatting',
  3974. i: 'startTagFormatting',
  3975. s: 'startTagFormatting',
  3976. small: 'startTagFormatting',
  3977. strike: 'startTagFormatting',
  3978. strong: 'startTagFormatting',
  3979. tt: 'startTagFormatting',
  3980. u: 'startTagFormatting',
  3981. nobr: 'startTagNobr',
  3982. area: 'startTagVoidFormatting',
  3983. br: 'startTagVoidFormatting',
  3984. embed: 'startTagVoidFormatting',
  3985. img: 'startTagVoidFormatting',
  3986. keygen: 'startTagVoidFormatting',
  3987. wbr: 'startTagVoidFormatting',
  3988. param: 'startTagParamSourceTrack',
  3989. source: 'startTagParamSourceTrack',
  3990. track: 'startTagParamSourceTrack',
  3991. iframe: 'startTagIFrame',
  3992. noembed: 'startTagRawText',
  3993. noscript: 'startTagRawText',
  3994. h1: 'startTagHeading',
  3995. h2: 'startTagHeading',
  3996. h3: 'startTagHeading',
  3997. h4: 'startTagHeading',
  3998. h5: 'startTagHeading',
  3999. h6: 'startTagHeading',
  4000. caption: 'startTagMisplaced',
  4001. col: 'startTagMisplaced',
  4002. colgroup: 'startTagMisplaced',
  4003. frame: 'startTagMisplaced',
  4004. frameset: 'startTagFrameset',
  4005. tbody: 'startTagMisplaced',
  4006. td: 'startTagMisplaced',
  4007. tfoot: 'startTagMisplaced',
  4008. th: 'startTagMisplaced',
  4009. thead: 'startTagMisplaced',
  4010. tr: 'startTagMisplaced',
  4011. option: 'startTagOptionOptgroup',
  4012. optgroup: 'startTagOptionOptgroup',
  4013. math: 'startTagMath',
  4014. svg: 'startTagSVG',
  4015. rt: 'startTagRpRt',
  4016. rp: 'startTagRpRt',
  4017. "-default": 'startTagOther'
  4018. };
  4019. modes.inBody.end_tag_handlers = {
  4020. p: 'endTagP',
  4021. body: 'endTagBody',
  4022. html: 'endTagHtml',
  4023. address: 'endTagBlock',
  4024. article: 'endTagBlock',
  4025. aside: 'endTagBlock',
  4026. blockquote: 'endTagBlock',
  4027. button: 'endTagBlock',
  4028. center: 'endTagBlock',
  4029. details: 'endTagBlock',
  4030. dir: 'endTagBlock',
  4031. div: 'endTagBlock',
  4032. dl: 'endTagBlock',
  4033. fieldset: 'endTagBlock',
  4034. figcaption: 'endTagBlock',
  4035. figure: 'endTagBlock',
  4036. footer: 'endTagBlock',
  4037. header: 'endTagBlock',
  4038. hgroup: 'endTagBlock',
  4039. listing: 'endTagBlock',
  4040. main: 'endTagBlock',
  4041. menu: 'endTagBlock',
  4042. nav: 'endTagBlock',
  4043. ol: 'endTagBlock',
  4044. pre: 'endTagBlock',
  4045. section: 'endTagBlock',
  4046. summary: 'endTagBlock',
  4047. ul: 'endTagBlock',
  4048. form: 'endTagForm',
  4049. applet: 'endTagAppletMarqueeObject',
  4050. marquee: 'endTagAppletMarqueeObject',
  4051. object: 'endTagAppletMarqueeObject',
  4052. dd: 'endTagListItem',
  4053. dt: 'endTagListItem',
  4054. li: 'endTagListItem',
  4055. h1: 'endTagHeading',
  4056. h2: 'endTagHeading',
  4057. h3: 'endTagHeading',
  4058. h4: 'endTagHeading',
  4059. h5: 'endTagHeading',
  4060. h6: 'endTagHeading',
  4061. a: 'endTagFormatting',
  4062. b: 'endTagFormatting',
  4063. big: 'endTagFormatting',
  4064. code: 'endTagFormatting',
  4065. em: 'endTagFormatting',
  4066. font: 'endTagFormatting',
  4067. i: 'endTagFormatting',
  4068. nobr: 'endTagFormatting',
  4069. s: 'endTagFormatting',
  4070. small: 'endTagFormatting',
  4071. strike: 'endTagFormatting',
  4072. strong: 'endTagFormatting',
  4073. tt: 'endTagFormatting',
  4074. u: 'endTagFormatting',
  4075. br: 'endTagBr',
  4076. "-default": 'endTagOther'
  4077. };
  4078. modes.inBody.processCharacters = function(buffer) {
  4079. if (tree.shouldSkipLeadingNewline) {
  4080. tree.shouldSkipLeadingNewline = false;
  4081. buffer.skipAtMostOneLeadingNewline();
  4082. }
  4083. tree.reconstructActiveFormattingElements();
  4084. var characters = buffer.takeRemaining();
  4085. characters = characters.replace(/\u0000/g, function(match, index){
  4086. tree.parseError("invalid-codepoint");
  4087. return '';
  4088. });
  4089. if (!characters)
  4090. return;
  4091. tree.insertText(characters);
  4092. if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
  4093. tree.framesetOk = false;
  4094. };
  4095. modes.inBody.startTagHtml = function(name, attributes) {
  4096. tree.parseError('non-html-root');
  4097. tree.addAttributesToElement(tree.openElements.rootNode, attributes);
  4098. };
  4099. modes.inBody.startTagProcessInHead = function(name, attributes) {
  4100. modes.inHead.processStartTag(name, attributes);
  4101. };
  4102. modes.inBody.startTagBody = function(name, attributes) {
  4103. tree.parseError('unexpected-start-tag', {name: 'body'});
  4104. if (tree.openElements.length == 1 ||
  4105. tree.openElements.item(1).localName != 'body') {
  4106. assert.ok(tree.context);
  4107. } else {
  4108. tree.framesetOk = false;
  4109. tree.addAttributesToElement(tree.openElements.bodyElement, attributes);
  4110. }
  4111. };
  4112. modes.inBody.startTagFrameset = function(name, attributes) {
  4113. tree.parseError('unexpected-start-tag', {name: 'frameset'});
  4114. if (tree.openElements.length == 1 ||
  4115. tree.openElements.item(1).localName != 'body') {
  4116. assert.ok(tree.context);
  4117. } else if (tree.framesetOk) {
  4118. tree.detachFromParent(tree.openElements.bodyElement);
  4119. while (tree.openElements.length > 1)
  4120. tree.openElements.pop();
  4121. tree.insertElement(name, attributes);
  4122. tree.setInsertionMode('inFrameset');
  4123. }
  4124. };
  4125. modes.inBody.startTagCloseP = function(name, attributes) {
  4126. if (tree.openElements.inButtonScope('p'))
  4127. this.endTagP('p');
  4128. tree.insertElement(name, attributes);
  4129. };
  4130. modes.inBody.startTagPreListing = function(name, attributes) {
  4131. if (tree.openElements.inButtonScope('p'))
  4132. this.endTagP('p');
  4133. tree.insertElement(name, attributes);
  4134. tree.framesetOk = false;
  4135. tree.shouldSkipLeadingNewline = true;
  4136. };
  4137. modes.inBody.startTagForm = function(name, attributes) {
  4138. if (tree.form) {
  4139. tree.parseError('unexpected-start-tag', {name: name});
  4140. } else {
  4141. if (tree.openElements.inButtonScope('p'))
  4142. this.endTagP('p');
  4143. tree.insertElement(name, attributes);
  4144. tree.form = tree.currentStackItem();
  4145. }
  4146. };
  4147. modes.inBody.startTagRpRt = function(name, attributes) {
  4148. if (tree.openElements.inScope('ruby')) {
  4149. tree.generateImpliedEndTags();
  4150. if (tree.currentStackItem().localName != 'ruby') {
  4151. tree.parseError('unexpected-start-tag', {name: name});
  4152. }
  4153. }
  4154. tree.insertElement(name, attributes);
  4155. };
  4156. modes.inBody.startTagListItem = function(name, attributes) {
  4157. var stopNames = {li: ['li'], dd: ['dd', 'dt'], dt: ['dd', 'dt']};
  4158. var stopName = stopNames[name];
  4159. var els = tree.openElements;
  4160. for (var i = els.length - 1; i >= 0; i--) {
  4161. var node = els.item(i);
  4162. if (stopName.indexOf(node.localName) != -1) {
  4163. tree.insertionMode.processEndTag(node.localName);
  4164. break;
  4165. }
  4166. if (node.isSpecial() && node.localName !== 'p' && node.localName !== 'address' && node.localName !== 'div')
  4167. break;
  4168. }
  4169. if (tree.openElements.inButtonScope('p'))
  4170. this.endTagP('p');
  4171. tree.insertElement(name, attributes);
  4172. tree.framesetOk = false;
  4173. };
  4174. modes.inBody.startTagPlaintext = function(name, attributes) {
  4175. if (tree.openElements.inButtonScope('p'))
  4176. this.endTagP('p');
  4177. tree.insertElement(name, attributes);
  4178. tree.tokenizer.setState(Tokenizer.PLAINTEXT);
  4179. };
  4180. modes.inBody.startTagHeading = function(name, attributes) {
  4181. if (tree.openElements.inButtonScope('p'))
  4182. this.endTagP('p');
  4183. if (tree.currentStackItem().isNumberedHeader()) {
  4184. tree.parseError('unexpected-start-tag', {name: name});
  4185. tree.popElement();
  4186. }
  4187. tree.insertElement(name, attributes);
  4188. };
  4189. modes.inBody.startTagA = function(name, attributes) {
  4190. var activeA = tree.elementInActiveFormattingElements('a');
  4191. if (activeA) {
  4192. tree.parseError("unexpected-start-tag-implies-end-tag", {startName: "a", endName: "a"});
  4193. tree.adoptionAgencyEndTag('a');
  4194. if (tree.openElements.contains(activeA))
  4195. tree.openElements.remove(activeA);
  4196. tree.removeElementFromActiveFormattingElements(activeA);
  4197. }
  4198. tree.reconstructActiveFormattingElements();
  4199. tree.insertFormattingElement(name, attributes);
  4200. };
  4201. modes.inBody.startTagFormatting = function(name, attributes) {
  4202. tree.reconstructActiveFormattingElements();
  4203. tree.insertFormattingElement(name, attributes);
  4204. };
  4205. modes.inBody.startTagNobr = function(name, attributes) {
  4206. tree.reconstructActiveFormattingElements();
  4207. if (tree.openElements.inScope('nobr')) {
  4208. tree.parseError("unexpected-start-tag-implies-end-tag", {startName: 'nobr', endName: 'nobr'});
  4209. this.processEndTag('nobr');
  4210. tree.reconstructActiveFormattingElements();
  4211. }
  4212. tree.insertFormattingElement(name, attributes);
  4213. };
  4214. modes.inBody.startTagButton = function(name, attributes) {
  4215. if (tree.openElements.inScope('button')) {
  4216. tree.parseError('unexpected-start-tag-implies-end-tag', {startName: 'button', endName: 'button'});
  4217. this.processEndTag('button');
  4218. tree.insertionMode.processStartTag(name, attributes);
  4219. } else {
  4220. tree.framesetOk = false;
  4221. tree.reconstructActiveFormattingElements();
  4222. tree.insertElement(name, attributes);
  4223. }
  4224. };
  4225. modes.inBody.startTagAppletMarqueeObject = function(name, attributes) {
  4226. tree.reconstructActiveFormattingElements();
  4227. tree.insertElement(name, attributes);
  4228. tree.activeFormattingElements.push(Marker);
  4229. tree.framesetOk = false;
  4230. };
  4231. modes.inBody.endTagAppletMarqueeObject = function(name) {
  4232. if (!tree.openElements.inScope(name)) {
  4233. tree.parseError("unexpected-end-tag", {name: name});
  4234. } else {
  4235. tree.generateImpliedEndTags();
  4236. if (tree.currentStackItem().localName != name) {
  4237. tree.parseError('end-tag-too-early', {name: name});
  4238. }
  4239. tree.openElements.popUntilPopped(name);
  4240. tree.clearActiveFormattingElements();
  4241. }
  4242. };
  4243. modes.inBody.startTagXmp = function(name, attributes) {
  4244. if (tree.openElements.inButtonScope('p'))
  4245. this.processEndTag('p');
  4246. tree.reconstructActiveFormattingElements();
  4247. tree.processGenericRawTextStartTag(name, attributes);
  4248. tree.framesetOk = false;
  4249. };
  4250. modes.inBody.startTagTable = function(name, attributes) {
  4251. if (tree.compatMode !== "quirks")
  4252. if (tree.openElements.inButtonScope('p'))
  4253. this.processEndTag('p');
  4254. tree.insertElement(name, attributes);
  4255. tree.setInsertionMode('inTable');
  4256. tree.framesetOk = false;
  4257. };
  4258. modes.inBody.startTagVoidFormatting = function(name, attributes) {
  4259. tree.reconstructActiveFormattingElements();
  4260. tree.insertSelfClosingElement(name, attributes);
  4261. tree.framesetOk = false;
  4262. };
  4263. modes.inBody.startTagParamSourceTrack = function(name, attributes) {
  4264. tree.insertSelfClosingElement(name, attributes);
  4265. };
  4266. modes.inBody.startTagHr = function(name, attributes) {
  4267. if (tree.openElements.inButtonScope('p'))
  4268. this.endTagP('p');
  4269. tree.insertSelfClosingElement(name, attributes);
  4270. tree.framesetOk = false;
  4271. };
  4272. modes.inBody.startTagImage = function(name, attributes) {
  4273. tree.parseError('unexpected-start-tag-treated-as', {originalName: 'image', newName: 'img'});
  4274. this.processStartTag('img', attributes);
  4275. };
  4276. modes.inBody.startTagInput = function(name, attributes) {
  4277. var currentFramesetOk = tree.framesetOk;
  4278. this.startTagVoidFormatting(name, attributes);
  4279. for (var key in attributes) {
  4280. if (attributes[key].nodeName == 'type') {
  4281. if (attributes[key].nodeValue.toLowerCase() == 'hidden')
  4282. tree.framesetOk = currentFramesetOk;
  4283. break;
  4284. }
  4285. }
  4286. };
  4287. modes.inBody.startTagIsindex = function(name, attributes) {
  4288. tree.parseError('deprecated-tag', {name: 'isindex'});
  4289. tree.selfClosingFlagAcknowledged = true;
  4290. if (tree.form)
  4291. return;
  4292. var formAttributes = [];
  4293. var inputAttributes = [];
  4294. var prompt = "This is a searchable index. Enter search keywords: ";
  4295. for (var key in attributes) {
  4296. switch (attributes[key].nodeName) {
  4297. case 'action':
  4298. formAttributes.push({nodeName: 'action',
  4299. nodeValue: attributes[key].nodeValue});
  4300. break;
  4301. case 'prompt':
  4302. prompt = attributes[key].nodeValue;
  4303. break;
  4304. case 'name':
  4305. break;
  4306. default:
  4307. inputAttributes.push({nodeName: attributes[key].nodeName,
  4308. nodeValue: attributes[key].nodeValue});
  4309. }
  4310. }
  4311. inputAttributes.push({nodeName: 'name', nodeValue: 'isindex'});
  4312. this.processStartTag('form', formAttributes);
  4313. this.processStartTag('hr');
  4314. this.processStartTag('label');
  4315. this.processCharacters(new CharacterBuffer(prompt));
  4316. this.processStartTag('input', inputAttributes);
  4317. this.processEndTag('label');
  4318. this.processStartTag('hr');
  4319. this.processEndTag('form');
  4320. };
  4321. modes.inBody.startTagTextarea = function(name, attributes) {
  4322. tree.insertElement(name, attributes);
  4323. tree.tokenizer.setState(Tokenizer.RCDATA);
  4324. tree.originalInsertionMode = tree.insertionModeName;
  4325. tree.shouldSkipLeadingNewline = true;
  4326. tree.framesetOk = false;
  4327. tree.setInsertionMode('text');
  4328. };
  4329. modes.inBody.startTagIFrame = function(name, attributes) {
  4330. tree.framesetOk = false;
  4331. this.startTagRawText(name, attributes);
  4332. };
  4333. modes.inBody.startTagRawText = function(name, attributes) {
  4334. tree.processGenericRawTextStartTag(name, attributes);
  4335. };
  4336. modes.inBody.startTagSelect = function(name, attributes) {
  4337. tree.reconstructActiveFormattingElements();
  4338. tree.insertElement(name, attributes);
  4339. tree.framesetOk = false;
  4340. var insertionModeName = tree.insertionModeName;
  4341. if (insertionModeName == 'inTable' ||
  4342. insertionModeName == 'inCaption' ||
  4343. insertionModeName == 'inColumnGroup' ||
  4344. insertionModeName == 'inTableBody' ||
  4345. insertionModeName == 'inRow' ||
  4346. insertionModeName == 'inCell') {
  4347. tree.setInsertionMode('inSelectInTable');
  4348. } else {
  4349. tree.setInsertionMode('inSelect');
  4350. }
  4351. };
  4352. modes.inBody.startTagMisplaced = function(name, attributes) {
  4353. tree.parseError('unexpected-start-tag-ignored', {name: name});
  4354. };
  4355. modes.inBody.endTagMisplaced = function(name) {
  4356. tree.parseError("unexpected-end-tag", {name: name});
  4357. };
  4358. modes.inBody.endTagBr = function(name) {
  4359. tree.parseError("unexpected-end-tag-treated-as", {originalName: "br", newName: "br element"});
  4360. tree.reconstructActiveFormattingElements();
  4361. tree.insertElement(name, []);
  4362. tree.popElement();
  4363. };
  4364. modes.inBody.startTagOptionOptgroup = function(name, attributes) {
  4365. if (tree.currentStackItem().localName == 'option')
  4366. tree.popElement();
  4367. tree.reconstructActiveFormattingElements();
  4368. tree.insertElement(name, attributes);
  4369. };
  4370. modes.inBody.startTagOther = function(name, attributes) {
  4371. tree.reconstructActiveFormattingElements();
  4372. tree.insertElement(name, attributes);
  4373. };
  4374. modes.inBody.endTagOther = function(name) {
  4375. var node;
  4376. for (var i = tree.openElements.length - 1; i > 0; i--) {
  4377. node = tree.openElements.item(i);
  4378. if (node.localName == name) {
  4379. tree.generateImpliedEndTags(name);
  4380. if (tree.currentStackItem().localName != name)
  4381. tree.parseError('unexpected-end-tag', {name: name});
  4382. tree.openElements.remove_openElements_until(function(x) {return x === node;});
  4383. break;
  4384. }
  4385. if (node.isSpecial()) {
  4386. tree.parseError('unexpected-end-tag', {name: name});
  4387. break;
  4388. }
  4389. }
  4390. };
  4391. modes.inBody.startTagMath = function(name, attributes, selfClosing) {
  4392. tree.reconstructActiveFormattingElements();
  4393. attributes = tree.adjustMathMLAttributes(attributes);
  4394. attributes = tree.adjustForeignAttributes(attributes);
  4395. tree.insertForeignElement(name, attributes, "http://www.w3.org/1998/Math/MathML", selfClosing);
  4396. };
  4397. modes.inBody.startTagSVG = function(name, attributes, selfClosing) {
  4398. tree.reconstructActiveFormattingElements();
  4399. attributes = tree.adjustSVGAttributes(attributes);
  4400. attributes = tree.adjustForeignAttributes(attributes);
  4401. tree.insertForeignElement(name, attributes, "http://www.w3.org/2000/svg", selfClosing);
  4402. };
  4403. modes.inBody.endTagP = function(name) {
  4404. if (!tree.openElements.inButtonScope('p')) {
  4405. tree.parseError('unexpected-end-tag', {name: 'p'});
  4406. this.startTagCloseP('p', []);
  4407. this.endTagP('p');
  4408. } else {
  4409. tree.generateImpliedEndTags('p');
  4410. if (tree.currentStackItem().localName != 'p')
  4411. tree.parseError('unexpected-implied-end-tag', {name: 'p'});
  4412. tree.openElements.popUntilPopped(name);
  4413. }
  4414. };
  4415. modes.inBody.endTagBody = function(name) {
  4416. if (!tree.openElements.inScope('body')) {
  4417. tree.parseError('unexpected-end-tag', {name: name});
  4418. return;
  4419. }
  4420. if (tree.currentStackItem().localName != 'body') {
  4421. tree.parseError('expected-one-end-tag-but-got-another', {
  4422. expectedName: tree.currentStackItem().localName,
  4423. gotName: name
  4424. });
  4425. }
  4426. tree.setInsertionMode('afterBody');
  4427. };
  4428. modes.inBody.endTagHtml = function(name) {
  4429. if (!tree.openElements.inScope('body')) {
  4430. tree.parseError('unexpected-end-tag', {name: name});
  4431. return;
  4432. }
  4433. if (tree.currentStackItem().localName != 'body') {
  4434. tree.parseError('expected-one-end-tag-but-got-another', {
  4435. expectedName: tree.currentStackItem().localName,
  4436. gotName: name
  4437. });
  4438. }
  4439. tree.setInsertionMode('afterBody');
  4440. tree.insertionMode.processEndTag(name);
  4441. };
  4442. modes.inBody.endTagBlock = function(name) {
  4443. if (!tree.openElements.inScope(name)) {
  4444. tree.parseError('unexpected-end-tag', {name: name});
  4445. } else {
  4446. tree.generateImpliedEndTags();
  4447. if (tree.currentStackItem().localName != name) {
  4448. tree.parseError('end-tag-too-early', {name: name});
  4449. }
  4450. tree.openElements.popUntilPopped(name);
  4451. }
  4452. };
  4453. modes.inBody.endTagForm = function(name) {
  4454. var node = tree.form;
  4455. tree.form = null;
  4456. if (!node || !tree.openElements.inScope(name)) {
  4457. tree.parseError('unexpected-end-tag', {name: name});
  4458. } else {
  4459. tree.generateImpliedEndTags();
  4460. if (tree.currentStackItem() != node) {
  4461. tree.parseError('end-tag-too-early-ignored', {name: 'form'});
  4462. }
  4463. tree.openElements.remove(node);
  4464. }
  4465. };
  4466. modes.inBody.endTagListItem = function(name) {
  4467. if (!tree.openElements.inListItemScope(name)) {
  4468. tree.parseError('unexpected-end-tag', {name: name});
  4469. } else {
  4470. tree.generateImpliedEndTags(name);
  4471. if (tree.currentStackItem().localName != name)
  4472. tree.parseError('end-tag-too-early', {name: name});
  4473. tree.openElements.popUntilPopped(name);
  4474. }
  4475. };
  4476. modes.inBody.endTagHeading = function(name) {
  4477. if (!tree.openElements.hasNumberedHeaderElementInScope()) {
  4478. tree.parseError('unexpected-end-tag', {name: name});
  4479. return;
  4480. }
  4481. tree.generateImpliedEndTags();
  4482. if (tree.currentStackItem().localName != name)
  4483. tree.parseError('end-tag-too-early', {name: name});
  4484. tree.openElements.remove_openElements_until(function(e) {
  4485. return e.isNumberedHeader();
  4486. });
  4487. };
  4488. modes.inBody.endTagFormatting = function(name, attributes) {
  4489. if (!tree.adoptionAgencyEndTag(name))
  4490. this.endTagOther(name, attributes);
  4491. };
  4492. modes.inCaption = Object.create(modes.base);
  4493. modes.inCaption.start_tag_handlers = {
  4494. html: 'startTagHtml',
  4495. caption: 'startTagTableElement',
  4496. col: 'startTagTableElement',
  4497. colgroup: 'startTagTableElement',
  4498. tbody: 'startTagTableElement',
  4499. td: 'startTagTableElement',
  4500. tfoot: 'startTagTableElement',
  4501. thead: 'startTagTableElement',
  4502. tr: 'startTagTableElement',
  4503. '-default': 'startTagOther'
  4504. };
  4505. modes.inCaption.end_tag_handlers = {
  4506. caption: 'endTagCaption',
  4507. table: 'endTagTable',
  4508. body: 'endTagIgnore',
  4509. col: 'endTagIgnore',
  4510. colgroup: 'endTagIgnore',
  4511. html: 'endTagIgnore',
  4512. tbody: 'endTagIgnore',
  4513. td: 'endTagIgnore',
  4514. tfood: 'endTagIgnore',
  4515. thead: 'endTagIgnore',
  4516. tr: 'endTagIgnore',
  4517. '-default': 'endTagOther'
  4518. };
  4519. modes.inCaption.processCharacters = function(data) {
  4520. modes.inBody.processCharacters(data);
  4521. };
  4522. modes.inCaption.startTagTableElement = function(name, attributes) {
  4523. tree.parseError('unexpected-end-tag', {name: name});
  4524. var ignoreEndTag = !tree.openElements.inTableScope('caption');
  4525. tree.insertionMode.processEndTag('caption');
  4526. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes);
  4527. };
  4528. modes.inCaption.startTagOther = function(name, attributes, selfClosing) {
  4529. modes.inBody.processStartTag(name, attributes, selfClosing);
  4530. };
  4531. modes.inCaption.endTagCaption = function(name) {
  4532. if (!tree.openElements.inTableScope('caption')) {
  4533. assert.ok(tree.context);
  4534. tree.parseError('unexpected-end-tag', {name: name});
  4535. } else {
  4536. tree.generateImpliedEndTags();
  4537. if (tree.currentStackItem().localName != 'caption') {
  4538. tree.parseError('expected-one-end-tag-but-got-another', {
  4539. gotName: "caption",
  4540. expectedName: tree.currentStackItem().localName
  4541. });
  4542. }
  4543. tree.openElements.popUntilPopped('caption');
  4544. tree.clearActiveFormattingElements();
  4545. tree.setInsertionMode('inTable');
  4546. }
  4547. };
  4548. modes.inCaption.endTagTable = function(name) {
  4549. tree.parseError("unexpected-end-table-in-caption");
  4550. var ignoreEndTag = !tree.openElements.inTableScope('caption');
  4551. tree.insertionMode.processEndTag('caption');
  4552. if (!ignoreEndTag) tree.insertionMode.processEndTag(name);
  4553. };
  4554. modes.inCaption.endTagIgnore = function(name) {
  4555. tree.parseError('unexpected-end-tag', {name: name});
  4556. };
  4557. modes.inCaption.endTagOther = function(name) {
  4558. modes.inBody.processEndTag(name);
  4559. };
  4560. modes.inCell = Object.create(modes.base);
  4561. modes.inCell.start_tag_handlers = {
  4562. html: 'startTagHtml',
  4563. caption: 'startTagTableOther',
  4564. col: 'startTagTableOther',
  4565. colgroup: 'startTagTableOther',
  4566. tbody: 'startTagTableOther',
  4567. td: 'startTagTableOther',
  4568. tfoot: 'startTagTableOther',
  4569. th: 'startTagTableOther',
  4570. thead: 'startTagTableOther',
  4571. tr: 'startTagTableOther',
  4572. '-default': 'startTagOther'
  4573. };
  4574. modes.inCell.end_tag_handlers = {
  4575. td: 'endTagTableCell',
  4576. th: 'endTagTableCell',
  4577. body: 'endTagIgnore',
  4578. caption: 'endTagIgnore',
  4579. col: 'endTagIgnore',
  4580. colgroup: 'endTagIgnore',
  4581. html: 'endTagIgnore',
  4582. table: 'endTagImply',
  4583. tbody: 'endTagImply',
  4584. tfoot: 'endTagImply',
  4585. thead: 'endTagImply',
  4586. tr: 'endTagImply',
  4587. '-default': 'endTagOther'
  4588. };
  4589. modes.inCell.processCharacters = function(data) {
  4590. modes.inBody.processCharacters(data);
  4591. };
  4592. modes.inCell.startTagTableOther = function(name, attributes, selfClosing) {
  4593. if (tree.openElements.inTableScope('td') || tree.openElements.inTableScope('th')) {
  4594. this.closeCell();
  4595. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4596. } else {
  4597. tree.parseError('unexpected-start-tag', {name: name});
  4598. }
  4599. };
  4600. modes.inCell.startTagOther = function(name, attributes, selfClosing) {
  4601. modes.inBody.processStartTag(name, attributes, selfClosing);
  4602. };
  4603. modes.inCell.endTagTableCell = function(name) {
  4604. if (tree.openElements.inTableScope(name)) {
  4605. tree.generateImpliedEndTags(name);
  4606. if (tree.currentStackItem().localName != name.toLowerCase()) {
  4607. tree.parseError('unexpected-cell-end-tag', {name: name});
  4608. tree.openElements.popUntilPopped(name);
  4609. } else {
  4610. tree.popElement();
  4611. }
  4612. tree.clearActiveFormattingElements();
  4613. tree.setInsertionMode('inRow');
  4614. } else {
  4615. tree.parseError('unexpected-end-tag', {name: name});
  4616. }
  4617. };
  4618. modes.inCell.endTagIgnore = function(name) {
  4619. tree.parseError('unexpected-end-tag', {name: name});
  4620. };
  4621. modes.inCell.endTagImply = function(name) {
  4622. if (tree.openElements.inTableScope(name)) {
  4623. this.closeCell();
  4624. tree.insertionMode.processEndTag(name);
  4625. } else {
  4626. tree.parseError('unexpected-end-tag', {name: name});
  4627. }
  4628. };
  4629. modes.inCell.endTagOther = function(name) {
  4630. modes.inBody.processEndTag(name);
  4631. };
  4632. modes.inCell.closeCell = function() {
  4633. if (tree.openElements.inTableScope('td')) {
  4634. this.endTagTableCell('td');
  4635. } else if (tree.openElements.inTableScope('th')) {
  4636. this.endTagTableCell('th');
  4637. }
  4638. };
  4639. modes.inColumnGroup = Object.create(modes.base);
  4640. modes.inColumnGroup.start_tag_handlers = {
  4641. html: 'startTagHtml',
  4642. col: 'startTagCol',
  4643. '-default': 'startTagOther'
  4644. };
  4645. modes.inColumnGroup.end_tag_handlers = {
  4646. colgroup: 'endTagColgroup',
  4647. col: 'endTagCol',
  4648. '-default': 'endTagOther'
  4649. };
  4650. modes.inColumnGroup.ignoreEndTagColgroup = function() {
  4651. return tree.currentStackItem().localName == 'html';
  4652. };
  4653. modes.inColumnGroup.processCharacters = function(buffer) {
  4654. var leadingWhitespace = buffer.takeLeadingWhitespace();
  4655. if (leadingWhitespace)
  4656. tree.insertText(leadingWhitespace);
  4657. if (!buffer.length)
  4658. return;
  4659. var ignoreEndTag = this.ignoreEndTagColgroup();
  4660. this.endTagColgroup('colgroup');
  4661. if (!ignoreEndTag) tree.insertionMode.processCharacters(buffer);
  4662. };
  4663. modes.inColumnGroup.startTagCol = function(name, attributes) {
  4664. tree.insertSelfClosingElement(name, attributes);
  4665. };
  4666. modes.inColumnGroup.startTagOther = function(name, attributes, selfClosing) {
  4667. var ignoreEndTag = this.ignoreEndTagColgroup();
  4668. this.endTagColgroup('colgroup');
  4669. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4670. };
  4671. modes.inColumnGroup.endTagColgroup = function(name) {
  4672. if (this.ignoreEndTagColgroup()) {
  4673. assert.ok(tree.context);
  4674. tree.parseError('unexpected-end-tag', {name: name});
  4675. } else {
  4676. tree.popElement();
  4677. tree.setInsertionMode('inTable');
  4678. }
  4679. };
  4680. modes.inColumnGroup.endTagCol = function(name) {
  4681. tree.parseError("no-end-tag", {name: 'col'});
  4682. };
  4683. modes.inColumnGroup.endTagOther = function(name) {
  4684. var ignoreEndTag = this.ignoreEndTagColgroup();
  4685. this.endTagColgroup('colgroup');
  4686. if (!ignoreEndTag) tree.insertionMode.processEndTag(name) ;
  4687. };
  4688. modes.inForeignContent = Object.create(modes.base);
  4689. modes.inForeignContent.processStartTag = function(name, attributes, selfClosing) {
  4690. if (['b', 'big', 'blockquote', 'body', 'br', 'center', 'code', 'dd', 'div', 'dl', 'dt', 'em', 'embed', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'i', 'img', 'li', 'listing', 'menu', 'meta', 'nobr', 'ol', 'p', 'pre', 'ruby', 's', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'table', 'tt', 'u', 'ul', 'var'].indexOf(name) != -1
  4691. || (name == 'font' && attributes.some(function(attr){ return ['color', 'face', 'size'].indexOf(attr.nodeName) >= 0 }))) {
  4692. tree.parseError('unexpected-html-element-in-foreign-content', {name: name});
  4693. while (tree.currentStackItem().isForeign()
  4694. && !tree.currentStackItem().isHtmlIntegrationPoint()
  4695. && !tree.currentStackItem().isMathMLTextIntegrationPoint()) {
  4696. tree.openElements.pop();
  4697. }
  4698. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4699. return;
  4700. }
  4701. if (tree.currentStackItem().namespaceURI == "http://www.w3.org/1998/Math/MathML") {
  4702. attributes = tree.adjustMathMLAttributes(attributes);
  4703. }
  4704. if (tree.currentStackItem().namespaceURI == "http://www.w3.org/2000/svg") {
  4705. name = tree.adjustSVGTagNameCase(name);
  4706. attributes = tree.adjustSVGAttributes(attributes);
  4707. }
  4708. attributes = tree.adjustForeignAttributes(attributes);
  4709. tree.insertForeignElement(name, attributes, tree.currentStackItem().namespaceURI, selfClosing);
  4710. };
  4711. modes.inForeignContent.processEndTag = function(name) {
  4712. var node = tree.currentStackItem();
  4713. var index = tree.openElements.length - 1;
  4714. if (node.localName.toLowerCase() != name)
  4715. tree.parseError("unexpected-end-tag", {name: name});
  4716. while (true) {
  4717. if (index === 0)
  4718. break;
  4719. if (node.localName.toLowerCase() == name) {
  4720. while (tree.openElements.pop() != node);
  4721. break;
  4722. }
  4723. index -= 1;
  4724. node = tree.openElements.item(index);
  4725. if (node.isForeign()) {
  4726. continue;
  4727. } else {
  4728. tree.insertionMode.processEndTag(name);
  4729. break;
  4730. }
  4731. }
  4732. };
  4733. modes.inForeignContent.processCharacters = function(buffer) {
  4734. var characters = buffer.takeRemaining();
  4735. characters = characters.replace(/\u0000/g, function(match, index){
  4736. tree.parseError('invalid-codepoint');
  4737. return '\uFFFD';
  4738. });
  4739. if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
  4740. tree.framesetOk = false;
  4741. tree.insertText(characters);
  4742. };
  4743. modes.inHeadNoscript = Object.create(modes.base);
  4744. modes.inHeadNoscript.start_tag_handlers = {
  4745. html: 'startTagHtml',
  4746. basefont: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4747. bgsound: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4748. link: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4749. meta: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4750. noframes: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4751. style: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4752. head: 'startTagHeadNoscript',
  4753. noscript: 'startTagHeadNoscript',
  4754. "-default": 'startTagOther'
  4755. };
  4756. modes.inHeadNoscript.end_tag_handlers = {
  4757. noscript: 'endTagNoscript',
  4758. br: 'endTagBr',
  4759. '-default': 'endTagOther'
  4760. };
  4761. modes.inHeadNoscript.processCharacters = function(buffer) {
  4762. var leadingWhitespace = buffer.takeLeadingWhitespace();
  4763. if (leadingWhitespace)
  4764. tree.insertText(leadingWhitespace);
  4765. if (!buffer.length)
  4766. return;
  4767. tree.parseError("unexpected-char-in-frameset");
  4768. this.anythingElse();
  4769. tree.insertionMode.processCharacters(buffer);
  4770. };
  4771. modes.inHeadNoscript.processComment = function(data) {
  4772. modes.inHead.processComment(data);
  4773. };
  4774. modes.inHeadNoscript.startTagBasefontBgsoundLinkMetaNoframesStyle = function(name, attributes) {
  4775. modes.inHead.processStartTag(name, attributes);
  4776. };
  4777. modes.inHeadNoscript.startTagHeadNoscript = function(name, attributes) {
  4778. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4779. };
  4780. modes.inHeadNoscript.startTagOther = function(name, attributes) {
  4781. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4782. this.anythingElse();
  4783. tree.insertionMode.processStartTag(name, attributes);
  4784. };
  4785. modes.inHeadNoscript.endTagBr = function(name, attributes) {
  4786. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4787. this.anythingElse();
  4788. tree.insertionMode.processEndTag(name, attributes);
  4789. };
  4790. modes.inHeadNoscript.endTagNoscript = function(name, attributes) {
  4791. tree.popElement();
  4792. tree.setInsertionMode('inHead');
  4793. };
  4794. modes.inHeadNoscript.endTagOther = function(name, attributes) {
  4795. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4796. };
  4797. modes.inHeadNoscript.anythingElse = function() {
  4798. tree.popElement();
  4799. tree.setInsertionMode('inHead');
  4800. };
  4801. modes.inFrameset = Object.create(modes.base);
  4802. modes.inFrameset.start_tag_handlers = {
  4803. html: 'startTagHtml',
  4804. frameset: 'startTagFrameset',
  4805. frame: 'startTagFrame',
  4806. noframes: 'startTagNoframes',
  4807. "-default": 'startTagOther'
  4808. };
  4809. modes.inFrameset.end_tag_handlers = {
  4810. frameset: 'endTagFrameset',
  4811. noframes: 'endTagNoframes',
  4812. '-default': 'endTagOther'
  4813. };
  4814. modes.inFrameset.processCharacters = function(data) {
  4815. tree.parseError("unexpected-char-in-frameset");
  4816. };
  4817. modes.inFrameset.startTagFrameset = function(name, attributes) {
  4818. tree.insertElement(name, attributes);
  4819. };
  4820. modes.inFrameset.startTagFrame = function(name, attributes) {
  4821. tree.insertSelfClosingElement(name, attributes);
  4822. };
  4823. modes.inFrameset.startTagNoframes = function(name, attributes) {
  4824. modes.inBody.processStartTag(name, attributes);
  4825. };
  4826. modes.inFrameset.startTagOther = function(name, attributes) {
  4827. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4828. };
  4829. modes.inFrameset.endTagFrameset = function(name, attributes) {
  4830. if (tree.currentStackItem().localName == 'html') {
  4831. tree.parseError("unexpected-frameset-in-frameset-innerhtml");
  4832. } else {
  4833. tree.popElement();
  4834. }
  4835. if (!tree.context && tree.currentStackItem().localName != 'frameset') {
  4836. tree.setInsertionMode('afterFrameset');
  4837. }
  4838. };
  4839. modes.inFrameset.endTagNoframes = function(name) {
  4840. modes.inBody.processEndTag(name);
  4841. };
  4842. modes.inFrameset.endTagOther = function(name) {
  4843. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4844. };
  4845. modes.inTable = Object.create(modes.base);
  4846. modes.inTable.start_tag_handlers = {
  4847. html: 'startTagHtml',
  4848. caption: 'startTagCaption',
  4849. colgroup: 'startTagColgroup',
  4850. col: 'startTagCol',
  4851. table: 'startTagTable',
  4852. tbody: 'startTagRowGroup',
  4853. tfoot: 'startTagRowGroup',
  4854. thead: 'startTagRowGroup',
  4855. td: 'startTagImplyTbody',
  4856. th: 'startTagImplyTbody',
  4857. tr: 'startTagImplyTbody',
  4858. style: 'startTagStyleScript',
  4859. script: 'startTagStyleScript',
  4860. input: 'startTagInput',
  4861. form: 'startTagForm',
  4862. '-default': 'startTagOther'
  4863. };
  4864. modes.inTable.end_tag_handlers = {
  4865. table: 'endTagTable',
  4866. body: 'endTagIgnore',
  4867. caption: 'endTagIgnore',
  4868. col: 'endTagIgnore',
  4869. colgroup: 'endTagIgnore',
  4870. html: 'endTagIgnore',
  4871. tbody: 'endTagIgnore',
  4872. td: 'endTagIgnore',
  4873. tfoot: 'endTagIgnore',
  4874. th: 'endTagIgnore',
  4875. thead: 'endTagIgnore',
  4876. tr: 'endTagIgnore',
  4877. '-default': 'endTagOther'
  4878. };
  4879. modes.inTable.processCharacters = function(data) {
  4880. if (tree.currentStackItem().isFosterParenting()) {
  4881. var originalInsertionMode = tree.insertionModeName;
  4882. tree.setInsertionMode('inTableText');
  4883. tree.originalInsertionMode = originalInsertionMode;
  4884. tree.insertionMode.processCharacters(data);
  4885. } else {
  4886. tree.redirectAttachToFosterParent = true;
  4887. modes.inBody.processCharacters(data);
  4888. tree.redirectAttachToFosterParent = false;
  4889. }
  4890. };
  4891. modes.inTable.startTagCaption = function(name, attributes) {
  4892. tree.openElements.popUntilTableScopeMarker();
  4893. tree.activeFormattingElements.push(Marker);
  4894. tree.insertElement(name, attributes);
  4895. tree.setInsertionMode('inCaption');
  4896. };
  4897. modes.inTable.startTagColgroup = function(name, attributes) {
  4898. tree.openElements.popUntilTableScopeMarker();
  4899. tree.insertElement(name, attributes);
  4900. tree.setInsertionMode('inColumnGroup');
  4901. };
  4902. modes.inTable.startTagCol = function(name, attributes) {
  4903. this.startTagColgroup('colgroup', []);
  4904. tree.insertionMode.processStartTag(name, attributes);
  4905. };
  4906. modes.inTable.startTagRowGroup = function(name, attributes) {
  4907. tree.openElements.popUntilTableScopeMarker();
  4908. tree.insertElement(name, attributes);
  4909. tree.setInsertionMode('inTableBody');
  4910. };
  4911. modes.inTable.startTagImplyTbody = function(name, attributes) {
  4912. this.startTagRowGroup('tbody', []);
  4913. tree.insertionMode.processStartTag(name, attributes);
  4914. };
  4915. modes.inTable.startTagTable = function(name, attributes) {
  4916. tree.parseError("unexpected-start-tag-implies-end-tag",
  4917. {startName: "table", endName: "table"});
  4918. tree.insertionMode.processEndTag('table');
  4919. if (!tree.context) tree.insertionMode.processStartTag(name, attributes);
  4920. };
  4921. modes.inTable.startTagStyleScript = function(name, attributes) {
  4922. modes.inHead.processStartTag(name, attributes);
  4923. };
  4924. modes.inTable.startTagInput = function(name, attributes) {
  4925. for (var key in attributes) {
  4926. if (attributes[key].nodeName.toLowerCase() == 'type') {
  4927. if (attributes[key].nodeValue.toLowerCase() == 'hidden') {
  4928. tree.parseError("unexpected-hidden-input-in-table");
  4929. tree.insertElement(name, attributes);
  4930. tree.openElements.pop();
  4931. return;
  4932. }
  4933. break;
  4934. }
  4935. }
  4936. this.startTagOther(name, attributes);
  4937. };
  4938. modes.inTable.startTagForm = function(name, attributes) {
  4939. tree.parseError("unexpected-form-in-table");
  4940. if (!tree.form) {
  4941. tree.insertElement(name, attributes);
  4942. tree.form = tree.currentStackItem();
  4943. tree.openElements.pop();
  4944. }
  4945. };
  4946. modes.inTable.startTagOther = function(name, attributes, selfClosing) {
  4947. tree.parseError("unexpected-start-tag-implies-table-voodoo", {name: name});
  4948. tree.redirectAttachToFosterParent = true;
  4949. modes.inBody.processStartTag(name, attributes, selfClosing);
  4950. tree.redirectAttachToFosterParent = false;
  4951. };
  4952. modes.inTable.endTagTable = function(name) {
  4953. if (tree.openElements.inTableScope(name)) {
  4954. tree.generateImpliedEndTags();
  4955. if (tree.currentStackItem().localName != name) {
  4956. tree.parseError("end-tag-too-early-named", {gotName: 'table', expectedName: tree.currentStackItem().localName});
  4957. }
  4958. tree.openElements.popUntilPopped('table');
  4959. tree.resetInsertionMode();
  4960. } else {
  4961. assert.ok(tree.context);
  4962. tree.parseError('unexpected-end-tag', {name: name});
  4963. }
  4964. };
  4965. modes.inTable.endTagIgnore = function(name) {
  4966. tree.parseError("unexpected-end-tag", {name: name});
  4967. };
  4968. modes.inTable.endTagOther = function(name) {
  4969. tree.parseError("unexpected-end-tag-implies-table-voodoo", {name: name});
  4970. tree.redirectAttachToFosterParent = true;
  4971. modes.inBody.processEndTag(name);
  4972. tree.redirectAttachToFosterParent = false;
  4973. };
  4974. modes.inTableText = Object.create(modes.base);
  4975. modes.inTableText.flushCharacters = function() {
  4976. var characters = tree.pendingTableCharacters.join('');
  4977. if (!isAllWhitespace(characters)) {
  4978. tree.redirectAttachToFosterParent = true;
  4979. tree.reconstructActiveFormattingElements();
  4980. tree.insertText(characters);
  4981. tree.framesetOk = false;
  4982. tree.redirectAttachToFosterParent = false;
  4983. } else {
  4984. tree.insertText(characters);
  4985. }
  4986. tree.pendingTableCharacters = [];
  4987. };
  4988. modes.inTableText.processComment = function(data) {
  4989. this.flushCharacters();
  4990. tree.setInsertionMode(tree.originalInsertionMode);
  4991. tree.insertionMode.processComment(data);
  4992. };
  4993. modes.inTableText.processEOF = function(data) {
  4994. this.flushCharacters();
  4995. tree.setInsertionMode(tree.originalInsertionMode);
  4996. tree.insertionMode.processEOF();
  4997. };
  4998. modes.inTableText.processCharacters = function(buffer) {
  4999. var characters = buffer.takeRemaining();
  5000. characters = characters.replace(/\u0000/g, function(match, index){
  5001. tree.parseError("invalid-codepoint");
  5002. return '';
  5003. });
  5004. if (!characters)
  5005. return;
  5006. tree.pendingTableCharacters.push(characters);
  5007. };
  5008. modes.inTableText.processStartTag = function(name, attributes, selfClosing) {
  5009. this.flushCharacters();
  5010. tree.setInsertionMode(tree.originalInsertionMode);
  5011. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  5012. };
  5013. modes.inTableText.processEndTag = function(name, attributes) {
  5014. this.flushCharacters();
  5015. tree.setInsertionMode(tree.originalInsertionMode);
  5016. tree.insertionMode.processEndTag(name, attributes);
  5017. };
  5018. modes.inTableBody = Object.create(modes.base);
  5019. modes.inTableBody.start_tag_handlers = {
  5020. html: 'startTagHtml',
  5021. tr: 'startTagTr',
  5022. td: 'startTagTableCell',
  5023. th: 'startTagTableCell',
  5024. caption: 'startTagTableOther',
  5025. col: 'startTagTableOther',
  5026. colgroup: 'startTagTableOther',
  5027. tbody: 'startTagTableOther',
  5028. tfoot: 'startTagTableOther',
  5029. thead: 'startTagTableOther',
  5030. '-default': 'startTagOther'
  5031. };
  5032. modes.inTableBody.end_tag_handlers = {
  5033. table: 'endTagTable',
  5034. tbody: 'endTagTableRowGroup',
  5035. tfoot: 'endTagTableRowGroup',
  5036. thead: 'endTagTableRowGroup',
  5037. body: 'endTagIgnore',
  5038. caption: 'endTagIgnore',
  5039. col: 'endTagIgnore',
  5040. colgroup: 'endTagIgnore',
  5041. html: 'endTagIgnore',
  5042. td: 'endTagIgnore',
  5043. th: 'endTagIgnore',
  5044. tr: 'endTagIgnore',
  5045. '-default': 'endTagOther'
  5046. };
  5047. modes.inTableBody.processCharacters = function(data) {
  5048. modes.inTable.processCharacters(data);
  5049. };
  5050. modes.inTableBody.startTagTr = function(name, attributes) {
  5051. tree.openElements.popUntilTableBodyScopeMarker();
  5052. tree.insertElement(name, attributes);
  5053. tree.setInsertionMode('inRow');
  5054. };
  5055. modes.inTableBody.startTagTableCell = function(name, attributes) {
  5056. tree.parseError("unexpected-cell-in-table-body", {name: name});
  5057. this.startTagTr('tr', []);
  5058. tree.insertionMode.processStartTag(name, attributes);
  5059. };
  5060. modes.inTableBody.startTagTableOther = function(name, attributes) {
  5061. if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) {
  5062. tree.openElements.popUntilTableBodyScopeMarker();
  5063. this.endTagTableRowGroup(tree.currentStackItem().localName);
  5064. tree.insertionMode.processStartTag(name, attributes);
  5065. } else {
  5066. tree.parseError('unexpected-start-tag', {name: name});
  5067. }
  5068. };
  5069. modes.inTableBody.startTagOther = function(name, attributes) {
  5070. modes.inTable.processStartTag(name, attributes);
  5071. };
  5072. modes.inTableBody.endTagTableRowGroup = function(name) {
  5073. if (tree.openElements.inTableScope(name)) {
  5074. tree.openElements.popUntilTableBodyScopeMarker();
  5075. tree.popElement();
  5076. tree.setInsertionMode('inTable');
  5077. } else {
  5078. tree.parseError('unexpected-end-tag-in-table-body', {name: name});
  5079. }
  5080. };
  5081. modes.inTableBody.endTagTable = function(name) {
  5082. if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) {
  5083. tree.openElements.popUntilTableBodyScopeMarker();
  5084. this.endTagTableRowGroup(tree.currentStackItem().localName);
  5085. tree.insertionMode.processEndTag(name);
  5086. } else {
  5087. tree.parseError('unexpected-end-tag', {name: name});
  5088. }
  5089. };
  5090. modes.inTableBody.endTagIgnore = function(name) {
  5091. tree.parseError("unexpected-end-tag-in-table-body", {name: name});
  5092. };
  5093. modes.inTableBody.endTagOther = function(name) {
  5094. modes.inTable.processEndTag(name);
  5095. };
  5096. modes.inSelect = Object.create(modes.base);
  5097. modes.inSelect.start_tag_handlers = {
  5098. html: 'startTagHtml',
  5099. option: 'startTagOption',
  5100. optgroup: 'startTagOptgroup',
  5101. select: 'startTagSelect',
  5102. input: 'startTagInput',
  5103. keygen: 'startTagInput',
  5104. textarea: 'startTagInput',
  5105. script: 'startTagScript',
  5106. '-default': 'startTagOther'
  5107. };
  5108. modes.inSelect.end_tag_handlers = {
  5109. option: 'endTagOption',
  5110. optgroup: 'endTagOptgroup',
  5111. select: 'endTagSelect',
  5112. caption: 'endTagTableElements',
  5113. table: 'endTagTableElements',
  5114. tbody: 'endTagTableElements',
  5115. tfoot: 'endTagTableElements',
  5116. thead: 'endTagTableElements',
  5117. tr: 'endTagTableElements',
  5118. td: 'endTagTableElements',
  5119. th: 'endTagTableElements',
  5120. '-default': 'endTagOther'
  5121. };
  5122. modes.inSelect.processCharacters = function(buffer) {
  5123. var data = buffer.takeRemaining();
  5124. data = data.replace(/\u0000/g, function(match, index){
  5125. tree.parseError("invalid-codepoint");
  5126. return '';
  5127. });
  5128. if (!data)
  5129. return;
  5130. tree.insertText(data);
  5131. };
  5132. modes.inSelect.startTagOption = function(name, attributes) {
  5133. if (tree.currentStackItem().localName == 'option')
  5134. tree.popElement();
  5135. tree.insertElement(name, attributes);
  5136. };
  5137. modes.inSelect.startTagOptgroup = function(name, attributes) {
  5138. if (tree.currentStackItem().localName == 'option')
  5139. tree.popElement();
  5140. if (tree.currentStackItem().localName == 'optgroup')
  5141. tree.popElement();
  5142. tree.insertElement(name, attributes);
  5143. };
  5144. modes.inSelect.endTagOption = function(name) {
  5145. if (tree.currentStackItem().localName !== 'option') {
  5146. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5147. return;
  5148. }
  5149. tree.popElement();
  5150. };
  5151. modes.inSelect.endTagOptgroup = function(name) {
  5152. if (tree.currentStackItem().localName == 'option' && tree.openElements.item(tree.openElements.length - 2).localName == 'optgroup') {
  5153. tree.popElement();
  5154. }
  5155. if (tree.currentStackItem().localName == 'optgroup') {
  5156. tree.popElement();
  5157. } else {
  5158. tree.parseError('unexpected-end-tag-in-select', {name: 'optgroup'});
  5159. }
  5160. };
  5161. modes.inSelect.startTagSelect = function(name) {
  5162. tree.parseError("unexpected-select-in-select");
  5163. this.endTagSelect('select');
  5164. };
  5165. modes.inSelect.endTagSelect = function(name) {
  5166. if (tree.openElements.inTableScope('select')) {
  5167. tree.openElements.popUntilPopped('select');
  5168. tree.resetInsertionMode();
  5169. } else {
  5170. tree.parseError('unexpected-end-tag', {name: name});
  5171. }
  5172. };
  5173. modes.inSelect.startTagInput = function(name, attributes) {
  5174. tree.parseError("unexpected-input-in-select");
  5175. if (tree.openElements.inSelectScope('select')) {
  5176. this.endTagSelect('select');
  5177. tree.insertionMode.processStartTag(name, attributes);
  5178. }
  5179. };
  5180. modes.inSelect.startTagScript = function(name, attributes) {
  5181. modes.inHead.processStartTag(name, attributes);
  5182. };
  5183. modes.inSelect.endTagTableElements = function(name) {
  5184. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5185. if (tree.openElements.inTableScope(name)) {
  5186. this.endTagSelect('select');
  5187. tree.insertionMode.processEndTag(name);
  5188. }
  5189. };
  5190. modes.inSelect.startTagOther = function(name, attributes) {
  5191. tree.parseError("unexpected-start-tag-in-select", {name: name});
  5192. };
  5193. modes.inSelect.endTagOther = function(name) {
  5194. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5195. };
  5196. modes.inSelectInTable = Object.create(modes.base);
  5197. modes.inSelectInTable.start_tag_handlers = {
  5198. caption: 'startTagTable',
  5199. table: 'startTagTable',
  5200. tbody: 'startTagTable',
  5201. tfoot: 'startTagTable',
  5202. thead: 'startTagTable',
  5203. tr: 'startTagTable',
  5204. td: 'startTagTable',
  5205. th: 'startTagTable',
  5206. '-default': 'startTagOther'
  5207. };
  5208. modes.inSelectInTable.end_tag_handlers = {
  5209. caption: 'endTagTable',
  5210. table: 'endTagTable',
  5211. tbody: 'endTagTable',
  5212. tfoot: 'endTagTable',
  5213. thead: 'endTagTable',
  5214. tr: 'endTagTable',
  5215. td: 'endTagTable',
  5216. th: 'endTagTable',
  5217. '-default': 'endTagOther'
  5218. };
  5219. modes.inSelectInTable.processCharacters = function(data) {
  5220. modes.inSelect.processCharacters(data);
  5221. };
  5222. modes.inSelectInTable.startTagTable = function(name, attributes) {
  5223. tree.parseError("unexpected-table-element-start-tag-in-select-in-table", {name: name});
  5224. this.endTagOther("select");
  5225. tree.insertionMode.processStartTag(name, attributes);
  5226. };
  5227. modes.inSelectInTable.startTagOther = function(name, attributes, selfClosing) {
  5228. modes.inSelect.processStartTag(name, attributes, selfClosing);
  5229. };
  5230. modes.inSelectInTable.endTagTable = function(name) {
  5231. tree.parseError("unexpected-table-element-end-tag-in-select-in-table", {name: name});
  5232. if (tree.openElements.inTableScope(name)) {
  5233. this.endTagOther("select");
  5234. tree.insertionMode.processEndTag(name);
  5235. }
  5236. };
  5237. modes.inSelectInTable.endTagOther = function(name) {
  5238. modes.inSelect.processEndTag(name);
  5239. };
  5240. modes.inRow = Object.create(modes.base);
  5241. modes.inRow.start_tag_handlers = {
  5242. html: 'startTagHtml',
  5243. td: 'startTagTableCell',
  5244. th: 'startTagTableCell',
  5245. caption: 'startTagTableOther',
  5246. col: 'startTagTableOther',
  5247. colgroup: 'startTagTableOther',
  5248. tbody: 'startTagTableOther',
  5249. tfoot: 'startTagTableOther',
  5250. thead: 'startTagTableOther',
  5251. tr: 'startTagTableOther',
  5252. '-default': 'startTagOther'
  5253. };
  5254. modes.inRow.end_tag_handlers = {
  5255. tr: 'endTagTr',
  5256. table: 'endTagTable',
  5257. tbody: 'endTagTableRowGroup',
  5258. tfoot: 'endTagTableRowGroup',
  5259. thead: 'endTagTableRowGroup',
  5260. body: 'endTagIgnore',
  5261. caption: 'endTagIgnore',
  5262. col: 'endTagIgnore',
  5263. colgroup: 'endTagIgnore',
  5264. html: 'endTagIgnore',
  5265. td: 'endTagIgnore',
  5266. th: 'endTagIgnore',
  5267. '-default': 'endTagOther'
  5268. };
  5269. modes.inRow.processCharacters = function(data) {
  5270. modes.inTable.processCharacters(data);
  5271. };
  5272. modes.inRow.startTagTableCell = function(name, attributes) {
  5273. tree.openElements.popUntilTableRowScopeMarker();
  5274. tree.insertElement(name, attributes);
  5275. tree.setInsertionMode('inCell');
  5276. tree.activeFormattingElements.push(Marker);
  5277. };
  5278. modes.inRow.startTagTableOther = function(name, attributes) {
  5279. var ignoreEndTag = this.ignoreEndTagTr();
  5280. this.endTagTr('tr');
  5281. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes);
  5282. };
  5283. modes.inRow.startTagOther = function(name, attributes, selfClosing) {
  5284. modes.inTable.processStartTag(name, attributes, selfClosing);
  5285. };
  5286. modes.inRow.endTagTr = function(name) {
  5287. if (this.ignoreEndTagTr()) {
  5288. assert.ok(tree.context);
  5289. tree.parseError('unexpected-end-tag', {name: name});
  5290. } else {
  5291. tree.openElements.popUntilTableRowScopeMarker();
  5292. tree.popElement();
  5293. tree.setInsertionMode('inTableBody');
  5294. }
  5295. };
  5296. modes.inRow.endTagTable = function(name) {
  5297. var ignoreEndTag = this.ignoreEndTagTr();
  5298. this.endTagTr('tr');
  5299. if (!ignoreEndTag) tree.insertionMode.processEndTag(name);
  5300. };
  5301. modes.inRow.endTagTableRowGroup = function(name) {
  5302. if (tree.openElements.inTableScope(name)) {
  5303. this.endTagTr('tr');
  5304. tree.insertionMode.processEndTag(name);
  5305. } else {
  5306. tree.parseError('unexpected-end-tag', {name: name});
  5307. }
  5308. };
  5309. modes.inRow.endTagIgnore = function(name) {
  5310. tree.parseError("unexpected-end-tag-in-table-row", {name: name});
  5311. };
  5312. modes.inRow.endTagOther = function(name) {
  5313. modes.inTable.processEndTag(name);
  5314. };
  5315. modes.inRow.ignoreEndTagTr = function() {
  5316. return !tree.openElements.inTableScope('tr');
  5317. };
  5318. modes.afterAfterFrameset = Object.create(modes.base);
  5319. modes.afterAfterFrameset.start_tag_handlers = {
  5320. html: 'startTagHtml',
  5321. noframes: 'startTagNoFrames',
  5322. '-default': 'startTagOther'
  5323. };
  5324. modes.afterAfterFrameset.processEOF = function() {};
  5325. modes.afterAfterFrameset.processComment = function(data) {
  5326. tree.insertComment(data, tree.document);
  5327. };
  5328. modes.afterAfterFrameset.processCharacters = function(buffer) {
  5329. var characters = buffer.takeRemaining();
  5330. var whitespace = "";
  5331. for (var i = 0; i < characters.length; i++) {
  5332. var ch = characters[i];
  5333. if (isWhitespace(ch))
  5334. whitespace += ch;
  5335. }
  5336. if (whitespace) {
  5337. tree.reconstructActiveFormattingElements();
  5338. tree.insertText(whitespace);
  5339. }
  5340. if (whitespace.length < characters.length)
  5341. tree.parseError('expected-eof-but-got-char');
  5342. };
  5343. modes.afterAfterFrameset.startTagNoFrames = function(name, attributes) {
  5344. modes.inHead.processStartTag(name, attributes);
  5345. };
  5346. modes.afterAfterFrameset.startTagOther = function(name, attributes, selfClosing) {
  5347. tree.parseError('expected-eof-but-got-start-tag', {name: name});
  5348. };
  5349. modes.afterAfterFrameset.processEndTag = function(name, attributes) {
  5350. tree.parseError('expected-eof-but-got-end-tag', {name: name});
  5351. };
  5352. modes.text = Object.create(modes.base);
  5353. modes.text.start_tag_handlers = {
  5354. '-default': 'startTagOther'
  5355. };
  5356. modes.text.end_tag_handlers = {
  5357. script: 'endTagScript',
  5358. '-default': 'endTagOther'
  5359. };
  5360. modes.text.processCharacters = function(buffer) {
  5361. if (tree.shouldSkipLeadingNewline) {
  5362. tree.shouldSkipLeadingNewline = false;
  5363. buffer.skipAtMostOneLeadingNewline();
  5364. }
  5365. var data = buffer.takeRemaining();
  5366. if (!data)
  5367. return;
  5368. tree.insertText(data);
  5369. };
  5370. modes.text.processEOF = function() {
  5371. tree.parseError("expected-named-closing-tag-but-got-eof",
  5372. {name: tree.currentStackItem().localName});
  5373. tree.openElements.pop();
  5374. tree.setInsertionMode(tree.originalInsertionMode);
  5375. tree.insertionMode.processEOF();
  5376. };
  5377. modes.text.startTagOther = function(name) {
  5378. throw "Tried to process start tag " + name + " in RCDATA/RAWTEXT mode";
  5379. };
  5380. modes.text.endTagScript = function(name) {
  5381. var node = tree.openElements.pop();
  5382. assert.ok(node.localName == 'script');
  5383. tree.setInsertionMode(tree.originalInsertionMode);
  5384. };
  5385. modes.text.endTagOther = function(name) {
  5386. tree.openElements.pop();
  5387. tree.setInsertionMode(tree.originalInsertionMode);
  5388. };
  5389. }
  5390. TreeBuilder.prototype.setInsertionMode = function(name) {
  5391. this.insertionMode = this.insertionModes[name];
  5392. this.insertionModeName = name;
  5393. };
  5394. TreeBuilder.prototype.adoptionAgencyEndTag = function(name) {
  5395. var outerIterationLimit = 8;
  5396. var innerIterationLimit = 3;
  5397. var formattingElement;
  5398. function isActiveFormattingElement(el) {
  5399. return el === formattingElement;
  5400. }
  5401. var outerLoopCounter = 0;
  5402. while (outerLoopCounter++ < outerIterationLimit) {
  5403. formattingElement = this.elementInActiveFormattingElements(name);
  5404. if (!formattingElement || (this.openElements.contains(formattingElement) && !this.openElements.inScope(formattingElement.localName))) {
  5405. this.parseError('adoption-agency-1.1', {name: name});
  5406. return false;
  5407. }
  5408. if (!this.openElements.contains(formattingElement)) {
  5409. this.parseError('adoption-agency-1.2', {name: name});
  5410. this.removeElementFromActiveFormattingElements(formattingElement);
  5411. return true;
  5412. }
  5413. if (!this.openElements.inScope(formattingElement.localName)) {
  5414. this.parseError('adoption-agency-4.4', {name: name});
  5415. }
  5416. if (formattingElement != this.currentStackItem()) {
  5417. this.parseError('adoption-agency-1.3', {name: name});
  5418. }
  5419. var furthestBlock = this.openElements.furthestBlockForFormattingElement(formattingElement.node);
  5420. if (!furthestBlock) {
  5421. this.openElements.remove_openElements_until(isActiveFormattingElement);
  5422. this.removeElementFromActiveFormattingElements(formattingElement);
  5423. return true;
  5424. }
  5425. var afeIndex = this.openElements.elements.indexOf(formattingElement);
  5426. var commonAncestor = this.openElements.item(afeIndex - 1);
  5427. var bookmark = this.activeFormattingElements.indexOf(formattingElement);
  5428. var node = furthestBlock;
  5429. var lastNode = furthestBlock;
  5430. var index = this.openElements.elements.indexOf(node);
  5431. var innerLoopCounter = 0;
  5432. while (innerLoopCounter++ < innerIterationLimit) {
  5433. index -= 1;
  5434. node = this.openElements.item(index);
  5435. if (this.activeFormattingElements.indexOf(node) < 0) {
  5436. this.openElements.elements.splice(index, 1);
  5437. continue;
  5438. }
  5439. if (node == formattingElement)
  5440. break;
  5441. if (lastNode == furthestBlock)
  5442. bookmark = this.activeFormattingElements.indexOf(node) + 1;
  5443. var clone = this.createElement(node.namespaceURI, node.localName, node.attributes);
  5444. var newNode = new StackItem(node.namespaceURI, node.localName, node.attributes, clone);
  5445. this.activeFormattingElements[this.activeFormattingElements.indexOf(node)] = newNode;
  5446. this.openElements.elements[this.openElements.elements.indexOf(node)] = newNode;
  5447. node = newNode;
  5448. this.detachFromParent(lastNode.node);
  5449. this.attachNode(lastNode.node, node.node);
  5450. lastNode = node;
  5451. }
  5452. this.detachFromParent(lastNode.node);
  5453. if (commonAncestor.isFosterParenting()) {
  5454. this.insertIntoFosterParent(lastNode.node);
  5455. } else {
  5456. this.attachNode(lastNode.node, commonAncestor.node);
  5457. }
  5458. var clone = this.createElement("http://www.w3.org/1999/xhtml", formattingElement.localName, formattingElement.attributes);
  5459. var formattingClone = new StackItem(formattingElement.namespaceURI, formattingElement.localName, formattingElement.attributes, clone);
  5460. this.reparentChildren(furthestBlock.node, clone);
  5461. this.attachNode(clone, furthestBlock.node);
  5462. this.removeElementFromActiveFormattingElements(formattingElement);
  5463. this.activeFormattingElements.splice(Math.min(bookmark, this.activeFormattingElements.length), 0, formattingClone);
  5464. this.openElements.remove(formattingElement);
  5465. this.openElements.elements.splice(this.openElements.elements.indexOf(furthestBlock) + 1, 0, formattingClone);
  5466. }
  5467. return true;
  5468. };
  5469. TreeBuilder.prototype.start = function() {
  5470. throw "Not mplemented";
  5471. };
  5472. TreeBuilder.prototype.startTokenization = function(tokenizer) {
  5473. this.tokenizer = tokenizer;
  5474. this.compatMode = "no quirks";
  5475. this.originalInsertionMode = "initial";
  5476. this.framesetOk = true;
  5477. this.openElements = new ElementStack();
  5478. this.activeFormattingElements = [];
  5479. this.start();
  5480. if (this.context) {
  5481. switch(this.context) {
  5482. case 'title':
  5483. case 'textarea':
  5484. this.tokenizer.setState(Tokenizer.RCDATA);
  5485. break;
  5486. case 'style':
  5487. case 'xmp':
  5488. case 'iframe':
  5489. case 'noembed':
  5490. case 'noframes':
  5491. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5492. break;
  5493. case 'script':
  5494. this.tokenizer.setState(Tokenizer.SCRIPT_DATA);
  5495. break;
  5496. case 'noscript':
  5497. if (this.scriptingEnabled)
  5498. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5499. break;
  5500. case 'plaintext':
  5501. this.tokenizer.setState(Tokenizer.PLAINTEXT);
  5502. break;
  5503. }
  5504. this.insertHtmlElement();
  5505. this.resetInsertionMode();
  5506. } else {
  5507. this.setInsertionMode('initial');
  5508. }
  5509. };
  5510. TreeBuilder.prototype.processToken = function(token) {
  5511. this.selfClosingFlagAcknowledged = false;
  5512. var currentNode = this.openElements.top || null;
  5513. var insertionMode;
  5514. if (!currentNode || !currentNode.isForeign() ||
  5515. (currentNode.isMathMLTextIntegrationPoint() &&
  5516. ((token.type == 'StartTag' &&
  5517. !(token.name in {mglyph:0, malignmark:0})) ||
  5518. (token.type === 'Characters'))
  5519. ) ||
  5520. (currentNode.namespaceURI == "http://www.w3.org/1998/Math/MathML" &&
  5521. currentNode.localName == 'annotation-xml' &&
  5522. token.type == 'StartTag' && token.name == 'svg'
  5523. ) ||
  5524. (currentNode.isHtmlIntegrationPoint() &&
  5525. token.type in {StartTag:0, Characters:0}
  5526. ) ||
  5527. token.type == 'EOF'
  5528. ) {
  5529. insertionMode = this.insertionMode;
  5530. } else {
  5531. insertionMode = this.insertionModes.inForeignContent;
  5532. }
  5533. switch(token.type) {
  5534. case 'Characters':
  5535. var buffer = new CharacterBuffer(token.data);
  5536. insertionMode.processCharacters(buffer);
  5537. break;
  5538. case 'Comment':
  5539. insertionMode.processComment(token.data);
  5540. break;
  5541. case 'StartTag':
  5542. insertionMode.processStartTag(token.name, token.data, token.selfClosing);
  5543. break;
  5544. case 'EndTag':
  5545. insertionMode.processEndTag(token.name);
  5546. break;
  5547. case 'Doctype':
  5548. insertionMode.processDoctype(token.name, token.publicId, token.systemId, token.forceQuirks);
  5549. break;
  5550. case 'EOF':
  5551. insertionMode.processEOF();
  5552. break;
  5553. }
  5554. };
  5555. TreeBuilder.prototype.isCdataSectionAllowed = function() {
  5556. return this.openElements.length > 0 && this.currentStackItem().isForeign();
  5557. };
  5558. TreeBuilder.prototype.isSelfClosingFlagAcknowledged = function() {
  5559. return this.selfClosingFlagAcknowledged;
  5560. };
  5561. TreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) {
  5562. throw new Error("Not implemented");
  5563. };
  5564. TreeBuilder.prototype.attachNode = function(child, parent) {
  5565. throw new Error("Not implemented");
  5566. };
  5567. TreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) {
  5568. throw new Error("Not implemented");
  5569. };
  5570. TreeBuilder.prototype.detachFromParent = function(node) {
  5571. throw new Error("Not implemented");
  5572. };
  5573. TreeBuilder.prototype.addAttributesToElement = function(element, attributes) {
  5574. throw new Error("Not implemented");
  5575. };
  5576. TreeBuilder.prototype.insertHtmlElement = function(attributes) {
  5577. var root = this.createElement("http://www.w3.org/1999/xhtml", 'html', attributes);
  5578. this.attachNode(root, this.document);
  5579. this.openElements.pushHtmlElement(new StackItem("http://www.w3.org/1999/xhtml", 'html', attributes, root));
  5580. return root;
  5581. };
  5582. TreeBuilder.prototype.insertHeadElement = function(attributes) {
  5583. var element = this.createElement("http://www.w3.org/1999/xhtml", "head", attributes);
  5584. this.head = new StackItem("http://www.w3.org/1999/xhtml", "head", attributes, element);
  5585. this.attachNode(element, this.openElements.top.node);
  5586. this.openElements.pushHeadElement(this.head);
  5587. return element;
  5588. };
  5589. TreeBuilder.prototype.insertBodyElement = function(attributes) {
  5590. var element = this.createElement("http://www.w3.org/1999/xhtml", "body", attributes);
  5591. this.attachNode(element, this.openElements.top.node);
  5592. this.openElements.pushBodyElement(new StackItem("http://www.w3.org/1999/xhtml", "body", attributes, element));
  5593. return element;
  5594. };
  5595. TreeBuilder.prototype.insertIntoFosterParent = function(node) {
  5596. var tableIndex = this.openElements.findIndex('table');
  5597. var tableElement = this.openElements.item(tableIndex).node;
  5598. if (tableIndex === 0)
  5599. return this.attachNode(node, tableElement);
  5600. this.attachNodeToFosterParent(node, tableElement, this.openElements.item(tableIndex - 1).node);
  5601. };
  5602. TreeBuilder.prototype.insertElement = function(name, attributes, namespaceURI, selfClosing) {
  5603. if (!namespaceURI)
  5604. namespaceURI = "http://www.w3.org/1999/xhtml";
  5605. var element = this.createElement(namespaceURI, name, attributes);
  5606. if (this.shouldFosterParent())
  5607. this.insertIntoFosterParent(element);
  5608. else
  5609. this.attachNode(element, this.openElements.top.node);
  5610. if (!selfClosing)
  5611. this.openElements.push(new StackItem(namespaceURI, name, attributes, element));
  5612. };
  5613. TreeBuilder.prototype.insertFormattingElement = function(name, attributes) {
  5614. this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml");
  5615. this.appendElementToActiveFormattingElements(this.currentStackItem());
  5616. };
  5617. TreeBuilder.prototype.insertSelfClosingElement = function(name, attributes) {
  5618. this.selfClosingFlagAcknowledged = true;
  5619. this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml", true);
  5620. };
  5621. TreeBuilder.prototype.insertForeignElement = function(name, attributes, namespaceURI, selfClosing) {
  5622. if (selfClosing)
  5623. this.selfClosingFlagAcknowledged = true;
  5624. this.insertElement(name, attributes, namespaceURI, selfClosing);
  5625. };
  5626. TreeBuilder.prototype.insertComment = function(data, parent) {
  5627. throw new Error("Not implemented");
  5628. };
  5629. TreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) {
  5630. throw new Error("Not implemented");
  5631. };
  5632. TreeBuilder.prototype.insertText = function(data) {
  5633. throw new Error("Not implemented");
  5634. };
  5635. TreeBuilder.prototype.currentStackItem = function() {
  5636. return this.openElements.top;
  5637. };
  5638. TreeBuilder.prototype.popElement = function() {
  5639. return this.openElements.pop();
  5640. };
  5641. TreeBuilder.prototype.shouldFosterParent = function() {
  5642. return this.redirectAttachToFosterParent && this.currentStackItem().isFosterParenting();
  5643. };
  5644. TreeBuilder.prototype.generateImpliedEndTags = function(exclude) {
  5645. var name = this.openElements.top.localName;
  5646. if (['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'].indexOf(name) != -1 && name != exclude) {
  5647. this.popElement();
  5648. this.generateImpliedEndTags(exclude);
  5649. }
  5650. };
  5651. TreeBuilder.prototype.reconstructActiveFormattingElements = function() {
  5652. if (this.activeFormattingElements.length === 0)
  5653. return;
  5654. var i = this.activeFormattingElements.length - 1;
  5655. var entry = this.activeFormattingElements[i];
  5656. if (entry == Marker || this.openElements.contains(entry))
  5657. return;
  5658. while (entry != Marker && !this.openElements.contains(entry)) {
  5659. i -= 1;
  5660. entry = this.activeFormattingElements[i];
  5661. if (!entry)
  5662. break;
  5663. }
  5664. while (true) {
  5665. i += 1;
  5666. entry = this.activeFormattingElements[i];
  5667. this.insertElement(entry.localName, entry.attributes);
  5668. var element = this.currentStackItem();
  5669. this.activeFormattingElements[i] = element;
  5670. if (element == this.activeFormattingElements[this.activeFormattingElements.length -1])
  5671. break;
  5672. }
  5673. };
  5674. TreeBuilder.prototype.ensureNoahsArkCondition = function(item) {
  5675. var kNoahsArkCapacity = 3;
  5676. if (this.activeFormattingElements.length < kNoahsArkCapacity)
  5677. return;
  5678. var candidates = [];
  5679. var newItemAttributeCount = item.attributes.length;
  5680. for (var i = this.activeFormattingElements.length - 1; i >= 0; i--) {
  5681. var candidate = this.activeFormattingElements[i];
  5682. if (candidate === Marker)
  5683. break;
  5684. if (item.localName !== candidate.localName || item.namespaceURI !== candidate.namespaceURI)
  5685. continue;
  5686. if (candidate.attributes.length != newItemAttributeCount)
  5687. continue;
  5688. candidates.push(candidate);
  5689. }
  5690. if (candidates.length < kNoahsArkCapacity)
  5691. return;
  5692. var remainingCandidates = [];
  5693. var attributes = item.attributes;
  5694. for (var i = 0; i < attributes.length; i++) {
  5695. var attribute = attributes[i];
  5696. for (var j = 0; j < candidates.length; j++) {
  5697. var candidate = candidates[j];
  5698. var candidateAttribute = getAttribute(candidate, attribute.nodeName);
  5699. if (candidateAttribute && candidateAttribute.nodeValue === attribute.nodeValue)
  5700. remainingCandidates.push(candidate);
  5701. }
  5702. if (remainingCandidates.length < kNoahsArkCapacity)
  5703. return;
  5704. candidates = remainingCandidates;
  5705. remainingCandidates = [];
  5706. }
  5707. for (var i = kNoahsArkCapacity - 1; i < candidates.length; i++)
  5708. this.removeElementFromActiveFormattingElements(candidates[i]);
  5709. };
  5710. TreeBuilder.prototype.appendElementToActiveFormattingElements = function(item) {
  5711. this.ensureNoahsArkCondition(item);
  5712. this.activeFormattingElements.push(item);
  5713. };
  5714. TreeBuilder.prototype.removeElementFromActiveFormattingElements = function(item) {
  5715. var index = this.activeFormattingElements.indexOf(item);
  5716. if (index >= 0)
  5717. this.activeFormattingElements.splice(index, 1);
  5718. };
  5719. TreeBuilder.prototype.elementInActiveFormattingElements = function(name) {
  5720. var els = this.activeFormattingElements;
  5721. for (var i = els.length - 1; i >= 0; i--) {
  5722. if (els[i] == Marker) break;
  5723. if (els[i].localName == name) return els[i];
  5724. }
  5725. return false;
  5726. };
  5727. TreeBuilder.prototype.clearActiveFormattingElements = function() {
  5728. while (!(this.activeFormattingElements.length === 0 || this.activeFormattingElements.pop() == Marker));
  5729. };
  5730. TreeBuilder.prototype.reparentChildren = function(oldParent, newParent) {
  5731. throw new Error("Not implemented");
  5732. };
  5733. TreeBuilder.prototype.setFragmentContext = function(context) {
  5734. this.context = context;
  5735. };
  5736. TreeBuilder.prototype.parseError = function(code, args) {
  5737. if (!this.errorHandler)
  5738. return;
  5739. var message = formatMessage(messages[code], args);
  5740. this.errorHandler.error(message, this.tokenizer._inputStream.location(), code);
  5741. };
  5742. TreeBuilder.prototype.resetInsertionMode = function() {
  5743. var last = false;
  5744. var node = null;
  5745. for (var i = this.openElements.length - 1; i >= 0; i--) {
  5746. node = this.openElements.item(i);
  5747. if (i === 0) {
  5748. assert.ok(this.context);
  5749. last = true;
  5750. node = new StackItem("http://www.w3.org/1999/xhtml", this.context, [], null);
  5751. }
  5752. if (node.namespaceURI === "http://www.w3.org/1999/xhtml") {
  5753. if (node.localName === 'select')
  5754. return this.setInsertionMode('inSelect');
  5755. if (node.localName === 'td' || node.localName === 'th')
  5756. return this.setInsertionMode('inCell');
  5757. if (node.localName === 'tr')
  5758. return this.setInsertionMode('inRow');
  5759. if (node.localName === 'tbody' || node.localName === 'thead' || node.localName === 'tfoot')
  5760. return this.setInsertionMode('inTableBody');
  5761. if (node.localName === 'caption')
  5762. return this.setInsertionMode('inCaption');
  5763. if (node.localName === 'colgroup')
  5764. return this.setInsertionMode('inColumnGroup');
  5765. if (node.localName === 'table')
  5766. return this.setInsertionMode('inTable');
  5767. if (node.localName === 'head' && !last)
  5768. return this.setInsertionMode('inHead');
  5769. if (node.localName === 'body')
  5770. return this.setInsertionMode('inBody');
  5771. if (node.localName === 'frameset')
  5772. return this.setInsertionMode('inFrameset');
  5773. if (node.localName === 'html')
  5774. if (!this.openElements.headElement)
  5775. return this.setInsertionMode('beforeHead');
  5776. else
  5777. return this.setInsertionMode('afterHead');
  5778. }
  5779. if (last)
  5780. return this.setInsertionMode('inBody');
  5781. }
  5782. };
  5783. TreeBuilder.prototype.processGenericRCDATAStartTag = function(name, attributes) {
  5784. this.insertElement(name, attributes);
  5785. this.tokenizer.setState(Tokenizer.RCDATA);
  5786. this.originalInsertionMode = this.insertionModeName;
  5787. this.setInsertionMode('text');
  5788. };
  5789. TreeBuilder.prototype.processGenericRawTextStartTag = function(name, attributes) {
  5790. this.insertElement(name, attributes);
  5791. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5792. this.originalInsertionMode = this.insertionModeName;
  5793. this.setInsertionMode('text');
  5794. };
  5795. TreeBuilder.prototype.adjustMathMLAttributes = function(attributes) {
  5796. attributes.forEach(function(a) {
  5797. a.namespaceURI = "http://www.w3.org/1998/Math/MathML";
  5798. if (constants.MATHMLAttributeMap[a.nodeName])
  5799. a.nodeName = constants.MATHMLAttributeMap[a.nodeName];
  5800. });
  5801. return attributes;
  5802. };
  5803. TreeBuilder.prototype.adjustSVGTagNameCase = function(name) {
  5804. return constants.SVGTagMap[name] || name;
  5805. };
  5806. TreeBuilder.prototype.adjustSVGAttributes = function(attributes) {
  5807. attributes.forEach(function(a) {
  5808. a.namespaceURI = "http://www.w3.org/2000/svg";
  5809. if (constants.SVGAttributeMap[a.nodeName])
  5810. a.nodeName = constants.SVGAttributeMap[a.nodeName];
  5811. });
  5812. return attributes;
  5813. };
  5814. TreeBuilder.prototype.adjustForeignAttributes = function(attributes) {
  5815. for (var i = 0; i < attributes.length; i++) {
  5816. var attribute = attributes[i];
  5817. var adjusted = constants.ForeignAttributeMap[attribute.nodeName];
  5818. if (adjusted) {
  5819. attribute.nodeName = adjusted.localName;
  5820. attribute.prefix = adjusted.prefix;
  5821. attribute.namespaceURI = adjusted.namespaceURI;
  5822. }
  5823. }
  5824. return attributes;
  5825. };
  5826. function formatMessage(format, args) {
  5827. return format.replace(new RegExp('{[0-9a-z-]+}', 'gi'), function(match) {
  5828. return args[match.slice(1, -1)] || match;
  5829. });
  5830. }
  5831. exports.TreeBuilder = TreeBuilder;
  5832. },
  5833. {"./ElementStack":1,"./StackItem":4,"./Tokenizer":5,"./constants":7,"./messages.json":8,"assert":13,"events":16}],
  5834. 7:[function(_dereq_,module,exports){
  5835. exports.SVGTagMap = {
  5836. "altglyph": "altGlyph",
  5837. "altglyphdef": "altGlyphDef",
  5838. "altglyphitem": "altGlyphItem",
  5839. "animatecolor": "animateColor",
  5840. "animatemotion": "animateMotion",
  5841. "animatetransform": "animateTransform",
  5842. "clippath": "clipPath",
  5843. "feblend": "feBlend",
  5844. "fecolormatrix": "feColorMatrix",
  5845. "fecomponenttransfer": "feComponentTransfer",
  5846. "fecomposite": "feComposite",
  5847. "feconvolvematrix": "feConvolveMatrix",
  5848. "fediffuselighting": "feDiffuseLighting",
  5849. "fedisplacementmap": "feDisplacementMap",
  5850. "fedistantlight": "feDistantLight",
  5851. "feflood": "feFlood",
  5852. "fefunca": "feFuncA",
  5853. "fefuncb": "feFuncB",
  5854. "fefuncg": "feFuncG",
  5855. "fefuncr": "feFuncR",
  5856. "fegaussianblur": "feGaussianBlur",
  5857. "feimage": "feImage",
  5858. "femerge": "feMerge",
  5859. "femergenode": "feMergeNode",
  5860. "femorphology": "feMorphology",
  5861. "feoffset": "feOffset",
  5862. "fepointlight": "fePointLight",
  5863. "fespecularlighting": "feSpecularLighting",
  5864. "fespotlight": "feSpotLight",
  5865. "fetile": "feTile",
  5866. "feturbulence": "feTurbulence",
  5867. "foreignobject": "foreignObject",
  5868. "glyphref": "glyphRef",
  5869. "lineargradient": "linearGradient",
  5870. "radialgradient": "radialGradient",
  5871. "textpath": "textPath"
  5872. };
  5873. exports.MATHMLAttributeMap = {
  5874. definitionurl: 'definitionURL'
  5875. };
  5876. exports.SVGAttributeMap = {
  5877. attributename: 'attributeName',
  5878. attributetype: 'attributeType',
  5879. basefrequency: 'baseFrequency',
  5880. baseprofile: 'baseProfile',
  5881. calcmode: 'calcMode',
  5882. clippathunits: 'clipPathUnits',
  5883. contentscripttype: 'contentScriptType',
  5884. contentstyletype: 'contentStyleType',
  5885. diffuseconstant: 'diffuseConstant',
  5886. edgemode: 'edgeMode',
  5887. externalresourcesrequired: 'externalResourcesRequired',
  5888. filterres: 'filterRes',
  5889. filterunits: 'filterUnits',
  5890. glyphref: 'glyphRef',
  5891. gradienttransform: 'gradientTransform',
  5892. gradientunits: 'gradientUnits',
  5893. kernelmatrix: 'kernelMatrix',
  5894. kernelunitlength: 'kernelUnitLength',
  5895. keypoints: 'keyPoints',
  5896. keysplines: 'keySplines',
  5897. keytimes: 'keyTimes',
  5898. lengthadjust: 'lengthAdjust',
  5899. limitingconeangle: 'limitingConeAngle',
  5900. markerheight: 'markerHeight',
  5901. markerunits: 'markerUnits',
  5902. markerwidth: 'markerWidth',
  5903. maskcontentunits: 'maskContentUnits',
  5904. maskunits: 'maskUnits',
  5905. numoctaves: 'numOctaves',
  5906. pathlength: 'pathLength',
  5907. patterncontentunits: 'patternContentUnits',
  5908. patterntransform: 'patternTransform',
  5909. patternunits: 'patternUnits',
  5910. pointsatx: 'pointsAtX',
  5911. pointsaty: 'pointsAtY',
  5912. pointsatz: 'pointsAtZ',
  5913. preservealpha: 'preserveAlpha',
  5914. preserveaspectratio: 'preserveAspectRatio',
  5915. primitiveunits: 'primitiveUnits',
  5916. refx: 'refX',
  5917. refy: 'refY',
  5918. repeatcount: 'repeatCount',
  5919. repeatdur: 'repeatDur',
  5920. requiredextensions: 'requiredExtensions',
  5921. requiredfeatures: 'requiredFeatures',
  5922. specularconstant: 'specularConstant',
  5923. specularexponent: 'specularExponent',
  5924. spreadmethod: 'spreadMethod',
  5925. startoffset: 'startOffset',
  5926. stddeviation: 'stdDeviation',
  5927. stitchtiles: 'stitchTiles',
  5928. surfacescale: 'surfaceScale',
  5929. systemlanguage: 'systemLanguage',
  5930. tablevalues: 'tableValues',
  5931. targetx: 'targetX',
  5932. targety: 'targetY',
  5933. textlength: 'textLength',
  5934. viewbox: 'viewBox',
  5935. viewtarget: 'viewTarget',
  5936. xchannelselector: 'xChannelSelector',
  5937. ychannelselector: 'yChannelSelector',
  5938. zoomandpan: 'zoomAndPan'
  5939. };
  5940. exports.ForeignAttributeMap = {
  5941. "xlink:actuate": {prefix: "xlink", localName: "actuate", namespaceURI: "http://www.w3.org/1999/xlink"},
  5942. "xlink:arcrole": {prefix: "xlink", localName: "arcrole", namespaceURI: "http://www.w3.org/1999/xlink"},
  5943. "xlink:href": {prefix: "xlink", localName: "href", namespaceURI: "http://www.w3.org/1999/xlink"},
  5944. "xlink:role": {prefix: "xlink", localName: "role", namespaceURI: "http://www.w3.org/1999/xlink"},
  5945. "xlink:show": {prefix: "xlink", localName: "show", namespaceURI: "http://www.w3.org/1999/xlink"},
  5946. "xlink:title": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"},
  5947. "xlink:type": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"},
  5948. "xml:base": {prefix: "xml", localName: "base", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5949. "xml:lang": {prefix: "xml", localName: "lang", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5950. "xml:space": {prefix: "xml", localName: "space", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5951. "xmlns": {prefix: null, localName: "xmlns", namespaceURI: "http://www.w3.org/2000/xmlns/"},
  5952. "xmlns:xlink": {prefix: "xmlns", localName: "xlink", namespaceURI: "http://www.w3.org/2000/xmlns/"},
  5953. };
  5954. },
  5955. {}],
  5956. 8:[function(_dereq_,module,exports){
  5957. module.exports={
  5958. "null-character":
  5959. "Null character in input stream, replaced with U+FFFD.",
  5960. "invalid-codepoint":
  5961. "Invalid codepoint in stream",
  5962. "incorrectly-placed-solidus":
  5963. "Solidus (/) incorrectly placed in tag.",
  5964. "incorrect-cr-newline-entity":
  5965. "Incorrect CR newline entity, replaced with LF.",
  5966. "illegal-windows-1252-entity":
  5967. "Entity used with illegal number (windows-1252 reference).",
  5968. "cant-convert-numeric-entity":
  5969. "Numeric entity couldn't be converted to character (codepoint U+{charAsInt}).",
  5970. "invalid-numeric-entity-replaced":
  5971. "Numeric entity represents an illegal codepoint. Expanded to the C1 controls range.",
  5972. "numeric-entity-without-semicolon":
  5973. "Numeric entity didn't end with ';'.",
  5974. "expected-numeric-entity-but-got-eof":
  5975. "Numeric entity expected. Got end of file instead.",
  5976. "expected-numeric-entity":
  5977. "Numeric entity expected but none found.",
  5978. "named-entity-without-semicolon":
  5979. "Named entity didn't end with ';'.",
  5980. "expected-named-entity":
  5981. "Named entity expected. Got none.",
  5982. "attributes-in-end-tag":
  5983. "End tag contains unexpected attributes.",
  5984. "self-closing-flag-on-end-tag":
  5985. "End tag contains unexpected self-closing flag.",
  5986. "bare-less-than-sign-at-eof":
  5987. "End of file after <.",
  5988. "expected-tag-name-but-got-right-bracket":
  5989. "Expected tag name. Got '>' instead.",
  5990. "expected-tag-name-but-got-question-mark":
  5991. "Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)",
  5992. "expected-tag-name":
  5993. "Expected tag name. Got something else instead.",
  5994. "expected-closing-tag-but-got-right-bracket":
  5995. "Expected closing tag. Got '>' instead. Ignoring '</>'.",
  5996. "expected-closing-tag-but-got-eof":
  5997. "Expected closing tag. Unexpected end of file.",
  5998. "expected-closing-tag-but-got-char":
  5999. "Expected closing tag. Unexpected character '{data}' found.",
  6000. "eof-in-tag-name":
  6001. "Unexpected end of file in the tag name.",
  6002. "expected-attribute-name-but-got-eof":
  6003. "Unexpected end of file. Expected attribute name instead.",
  6004. "eof-in-attribute-name":
  6005. "Unexpected end of file in attribute name.",
  6006. "invalid-character-in-attribute-name":
  6007. "Invalid character in attribute name.",
  6008. "duplicate-attribute":
  6009. "Dropped duplicate attribute '{name}' on tag.",
  6010. "expected-end-of-tag-but-got-eof":
  6011. "Unexpected end of file. Expected = or end of tag.",
  6012. "expected-attribute-value-but-got-eof":
  6013. "Unexpected end of file. Expected attribute value.",
  6014. "expected-attribute-value-but-got-right-bracket":
  6015. "Expected attribute value. Got '>' instead.",
  6016. "unexpected-character-in-unquoted-attribute-value":
  6017. "Unexpected character in unquoted attribute",
  6018. "invalid-character-after-attribute-name":
  6019. "Unexpected character after attribute name.",
  6020. "unexpected-character-after-attribute-value":
  6021. "Unexpected character after attribute value.",
  6022. "eof-in-attribute-value-double-quote":
  6023. "Unexpected end of file in attribute value (\").",
  6024. "eof-in-attribute-value-single-quote":
  6025. "Unexpected end of file in attribute value (').",
  6026. "eof-in-attribute-value-no-quotes":
  6027. "Unexpected end of file in attribute value.",
  6028. "eof-after-attribute-value":
  6029. "Unexpected end of file after attribute value.",
  6030. "unexpected-eof-after-solidus-in-tag":
  6031. "Unexpected end of file in tag. Expected >.",
  6032. "unexpected-character-after-solidus-in-tag":
  6033. "Unexpected character after / in tag. Expected >.",
  6034. "expected-dashes-or-doctype":
  6035. "Expected '--' or 'DOCTYPE'. Not found.",
  6036. "unexpected-bang-after-double-dash-in-comment":
  6037. "Unexpected ! after -- in comment.",
  6038. "incorrect-comment":
  6039. "Incorrect comment.",
  6040. "eof-in-comment":
  6041. "Unexpected end of file in comment.",
  6042. "eof-in-comment-end-dash":
  6043. "Unexpected end of file in comment (-).",
  6044. "unexpected-dash-after-double-dash-in-comment":
  6045. "Unexpected '-' after '--' found in comment.",
  6046. "eof-in-comment-double-dash":
  6047. "Unexpected end of file in comment (--).",
  6048. "eof-in-comment-end-bang-state":
  6049. "Unexpected end of file in comment.",
  6050. "unexpected-char-in-comment":
  6051. "Unexpected character in comment found.",
  6052. "need-space-after-doctype":
  6053. "No space after literal string 'DOCTYPE'.",
  6054. "expected-doctype-name-but-got-right-bracket":
  6055. "Unexpected > character. Expected DOCTYPE name.",
  6056. "expected-doctype-name-but-got-eof":
  6057. "Unexpected end of file. Expected DOCTYPE name.",
  6058. "eof-in-doctype-name":
  6059. "Unexpected end of file in DOCTYPE name.",
  6060. "eof-in-doctype":
  6061. "Unexpected end of file in DOCTYPE.",
  6062. "expected-space-or-right-bracket-in-doctype":
  6063. "Expected space or '>'. Got '{data}'.",
  6064. "unexpected-end-of-doctype":
  6065. "Unexpected end of DOCTYPE.",
  6066. "unexpected-char-in-doctype":
  6067. "Unexpected character in DOCTYPE.",
  6068. "eof-in-bogus-doctype":
  6069. "Unexpected end of file in bogus doctype.",
  6070. "eof-in-innerhtml":
  6071. "Unexpected EOF in inner html mode.",
  6072. "unexpected-doctype":
  6073. "Unexpected DOCTYPE. Ignored.",
  6074. "non-html-root":
  6075. "html needs to be the first start tag.",
  6076. "expected-doctype-but-got-eof":
  6077. "Unexpected End of file. Expected DOCTYPE.",
  6078. "unknown-doctype":
  6079. "Erroneous DOCTYPE. Expected <!DOCTYPE html>.",
  6080. "quirky-doctype":
  6081. "Quirky doctype. Expected <!DOCTYPE html>.",
  6082. "almost-standards-doctype":
  6083. "Almost standards mode doctype. Expected <!DOCTYPE html>.",
  6084. "obsolete-doctype":
  6085. "Obsolete doctype. Expected <!DOCTYPE html>.",
  6086. "expected-doctype-but-got-chars":
  6087. "Non-space characters found without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6088. "expected-doctype-but-got-start-tag":
  6089. "Start tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6090. "expected-doctype-but-got-end-tag":
  6091. "End tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6092. "end-tag-after-implied-root":
  6093. "Unexpected end tag ({name}) after the (implied) root element.",
  6094. "expected-named-closing-tag-but-got-eof":
  6095. "Unexpected end of file. Expected end tag ({name}).",
  6096. "two-heads-are-not-better-than-one":
  6097. "Unexpected start tag head in existing head. Ignored.",
  6098. "unexpected-end-tag":
  6099. "Unexpected end tag ({name}). Ignored.",
  6100. "unexpected-implied-end-tag":
  6101. "End tag {name} implied, but there were open elements.",
  6102. "unexpected-start-tag-out-of-my-head":
  6103. "Unexpected start tag ({name}) that can be in head. Moved.",
  6104. "unexpected-start-tag":
  6105. "Unexpected start tag ({name}).",
  6106. "missing-end-tag":
  6107. "Missing end tag ({name}).",
  6108. "missing-end-tags":
  6109. "Missing end tags ({name}).",
  6110. "unexpected-start-tag-implies-end-tag":
  6111. "Unexpected start tag ({startName}) implies end tag ({endName}).",
  6112. "unexpected-start-tag-treated-as":
  6113. "Unexpected start tag ({originalName}). Treated as {newName}.",
  6114. "deprecated-tag":
  6115. "Unexpected start tag {name}. Don't use it!",
  6116. "unexpected-start-tag-ignored":
  6117. "Unexpected start tag {name}. Ignored.",
  6118. "expected-one-end-tag-but-got-another":
  6119. "Unexpected end tag ({gotName}). Missing end tag ({expectedName}).",
  6120. "end-tag-too-early":
  6121. "End tag ({name}) seen too early. Expected other end tag.",
  6122. "end-tag-too-early-named":
  6123. "Unexpected end tag ({gotName}). Expected end tag ({expectedName}.",
  6124. "end-tag-too-early-ignored":
  6125. "End tag ({name}) seen too early. Ignored.",
  6126. "adoption-agency-1.1":
  6127. "End tag ({name}) violates step 1, paragraph 1 of the adoption agency algorithm.",
  6128. "adoption-agency-1.2":
  6129. "End tag ({name}) violates step 1, paragraph 2 of the adoption agency algorithm.",
  6130. "adoption-agency-1.3":
  6131. "End tag ({name}) violates step 1, paragraph 3 of the adoption agency algorithm.",
  6132. "adoption-agency-4.4":
  6133. "End tag ({name}) violates step 4, paragraph 4 of the adoption agency algorithm.",
  6134. "unexpected-end-tag-treated-as":
  6135. "Unexpected end tag ({originalName}). Treated as {newName}.",
  6136. "no-end-tag":
  6137. "This element ({name}) has no end tag.",
  6138. "unexpected-implied-end-tag-in-table":
  6139. "Unexpected implied end tag ({name}) in the table phase.",
  6140. "unexpected-implied-end-tag-in-table-body":
  6141. "Unexpected implied end tag ({name}) in the table body phase.",
  6142. "unexpected-char-implies-table-voodoo":
  6143. "Unexpected non-space characters in table context caused voodoo mode.",
  6144. "unexpected-hidden-input-in-table":
  6145. "Unexpected input with type hidden in table context.",
  6146. "unexpected-form-in-table":
  6147. "Unexpected form in table context.",
  6148. "unexpected-start-tag-implies-table-voodoo":
  6149. "Unexpected start tag ({name}) in table context caused voodoo mode.",
  6150. "unexpected-end-tag-implies-table-voodoo":
  6151. "Unexpected end tag ({name}) in table context caused voodoo mode.",
  6152. "unexpected-cell-in-table-body":
  6153. "Unexpected table cell start tag ({name}) in the table body phase.",
  6154. "unexpected-cell-end-tag":
  6155. "Got table cell end tag ({name}) while required end tags are missing.",
  6156. "unexpected-end-tag-in-table-body":
  6157. "Unexpected end tag ({name}) in the table body phase. Ignored.",
  6158. "unexpected-implied-end-tag-in-table-row":
  6159. "Unexpected implied end tag ({name}) in the table row phase.",
  6160. "unexpected-end-tag-in-table-row":
  6161. "Unexpected end tag ({name}) in the table row phase. Ignored.",
  6162. "unexpected-select-in-select":
  6163. "Unexpected select start tag in the select phase treated as select end tag.",
  6164. "unexpected-input-in-select":
  6165. "Unexpected input start tag in the select phase.",
  6166. "unexpected-start-tag-in-select":
  6167. "Unexpected start tag token ({name}) in the select phase. Ignored.",
  6168. "unexpected-end-tag-in-select":
  6169. "Unexpected end tag ({name}) in the select phase. Ignored.",
  6170. "unexpected-table-element-start-tag-in-select-in-table":
  6171. "Unexpected table element start tag ({name}) in the select in table phase.",
  6172. "unexpected-table-element-end-tag-in-select-in-table":
  6173. "Unexpected table element end tag ({name}) in the select in table phase.",
  6174. "unexpected-char-after-body":
  6175. "Unexpected non-space characters in the after body phase.",
  6176. "unexpected-start-tag-after-body":
  6177. "Unexpected start tag token ({name}) in the after body phase.",
  6178. "unexpected-end-tag-after-body":
  6179. "Unexpected end tag token ({name}) in the after body phase.",
  6180. "unexpected-char-in-frameset":
  6181. "Unepxected characters in the frameset phase. Characters ignored.",
  6182. "unexpected-start-tag-in-frameset":
  6183. "Unexpected start tag token ({name}) in the frameset phase. Ignored.",
  6184. "unexpected-frameset-in-frameset-innerhtml":
  6185. "Unexpected end tag token (frameset in the frameset phase (innerHTML).",
  6186. "unexpected-end-tag-in-frameset":
  6187. "Unexpected end tag token ({name}) in the frameset phase. Ignored.",
  6188. "unexpected-char-after-frameset":
  6189. "Unexpected non-space characters in the after frameset phase. Ignored.",
  6190. "unexpected-start-tag-after-frameset":
  6191. "Unexpected start tag ({name}) in the after frameset phase. Ignored.",
  6192. "unexpected-end-tag-after-frameset":
  6193. "Unexpected end tag ({name}) in the after frameset phase. Ignored.",
  6194. "expected-eof-but-got-char":
  6195. "Unexpected non-space characters. Expected end of file.",
  6196. "expected-eof-but-got-start-tag":
  6197. "Unexpected start tag ({name}). Expected end of file.",
  6198. "expected-eof-but-got-end-tag":
  6199. "Unexpected end tag ({name}). Expected end of file.",
  6200. "unexpected-end-table-in-caption":
  6201. "Unexpected end table tag in caption. Generates implied end caption.",
  6202. "end-html-in-innerhtml":
  6203. "Unexpected html end tag in inner html mode.",
  6204. "eof-in-table":
  6205. "Unexpected end of file. Expected table content.",
  6206. "eof-in-script":
  6207. "Unexpected end of file. Expected script content.",
  6208. "non-void-element-with-trailing-solidus":
  6209. "Trailing solidus not allowed on element {name}.",
  6210. "unexpected-html-element-in-foreign-content":
  6211. "HTML start tag \"{name}\" in a foreign namespace context.",
  6212. "unexpected-start-tag-in-table":
  6213. "Unexpected {name}. Expected table content."
  6214. }
  6215. },
  6216. {}],
  6217. 9:[function(_dereq_,module,exports){
  6218. var SAXTreeBuilder = _dereq_('./SAXTreeBuilder').SAXTreeBuilder;
  6219. var Tokenizer = _dereq_('../Tokenizer').Tokenizer;
  6220. var TreeParser = _dereq_('./TreeParser').TreeParser;
  6221. function SAXParser() {
  6222. this.contentHandler = null;
  6223. this._errorHandler = null;
  6224. this._treeBuilder = new SAXTreeBuilder();
  6225. this._tokenizer = new Tokenizer(this._treeBuilder);
  6226. this._scriptingEnabled = false;
  6227. }
  6228. SAXParser.prototype.parse = function(source) {
  6229. this._tokenizer.tokenize(source);
  6230. var document = this._treeBuilder.document;
  6231. if (document) {
  6232. new TreeParser(this.contentHandler).parse(document);
  6233. }
  6234. };
  6235. SAXParser.prototype.parseFragment = function(source, context) {
  6236. this._treeBuilder.setFragmentContext(context);
  6237. this._tokenizer.tokenize(source);
  6238. var fragment = this._treeBuilder.getFragment();
  6239. if (fragment) {
  6240. new TreeParser(this.contentHandler).parse(fragment);
  6241. }
  6242. };
  6243. Object.defineProperty(SAXParser.prototype, 'scriptingEnabled', {
  6244. get: function() {
  6245. return this._scriptingEnabled;
  6246. },
  6247. set: function(value) {
  6248. this._scriptingEnabled = value;
  6249. this._treeBuilder.scriptingEnabled = value;
  6250. }
  6251. });
  6252. Object.defineProperty(SAXParser.prototype, 'errorHandler', {
  6253. get: function() {
  6254. return this._errorHandler;
  6255. },
  6256. set: function(value) {
  6257. this._errorHandler = value;
  6258. this._treeBuilder.errorHandler = value;
  6259. }
  6260. });
  6261. exports.SAXParser = SAXParser;
  6262. },
  6263. {"../Tokenizer":5,"./SAXTreeBuilder":10,"./TreeParser":11}],
  6264. 10:[function(_dereq_,module,exports){
  6265. var util = _dereq_('util');
  6266. var TreeBuilder = _dereq_('../TreeBuilder').TreeBuilder;
  6267. function SAXTreeBuilder() {
  6268. TreeBuilder.call(this);
  6269. }
  6270. util.inherits(SAXTreeBuilder, TreeBuilder);
  6271. SAXTreeBuilder.prototype.start = function(tokenizer) {
  6272. this.document = new Document(this.tokenizer);
  6273. };
  6274. SAXTreeBuilder.prototype.end = function() {
  6275. this.document.endLocator = this.tokenizer;
  6276. };
  6277. SAXTreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) {
  6278. var doctype = new DTD(this.tokenizer, name, publicId, systemId);
  6279. doctype.endLocator = this.tokenizer;
  6280. this.document.appendChild(doctype);
  6281. };
  6282. SAXTreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) {
  6283. var element = new Element(this.tokenizer, namespaceURI, localName, localName, attributes || []);
  6284. return element;
  6285. };
  6286. SAXTreeBuilder.prototype.insertComment = function(data, parent) {
  6287. if (!parent)
  6288. parent = this.currentStackItem();
  6289. var comment = new Comment(this.tokenizer, data);
  6290. parent.appendChild(comment);
  6291. };
  6292. SAXTreeBuilder.prototype.appendCharacters = function(parent, data) {
  6293. var text = new Characters(this.tokenizer, data);
  6294. parent.appendChild(text);
  6295. };
  6296. SAXTreeBuilder.prototype.insertText = function(data) {
  6297. if (this.redirectAttachToFosterParent && this.openElements.top.isFosterParenting()) {
  6298. var tableIndex = this.openElements.findIndex('table');
  6299. var tableItem = this.openElements.item(tableIndex);
  6300. var table = tableItem.node;
  6301. if (tableIndex === 0) {
  6302. return this.appendCharacters(table, data);
  6303. }
  6304. var text = new Characters(this.tokenizer, data);
  6305. var parent = table.parentNode;
  6306. if (parent) {
  6307. parent.insertBetween(text, table.previousSibling, table);
  6308. return;
  6309. }
  6310. var stackParent = this.openElements.item(tableIndex - 1).node;
  6311. stackParent.appendChild(text);
  6312. return;
  6313. }
  6314. this.appendCharacters(this.currentStackItem().node, data);
  6315. };
  6316. SAXTreeBuilder.prototype.attachNode = function(node, parent) {
  6317. parent.appendChild(node);
  6318. };
  6319. SAXTreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) {
  6320. var parent = table.parentNode;
  6321. if (parent)
  6322. parent.insertBetween(child, table.previousSibling, table);
  6323. else
  6324. stackParent.appendChild(child);
  6325. };
  6326. SAXTreeBuilder.prototype.detachFromParent = function(element) {
  6327. element.detach();
  6328. };
  6329. SAXTreeBuilder.prototype.reparentChildren = function(oldParent, newParent) {
  6330. newParent.appendChildren(oldParent.firstChild);
  6331. };
  6332. SAXTreeBuilder.prototype.getFragment = function() {
  6333. var fragment = new DocumentFragment();
  6334. this.reparentChildren(this.openElements.rootNode, fragment);
  6335. return fragment;
  6336. };
  6337. function getAttribute(node, name) {
  6338. for (var i = 0; i < node.attributes.length; i++) {
  6339. var attribute = node.attributes[i];
  6340. if (attribute.nodeName === name)
  6341. return attribute.nodeValue;
  6342. }
  6343. }
  6344. SAXTreeBuilder.prototype.addAttributesToElement = function(element, attributes) {
  6345. for (var i = 0; i < attributes.length; i++) {
  6346. var attribute = attributes[i];
  6347. if (!getAttribute(element, attribute.nodeName))
  6348. element.attributes.push(attribute);
  6349. }
  6350. };
  6351. var NodeType = {
  6352. CDATA: 1,
  6353. CHARACTERS: 2,
  6354. COMMENT: 3,
  6355. DOCUMENT: 4,
  6356. DOCUMENT_FRAGMENT: 5,
  6357. DTD: 6,
  6358. ELEMENT: 7,
  6359. ENTITY: 8,
  6360. IGNORABLE_WHITESPACE: 9,
  6361. PROCESSING_INSTRUCTION: 10,
  6362. SKIPPED_ENTITY: 11
  6363. };
  6364. function Node(locator) {
  6365. if (!locator) {
  6366. this.columnNumber = -1;
  6367. this.lineNumber = -1;
  6368. } else {
  6369. this.columnNumber = locator.columnNumber;
  6370. this.lineNumber = locator.lineNumber;
  6371. }
  6372. this.parentNode = null;
  6373. this.nextSibling = null;
  6374. this.firstChild = null;
  6375. }
  6376. Node.prototype.visit = function(treeParser) {
  6377. throw new Error("Not Implemented");
  6378. };
  6379. Node.prototype.revisit = function(treeParser) {
  6380. return;
  6381. };
  6382. Node.prototype.detach = function() {
  6383. if (this.parentNode !== null) {
  6384. this.parentNode.removeChild(this);
  6385. this.parentNode = null;
  6386. }
  6387. };
  6388. Object.defineProperty(Node.prototype, 'previousSibling', {
  6389. get: function() {
  6390. var prev = null;
  6391. var next = this.parentNode.firstChild;
  6392. for(;;) {
  6393. if (this == next) {
  6394. return prev;
  6395. }
  6396. prev = next;
  6397. next = next.nextSibling;
  6398. }
  6399. }
  6400. });
  6401. function ParentNode(locator) {
  6402. Node.call(this, locator);
  6403. this.lastChild = null;
  6404. this._endLocator = null;
  6405. }
  6406. ParentNode.prototype = Object.create(Node.prototype);
  6407. ParentNode.prototype.insertBefore = function(child, sibling) {
  6408. if (!sibling) {
  6409. return this.appendChild(child);
  6410. }
  6411. child.detach();
  6412. child.parentNode = this;
  6413. if (this.firstChild == sibling) {
  6414. child.nextSibling = sibling;
  6415. this.firstChild = child;
  6416. } else {
  6417. var prev = this.firstChild;
  6418. var next = this.firstChild.nextSibling;
  6419. while (next != sibling) {
  6420. prev = next;
  6421. next = next.nextSibling;
  6422. }
  6423. prev.nextSibling = child;
  6424. child.nextSibling = next;
  6425. }
  6426. return child;
  6427. };
  6428. ParentNode.prototype.insertBetween = function(child, prev, next) {
  6429. if (!next) {
  6430. return this.appendChild(child);
  6431. }
  6432. child.detach();
  6433. child.parentNode = this;
  6434. child.nextSibling = next;
  6435. if (!prev) {
  6436. firstChild = child;
  6437. } else {
  6438. prev.nextSibling = child;
  6439. }
  6440. return child;
  6441. };
  6442. ParentNode.prototype.appendChild = function(child) {
  6443. child.detach();
  6444. child.parentNode = this;
  6445. if (!this.firstChild) {
  6446. this.firstChild = child;
  6447. } else {
  6448. this.lastChild.nextSibling = child;
  6449. }
  6450. this.lastChild = child;
  6451. return child;
  6452. };
  6453. ParentNode.prototype.appendChildren = function(parent) {
  6454. var child = parent.firstChild;
  6455. if (!child) {
  6456. return;
  6457. }
  6458. var another = parent;
  6459. if (!this.firstChild) {
  6460. this.firstChild = child;
  6461. } else {
  6462. this.lastChild.nextSibling = child;
  6463. }
  6464. this.lastChild = another.lastChild;
  6465. do {
  6466. child.parentNode = this;
  6467. } while ((child = child.nextSibling));
  6468. another.firstChild = null;
  6469. another.lastChild = null;
  6470. };
  6471. ParentNode.prototype.removeChild = function(node) {
  6472. if (this.firstChild == node) {
  6473. this.firstChild = node.nextSibling;
  6474. if (this.lastChild == node) {
  6475. this.lastChild = null;
  6476. }
  6477. } else {
  6478. var prev = this.firstChild;
  6479. var next = this.firstChild.nextSibling;
  6480. while (next != node) {
  6481. prev = next;
  6482. next = next.nextSibling;
  6483. }
  6484. prev.nextSibling = node.nextSibling;
  6485. if (this.lastChild == node) {
  6486. this.lastChild = prev;
  6487. }
  6488. }
  6489. node.parentNode = null;
  6490. return node;
  6491. };
  6492. Object.defineProperty(ParentNode.prototype, 'endLocator', {
  6493. get: function() {
  6494. return this._endLocator;
  6495. },
  6496. set: function(endLocator) {
  6497. this._endLocator = {
  6498. lineNumber: endLocator.lineNumber,
  6499. columnNumber: endLocator.columnNumber
  6500. };
  6501. }
  6502. });
  6503. function Document (locator) {
  6504. ParentNode.call(this, locator);
  6505. this.nodeType = NodeType.DOCUMENT;
  6506. }
  6507. Document.prototype = Object.create(ParentNode.prototype);
  6508. Document.prototype.visit = function(treeParser) {
  6509. treeParser.startDocument(this);
  6510. };
  6511. Document.prototype.revisit = function(treeParser) {
  6512. treeParser.endDocument(this.endLocator);
  6513. };
  6514. function DocumentFragment() {
  6515. ParentNode.call(this, new Locator());
  6516. this.nodeType = NodeType.DOCUMENT_FRAGMENT;
  6517. }
  6518. DocumentFragment.prototype = Object.create(ParentNode.prototype);
  6519. DocumentFragment.prototype.visit = function(treeParser) {
  6520. };
  6521. function Element(locator, uri, localName, qName, atts, prefixMappings) {
  6522. ParentNode.call(this, locator);
  6523. this.uri = uri;
  6524. this.localName = localName;
  6525. this.qName = qName;
  6526. this.attributes = atts;
  6527. this.prefixMappings = prefixMappings;
  6528. this.nodeType = NodeType.ELEMENT;
  6529. }
  6530. Element.prototype = Object.create(ParentNode.prototype);
  6531. Element.prototype.visit = function(treeParser) {
  6532. if (this.prefixMappings) {
  6533. for (var key in prefixMappings) {
  6534. var mapping = prefixMappings[key];
  6535. treeParser.startPrefixMapping(mapping.getPrefix(),
  6536. mapping.getUri(), this);
  6537. }
  6538. }
  6539. treeParser.startElement(this.uri, this.localName, this.qName, this.attributes, this);
  6540. };
  6541. Element.prototype.revisit = function(treeParser) {
  6542. treeParser.endElement(this.uri, this.localName, this.qName, this.endLocator);
  6543. if (this.prefixMappings) {
  6544. for (var key in prefixMappings) {
  6545. var mapping = prefixMappings[key];
  6546. treeParser.endPrefixMapping(mapping.getPrefix(), this.endLocator);
  6547. }
  6548. }
  6549. };
  6550. function Characters(locator, data){
  6551. Node.call(this, locator);
  6552. this.data = data;
  6553. this.nodeType = NodeType.CHARACTERS;
  6554. }
  6555. Characters.prototype = Object.create(Node.prototype);
  6556. Characters.prototype.visit = function (treeParser) {
  6557. treeParser.characters(this.data, 0, this.data.length, this);
  6558. };
  6559. function IgnorableWhitespace(locator, data) {
  6560. Node.call(this, locator);
  6561. this.data = data;
  6562. this.nodeType = NodeType.IGNORABLE_WHITESPACE;
  6563. }
  6564. IgnorableWhitespace.prototype = Object.create(Node.prototype);
  6565. IgnorableWhitespace.prototype.visit = function(treeParser) {
  6566. treeParser.ignorableWhitespace(this.data, 0, this.data.length, this);
  6567. };
  6568. function Comment(locator, data) {
  6569. Node.call(this, locator);
  6570. this.data = data;
  6571. this.nodeType = NodeType.COMMENT;
  6572. }
  6573. Comment.prototype = Object.create(Node.prototype);
  6574. Comment.prototype.visit = function(treeParser) {
  6575. treeParser.comment(this.data, 0, this.data.length, this);
  6576. };
  6577. function CDATA(locator) {
  6578. ParentNode.call(this, locator);
  6579. this.nodeType = NodeType.CDATA;
  6580. }
  6581. CDATA.prototype = Object.create(ParentNode.prototype);
  6582. CDATA.prototype.visit = function(treeParser) {
  6583. treeParser.startCDATA(this);
  6584. };
  6585. CDATA.prototype.revisit = function(treeParser) {
  6586. treeParser.endCDATA(this.endLocator);
  6587. };
  6588. function Entity(name) {
  6589. ParentNode.call(this);
  6590. this.name = name;
  6591. this.nodeType = NodeType.ENTITY;
  6592. }
  6593. Entity.prototype = Object.create(ParentNode.prototype);
  6594. Entity.prototype.visit = function(treeParser) {
  6595. treeParser.startEntity(this.name, this);
  6596. };
  6597. Entity.prototype.revisit = function(treeParser) {
  6598. treeParser.endEntity(this.name);
  6599. };
  6600. function SkippedEntity(name) {
  6601. Node.call(this);
  6602. this.name = name;
  6603. this.nodeType = NodeType.SKIPPED_ENTITY;
  6604. }
  6605. SkippedEntity.prototype = Object.create(Node.prototype);
  6606. SkippedEntity.prototype.visit = function(treeParser) {
  6607. treeParser.skippedEntity(this.name, this);
  6608. };
  6609. function ProcessingInstruction(target, data) {
  6610. Node.call(this);
  6611. this.target = target;
  6612. this.data = data;
  6613. }
  6614. ProcessingInstruction.prototype = Object.create(Node.prototype);
  6615. ProcessingInstruction.prototype.visit = function(treeParser) {
  6616. treeParser.processingInstruction(this.target, this.data, this);
  6617. };
  6618. ProcessingInstruction.prototype.getNodeType = function() {
  6619. return NodeType.PROCESSING_INSTRUCTION;
  6620. };
  6621. function DTD(name, publicIdentifier, systemIdentifier) {
  6622. ParentNode.call(this);
  6623. this.name = name;
  6624. this.publicIdentifier = publicIdentifier;
  6625. this.systemIdentifier = systemIdentifier;
  6626. this.nodeType = NodeType.DTD;
  6627. }
  6628. DTD.prototype = Object.create(ParentNode.prototype);
  6629. DTD.prototype.visit = function(treeParser) {
  6630. treeParser.startDTD(this.name, this.publicIdentifier, this.systemIdentifier, this);
  6631. };
  6632. DTD.prototype.revisit = function(treeParser) {
  6633. treeParser.endDTD();
  6634. };
  6635. exports.SAXTreeBuilder = SAXTreeBuilder;
  6636. },
  6637. {"../TreeBuilder":6,"util":20}],
  6638. 11:[function(_dereq_,module,exports){
  6639. function TreeParser(contentHandler, lexicalHandler){
  6640. this.contentHandler;
  6641. this.lexicalHandler;
  6642. this.locatorDelegate;
  6643. if (!contentHandler) {
  6644. throw new IllegalArgumentException("contentHandler was null.");
  6645. }
  6646. this.contentHandler = contentHandler;
  6647. if (!lexicalHandler) {
  6648. this.lexicalHandler = new NullLexicalHandler();
  6649. } else {
  6650. this.lexicalHandler = lexicalHandler;
  6651. }
  6652. }
  6653. TreeParser.prototype.parse = function(node) {
  6654. this.contentHandler.documentLocator = this;
  6655. var current = node;
  6656. var next;
  6657. for (;;) {
  6658. current.visit(this);
  6659. if (next = current.firstChild) {
  6660. current = next;
  6661. continue;
  6662. }
  6663. for (;;) {
  6664. current.revisit(this);
  6665. if (current == node) {
  6666. return;
  6667. }
  6668. if (next = current.nextSibling) {
  6669. current = next;
  6670. break;
  6671. }
  6672. current = current.parentNode;
  6673. }
  6674. }
  6675. };
  6676. TreeParser.prototype.characters = function(ch, start, length, locator) {
  6677. this.locatorDelegate = locator;
  6678. this.contentHandler.characters(ch, start, length);
  6679. };
  6680. TreeParser.prototype.endDocument = function(locator) {
  6681. this.locatorDelegate = locator;
  6682. this.contentHandler.endDocument();
  6683. };
  6684. TreeParser.prototype.endElement = function(uri, localName, qName, locator) {
  6685. this.locatorDelegate = locator;
  6686. this.contentHandler.endElement(uri, localName, qName);
  6687. };
  6688. TreeParser.prototype.endPrefixMapping = function(prefix, locator) {
  6689. this.locatorDelegate = locator;
  6690. this.contentHandler.endPrefixMapping(prefix);
  6691. };
  6692. TreeParser.prototype.ignorableWhitespace = function(ch, start, length, locator) {
  6693. this.locatorDelegate = locator;
  6694. this.contentHandler.ignorableWhitespace(ch, start, length);
  6695. };
  6696. TreeParser.prototype.processingInstruction = function(target, data, locator) {
  6697. this.locatorDelegate = locator;
  6698. this.contentHandler.processingInstruction(target, data);
  6699. };
  6700. TreeParser.prototype.skippedEntity = function(name, locator) {
  6701. this.locatorDelegate = locator;
  6702. this.contentHandler.skippedEntity(name);
  6703. };
  6704. TreeParser.prototype.startDocument = function(locator) {
  6705. this.locatorDelegate = locator;
  6706. this.contentHandler.startDocument();
  6707. };
  6708. TreeParser.prototype.startElement = function(uri, localName, qName, atts, locator) {
  6709. this.locatorDelegate = locator;
  6710. this.contentHandler.startElement(uri, localName, qName, atts);
  6711. };
  6712. TreeParser.prototype.startPrefixMapping = function(prefix, uri, locator) {
  6713. this.locatorDelegate = locator;
  6714. this.contentHandler.startPrefixMapping(prefix, uri);
  6715. };
  6716. TreeParser.prototype.comment = function(ch, start, length, locator) {
  6717. this.locatorDelegate = locator;
  6718. this.lexicalHandler.comment(ch, start, length);
  6719. };
  6720. TreeParser.prototype.endCDATA = function(locator) {
  6721. this.locatorDelegate = locator;
  6722. this.lexicalHandler.endCDATA();
  6723. };
  6724. TreeParser.prototype.endDTD = function(locator) {
  6725. this.locatorDelegate = locator;
  6726. this.lexicalHandler.endDTD();
  6727. };
  6728. TreeParser.prototype.endEntity = function(name, locator) {
  6729. this.locatorDelegate = locator;
  6730. this.lexicalHandler.endEntity(name);
  6731. };
  6732. TreeParser.prototype.startCDATA = function(locator) {
  6733. this.locatorDelegate = locator;
  6734. this.lexicalHandler.startCDATA();
  6735. };
  6736. TreeParser.prototype.startDTD = function(name, publicId, systemId, locator) {
  6737. this.locatorDelegate = locator;
  6738. this.lexicalHandler.startDTD(name, publicId, systemId);
  6739. };
  6740. TreeParser.prototype.startEntity = function(name, locator) {
  6741. this.locatorDelegate = locator;
  6742. this.lexicalHandler.startEntity(name);
  6743. };
  6744. Object.defineProperty(TreeParser.prototype, 'columnNumber', {
  6745. get: function() {
  6746. if (!this.locatorDelegate)
  6747. return -1;
  6748. else
  6749. return this.locatorDelegate.columnNumber;
  6750. }
  6751. });
  6752. Object.defineProperty(TreeParser.prototype, 'lineNumber', {
  6753. get: function() {
  6754. if (!this.locatorDelegate)
  6755. return -1;
  6756. else
  6757. return this.locatorDelegate.lineNumber;
  6758. }
  6759. });
  6760. function NullLexicalHandler() {
  6761. }
  6762. NullLexicalHandler.prototype.comment = function() {};
  6763. NullLexicalHandler.prototype.endCDATA = function() {};
  6764. NullLexicalHandler.prototype.endDTD = function() {};
  6765. NullLexicalHandler.prototype.endEntity = function() {};
  6766. NullLexicalHandler.prototype.startCDATA = function() {};
  6767. NullLexicalHandler.prototype.startDTD = function() {};
  6768. NullLexicalHandler.prototype.startEntity = function() {};
  6769. exports.TreeParser = TreeParser;
  6770. },
  6771. {}],
  6772. 12:[function(_dereq_,module,exports){
  6773. module.exports = {
  6774. "Aacute;": "\u00C1",
  6775. "Aacute": "\u00C1",
  6776. "aacute;": "\u00E1",
  6777. "aacute": "\u00E1",
  6778. "Abreve;": "\u0102",
  6779. "abreve;": "\u0103",
  6780. "ac;": "\u223E",
  6781. "acd;": "\u223F",
  6782. "acE;": "\u223E\u0333",
  6783. "Acirc;": "\u00C2",
  6784. "Acirc": "\u00C2",
  6785. "acirc;": "\u00E2",
  6786. "acirc": "\u00E2",
  6787. "acute;": "\u00B4",
  6788. "acute": "\u00B4",
  6789. "Acy;": "\u0410",
  6790. "acy;": "\u0430",
  6791. "AElig;": "\u00C6",
  6792. "AElig": "\u00C6",
  6793. "aelig;": "\u00E6",
  6794. "aelig": "\u00E6",
  6795. "af;": "\u2061",
  6796. "Afr;": "\uD835\uDD04",
  6797. "afr;": "\uD835\uDD1E",
  6798. "Agrave;": "\u00C0",
  6799. "Agrave": "\u00C0",
  6800. "agrave;": "\u00E0",
  6801. "agrave": "\u00E0",
  6802. "alefsym;": "\u2135",
  6803. "aleph;": "\u2135",
  6804. "Alpha;": "\u0391",
  6805. "alpha;": "\u03B1",
  6806. "Amacr;": "\u0100",
  6807. "amacr;": "\u0101",
  6808. "amalg;": "\u2A3F",
  6809. "amp;": "\u0026",
  6810. "amp": "\u0026",
  6811. "AMP;": "\u0026",
  6812. "AMP": "\u0026",
  6813. "andand;": "\u2A55",
  6814. "And;": "\u2A53",
  6815. "and;": "\u2227",
  6816. "andd;": "\u2A5C",
  6817. "andslope;": "\u2A58",
  6818. "andv;": "\u2A5A",
  6819. "ang;": "\u2220",
  6820. "ange;": "\u29A4",
  6821. "angle;": "\u2220",
  6822. "angmsdaa;": "\u29A8",
  6823. "angmsdab;": "\u29A9",
  6824. "angmsdac;": "\u29AA",
  6825. "angmsdad;": "\u29AB",
  6826. "angmsdae;": "\u29AC",
  6827. "angmsdaf;": "\u29AD",
  6828. "angmsdag;": "\u29AE",
  6829. "angmsdah;": "\u29AF",
  6830. "angmsd;": "\u2221",
  6831. "angrt;": "\u221F",
  6832. "angrtvb;": "\u22BE",
  6833. "angrtvbd;": "\u299D",
  6834. "angsph;": "\u2222",
  6835. "angst;": "\u00C5",
  6836. "angzarr;": "\u237C",
  6837. "Aogon;": "\u0104",
  6838. "aogon;": "\u0105",
  6839. "Aopf;": "\uD835\uDD38",
  6840. "aopf;": "\uD835\uDD52",
  6841. "apacir;": "\u2A6F",
  6842. "ap;": "\u2248",
  6843. "apE;": "\u2A70",
  6844. "ape;": "\u224A",
  6845. "apid;": "\u224B",
  6846. "apos;": "\u0027",
  6847. "ApplyFunction;": "\u2061",
  6848. "approx;": "\u2248",
  6849. "approxeq;": "\u224A",
  6850. "Aring;": "\u00C5",
  6851. "Aring": "\u00C5",
  6852. "aring;": "\u00E5",
  6853. "aring": "\u00E5",
  6854. "Ascr;": "\uD835\uDC9C",
  6855. "ascr;": "\uD835\uDCB6",
  6856. "Assign;": "\u2254",
  6857. "ast;": "\u002A",
  6858. "asymp;": "\u2248",
  6859. "asympeq;": "\u224D",
  6860. "Atilde;": "\u00C3",
  6861. "Atilde": "\u00C3",
  6862. "atilde;": "\u00E3",
  6863. "atilde": "\u00E3",
  6864. "Auml;": "\u00C4",
  6865. "Auml": "\u00C4",
  6866. "auml;": "\u00E4",
  6867. "auml": "\u00E4",
  6868. "awconint;": "\u2233",
  6869. "awint;": "\u2A11",
  6870. "backcong;": "\u224C",
  6871. "backepsilon;": "\u03F6",
  6872. "backprime;": "\u2035",
  6873. "backsim;": "\u223D",
  6874. "backsimeq;": "\u22CD",
  6875. "Backslash;": "\u2216",
  6876. "Barv;": "\u2AE7",
  6877. "barvee;": "\u22BD",
  6878. "barwed;": "\u2305",
  6879. "Barwed;": "\u2306",
  6880. "barwedge;": "\u2305",
  6881. "bbrk;": "\u23B5",
  6882. "bbrktbrk;": "\u23B6",
  6883. "bcong;": "\u224C",
  6884. "Bcy;": "\u0411",
  6885. "bcy;": "\u0431",
  6886. "bdquo;": "\u201E",
  6887. "becaus;": "\u2235",
  6888. "because;": "\u2235",
  6889. "Because;": "\u2235",
  6890. "bemptyv;": "\u29B0",
  6891. "bepsi;": "\u03F6",
  6892. "bernou;": "\u212C",
  6893. "Bernoullis;": "\u212C",
  6894. "Beta;": "\u0392",
  6895. "beta;": "\u03B2",
  6896. "beth;": "\u2136",
  6897. "between;": "\u226C",
  6898. "Bfr;": "\uD835\uDD05",
  6899. "bfr;": "\uD835\uDD1F",
  6900. "bigcap;": "\u22C2",
  6901. "bigcirc;": "\u25EF",
  6902. "bigcup;": "\u22C3",
  6903. "bigodot;": "\u2A00",
  6904. "bigoplus;": "\u2A01",
  6905. "bigotimes;": "\u2A02",
  6906. "bigsqcup;": "\u2A06",
  6907. "bigstar;": "\u2605",
  6908. "bigtriangledown;": "\u25BD",
  6909. "bigtriangleup;": "\u25B3",
  6910. "biguplus;": "\u2A04",
  6911. "bigvee;": "\u22C1",
  6912. "bigwedge;": "\u22C0",
  6913. "bkarow;": "\u290D",
  6914. "blacklozenge;": "\u29EB",
  6915. "blacksquare;": "\u25AA",
  6916. "blacktriangle;": "\u25B4",
  6917. "blacktriangledown;": "\u25BE",
  6918. "blacktriangleleft;": "\u25C2",
  6919. "blacktriangleright;": "\u25B8",
  6920. "blank;": "\u2423",
  6921. "blk12;": "\u2592",
  6922. "blk14;": "\u2591",
  6923. "blk34;": "\u2593",
  6924. "block;": "\u2588",
  6925. "bne;": "\u003D\u20E5",
  6926. "bnequiv;": "\u2261\u20E5",
  6927. "bNot;": "\u2AED",
  6928. "bnot;": "\u2310",
  6929. "Bopf;": "\uD835\uDD39",
  6930. "bopf;": "\uD835\uDD53",
  6931. "bot;": "\u22A5",
  6932. "bottom;": "\u22A5",
  6933. "bowtie;": "\u22C8",
  6934. "boxbox;": "\u29C9",
  6935. "boxdl;": "\u2510",
  6936. "boxdL;": "\u2555",
  6937. "boxDl;": "\u2556",
  6938. "boxDL;": "\u2557",
  6939. "boxdr;": "\u250C",
  6940. "boxdR;": "\u2552",
  6941. "boxDr;": "\u2553",
  6942. "boxDR;": "\u2554",
  6943. "boxh;": "\u2500",
  6944. "boxH;": "\u2550",
  6945. "boxhd;": "\u252C",
  6946. "boxHd;": "\u2564",
  6947. "boxhD;": "\u2565",
  6948. "boxHD;": "\u2566",
  6949. "boxhu;": "\u2534",
  6950. "boxHu;": "\u2567",
  6951. "boxhU;": "\u2568",
  6952. "boxHU;": "\u2569",
  6953. "boxminus;": "\u229F",
  6954. "boxplus;": "\u229E",
  6955. "boxtimes;": "\u22A0",
  6956. "boxul;": "\u2518",
  6957. "boxuL;": "\u255B",
  6958. "boxUl;": "\u255C",
  6959. "boxUL;": "\u255D",
  6960. "boxur;": "\u2514",
  6961. "boxuR;": "\u2558",
  6962. "boxUr;": "\u2559",
  6963. "boxUR;": "\u255A",
  6964. "boxv;": "\u2502",
  6965. "boxV;": "\u2551",
  6966. "boxvh;": "\u253C",
  6967. "boxvH;": "\u256A",
  6968. "boxVh;": "\u256B",
  6969. "boxVH;": "\u256C",
  6970. "boxvl;": "\u2524",
  6971. "boxvL;": "\u2561",
  6972. "boxVl;": "\u2562",
  6973. "boxVL;": "\u2563",
  6974. "boxvr;": "\u251C",
  6975. "boxvR;": "\u255E",
  6976. "boxVr;": "\u255F",
  6977. "boxVR;": "\u2560",
  6978. "bprime;": "\u2035",
  6979. "breve;": "\u02D8",
  6980. "Breve;": "\u02D8",
  6981. "brvbar;": "\u00A6",
  6982. "brvbar": "\u00A6",
  6983. "bscr;": "\uD835\uDCB7",
  6984. "Bscr;": "\u212C",
  6985. "bsemi;": "\u204F",
  6986. "bsim;": "\u223D",
  6987. "bsime;": "\u22CD",
  6988. "bsolb;": "\u29C5",
  6989. "bsol;": "\u005C",
  6990. "bsolhsub;": "\u27C8",
  6991. "bull;": "\u2022",
  6992. "bullet;": "\u2022",
  6993. "bump;": "\u224E",
  6994. "bumpE;": "\u2AAE",
  6995. "bumpe;": "\u224F",
  6996. "Bumpeq;": "\u224E",
  6997. "bumpeq;": "\u224F",
  6998. "Cacute;": "\u0106",
  6999. "cacute;": "\u0107",
  7000. "capand;": "\u2A44",
  7001. "capbrcup;": "\u2A49",
  7002. "capcap;": "\u2A4B",
  7003. "cap;": "\u2229",
  7004. "Cap;": "\u22D2",
  7005. "capcup;": "\u2A47",
  7006. "capdot;": "\u2A40",
  7007. "CapitalDifferentialD;": "\u2145",
  7008. "caps;": "\u2229\uFE00",
  7009. "caret;": "\u2041",
  7010. "caron;": "\u02C7",
  7011. "Cayleys;": "\u212D",
  7012. "ccaps;": "\u2A4D",
  7013. "Ccaron;": "\u010C",
  7014. "ccaron;": "\u010D",
  7015. "Ccedil;": "\u00C7",
  7016. "Ccedil": "\u00C7",
  7017. "ccedil;": "\u00E7",
  7018. "ccedil": "\u00E7",
  7019. "Ccirc;": "\u0108",
  7020. "ccirc;": "\u0109",
  7021. "Cconint;": "\u2230",
  7022. "ccups;": "\u2A4C",
  7023. "ccupssm;": "\u2A50",
  7024. "Cdot;": "\u010A",
  7025. "cdot;": "\u010B",
  7026. "cedil;": "\u00B8",
  7027. "cedil": "\u00B8",
  7028. "Cedilla;": "\u00B8",
  7029. "cemptyv;": "\u29B2",
  7030. "cent;": "\u00A2",
  7031. "cent": "\u00A2",
  7032. "centerdot;": "\u00B7",
  7033. "CenterDot;": "\u00B7",
  7034. "cfr;": "\uD835\uDD20",
  7035. "Cfr;": "\u212D",
  7036. "CHcy;": "\u0427",
  7037. "chcy;": "\u0447",
  7038. "check;": "\u2713",
  7039. "checkmark;": "\u2713",
  7040. "Chi;": "\u03A7",
  7041. "chi;": "\u03C7",
  7042. "circ;": "\u02C6",
  7043. "circeq;": "\u2257",
  7044. "circlearrowleft;": "\u21BA",
  7045. "circlearrowright;": "\u21BB",
  7046. "circledast;": "\u229B",
  7047. "circledcirc;": "\u229A",
  7048. "circleddash;": "\u229D",
  7049. "CircleDot;": "\u2299",
  7050. "circledR;": "\u00AE",
  7051. "circledS;": "\u24C8",
  7052. "CircleMinus;": "\u2296",
  7053. "CirclePlus;": "\u2295",
  7054. "CircleTimes;": "\u2297",
  7055. "cir;": "\u25CB",
  7056. "cirE;": "\u29C3",
  7057. "cire;": "\u2257",
  7058. "cirfnint;": "\u2A10",
  7059. "cirmid;": "\u2AEF",
  7060. "cirscir;": "\u29C2",
  7061. "ClockwiseContourIntegral;": "\u2232",
  7062. "CloseCurlyDoubleQuote;": "\u201D",
  7063. "CloseCurlyQuote;": "\u2019",
  7064. "clubs;": "\u2663",
  7065. "clubsuit;": "\u2663",
  7066. "colon;": "\u003A",
  7067. "Colon;": "\u2237",
  7068. "Colone;": "\u2A74",
  7069. "colone;": "\u2254",
  7070. "coloneq;": "\u2254",
  7071. "comma;": "\u002C",
  7072. "commat;": "\u0040",
  7073. "comp;": "\u2201",
  7074. "compfn;": "\u2218",
  7075. "complement;": "\u2201",
  7076. "complexes;": "\u2102",
  7077. "cong;": "\u2245",
  7078. "congdot;": "\u2A6D",
  7079. "Congruent;": "\u2261",
  7080. "conint;": "\u222E",
  7081. "Conint;": "\u222F",
  7082. "ContourIntegral;": "\u222E",
  7083. "copf;": "\uD835\uDD54",
  7084. "Copf;": "\u2102",
  7085. "coprod;": "\u2210",
  7086. "Coproduct;": "\u2210",
  7087. "copy;": "\u00A9",
  7088. "copy": "\u00A9",
  7089. "COPY;": "\u00A9",
  7090. "COPY": "\u00A9",
  7091. "copysr;": "\u2117",
  7092. "CounterClockwiseContourIntegral;": "\u2233",
  7093. "crarr;": "\u21B5",
  7094. "cross;": "\u2717",
  7095. "Cross;": "\u2A2F",
  7096. "Cscr;": "\uD835\uDC9E",
  7097. "cscr;": "\uD835\uDCB8",
  7098. "csub;": "\u2ACF",
  7099. "csube;": "\u2AD1",
  7100. "csup;": "\u2AD0",
  7101. "csupe;": "\u2AD2",
  7102. "ctdot;": "\u22EF",
  7103. "cudarrl;": "\u2938",
  7104. "cudarrr;": "\u2935",
  7105. "cuepr;": "\u22DE",
  7106. "cuesc;": "\u22DF",
  7107. "cularr;": "\u21B6",
  7108. "cularrp;": "\u293D",
  7109. "cupbrcap;": "\u2A48",
  7110. "cupcap;": "\u2A46",
  7111. "CupCap;": "\u224D",
  7112. "cup;": "\u222A",
  7113. "Cup;": "\u22D3",
  7114. "cupcup;": "\u2A4A",
  7115. "cupdot;": "\u228D",
  7116. "cupor;": "\u2A45",
  7117. "cups;": "\u222A\uFE00",
  7118. "curarr;": "\u21B7",
  7119. "curarrm;": "\u293C",
  7120. "curlyeqprec;": "\u22DE",
  7121. "curlyeqsucc;": "\u22DF",
  7122. "curlyvee;": "\u22CE",
  7123. "curlywedge;": "\u22CF",
  7124. "curren;": "\u00A4",
  7125. "curren": "\u00A4",
  7126. "curvearrowleft;": "\u21B6",
  7127. "curvearrowright;": "\u21B7",
  7128. "cuvee;": "\u22CE",
  7129. "cuwed;": "\u22CF",
  7130. "cwconint;": "\u2232",
  7131. "cwint;": "\u2231",
  7132. "cylcty;": "\u232D",
  7133. "dagger;": "\u2020",
  7134. "Dagger;": "\u2021",
  7135. "daleth;": "\u2138",
  7136. "darr;": "\u2193",
  7137. "Darr;": "\u21A1",
  7138. "dArr;": "\u21D3",
  7139. "dash;": "\u2010",
  7140. "Dashv;": "\u2AE4",
  7141. "dashv;": "\u22A3",
  7142. "dbkarow;": "\u290F",
  7143. "dblac;": "\u02DD",
  7144. "Dcaron;": "\u010E",
  7145. "dcaron;": "\u010F",
  7146. "Dcy;": "\u0414",
  7147. "dcy;": "\u0434",
  7148. "ddagger;": "\u2021",
  7149. "ddarr;": "\u21CA",
  7150. "DD;": "\u2145",
  7151. "dd;": "\u2146",
  7152. "DDotrahd;": "\u2911",
  7153. "ddotseq;": "\u2A77",
  7154. "deg;": "\u00B0",
  7155. "deg": "\u00B0",
  7156. "Del;": "\u2207",
  7157. "Delta;": "\u0394",
  7158. "delta;": "\u03B4",
  7159. "demptyv;": "\u29B1",
  7160. "dfisht;": "\u297F",
  7161. "Dfr;": "\uD835\uDD07",
  7162. "dfr;": "\uD835\uDD21",
  7163. "dHar;": "\u2965",
  7164. "dharl;": "\u21C3",
  7165. "dharr;": "\u21C2",
  7166. "DiacriticalAcute;": "\u00B4",
  7167. "DiacriticalDot;": "\u02D9",
  7168. "DiacriticalDoubleAcute;": "\u02DD",
  7169. "DiacriticalGrave;": "\u0060",
  7170. "DiacriticalTilde;": "\u02DC",
  7171. "diam;": "\u22C4",
  7172. "diamond;": "\u22C4",
  7173. "Diamond;": "\u22C4",
  7174. "diamondsuit;": "\u2666",
  7175. "diams;": "\u2666",
  7176. "die;": "\u00A8",
  7177. "DifferentialD;": "\u2146",
  7178. "digamma;": "\u03DD",
  7179. "disin;": "\u22F2",
  7180. "div;": "\u00F7",
  7181. "divide;": "\u00F7",
  7182. "divide": "\u00F7",
  7183. "divideontimes;": "\u22C7",
  7184. "divonx;": "\u22C7",
  7185. "DJcy;": "\u0402",
  7186. "djcy;": "\u0452",
  7187. "dlcorn;": "\u231E",
  7188. "dlcrop;": "\u230D",
  7189. "dollar;": "\u0024",
  7190. "Dopf;": "\uD835\uDD3B",
  7191. "dopf;": "\uD835\uDD55",
  7192. "Dot;": "\u00A8",
  7193. "dot;": "\u02D9",
  7194. "DotDot;": "\u20DC",
  7195. "doteq;": "\u2250",
  7196. "doteqdot;": "\u2251",
  7197. "DotEqual;": "\u2250",
  7198. "dotminus;": "\u2238",
  7199. "dotplus;": "\u2214",
  7200. "dotsquare;": "\u22A1",
  7201. "doublebarwedge;": "\u2306",
  7202. "DoubleContourIntegral;": "\u222F",
  7203. "DoubleDot;": "\u00A8",
  7204. "DoubleDownArrow;": "\u21D3",
  7205. "DoubleLeftArrow;": "\u21D0",
  7206. "DoubleLeftRightArrow;": "\u21D4",
  7207. "DoubleLeftTee;": "\u2AE4",
  7208. "DoubleLongLeftArrow;": "\u27F8",
  7209. "DoubleLongLeftRightArrow;": "\u27FA",
  7210. "DoubleLongRightArrow;": "\u27F9",
  7211. "DoubleRightArrow;": "\u21D2",
  7212. "DoubleRightTee;": "\u22A8",
  7213. "DoubleUpArrow;": "\u21D1",
  7214. "DoubleUpDownArrow;": "\u21D5",
  7215. "DoubleVerticalBar;": "\u2225",
  7216. "DownArrowBar;": "\u2913",
  7217. "downarrow;": "\u2193",
  7218. "DownArrow;": "\u2193",
  7219. "Downarrow;": "\u21D3",
  7220. "DownArrowUpArrow;": "\u21F5",
  7221. "DownBreve;": "\u0311",
  7222. "downdownarrows;": "\u21CA",
  7223. "downharpoonleft;": "\u21C3",
  7224. "downharpoonright;": "\u21C2",
  7225. "DownLeftRightVector;": "\u2950",
  7226. "DownLeftTeeVector;": "\u295E",
  7227. "DownLeftVectorBar;": "\u2956",
  7228. "DownLeftVector;": "\u21BD",
  7229. "DownRightTeeVector;": "\u295F",
  7230. "DownRightVectorBar;": "\u2957",
  7231. "DownRightVector;": "\u21C1",
  7232. "DownTeeArrow;": "\u21A7",
  7233. "DownTee;": "\u22A4",
  7234. "drbkarow;": "\u2910",
  7235. "drcorn;": "\u231F",
  7236. "drcrop;": "\u230C",
  7237. "Dscr;": "\uD835\uDC9F",
  7238. "dscr;": "\uD835\uDCB9",
  7239. "DScy;": "\u0405",
  7240. "dscy;": "\u0455",
  7241. "dsol;": "\u29F6",
  7242. "Dstrok;": "\u0110",
  7243. "dstrok;": "\u0111",
  7244. "dtdot;": "\u22F1",
  7245. "dtri;": "\u25BF",
  7246. "dtrif;": "\u25BE",
  7247. "duarr;": "\u21F5",
  7248. "duhar;": "\u296F",
  7249. "dwangle;": "\u29A6",
  7250. "DZcy;": "\u040F",
  7251. "dzcy;": "\u045F",
  7252. "dzigrarr;": "\u27FF",
  7253. "Eacute;": "\u00C9",
  7254. "Eacute": "\u00C9",
  7255. "eacute;": "\u00E9",
  7256. "eacute": "\u00E9",
  7257. "easter;": "\u2A6E",
  7258. "Ecaron;": "\u011A",
  7259. "ecaron;": "\u011B",
  7260. "Ecirc;": "\u00CA",
  7261. "Ecirc": "\u00CA",
  7262. "ecirc;": "\u00EA",
  7263. "ecirc": "\u00EA",
  7264. "ecir;": "\u2256",
  7265. "ecolon;": "\u2255",
  7266. "Ecy;": "\u042D",
  7267. "ecy;": "\u044D",
  7268. "eDDot;": "\u2A77",
  7269. "Edot;": "\u0116",
  7270. "edot;": "\u0117",
  7271. "eDot;": "\u2251",
  7272. "ee;": "\u2147",
  7273. "efDot;": "\u2252",
  7274. "Efr;": "\uD835\uDD08",
  7275. "efr;": "\uD835\uDD22",
  7276. "eg;": "\u2A9A",
  7277. "Egrave;": "\u00C8",
  7278. "Egrave": "\u00C8",
  7279. "egrave;": "\u00E8",
  7280. "egrave": "\u00E8",
  7281. "egs;": "\u2A96",
  7282. "egsdot;": "\u2A98",
  7283. "el;": "\u2A99",
  7284. "Element;": "\u2208",
  7285. "elinters;": "\u23E7",
  7286. "ell;": "\u2113",
  7287. "els;": "\u2A95",
  7288. "elsdot;": "\u2A97",
  7289. "Emacr;": "\u0112",
  7290. "emacr;": "\u0113",
  7291. "empty;": "\u2205",
  7292. "emptyset;": "\u2205",
  7293. "EmptySmallSquare;": "\u25FB",
  7294. "emptyv;": "\u2205",
  7295. "EmptyVerySmallSquare;": "\u25AB",
  7296. "emsp13;": "\u2004",
  7297. "emsp14;": "\u2005",
  7298. "emsp;": "\u2003",
  7299. "ENG;": "\u014A",
  7300. "eng;": "\u014B",
  7301. "ensp;": "\u2002",
  7302. "Eogon;": "\u0118",
  7303. "eogon;": "\u0119",
  7304. "Eopf;": "\uD835\uDD3C",
  7305. "eopf;": "\uD835\uDD56",
  7306. "epar;": "\u22D5",
  7307. "eparsl;": "\u29E3",
  7308. "eplus;": "\u2A71",
  7309. "epsi;": "\u03B5",
  7310. "Epsilon;": "\u0395",
  7311. "epsilon;": "\u03B5",
  7312. "epsiv;": "\u03F5",
  7313. "eqcirc;": "\u2256",
  7314. "eqcolon;": "\u2255",
  7315. "eqsim;": "\u2242",
  7316. "eqslantgtr;": "\u2A96",
  7317. "eqslantless;": "\u2A95",
  7318. "Equal;": "\u2A75",
  7319. "equals;": "\u003D",
  7320. "EqualTilde;": "\u2242",
  7321. "equest;": "\u225F",
  7322. "Equilibrium;": "\u21CC",
  7323. "equiv;": "\u2261",
  7324. "equivDD;": "\u2A78",
  7325. "eqvparsl;": "\u29E5",
  7326. "erarr;": "\u2971",
  7327. "erDot;": "\u2253",
  7328. "escr;": "\u212F",
  7329. "Escr;": "\u2130",
  7330. "esdot;": "\u2250",
  7331. "Esim;": "\u2A73",
  7332. "esim;": "\u2242",
  7333. "Eta;": "\u0397",
  7334. "eta;": "\u03B7",
  7335. "ETH;": "\u00D0",
  7336. "ETH": "\u00D0",
  7337. "eth;": "\u00F0",
  7338. "eth": "\u00F0",
  7339. "Euml;": "\u00CB",
  7340. "Euml": "\u00CB",
  7341. "euml;": "\u00EB",
  7342. "euml": "\u00EB",
  7343. "euro;": "\u20AC",
  7344. "excl;": "\u0021",
  7345. "exist;": "\u2203",
  7346. "Exists;": "\u2203",
  7347. "expectation;": "\u2130",
  7348. "exponentiale;": "\u2147",
  7349. "ExponentialE;": "\u2147",
  7350. "fallingdotseq;": "\u2252",
  7351. "Fcy;": "\u0424",
  7352. "fcy;": "\u0444",
  7353. "female;": "\u2640",
  7354. "ffilig;": "\uFB03",
  7355. "fflig;": "\uFB00",
  7356. "ffllig;": "\uFB04",
  7357. "Ffr;": "\uD835\uDD09",
  7358. "ffr;": "\uD835\uDD23",
  7359. "filig;": "\uFB01",
  7360. "FilledSmallSquare;": "\u25FC",
  7361. "FilledVerySmallSquare;": "\u25AA",
  7362. "fjlig;": "\u0066\u006A",
  7363. "flat;": "\u266D",
  7364. "fllig;": "\uFB02",
  7365. "fltns;": "\u25B1",
  7366. "fnof;": "\u0192",
  7367. "Fopf;": "\uD835\uDD3D",
  7368. "fopf;": "\uD835\uDD57",
  7369. "forall;": "\u2200",
  7370. "ForAll;": "\u2200",
  7371. "fork;": "\u22D4",
  7372. "forkv;": "\u2AD9",
  7373. "Fouriertrf;": "\u2131",
  7374. "fpartint;": "\u2A0D",
  7375. "frac12;": "\u00BD",
  7376. "frac12": "\u00BD",
  7377. "frac13;": "\u2153",
  7378. "frac14;": "\u00BC",
  7379. "frac14": "\u00BC",
  7380. "frac15;": "\u2155",
  7381. "frac16;": "\u2159",
  7382. "frac18;": "\u215B",
  7383. "frac23;": "\u2154",
  7384. "frac25;": "\u2156",
  7385. "frac34;": "\u00BE",
  7386. "frac34": "\u00BE",
  7387. "frac35;": "\u2157",
  7388. "frac38;": "\u215C",
  7389. "frac45;": "\u2158",
  7390. "frac56;": "\u215A",
  7391. "frac58;": "\u215D",
  7392. "frac78;": "\u215E",
  7393. "frasl;": "\u2044",
  7394. "frown;": "\u2322",
  7395. "fscr;": "\uD835\uDCBB",
  7396. "Fscr;": "\u2131",
  7397. "gacute;": "\u01F5",
  7398. "Gamma;": "\u0393",
  7399. "gamma;": "\u03B3",
  7400. "Gammad;": "\u03DC",
  7401. "gammad;": "\u03DD",
  7402. "gap;": "\u2A86",
  7403. "Gbreve;": "\u011E",
  7404. "gbreve;": "\u011F",
  7405. "Gcedil;": "\u0122",
  7406. "Gcirc;": "\u011C",
  7407. "gcirc;": "\u011D",
  7408. "Gcy;": "\u0413",
  7409. "gcy;": "\u0433",
  7410. "Gdot;": "\u0120",
  7411. "gdot;": "\u0121",
  7412. "ge;": "\u2265",
  7413. "gE;": "\u2267",
  7414. "gEl;": "\u2A8C",
  7415. "gel;": "\u22DB",
  7416. "geq;": "\u2265",
  7417. "geqq;": "\u2267",
  7418. "geqslant;": "\u2A7E",
  7419. "gescc;": "\u2AA9",
  7420. "ges;": "\u2A7E",
  7421. "gesdot;": "\u2A80",
  7422. "gesdoto;": "\u2A82",
  7423. "gesdotol;": "\u2A84",
  7424. "gesl;": "\u22DB\uFE00",
  7425. "gesles;": "\u2A94",
  7426. "Gfr;": "\uD835\uDD0A",
  7427. "gfr;": "\uD835\uDD24",
  7428. "gg;": "\u226B",
  7429. "Gg;": "\u22D9",
  7430. "ggg;": "\u22D9",
  7431. "gimel;": "\u2137",
  7432. "GJcy;": "\u0403",
  7433. "gjcy;": "\u0453",
  7434. "gla;": "\u2AA5",
  7435. "gl;": "\u2277",
  7436. "glE;": "\u2A92",
  7437. "glj;": "\u2AA4",
  7438. "gnap;": "\u2A8A",
  7439. "gnapprox;": "\u2A8A",
  7440. "gne;": "\u2A88",
  7441. "gnE;": "\u2269",
  7442. "gneq;": "\u2A88",
  7443. "gneqq;": "\u2269",
  7444. "gnsim;": "\u22E7",
  7445. "Gopf;": "\uD835\uDD3E",
  7446. "gopf;": "\uD835\uDD58",
  7447. "grave;": "\u0060",
  7448. "GreaterEqual;": "\u2265",
  7449. "GreaterEqualLess;": "\u22DB",
  7450. "GreaterFullEqual;": "\u2267",
  7451. "GreaterGreater;": "\u2AA2",
  7452. "GreaterLess;": "\u2277",
  7453. "GreaterSlantEqual;": "\u2A7E",
  7454. "GreaterTilde;": "\u2273",
  7455. "Gscr;": "\uD835\uDCA2",
  7456. "gscr;": "\u210A",
  7457. "gsim;": "\u2273",
  7458. "gsime;": "\u2A8E",
  7459. "gsiml;": "\u2A90",
  7460. "gtcc;": "\u2AA7",
  7461. "gtcir;": "\u2A7A",
  7462. "gt;": "\u003E",
  7463. "gt": "\u003E",
  7464. "GT;": "\u003E",
  7465. "GT": "\u003E",
  7466. "Gt;": "\u226B",
  7467. "gtdot;": "\u22D7",
  7468. "gtlPar;": "\u2995",
  7469. "gtquest;": "\u2A7C",
  7470. "gtrapprox;": "\u2A86",
  7471. "gtrarr;": "\u2978",
  7472. "gtrdot;": "\u22D7",
  7473. "gtreqless;": "\u22DB",
  7474. "gtreqqless;": "\u2A8C",
  7475. "gtrless;": "\u2277",
  7476. "gtrsim;": "\u2273",
  7477. "gvertneqq;": "\u2269\uFE00",
  7478. "gvnE;": "\u2269\uFE00",
  7479. "Hacek;": "\u02C7",
  7480. "hairsp;": "\u200A",
  7481. "half;": "\u00BD",
  7482. "hamilt;": "\u210B",
  7483. "HARDcy;": "\u042A",
  7484. "hardcy;": "\u044A",
  7485. "harrcir;": "\u2948",
  7486. "harr;": "\u2194",
  7487. "hArr;": "\u21D4",
  7488. "harrw;": "\u21AD",
  7489. "Hat;": "\u005E",
  7490. "hbar;": "\u210F",
  7491. "Hcirc;": "\u0124",
  7492. "hcirc;": "\u0125",
  7493. "hearts;": "\u2665",
  7494. "heartsuit;": "\u2665",
  7495. "hellip;": "\u2026",
  7496. "hercon;": "\u22B9",
  7497. "hfr;": "\uD835\uDD25",
  7498. "Hfr;": "\u210C",
  7499. "HilbertSpace;": "\u210B",
  7500. "hksearow;": "\u2925",
  7501. "hkswarow;": "\u2926",
  7502. "hoarr;": "\u21FF",
  7503. "homtht;": "\u223B",
  7504. "hookleftarrow;": "\u21A9",
  7505. "hookrightarrow;": "\u21AA",
  7506. "hopf;": "\uD835\uDD59",
  7507. "Hopf;": "\u210D",
  7508. "horbar;": "\u2015",
  7509. "HorizontalLine;": "\u2500",
  7510. "hscr;": "\uD835\uDCBD",
  7511. "Hscr;": "\u210B",
  7512. "hslash;": "\u210F",
  7513. "Hstrok;": "\u0126",
  7514. "hstrok;": "\u0127",
  7515. "HumpDownHump;": "\u224E",
  7516. "HumpEqual;": "\u224F",
  7517. "hybull;": "\u2043",
  7518. "hyphen;": "\u2010",
  7519. "Iacute;": "\u00CD",
  7520. "Iacute": "\u00CD",
  7521. "iacute;": "\u00ED",
  7522. "iacute": "\u00ED",
  7523. "ic;": "\u2063",
  7524. "Icirc;": "\u00CE",
  7525. "Icirc": "\u00CE",
  7526. "icirc;": "\u00EE",
  7527. "icirc": "\u00EE",
  7528. "Icy;": "\u0418",
  7529. "icy;": "\u0438",
  7530. "Idot;": "\u0130",
  7531. "IEcy;": "\u0415",
  7532. "iecy;": "\u0435",
  7533. "iexcl;": "\u00A1",
  7534. "iexcl": "\u00A1",
  7535. "iff;": "\u21D4",
  7536. "ifr;": "\uD835\uDD26",
  7537. "Ifr;": "\u2111",
  7538. "Igrave;": "\u00CC",
  7539. "Igrave": "\u00CC",
  7540. "igrave;": "\u00EC",
  7541. "igrave": "\u00EC",
  7542. "ii;": "\u2148",
  7543. "iiiint;": "\u2A0C",
  7544. "iiint;": "\u222D",
  7545. "iinfin;": "\u29DC",
  7546. "iiota;": "\u2129",
  7547. "IJlig;": "\u0132",
  7548. "ijlig;": "\u0133",
  7549. "Imacr;": "\u012A",
  7550. "imacr;": "\u012B",
  7551. "image;": "\u2111",
  7552. "ImaginaryI;": "\u2148",
  7553. "imagline;": "\u2110",
  7554. "imagpart;": "\u2111",
  7555. "imath;": "\u0131",
  7556. "Im;": "\u2111",
  7557. "imof;": "\u22B7",
  7558. "imped;": "\u01B5",
  7559. "Implies;": "\u21D2",
  7560. "incare;": "\u2105",
  7561. "in;": "\u2208",
  7562. "infin;": "\u221E",
  7563. "infintie;": "\u29DD",
  7564. "inodot;": "\u0131",
  7565. "intcal;": "\u22BA",
  7566. "int;": "\u222B",
  7567. "Int;": "\u222C",
  7568. "integers;": "\u2124",
  7569. "Integral;": "\u222B",
  7570. "intercal;": "\u22BA",
  7571. "Intersection;": "\u22C2",
  7572. "intlarhk;": "\u2A17",
  7573. "intprod;": "\u2A3C",
  7574. "InvisibleComma;": "\u2063",
  7575. "InvisibleTimes;": "\u2062",
  7576. "IOcy;": "\u0401",
  7577. "iocy;": "\u0451",
  7578. "Iogon;": "\u012E",
  7579. "iogon;": "\u012F",
  7580. "Iopf;": "\uD835\uDD40",
  7581. "iopf;": "\uD835\uDD5A",
  7582. "Iota;": "\u0399",
  7583. "iota;": "\u03B9",
  7584. "iprod;": "\u2A3C",
  7585. "iquest;": "\u00BF",
  7586. "iquest": "\u00BF",
  7587. "iscr;": "\uD835\uDCBE",
  7588. "Iscr;": "\u2110",
  7589. "isin;": "\u2208",
  7590. "isindot;": "\u22F5",
  7591. "isinE;": "\u22F9",
  7592. "isins;": "\u22F4",
  7593. "isinsv;": "\u22F3",
  7594. "isinv;": "\u2208",
  7595. "it;": "\u2062",
  7596. "Itilde;": "\u0128",
  7597. "itilde;": "\u0129",
  7598. "Iukcy;": "\u0406",
  7599. "iukcy;": "\u0456",
  7600. "Iuml;": "\u00CF",
  7601. "Iuml": "\u00CF",
  7602. "iuml;": "\u00EF",
  7603. "iuml": "\u00EF",
  7604. "Jcirc;": "\u0134",
  7605. "jcirc;": "\u0135",
  7606. "Jcy;": "\u0419",
  7607. "jcy;": "\u0439",
  7608. "Jfr;": "\uD835\uDD0D",
  7609. "jfr;": "\uD835\uDD27",
  7610. "jmath;": "\u0237",
  7611. "Jopf;": "\uD835\uDD41",
  7612. "jopf;": "\uD835\uDD5B",
  7613. "Jscr;": "\uD835\uDCA5",
  7614. "jscr;": "\uD835\uDCBF",
  7615. "Jsercy;": "\u0408",
  7616. "jsercy;": "\u0458",
  7617. "Jukcy;": "\u0404",
  7618. "jukcy;": "\u0454",
  7619. "Kappa;": "\u039A",
  7620. "kappa;": "\u03BA",
  7621. "kappav;": "\u03F0",
  7622. "Kcedil;": "\u0136",
  7623. "kcedil;": "\u0137",
  7624. "Kcy;": "\u041A",
  7625. "kcy;": "\u043A",
  7626. "Kfr;": "\uD835\uDD0E",
  7627. "kfr;": "\uD835\uDD28",
  7628. "kgreen;": "\u0138",
  7629. "KHcy;": "\u0425",
  7630. "khcy;": "\u0445",
  7631. "KJcy;": "\u040C",
  7632. "kjcy;": "\u045C",
  7633. "Kopf;": "\uD835\uDD42",
  7634. "kopf;": "\uD835\uDD5C",
  7635. "Kscr;": "\uD835\uDCA6",
  7636. "kscr;": "\uD835\uDCC0",
  7637. "lAarr;": "\u21DA",
  7638. "Lacute;": "\u0139",
  7639. "lacute;": "\u013A",
  7640. "laemptyv;": "\u29B4",
  7641. "lagran;": "\u2112",
  7642. "Lambda;": "\u039B",
  7643. "lambda;": "\u03BB",
  7644. "lang;": "\u27E8",
  7645. "Lang;": "\u27EA",
  7646. "langd;": "\u2991",
  7647. "langle;": "\u27E8",
  7648. "lap;": "\u2A85",
  7649. "Laplacetrf;": "\u2112",
  7650. "laquo;": "\u00AB",
  7651. "laquo": "\u00AB",
  7652. "larrb;": "\u21E4",
  7653. "larrbfs;": "\u291F",
  7654. "larr;": "\u2190",
  7655. "Larr;": "\u219E",
  7656. "lArr;": "\u21D0",
  7657. "larrfs;": "\u291D",
  7658. "larrhk;": "\u21A9",
  7659. "larrlp;": "\u21AB",
  7660. "larrpl;": "\u2939",
  7661. "larrsim;": "\u2973",
  7662. "larrtl;": "\u21A2",
  7663. "latail;": "\u2919",
  7664. "lAtail;": "\u291B",
  7665. "lat;": "\u2AAB",
  7666. "late;": "\u2AAD",
  7667. "lates;": "\u2AAD\uFE00",
  7668. "lbarr;": "\u290C",
  7669. "lBarr;": "\u290E",
  7670. "lbbrk;": "\u2772",
  7671. "lbrace;": "\u007B",
  7672. "lbrack;": "\u005B",
  7673. "lbrke;": "\u298B",
  7674. "lbrksld;": "\u298F",
  7675. "lbrkslu;": "\u298D",
  7676. "Lcaron;": "\u013D",
  7677. "lcaron;": "\u013E",
  7678. "Lcedil;": "\u013B",
  7679. "lcedil;": "\u013C",
  7680. "lceil;": "\u2308",
  7681. "lcub;": "\u007B",
  7682. "Lcy;": "\u041B",
  7683. "lcy;": "\u043B",
  7684. "ldca;": "\u2936",
  7685. "ldquo;": "\u201C",
  7686. "ldquor;": "\u201E",
  7687. "ldrdhar;": "\u2967",
  7688. "ldrushar;": "\u294B",
  7689. "ldsh;": "\u21B2",
  7690. "le;": "\u2264",
  7691. "lE;": "\u2266",
  7692. "LeftAngleBracket;": "\u27E8",
  7693. "LeftArrowBar;": "\u21E4",
  7694. "leftarrow;": "\u2190",
  7695. "LeftArrow;": "\u2190",
  7696. "Leftarrow;": "\u21D0",
  7697. "LeftArrowRightArrow;": "\u21C6",
  7698. "leftarrowtail;": "\u21A2",
  7699. "LeftCeiling;": "\u2308",
  7700. "LeftDoubleBracket;": "\u27E6",
  7701. "LeftDownTeeVector;": "\u2961",
  7702. "LeftDownVectorBar;": "\u2959",
  7703. "LeftDownVector;": "\u21C3",
  7704. "LeftFloor;": "\u230A",
  7705. "leftharpoondown;": "\u21BD",
  7706. "leftharpoonup;": "\u21BC",
  7707. "leftleftarrows;": "\u21C7",
  7708. "leftrightarrow;": "\u2194",
  7709. "LeftRightArrow;": "\u2194",
  7710. "Leftrightarrow;": "\u21D4",
  7711. "leftrightarrows;": "\u21C6",
  7712. "leftrightharpoons;": "\u21CB",
  7713. "leftrightsquigarrow;": "\u21AD",
  7714. "LeftRightVector;": "\u294E",
  7715. "LeftTeeArrow;": "\u21A4",
  7716. "LeftTee;": "\u22A3",
  7717. "LeftTeeVector;": "\u295A",
  7718. "leftthreetimes;": "\u22CB",
  7719. "LeftTriangleBar;": "\u29CF",
  7720. "LeftTriangle;": "\u22B2",
  7721. "LeftTriangleEqual;": "\u22B4",
  7722. "LeftUpDownVector;": "\u2951",
  7723. "LeftUpTeeVector;": "\u2960",
  7724. "LeftUpVectorBar;": "\u2958",
  7725. "LeftUpVector;": "\u21BF",
  7726. "LeftVectorBar;": "\u2952",
  7727. "LeftVector;": "\u21BC",
  7728. "lEg;": "\u2A8B",
  7729. "leg;": "\u22DA",
  7730. "leq;": "\u2264",
  7731. "leqq;": "\u2266",
  7732. "leqslant;": "\u2A7D",
  7733. "lescc;": "\u2AA8",
  7734. "les;": "\u2A7D",
  7735. "lesdot;": "\u2A7F",
  7736. "lesdoto;": "\u2A81",
  7737. "lesdotor;": "\u2A83",
  7738. "lesg;": "\u22DA\uFE00",
  7739. "lesges;": "\u2A93",
  7740. "lessapprox;": "\u2A85",
  7741. "lessdot;": "\u22D6",
  7742. "lesseqgtr;": "\u22DA",
  7743. "lesseqqgtr;": "\u2A8B",
  7744. "LessEqualGreater;": "\u22DA",
  7745. "LessFullEqual;": "\u2266",
  7746. "LessGreater;": "\u2276",
  7747. "lessgtr;": "\u2276",
  7748. "LessLess;": "\u2AA1",
  7749. "lesssim;": "\u2272",
  7750. "LessSlantEqual;": "\u2A7D",
  7751. "LessTilde;": "\u2272",
  7752. "lfisht;": "\u297C",
  7753. "lfloor;": "\u230A",
  7754. "Lfr;": "\uD835\uDD0F",
  7755. "lfr;": "\uD835\uDD29",
  7756. "lg;": "\u2276",
  7757. "lgE;": "\u2A91",
  7758. "lHar;": "\u2962",
  7759. "lhard;": "\u21BD",
  7760. "lharu;": "\u21BC",
  7761. "lharul;": "\u296A",
  7762. "lhblk;": "\u2584",
  7763. "LJcy;": "\u0409",
  7764. "ljcy;": "\u0459",
  7765. "llarr;": "\u21C7",
  7766. "ll;": "\u226A",
  7767. "Ll;": "\u22D8",
  7768. "llcorner;": "\u231E",
  7769. "Lleftarrow;": "\u21DA",
  7770. "llhard;": "\u296B",
  7771. "lltri;": "\u25FA",
  7772. "Lmidot;": "\u013F",
  7773. "lmidot;": "\u0140",
  7774. "lmoustache;": "\u23B0",
  7775. "lmoust;": "\u23B0",
  7776. "lnap;": "\u2A89",
  7777. "lnapprox;": "\u2A89",
  7778. "lne;": "\u2A87",
  7779. "lnE;": "\u2268",
  7780. "lneq;": "\u2A87",
  7781. "lneqq;": "\u2268",
  7782. "lnsim;": "\u22E6",
  7783. "loang;": "\u27EC",
  7784. "loarr;": "\u21FD",
  7785. "lobrk;": "\u27E6",
  7786. "longleftarrow;": "\u27F5",
  7787. "LongLeftArrow;": "\u27F5",
  7788. "Longleftarrow;": "\u27F8",
  7789. "longleftrightarrow;": "\u27F7",
  7790. "LongLeftRightArrow;": "\u27F7",
  7791. "Longleftrightarrow;": "\u27FA",
  7792. "longmapsto;": "\u27FC",
  7793. "longrightarrow;": "\u27F6",
  7794. "LongRightArrow;": "\u27F6",
  7795. "Longrightarrow;": "\u27F9",
  7796. "looparrowleft;": "\u21AB",
  7797. "looparrowright;": "\u21AC",
  7798. "lopar;": "\u2985",
  7799. "Lopf;": "\uD835\uDD43",
  7800. "lopf;": "\uD835\uDD5D",
  7801. "loplus;": "\u2A2D",
  7802. "lotimes;": "\u2A34",
  7803. "lowast;": "\u2217",
  7804. "lowbar;": "\u005F",
  7805. "LowerLeftArrow;": "\u2199",
  7806. "LowerRightArrow;": "\u2198",
  7807. "loz;": "\u25CA",
  7808. "lozenge;": "\u25CA",
  7809. "lozf;": "\u29EB",
  7810. "lpar;": "\u0028",
  7811. "lparlt;": "\u2993",
  7812. "lrarr;": "\u21C6",
  7813. "lrcorner;": "\u231F",
  7814. "lrhar;": "\u21CB",
  7815. "lrhard;": "\u296D",
  7816. "lrm;": "\u200E",
  7817. "lrtri;": "\u22BF",
  7818. "lsaquo;": "\u2039",
  7819. "lscr;": "\uD835\uDCC1",
  7820. "Lscr;": "\u2112",
  7821. "lsh;": "\u21B0",
  7822. "Lsh;": "\u21B0",
  7823. "lsim;": "\u2272",
  7824. "lsime;": "\u2A8D",
  7825. "lsimg;": "\u2A8F",
  7826. "lsqb;": "\u005B",
  7827. "lsquo;": "\u2018",
  7828. "lsquor;": "\u201A",
  7829. "Lstrok;": "\u0141",
  7830. "lstrok;": "\u0142",
  7831. "ltcc;": "\u2AA6",
  7832. "ltcir;": "\u2A79",
  7833. "lt;": "\u003C",
  7834. "lt": "\u003C",
  7835. "LT;": "\u003C",
  7836. "LT": "\u003C",
  7837. "Lt;": "\u226A",
  7838. "ltdot;": "\u22D6",
  7839. "lthree;": "\u22CB",
  7840. "ltimes;": "\u22C9",
  7841. "ltlarr;": "\u2976",
  7842. "ltquest;": "\u2A7B",
  7843. "ltri;": "\u25C3",
  7844. "ltrie;": "\u22B4",
  7845. "ltrif;": "\u25C2",
  7846. "ltrPar;": "\u2996",
  7847. "lurdshar;": "\u294A",
  7848. "luruhar;": "\u2966",
  7849. "lvertneqq;": "\u2268\uFE00",
  7850. "lvnE;": "\u2268\uFE00",
  7851. "macr;": "\u00AF",
  7852. "macr": "\u00AF",
  7853. "male;": "\u2642",
  7854. "malt;": "\u2720",
  7855. "maltese;": "\u2720",
  7856. "Map;": "\u2905",
  7857. "map;": "\u21A6",
  7858. "mapsto;": "\u21A6",
  7859. "mapstodown;": "\u21A7",
  7860. "mapstoleft;": "\u21A4",
  7861. "mapstoup;": "\u21A5",
  7862. "marker;": "\u25AE",
  7863. "mcomma;": "\u2A29",
  7864. "Mcy;": "\u041C",
  7865. "mcy;": "\u043C",
  7866. "mdash;": "\u2014",
  7867. "mDDot;": "\u223A",
  7868. "measuredangle;": "\u2221",
  7869. "MediumSpace;": "\u205F",
  7870. "Mellintrf;": "\u2133",
  7871. "Mfr;": "\uD835\uDD10",
  7872. "mfr;": "\uD835\uDD2A",
  7873. "mho;": "\u2127",
  7874. "micro;": "\u00B5",
  7875. "micro": "\u00B5",
  7876. "midast;": "\u002A",
  7877. "midcir;": "\u2AF0",
  7878. "mid;": "\u2223",
  7879. "middot;": "\u00B7",
  7880. "middot": "\u00B7",
  7881. "minusb;": "\u229F",
  7882. "minus;": "\u2212",
  7883. "minusd;": "\u2238",
  7884. "minusdu;": "\u2A2A",
  7885. "MinusPlus;": "\u2213",
  7886. "mlcp;": "\u2ADB",
  7887. "mldr;": "\u2026",
  7888. "mnplus;": "\u2213",
  7889. "models;": "\u22A7",
  7890. "Mopf;": "\uD835\uDD44",
  7891. "mopf;": "\uD835\uDD5E",
  7892. "mp;": "\u2213",
  7893. "mscr;": "\uD835\uDCC2",
  7894. "Mscr;": "\u2133",
  7895. "mstpos;": "\u223E",
  7896. "Mu;": "\u039C",
  7897. "mu;": "\u03BC",
  7898. "multimap;": "\u22B8",
  7899. "mumap;": "\u22B8",
  7900. "nabla;": "\u2207",
  7901. "Nacute;": "\u0143",
  7902. "nacute;": "\u0144",
  7903. "nang;": "\u2220\u20D2",
  7904. "nap;": "\u2249",
  7905. "napE;": "\u2A70\u0338",
  7906. "napid;": "\u224B\u0338",
  7907. "napos;": "\u0149",
  7908. "napprox;": "\u2249",
  7909. "natural;": "\u266E",
  7910. "naturals;": "\u2115",
  7911. "natur;": "\u266E",
  7912. "nbsp;": "\u00A0",
  7913. "nbsp": "\u00A0",
  7914. "nbump;": "\u224E\u0338",
  7915. "nbumpe;": "\u224F\u0338",
  7916. "ncap;": "\u2A43",
  7917. "Ncaron;": "\u0147",
  7918. "ncaron;": "\u0148",
  7919. "Ncedil;": "\u0145",
  7920. "ncedil;": "\u0146",
  7921. "ncong;": "\u2247",
  7922. "ncongdot;": "\u2A6D\u0338",
  7923. "ncup;": "\u2A42",
  7924. "Ncy;": "\u041D",
  7925. "ncy;": "\u043D",
  7926. "ndash;": "\u2013",
  7927. "nearhk;": "\u2924",
  7928. "nearr;": "\u2197",
  7929. "neArr;": "\u21D7",
  7930. "nearrow;": "\u2197",
  7931. "ne;": "\u2260",
  7932. "nedot;": "\u2250\u0338",
  7933. "NegativeMediumSpace;": "\u200B",
  7934. "NegativeThickSpace;": "\u200B",
  7935. "NegativeThinSpace;": "\u200B",
  7936. "NegativeVeryThinSpace;": "\u200B",
  7937. "nequiv;": "\u2262",
  7938. "nesear;": "\u2928",
  7939. "nesim;": "\u2242\u0338",
  7940. "NestedGreaterGreater;": "\u226B",
  7941. "NestedLessLess;": "\u226A",
  7942. "NewLine;": "\u000A",
  7943. "nexist;": "\u2204",
  7944. "nexists;": "\u2204",
  7945. "Nfr;": "\uD835\uDD11",
  7946. "nfr;": "\uD835\uDD2B",
  7947. "ngE;": "\u2267\u0338",
  7948. "nge;": "\u2271",
  7949. "ngeq;": "\u2271",
  7950. "ngeqq;": "\u2267\u0338",
  7951. "ngeqslant;": "\u2A7E\u0338",
  7952. "nges;": "\u2A7E\u0338",
  7953. "nGg;": "\u22D9\u0338",
  7954. "ngsim;": "\u2275",
  7955. "nGt;": "\u226B\u20D2",
  7956. "ngt;": "\u226F",
  7957. "ngtr;": "\u226F",
  7958. "nGtv;": "\u226B\u0338",
  7959. "nharr;": "\u21AE",
  7960. "nhArr;": "\u21CE",
  7961. "nhpar;": "\u2AF2",
  7962. "ni;": "\u220B",
  7963. "nis;": "\u22FC",
  7964. "nisd;": "\u22FA",
  7965. "niv;": "\u220B",
  7966. "NJcy;": "\u040A",
  7967. "njcy;": "\u045A",
  7968. "nlarr;": "\u219A",
  7969. "nlArr;": "\u21CD",
  7970. "nldr;": "\u2025",
  7971. "nlE;": "\u2266\u0338",
  7972. "nle;": "\u2270",
  7973. "nleftarrow;": "\u219A",
  7974. "nLeftarrow;": "\u21CD",
  7975. "nleftrightarrow;": "\u21AE",
  7976. "nLeftrightarrow;": "\u21CE",
  7977. "nleq;": "\u2270",
  7978. "nleqq;": "\u2266\u0338",
  7979. "nleqslant;": "\u2A7D\u0338",
  7980. "nles;": "\u2A7D\u0338",
  7981. "nless;": "\u226E",
  7982. "nLl;": "\u22D8\u0338",
  7983. "nlsim;": "\u2274",
  7984. "nLt;": "\u226A\u20D2",
  7985. "nlt;": "\u226E",
  7986. "nltri;": "\u22EA",
  7987. "nltrie;": "\u22EC",
  7988. "nLtv;": "\u226A\u0338",
  7989. "nmid;": "\u2224",
  7990. "NoBreak;": "\u2060",
  7991. "NonBreakingSpace;": "\u00A0",
  7992. "nopf;": "\uD835\uDD5F",
  7993. "Nopf;": "\u2115",
  7994. "Not;": "\u2AEC",
  7995. "not;": "\u00AC",
  7996. "not": "\u00AC",
  7997. "NotCongruent;": "\u2262",
  7998. "NotCupCap;": "\u226D",
  7999. "NotDoubleVerticalBar;": "\u2226",
  8000. "NotElement;": "\u2209",
  8001. "NotEqual;": "\u2260",
  8002. "NotEqualTilde;": "\u2242\u0338",
  8003. "NotExists;": "\u2204",
  8004. "NotGreater;": "\u226F",
  8005. "NotGreaterEqual;": "\u2271",
  8006. "NotGreaterFullEqual;": "\u2267\u0338",
  8007. "NotGreaterGreater;": "\u226B\u0338",
  8008. "NotGreaterLess;": "\u2279",
  8009. "NotGreaterSlantEqual;": "\u2A7E\u0338",
  8010. "NotGreaterTilde;": "\u2275",
  8011. "NotHumpDownHump;": "\u224E\u0338",
  8012. "NotHumpEqual;": "\u224F\u0338",
  8013. "notin;": "\u2209",
  8014. "notindot;": "\u22F5\u0338",
  8015. "notinE;": "\u22F9\u0338",
  8016. "notinva;": "\u2209",
  8017. "notinvb;": "\u22F7",
  8018. "notinvc;": "\u22F6",
  8019. "NotLeftTriangleBar;": "\u29CF\u0338",
  8020. "NotLeftTriangle;": "\u22EA",
  8021. "NotLeftTriangleEqual;": "\u22EC",
  8022. "NotLess;": "\u226E",
  8023. "NotLessEqual;": "\u2270",
  8024. "NotLessGreater;": "\u2278",
  8025. "NotLessLess;": "\u226A\u0338",
  8026. "NotLessSlantEqual;": "\u2A7D\u0338",
  8027. "NotLessTilde;": "\u2274",
  8028. "NotNestedGreaterGreater;": "\u2AA2\u0338",
  8029. "NotNestedLessLess;": "\u2AA1\u0338",
  8030. "notni;": "\u220C",
  8031. "notniva;": "\u220C",
  8032. "notnivb;": "\u22FE",
  8033. "notnivc;": "\u22FD",
  8034. "NotPrecedes;": "\u2280",
  8035. "NotPrecedesEqual;": "\u2AAF\u0338",
  8036. "NotPrecedesSlantEqual;": "\u22E0",
  8037. "NotReverseElement;": "\u220C",
  8038. "NotRightTriangleBar;": "\u29D0\u0338",
  8039. "NotRightTriangle;": "\u22EB",
  8040. "NotRightTriangleEqual;": "\u22ED",
  8041. "NotSquareSubset;": "\u228F\u0338",
  8042. "NotSquareSubsetEqual;": "\u22E2",
  8043. "NotSquareSuperset;": "\u2290\u0338",
  8044. "NotSquareSupersetEqual;": "\u22E3",
  8045. "NotSubset;": "\u2282\u20D2",
  8046. "NotSubsetEqual;": "\u2288",
  8047. "NotSucceeds;": "\u2281",
  8048. "NotSucceedsEqual;": "\u2AB0\u0338",
  8049. "NotSucceedsSlantEqual;": "\u22E1",
  8050. "NotSucceedsTilde;": "\u227F\u0338",
  8051. "NotSuperset;": "\u2283\u20D2",
  8052. "NotSupersetEqual;": "\u2289",
  8053. "NotTilde;": "\u2241",
  8054. "NotTildeEqual;": "\u2244",
  8055. "NotTildeFullEqual;": "\u2247",
  8056. "NotTildeTilde;": "\u2249",
  8057. "NotVerticalBar;": "\u2224",
  8058. "nparallel;": "\u2226",
  8059. "npar;": "\u2226",
  8060. "nparsl;": "\u2AFD\u20E5",
  8061. "npart;": "\u2202\u0338",
  8062. "npolint;": "\u2A14",
  8063. "npr;": "\u2280",
  8064. "nprcue;": "\u22E0",
  8065. "nprec;": "\u2280",
  8066. "npreceq;": "\u2AAF\u0338",
  8067. "npre;": "\u2AAF\u0338",
  8068. "nrarrc;": "\u2933\u0338",
  8069. "nrarr;": "\u219B",
  8070. "nrArr;": "\u21CF",
  8071. "nrarrw;": "\u219D\u0338",
  8072. "nrightarrow;": "\u219B",
  8073. "nRightarrow;": "\u21CF",
  8074. "nrtri;": "\u22EB",
  8075. "nrtrie;": "\u22ED",
  8076. "nsc;": "\u2281",
  8077. "nsccue;": "\u22E1",
  8078. "nsce;": "\u2AB0\u0338",
  8079. "Nscr;": "\uD835\uDCA9",
  8080. "nscr;": "\uD835\uDCC3",
  8081. "nshortmid;": "\u2224",
  8082. "nshortparallel;": "\u2226",
  8083. "nsim;": "\u2241",
  8084. "nsime;": "\u2244",
  8085. "nsimeq;": "\u2244",
  8086. "nsmid;": "\u2224",
  8087. "nspar;": "\u2226",
  8088. "nsqsube;": "\u22E2",
  8089. "nsqsupe;": "\u22E3",
  8090. "nsub;": "\u2284",
  8091. "nsubE;": "\u2AC5\u0338",
  8092. "nsube;": "\u2288",
  8093. "nsubset;": "\u2282\u20D2",
  8094. "nsubseteq;": "\u2288",
  8095. "nsubseteqq;": "\u2AC5\u0338",
  8096. "nsucc;": "\u2281",
  8097. "nsucceq;": "\u2AB0\u0338",
  8098. "nsup;": "\u2285",
  8099. "nsupE;": "\u2AC6\u0338",
  8100. "nsupe;": "\u2289",
  8101. "nsupset;": "\u2283\u20D2",
  8102. "nsupseteq;": "\u2289",
  8103. "nsupseteqq;": "\u2AC6\u0338",
  8104. "ntgl;": "\u2279",
  8105. "Ntilde;": "\u00D1",
  8106. "Ntilde": "\u00D1",
  8107. "ntilde;": "\u00F1",
  8108. "ntilde": "\u00F1",
  8109. "ntlg;": "\u2278",
  8110. "ntriangleleft;": "\u22EA",
  8111. "ntrianglelefteq;": "\u22EC",
  8112. "ntriangleright;": "\u22EB",
  8113. "ntrianglerighteq;": "\u22ED",
  8114. "Nu;": "\u039D",
  8115. "nu;": "\u03BD",
  8116. "num;": "\u0023",
  8117. "numero;": "\u2116",
  8118. "numsp;": "\u2007",
  8119. "nvap;": "\u224D\u20D2",
  8120. "nvdash;": "\u22AC",
  8121. "nvDash;": "\u22AD",
  8122. "nVdash;": "\u22AE",
  8123. "nVDash;": "\u22AF",
  8124. "nvge;": "\u2265\u20D2",
  8125. "nvgt;": "\u003E\u20D2",
  8126. "nvHarr;": "\u2904",
  8127. "nvinfin;": "\u29DE",
  8128. "nvlArr;": "\u2902",
  8129. "nvle;": "\u2264\u20D2",
  8130. "nvlt;": "\u003C\u20D2",
  8131. "nvltrie;": "\u22B4\u20D2",
  8132. "nvrArr;": "\u2903",
  8133. "nvrtrie;": "\u22B5\u20D2",
  8134. "nvsim;": "\u223C\u20D2",
  8135. "nwarhk;": "\u2923",
  8136. "nwarr;": "\u2196",
  8137. "nwArr;": "\u21D6",
  8138. "nwarrow;": "\u2196",
  8139. "nwnear;": "\u2927",
  8140. "Oacute;": "\u00D3",
  8141. "Oacute": "\u00D3",
  8142. "oacute;": "\u00F3",
  8143. "oacute": "\u00F3",
  8144. "oast;": "\u229B",
  8145. "Ocirc;": "\u00D4",
  8146. "Ocirc": "\u00D4",
  8147. "ocirc;": "\u00F4",
  8148. "ocirc": "\u00F4",
  8149. "ocir;": "\u229A",
  8150. "Ocy;": "\u041E",
  8151. "ocy;": "\u043E",
  8152. "odash;": "\u229D",
  8153. "Odblac;": "\u0150",
  8154. "odblac;": "\u0151",
  8155. "odiv;": "\u2A38",
  8156. "odot;": "\u2299",
  8157. "odsold;": "\u29BC",
  8158. "OElig;": "\u0152",
  8159. "oelig;": "\u0153",
  8160. "ofcir;": "\u29BF",
  8161. "Ofr;": "\uD835\uDD12",
  8162. "ofr;": "\uD835\uDD2C",
  8163. "ogon;": "\u02DB",
  8164. "Ograve;": "\u00D2",
  8165. "Ograve": "\u00D2",
  8166. "ograve;": "\u00F2",
  8167. "ograve": "\u00F2",
  8168. "ogt;": "\u29C1",
  8169. "ohbar;": "\u29B5",
  8170. "ohm;": "\u03A9",
  8171. "oint;": "\u222E",
  8172. "olarr;": "\u21BA",
  8173. "olcir;": "\u29BE",
  8174. "olcross;": "\u29BB",
  8175. "oline;": "\u203E",
  8176. "olt;": "\u29C0",
  8177. "Omacr;": "\u014C",
  8178. "omacr;": "\u014D",
  8179. "Omega;": "\u03A9",
  8180. "omega;": "\u03C9",
  8181. "Omicron;": "\u039F",
  8182. "omicron;": "\u03BF",
  8183. "omid;": "\u29B6",
  8184. "ominus;": "\u2296",
  8185. "Oopf;": "\uD835\uDD46",
  8186. "oopf;": "\uD835\uDD60",
  8187. "opar;": "\u29B7",
  8188. "OpenCurlyDoubleQuote;": "\u201C",
  8189. "OpenCurlyQuote;": "\u2018",
  8190. "operp;": "\u29B9",
  8191. "oplus;": "\u2295",
  8192. "orarr;": "\u21BB",
  8193. "Or;": "\u2A54",
  8194. "or;": "\u2228",
  8195. "ord;": "\u2A5D",
  8196. "order;": "\u2134",
  8197. "orderof;": "\u2134",
  8198. "ordf;": "\u00AA",
  8199. "ordf": "\u00AA",
  8200. "ordm;": "\u00BA",
  8201. "ordm": "\u00BA",
  8202. "origof;": "\u22B6",
  8203. "oror;": "\u2A56",
  8204. "orslope;": "\u2A57",
  8205. "orv;": "\u2A5B",
  8206. "oS;": "\u24C8",
  8207. "Oscr;": "\uD835\uDCAA",
  8208. "oscr;": "\u2134",
  8209. "Oslash;": "\u00D8",
  8210. "Oslash": "\u00D8",
  8211. "oslash;": "\u00F8",
  8212. "oslash": "\u00F8",
  8213. "osol;": "\u2298",
  8214. "Otilde;": "\u00D5",
  8215. "Otilde": "\u00D5",
  8216. "otilde;": "\u00F5",
  8217. "otilde": "\u00F5",
  8218. "otimesas;": "\u2A36",
  8219. "Otimes;": "\u2A37",
  8220. "otimes;": "\u2297",
  8221. "Ouml;": "\u00D6",
  8222. "Ouml": "\u00D6",
  8223. "ouml;": "\u00F6",
  8224. "ouml": "\u00F6",
  8225. "ovbar;": "\u233D",
  8226. "OverBar;": "\u203E",
  8227. "OverBrace;": "\u23DE",
  8228. "OverBracket;": "\u23B4",
  8229. "OverParenthesis;": "\u23DC",
  8230. "para;": "\u00B6",
  8231. "para": "\u00B6",
  8232. "parallel;": "\u2225",
  8233. "par;": "\u2225",
  8234. "parsim;": "\u2AF3",
  8235. "parsl;": "\u2AFD",
  8236. "part;": "\u2202",
  8237. "PartialD;": "\u2202",
  8238. "Pcy;": "\u041F",
  8239. "pcy;": "\u043F",
  8240. "percnt;": "\u0025",
  8241. "period;": "\u002E",
  8242. "permil;": "\u2030",
  8243. "perp;": "\u22A5",
  8244. "pertenk;": "\u2031",
  8245. "Pfr;": "\uD835\uDD13",
  8246. "pfr;": "\uD835\uDD2D",
  8247. "Phi;": "\u03A6",
  8248. "phi;": "\u03C6",
  8249. "phiv;": "\u03D5",
  8250. "phmmat;": "\u2133",
  8251. "phone;": "\u260E",
  8252. "Pi;": "\u03A0",
  8253. "pi;": "\u03C0",
  8254. "pitchfork;": "\u22D4",
  8255. "piv;": "\u03D6",
  8256. "planck;": "\u210F",
  8257. "planckh;": "\u210E",
  8258. "plankv;": "\u210F",
  8259. "plusacir;": "\u2A23",
  8260. "plusb;": "\u229E",
  8261. "pluscir;": "\u2A22",
  8262. "plus;": "\u002B",
  8263. "plusdo;": "\u2214",
  8264. "plusdu;": "\u2A25",
  8265. "pluse;": "\u2A72",
  8266. "PlusMinus;": "\u00B1",
  8267. "plusmn;": "\u00B1",
  8268. "plusmn": "\u00B1",
  8269. "plussim;": "\u2A26",
  8270. "plustwo;": "\u2A27",
  8271. "pm;": "\u00B1",
  8272. "Poincareplane;": "\u210C",
  8273. "pointint;": "\u2A15",
  8274. "popf;": "\uD835\uDD61",
  8275. "Popf;": "\u2119",
  8276. "pound;": "\u00A3",
  8277. "pound": "\u00A3",
  8278. "prap;": "\u2AB7",
  8279. "Pr;": "\u2ABB",
  8280. "pr;": "\u227A",
  8281. "prcue;": "\u227C",
  8282. "precapprox;": "\u2AB7",
  8283. "prec;": "\u227A",
  8284. "preccurlyeq;": "\u227C",
  8285. "Precedes;": "\u227A",
  8286. "PrecedesEqual;": "\u2AAF",
  8287. "PrecedesSlantEqual;": "\u227C",
  8288. "PrecedesTilde;": "\u227E",
  8289. "preceq;": "\u2AAF",
  8290. "precnapprox;": "\u2AB9",
  8291. "precneqq;": "\u2AB5",
  8292. "precnsim;": "\u22E8",
  8293. "pre;": "\u2AAF",
  8294. "prE;": "\u2AB3",
  8295. "precsim;": "\u227E",
  8296. "prime;": "\u2032",
  8297. "Prime;": "\u2033",
  8298. "primes;": "\u2119",
  8299. "prnap;": "\u2AB9",
  8300. "prnE;": "\u2AB5",
  8301. "prnsim;": "\u22E8",
  8302. "prod;": "\u220F",
  8303. "Product;": "\u220F",
  8304. "profalar;": "\u232E",
  8305. "profline;": "\u2312",
  8306. "profsurf;": "\u2313",
  8307. "prop;": "\u221D",
  8308. "Proportional;": "\u221D",
  8309. "Proportion;": "\u2237",
  8310. "propto;": "\u221D",
  8311. "prsim;": "\u227E",
  8312. "prurel;": "\u22B0",
  8313. "Pscr;": "\uD835\uDCAB",
  8314. "pscr;": "\uD835\uDCC5",
  8315. "Psi;": "\u03A8",
  8316. "psi;": "\u03C8",
  8317. "puncsp;": "\u2008",
  8318. "Qfr;": "\uD835\uDD14",
  8319. "qfr;": "\uD835\uDD2E",
  8320. "qint;": "\u2A0C",
  8321. "qopf;": "\uD835\uDD62",
  8322. "Qopf;": "\u211A",
  8323. "qprime;": "\u2057",
  8324. "Qscr;": "\uD835\uDCAC",
  8325. "qscr;": "\uD835\uDCC6",
  8326. "quaternions;": "\u210D",
  8327. "quatint;": "\u2A16",
  8328. "quest;": "\u003F",
  8329. "questeq;": "\u225F",
  8330. "quot;": "\u0022",
  8331. "quot": "\u0022",
  8332. "QUOT;": "\u0022",
  8333. "QUOT": "\u0022",
  8334. "rAarr;": "\u21DB",
  8335. "race;": "\u223D\u0331",
  8336. "Racute;": "\u0154",
  8337. "racute;": "\u0155",
  8338. "radic;": "\u221A",
  8339. "raemptyv;": "\u29B3",
  8340. "rang;": "\u27E9",
  8341. "Rang;": "\u27EB",
  8342. "rangd;": "\u2992",
  8343. "range;": "\u29A5",
  8344. "rangle;": "\u27E9",
  8345. "raquo;": "\u00BB",
  8346. "raquo": "\u00BB",
  8347. "rarrap;": "\u2975",
  8348. "rarrb;": "\u21E5",
  8349. "rarrbfs;": "\u2920",
  8350. "rarrc;": "\u2933",
  8351. "rarr;": "\u2192",
  8352. "Rarr;": "\u21A0",
  8353. "rArr;": "\u21D2",
  8354. "rarrfs;": "\u291E",
  8355. "rarrhk;": "\u21AA",
  8356. "rarrlp;": "\u21AC",
  8357. "rarrpl;": "\u2945",
  8358. "rarrsim;": "\u2974",
  8359. "Rarrtl;": "\u2916",
  8360. "rarrtl;": "\u21A3",
  8361. "rarrw;": "\u219D",
  8362. "ratail;": "\u291A",
  8363. "rAtail;": "\u291C",
  8364. "ratio;": "\u2236",
  8365. "rationals;": "\u211A",
  8366. "rbarr;": "\u290D",
  8367. "rBarr;": "\u290F",
  8368. "RBarr;": "\u2910",
  8369. "rbbrk;": "\u2773",
  8370. "rbrace;": "\u007D",
  8371. "rbrack;": "\u005D",
  8372. "rbrke;": "\u298C",
  8373. "rbrksld;": "\u298E",
  8374. "rbrkslu;": "\u2990",
  8375. "Rcaron;": "\u0158",
  8376. "rcaron;": "\u0159",
  8377. "Rcedil;": "\u0156",
  8378. "rcedil;": "\u0157",
  8379. "rceil;": "\u2309",
  8380. "rcub;": "\u007D",
  8381. "Rcy;": "\u0420",
  8382. "rcy;": "\u0440",
  8383. "rdca;": "\u2937",
  8384. "rdldhar;": "\u2969",
  8385. "rdquo;": "\u201D",
  8386. "rdquor;": "\u201D",
  8387. "rdsh;": "\u21B3",
  8388. "real;": "\u211C",
  8389. "realine;": "\u211B",
  8390. "realpart;": "\u211C",
  8391. "reals;": "\u211D",
  8392. "Re;": "\u211C",
  8393. "rect;": "\u25AD",
  8394. "reg;": "\u00AE",
  8395. "reg": "\u00AE",
  8396. "REG;": "\u00AE",
  8397. "REG": "\u00AE",
  8398. "ReverseElement;": "\u220B",
  8399. "ReverseEquilibrium;": "\u21CB",
  8400. "ReverseUpEquilibrium;": "\u296F",
  8401. "rfisht;": "\u297D",
  8402. "rfloor;": "\u230B",
  8403. "rfr;": "\uD835\uDD2F",
  8404. "Rfr;": "\u211C",
  8405. "rHar;": "\u2964",
  8406. "rhard;": "\u21C1",
  8407. "rharu;": "\u21C0",
  8408. "rharul;": "\u296C",
  8409. "Rho;": "\u03A1",
  8410. "rho;": "\u03C1",
  8411. "rhov;": "\u03F1",
  8412. "RightAngleBracket;": "\u27E9",
  8413. "RightArrowBar;": "\u21E5",
  8414. "rightarrow;": "\u2192",
  8415. "RightArrow;": "\u2192",
  8416. "Rightarrow;": "\u21D2",
  8417. "RightArrowLeftArrow;": "\u21C4",
  8418. "rightarrowtail;": "\u21A3",
  8419. "RightCeiling;": "\u2309",
  8420. "RightDoubleBracket;": "\u27E7",
  8421. "RightDownTeeVector;": "\u295D",
  8422. "RightDownVectorBar;": "\u2955",
  8423. "RightDownVector;": "\u21C2",
  8424. "RightFloor;": "\u230B",
  8425. "rightharpoondown;": "\u21C1",
  8426. "rightharpoonup;": "\u21C0",
  8427. "rightleftarrows;": "\u21C4",
  8428. "rightleftharpoons;": "\u21CC",
  8429. "rightrightarrows;": "\u21C9",
  8430. "rightsquigarrow;": "\u219D",
  8431. "RightTeeArrow;": "\u21A6",
  8432. "RightTee;": "\u22A2",
  8433. "RightTeeVector;": "\u295B",
  8434. "rightthreetimes;": "\u22CC",
  8435. "RightTriangleBar;": "\u29D0",
  8436. "RightTriangle;": "\u22B3",
  8437. "RightTriangleEqual;": "\u22B5",
  8438. "RightUpDownVector;": "\u294F",
  8439. "RightUpTeeVector;": "\u295C",
  8440. "RightUpVectorBar;": "\u2954",
  8441. "RightUpVector;": "\u21BE",
  8442. "RightVectorBar;": "\u2953",
  8443. "RightVector;": "\u21C0",
  8444. "ring;": "\u02DA",
  8445. "risingdotseq;": "\u2253",
  8446. "rlarr;": "\u21C4",
  8447. "rlhar;": "\u21CC",
  8448. "rlm;": "\u200F",
  8449. "rmoustache;": "\u23B1",
  8450. "rmoust;": "\u23B1",
  8451. "rnmid;": "\u2AEE",
  8452. "roang;": "\u27ED",
  8453. "roarr;": "\u21FE",
  8454. "robrk;": "\u27E7",
  8455. "ropar;": "\u2986",
  8456. "ropf;": "\uD835\uDD63",
  8457. "Ropf;": "\u211D",
  8458. "roplus;": "\u2A2E",
  8459. "rotimes;": "\u2A35",
  8460. "RoundImplies;": "\u2970",
  8461. "rpar;": "\u0029",
  8462. "rpargt;": "\u2994",
  8463. "rppolint;": "\u2A12",
  8464. "rrarr;": "\u21C9",
  8465. "Rrightarrow;": "\u21DB",
  8466. "rsaquo;": "\u203A",
  8467. "rscr;": "\uD835\uDCC7",
  8468. "Rscr;": "\u211B",
  8469. "rsh;": "\u21B1",
  8470. "Rsh;": "\u21B1",
  8471. "rsqb;": "\u005D",
  8472. "rsquo;": "\u2019",
  8473. "rsquor;": "\u2019",
  8474. "rthree;": "\u22CC",
  8475. "rtimes;": "\u22CA",
  8476. "rtri;": "\u25B9",
  8477. "rtrie;": "\u22B5",
  8478. "rtrif;": "\u25B8",
  8479. "rtriltri;": "\u29CE",
  8480. "RuleDelayed;": "\u29F4",
  8481. "ruluhar;": "\u2968",
  8482. "rx;": "\u211E",
  8483. "Sacute;": "\u015A",
  8484. "sacute;": "\u015B",
  8485. "sbquo;": "\u201A",
  8486. "scap;": "\u2AB8",
  8487. "Scaron;": "\u0160",
  8488. "scaron;": "\u0161",
  8489. "Sc;": "\u2ABC",
  8490. "sc;": "\u227B",
  8491. "sccue;": "\u227D",
  8492. "sce;": "\u2AB0",
  8493. "scE;": "\u2AB4",
  8494. "Scedil;": "\u015E",
  8495. "scedil;": "\u015F",
  8496. "Scirc;": "\u015C",
  8497. "scirc;": "\u015D",
  8498. "scnap;": "\u2ABA",
  8499. "scnE;": "\u2AB6",
  8500. "scnsim;": "\u22E9",
  8501. "scpolint;": "\u2A13",
  8502. "scsim;": "\u227F",
  8503. "Scy;": "\u0421",
  8504. "scy;": "\u0441",
  8505. "sdotb;": "\u22A1",
  8506. "sdot;": "\u22C5",
  8507. "sdote;": "\u2A66",
  8508. "searhk;": "\u2925",
  8509. "searr;": "\u2198",
  8510. "seArr;": "\u21D8",
  8511. "searrow;": "\u2198",
  8512. "sect;": "\u00A7",
  8513. "sect": "\u00A7",
  8514. "semi;": "\u003B",
  8515. "seswar;": "\u2929",
  8516. "setminus;": "\u2216",
  8517. "setmn;": "\u2216",
  8518. "sext;": "\u2736",
  8519. "Sfr;": "\uD835\uDD16",
  8520. "sfr;": "\uD835\uDD30",
  8521. "sfrown;": "\u2322",
  8522. "sharp;": "\u266F",
  8523. "SHCHcy;": "\u0429",
  8524. "shchcy;": "\u0449",
  8525. "SHcy;": "\u0428",
  8526. "shcy;": "\u0448",
  8527. "ShortDownArrow;": "\u2193",
  8528. "ShortLeftArrow;": "\u2190",
  8529. "shortmid;": "\u2223",
  8530. "shortparallel;": "\u2225",
  8531. "ShortRightArrow;": "\u2192",
  8532. "ShortUpArrow;": "\u2191",
  8533. "shy;": "\u00AD",
  8534. "shy": "\u00AD",
  8535. "Sigma;": "\u03A3",
  8536. "sigma;": "\u03C3",
  8537. "sigmaf;": "\u03C2",
  8538. "sigmav;": "\u03C2",
  8539. "sim;": "\u223C",
  8540. "simdot;": "\u2A6A",
  8541. "sime;": "\u2243",
  8542. "simeq;": "\u2243",
  8543. "simg;": "\u2A9E",
  8544. "simgE;": "\u2AA0",
  8545. "siml;": "\u2A9D",
  8546. "simlE;": "\u2A9F",
  8547. "simne;": "\u2246",
  8548. "simplus;": "\u2A24",
  8549. "simrarr;": "\u2972",
  8550. "slarr;": "\u2190",
  8551. "SmallCircle;": "\u2218",
  8552. "smallsetminus;": "\u2216",
  8553. "smashp;": "\u2A33",
  8554. "smeparsl;": "\u29E4",
  8555. "smid;": "\u2223",
  8556. "smile;": "\u2323",
  8557. "smt;": "\u2AAA",
  8558. "smte;": "\u2AAC",
  8559. "smtes;": "\u2AAC\uFE00",
  8560. "SOFTcy;": "\u042C",
  8561. "softcy;": "\u044C",
  8562. "solbar;": "\u233F",
  8563. "solb;": "\u29C4",
  8564. "sol;": "\u002F",
  8565. "Sopf;": "\uD835\uDD4A",
  8566. "sopf;": "\uD835\uDD64",
  8567. "spades;": "\u2660",
  8568. "spadesuit;": "\u2660",
  8569. "spar;": "\u2225",
  8570. "sqcap;": "\u2293",
  8571. "sqcaps;": "\u2293\uFE00",
  8572. "sqcup;": "\u2294",
  8573. "sqcups;": "\u2294\uFE00",
  8574. "Sqrt;": "\u221A",
  8575. "sqsub;": "\u228F",
  8576. "sqsube;": "\u2291",
  8577. "sqsubset;": "\u228F",
  8578. "sqsubseteq;": "\u2291",
  8579. "sqsup;": "\u2290",
  8580. "sqsupe;": "\u2292",
  8581. "sqsupset;": "\u2290",
  8582. "sqsupseteq;": "\u2292",
  8583. "square;": "\u25A1",
  8584. "Square;": "\u25A1",
  8585. "SquareIntersection;": "\u2293",
  8586. "SquareSubset;": "\u228F",
  8587. "SquareSubsetEqual;": "\u2291",
  8588. "SquareSuperset;": "\u2290",
  8589. "SquareSupersetEqual;": "\u2292",
  8590. "SquareUnion;": "\u2294",
  8591. "squarf;": "\u25AA",
  8592. "squ;": "\u25A1",
  8593. "squf;": "\u25AA",
  8594. "srarr;": "\u2192",
  8595. "Sscr;": "\uD835\uDCAE",
  8596. "sscr;": "\uD835\uDCC8",
  8597. "ssetmn;": "\u2216",
  8598. "ssmile;": "\u2323",
  8599. "sstarf;": "\u22C6",
  8600. "Star;": "\u22C6",
  8601. "star;": "\u2606",
  8602. "starf;": "\u2605",
  8603. "straightepsilon;": "\u03F5",
  8604. "straightphi;": "\u03D5",
  8605. "strns;": "\u00AF",
  8606. "sub;": "\u2282",
  8607. "Sub;": "\u22D0",
  8608. "subdot;": "\u2ABD",
  8609. "subE;": "\u2AC5",
  8610. "sube;": "\u2286",
  8611. "subedot;": "\u2AC3",
  8612. "submult;": "\u2AC1",
  8613. "subnE;": "\u2ACB",
  8614. "subne;": "\u228A",
  8615. "subplus;": "\u2ABF",
  8616. "subrarr;": "\u2979",
  8617. "subset;": "\u2282",
  8618. "Subset;": "\u22D0",
  8619. "subseteq;": "\u2286",
  8620. "subseteqq;": "\u2AC5",
  8621. "SubsetEqual;": "\u2286",
  8622. "subsetneq;": "\u228A",
  8623. "subsetneqq;": "\u2ACB",
  8624. "subsim;": "\u2AC7",
  8625. "subsub;": "\u2AD5",
  8626. "subsup;": "\u2AD3",
  8627. "succapprox;": "\u2AB8",
  8628. "succ;": "\u227B",
  8629. "succcurlyeq;": "\u227D",
  8630. "Succeeds;": "\u227B",
  8631. "SucceedsEqual;": "\u2AB0",
  8632. "SucceedsSlantEqual;": "\u227D",
  8633. "SucceedsTilde;": "\u227F",
  8634. "succeq;": "\u2AB0",
  8635. "succnapprox;": "\u2ABA",
  8636. "succneqq;": "\u2AB6",
  8637. "succnsim;": "\u22E9",
  8638. "succsim;": "\u227F",
  8639. "SuchThat;": "\u220B",
  8640. "sum;": "\u2211",
  8641. "Sum;": "\u2211",
  8642. "sung;": "\u266A",
  8643. "sup1;": "\u00B9",
  8644. "sup1": "\u00B9",
  8645. "sup2;": "\u00B2",
  8646. "sup2": "\u00B2",
  8647. "sup3;": "\u00B3",
  8648. "sup3": "\u00B3",
  8649. "sup;": "\u2283",
  8650. "Sup;": "\u22D1",
  8651. "supdot;": "\u2ABE",
  8652. "supdsub;": "\u2AD8",
  8653. "supE;": "\u2AC6",
  8654. "supe;": "\u2287",
  8655. "supedot;": "\u2AC4",
  8656. "Superset;": "\u2283",
  8657. "SupersetEqual;": "\u2287",
  8658. "suphsol;": "\u27C9",
  8659. "suphsub;": "\u2AD7",
  8660. "suplarr;": "\u297B",
  8661. "supmult;": "\u2AC2",
  8662. "supnE;": "\u2ACC",
  8663. "supne;": "\u228B",
  8664. "supplus;": "\u2AC0",
  8665. "supset;": "\u2283",
  8666. "Supset;": "\u22D1",
  8667. "supseteq;": "\u2287",
  8668. "supseteqq;": "\u2AC6",
  8669. "supsetneq;": "\u228B",
  8670. "supsetneqq;": "\u2ACC",
  8671. "supsim;": "\u2AC8",
  8672. "supsub;": "\u2AD4",
  8673. "supsup;": "\u2AD6",
  8674. "swarhk;": "\u2926",
  8675. "swarr;": "\u2199",
  8676. "swArr;": "\u21D9",
  8677. "swarrow;": "\u2199",
  8678. "swnwar;": "\u292A",
  8679. "szlig;": "\u00DF",
  8680. "szlig": "\u00DF",
  8681. "Tab;": "\u0009",
  8682. "target;": "\u2316",
  8683. "Tau;": "\u03A4",
  8684. "tau;": "\u03C4",
  8685. "tbrk;": "\u23B4",
  8686. "Tcaron;": "\u0164",
  8687. "tcaron;": "\u0165",
  8688. "Tcedil;": "\u0162",
  8689. "tcedil;": "\u0163",
  8690. "Tcy;": "\u0422",
  8691. "tcy;": "\u0442",
  8692. "tdot;": "\u20DB",
  8693. "telrec;": "\u2315",
  8694. "Tfr;": "\uD835\uDD17",
  8695. "tfr;": "\uD835\uDD31",
  8696. "there4;": "\u2234",
  8697. "therefore;": "\u2234",
  8698. "Therefore;": "\u2234",
  8699. "Theta;": "\u0398",
  8700. "theta;": "\u03B8",
  8701. "thetasym;": "\u03D1",
  8702. "thetav;": "\u03D1",
  8703. "thickapprox;": "\u2248",
  8704. "thicksim;": "\u223C",
  8705. "ThickSpace;": "\u205F\u200A",
  8706. "ThinSpace;": "\u2009",
  8707. "thinsp;": "\u2009",
  8708. "thkap;": "\u2248",
  8709. "thksim;": "\u223C",
  8710. "THORN;": "\u00DE",
  8711. "THORN": "\u00DE",
  8712. "thorn;": "\u00FE",
  8713. "thorn": "\u00FE",
  8714. "tilde;": "\u02DC",
  8715. "Tilde;": "\u223C",
  8716. "TildeEqual;": "\u2243",
  8717. "TildeFullEqual;": "\u2245",
  8718. "TildeTilde;": "\u2248",
  8719. "timesbar;": "\u2A31",
  8720. "timesb;": "\u22A0",
  8721. "times;": "\u00D7",
  8722. "times": "\u00D7",
  8723. "timesd;": "\u2A30",
  8724. "tint;": "\u222D",
  8725. "toea;": "\u2928",
  8726. "topbot;": "\u2336",
  8727. "topcir;": "\u2AF1",
  8728. "top;": "\u22A4",
  8729. "Topf;": "\uD835\uDD4B",
  8730. "topf;": "\uD835\uDD65",
  8731. "topfork;": "\u2ADA",
  8732. "tosa;": "\u2929",
  8733. "tprime;": "\u2034",
  8734. "trade;": "\u2122",
  8735. "TRADE;": "\u2122",
  8736. "triangle;": "\u25B5",
  8737. "triangledown;": "\u25BF",
  8738. "triangleleft;": "\u25C3",
  8739. "trianglelefteq;": "\u22B4",
  8740. "triangleq;": "\u225C",
  8741. "triangleright;": "\u25B9",
  8742. "trianglerighteq;": "\u22B5",
  8743. "tridot;": "\u25EC",
  8744. "trie;": "\u225C",
  8745. "triminus;": "\u2A3A",
  8746. "TripleDot;": "\u20DB",
  8747. "triplus;": "\u2A39",
  8748. "trisb;": "\u29CD",
  8749. "tritime;": "\u2A3B",
  8750. "trpezium;": "\u23E2",
  8751. "Tscr;": "\uD835\uDCAF",
  8752. "tscr;": "\uD835\uDCC9",
  8753. "TScy;": "\u0426",
  8754. "tscy;": "\u0446",
  8755. "TSHcy;": "\u040B",
  8756. "tshcy;": "\u045B",
  8757. "Tstrok;": "\u0166",
  8758. "tstrok;": "\u0167",
  8759. "twixt;": "\u226C",
  8760. "twoheadleftarrow;": "\u219E",
  8761. "twoheadrightarrow;": "\u21A0",
  8762. "Uacute;": "\u00DA",
  8763. "Uacute": "\u00DA",
  8764. "uacute;": "\u00FA",
  8765. "uacute": "\u00FA",
  8766. "uarr;": "\u2191",
  8767. "Uarr;": "\u219F",
  8768. "uArr;": "\u21D1",
  8769. "Uarrocir;": "\u2949",
  8770. "Ubrcy;": "\u040E",
  8771. "ubrcy;": "\u045E",
  8772. "Ubreve;": "\u016C",
  8773. "ubreve;": "\u016D",
  8774. "Ucirc;": "\u00DB",
  8775. "Ucirc": "\u00DB",
  8776. "ucirc;": "\u00FB",
  8777. "ucirc": "\u00FB",
  8778. "Ucy;": "\u0423",
  8779. "ucy;": "\u0443",
  8780. "udarr;": "\u21C5",
  8781. "Udblac;": "\u0170",
  8782. "udblac;": "\u0171",
  8783. "udhar;": "\u296E",
  8784. "ufisht;": "\u297E",
  8785. "Ufr;": "\uD835\uDD18",
  8786. "ufr;": "\uD835\uDD32",
  8787. "Ugrave;": "\u00D9",
  8788. "Ugrave": "\u00D9",
  8789. "ugrave;": "\u00F9",
  8790. "ugrave": "\u00F9",
  8791. "uHar;": "\u2963",
  8792. "uharl;": "\u21BF",
  8793. "uharr;": "\u21BE",
  8794. "uhblk;": "\u2580",
  8795. "ulcorn;": "\u231C",
  8796. "ulcorner;": "\u231C",
  8797. "ulcrop;": "\u230F",
  8798. "ultri;": "\u25F8",
  8799. "Umacr;": "\u016A",
  8800. "umacr;": "\u016B",
  8801. "uml;": "\u00A8",
  8802. "uml": "\u00A8",
  8803. "UnderBar;": "\u005F",
  8804. "UnderBrace;": "\u23DF",
  8805. "UnderBracket;": "\u23B5",
  8806. "UnderParenthesis;": "\u23DD",
  8807. "Union;": "\u22C3",
  8808. "UnionPlus;": "\u228E",
  8809. "Uogon;": "\u0172",
  8810. "uogon;": "\u0173",
  8811. "Uopf;": "\uD835\uDD4C",
  8812. "uopf;": "\uD835\uDD66",
  8813. "UpArrowBar;": "\u2912",
  8814. "uparrow;": "\u2191",
  8815. "UpArrow;": "\u2191",
  8816. "Uparrow;": "\u21D1",
  8817. "UpArrowDownArrow;": "\u21C5",
  8818. "updownarrow;": "\u2195",
  8819. "UpDownArrow;": "\u2195",
  8820. "Updownarrow;": "\u21D5",
  8821. "UpEquilibrium;": "\u296E",
  8822. "upharpoonleft;": "\u21BF",
  8823. "upharpoonright;": "\u21BE",
  8824. "uplus;": "\u228E",
  8825. "UpperLeftArrow;": "\u2196",
  8826. "UpperRightArrow;": "\u2197",
  8827. "upsi;": "\u03C5",
  8828. "Upsi;": "\u03D2",
  8829. "upsih;": "\u03D2",
  8830. "Upsilon;": "\u03A5",
  8831. "upsilon;": "\u03C5",
  8832. "UpTeeArrow;": "\u21A5",
  8833. "UpTee;": "\u22A5",
  8834. "upuparrows;": "\u21C8",
  8835. "urcorn;": "\u231D",
  8836. "urcorner;": "\u231D",
  8837. "urcrop;": "\u230E",
  8838. "Uring;": "\u016E",
  8839. "uring;": "\u016F",
  8840. "urtri;": "\u25F9",
  8841. "Uscr;": "\uD835\uDCB0",
  8842. "uscr;": "\uD835\uDCCA",
  8843. "utdot;": "\u22F0",
  8844. "Utilde;": "\u0168",
  8845. "utilde;": "\u0169",
  8846. "utri;": "\u25B5",
  8847. "utrif;": "\u25B4",
  8848. "uuarr;": "\u21C8",
  8849. "Uuml;": "\u00DC",
  8850. "Uuml": "\u00DC",
  8851. "uuml;": "\u00FC",
  8852. "uuml": "\u00FC",
  8853. "uwangle;": "\u29A7",
  8854. "vangrt;": "\u299C",
  8855. "varepsilon;": "\u03F5",
  8856. "varkappa;": "\u03F0",
  8857. "varnothing;": "\u2205",
  8858. "varphi;": "\u03D5",
  8859. "varpi;": "\u03D6",
  8860. "varpropto;": "\u221D",
  8861. "varr;": "\u2195",
  8862. "vArr;": "\u21D5",
  8863. "varrho;": "\u03F1",
  8864. "varsigma;": "\u03C2",
  8865. "varsubsetneq;": "\u228A\uFE00",
  8866. "varsubsetneqq;": "\u2ACB\uFE00",
  8867. "varsupsetneq;": "\u228B\uFE00",
  8868. "varsupsetneqq;": "\u2ACC\uFE00",
  8869. "vartheta;": "\u03D1",
  8870. "vartriangleleft;": "\u22B2",
  8871. "vartriangleright;": "\u22B3",
  8872. "vBar;": "\u2AE8",
  8873. "Vbar;": "\u2AEB",
  8874. "vBarv;": "\u2AE9",
  8875. "Vcy;": "\u0412",
  8876. "vcy;": "\u0432",
  8877. "vdash;": "\u22A2",
  8878. "vDash;": "\u22A8",
  8879. "Vdash;": "\u22A9",
  8880. "VDash;": "\u22AB",
  8881. "Vdashl;": "\u2AE6",
  8882. "veebar;": "\u22BB",
  8883. "vee;": "\u2228",
  8884. "Vee;": "\u22C1",
  8885. "veeeq;": "\u225A",
  8886. "vellip;": "\u22EE",
  8887. "verbar;": "\u007C",
  8888. "Verbar;": "\u2016",
  8889. "vert;": "\u007C",
  8890. "Vert;": "\u2016",
  8891. "VerticalBar;": "\u2223",
  8892. "VerticalLine;": "\u007C",
  8893. "VerticalSeparator;": "\u2758",
  8894. "VerticalTilde;": "\u2240",
  8895. "VeryThinSpace;": "\u200A",
  8896. "Vfr;": "\uD835\uDD19",
  8897. "vfr;": "\uD835\uDD33",
  8898. "vltri;": "\u22B2",
  8899. "vnsub;": "\u2282\u20D2",
  8900. "vnsup;": "\u2283\u20D2",
  8901. "Vopf;": "\uD835\uDD4D",
  8902. "vopf;": "\uD835\uDD67",
  8903. "vprop;": "\u221D",
  8904. "vrtri;": "\u22B3",
  8905. "Vscr;": "\uD835\uDCB1",
  8906. "vscr;": "\uD835\uDCCB",
  8907. "vsubnE;": "\u2ACB\uFE00",
  8908. "vsubne;": "\u228A\uFE00",
  8909. "vsupnE;": "\u2ACC\uFE00",
  8910. "vsupne;": "\u228B\uFE00",
  8911. "Vvdash;": "\u22AA",
  8912. "vzigzag;": "\u299A",
  8913. "Wcirc;": "\u0174",
  8914. "wcirc;": "\u0175",
  8915. "wedbar;": "\u2A5F",
  8916. "wedge;": "\u2227",
  8917. "Wedge;": "\u22C0",
  8918. "wedgeq;": "\u2259",
  8919. "weierp;": "\u2118",
  8920. "Wfr;": "\uD835\uDD1A",
  8921. "wfr;": "\uD835\uDD34",
  8922. "Wopf;": "\uD835\uDD4E",
  8923. "wopf;": "\uD835\uDD68",
  8924. "wp;": "\u2118",
  8925. "wr;": "\u2240",
  8926. "wreath;": "\u2240",
  8927. "Wscr;": "\uD835\uDCB2",
  8928. "wscr;": "\uD835\uDCCC",
  8929. "xcap;": "\u22C2",
  8930. "xcirc;": "\u25EF",
  8931. "xcup;": "\u22C3",
  8932. "xdtri;": "\u25BD",
  8933. "Xfr;": "\uD835\uDD1B",
  8934. "xfr;": "\uD835\uDD35",
  8935. "xharr;": "\u27F7",
  8936. "xhArr;": "\u27FA",
  8937. "Xi;": "\u039E",
  8938. "xi;": "\u03BE",
  8939. "xlarr;": "\u27F5",
  8940. "xlArr;": "\u27F8",
  8941. "xmap;": "\u27FC",
  8942. "xnis;": "\u22FB",
  8943. "xodot;": "\u2A00",
  8944. "Xopf;": "\uD835\uDD4F",
  8945. "xopf;": "\uD835\uDD69",
  8946. "xoplus;": "\u2A01",
  8947. "xotime;": "\u2A02",
  8948. "xrarr;": "\u27F6",
  8949. "xrArr;": "\u27F9",
  8950. "Xscr;": "\uD835\uDCB3",
  8951. "xscr;": "\uD835\uDCCD",
  8952. "xsqcup;": "\u2A06",
  8953. "xuplus;": "\u2A04",
  8954. "xutri;": "\u25B3",
  8955. "xvee;": "\u22C1",
  8956. "xwedge;": "\u22C0",
  8957. "Yacute;": "\u00DD",
  8958. "Yacute": "\u00DD",
  8959. "yacute;": "\u00FD",
  8960. "yacute": "\u00FD",
  8961. "YAcy;": "\u042F",
  8962. "yacy;": "\u044F",
  8963. "Ycirc;": "\u0176",
  8964. "ycirc;": "\u0177",
  8965. "Ycy;": "\u042B",
  8966. "ycy;": "\u044B",
  8967. "yen;": "\u00A5",
  8968. "yen": "\u00A5",
  8969. "Yfr;": "\uD835\uDD1C",
  8970. "yfr;": "\uD835\uDD36",
  8971. "YIcy;": "\u0407",
  8972. "yicy;": "\u0457",
  8973. "Yopf;": "\uD835\uDD50",
  8974. "yopf;": "\uD835\uDD6A",
  8975. "Yscr;": "\uD835\uDCB4",
  8976. "yscr;": "\uD835\uDCCE",
  8977. "YUcy;": "\u042E",
  8978. "yucy;": "\u044E",
  8979. "yuml;": "\u00FF",
  8980. "yuml": "\u00FF",
  8981. "Yuml;": "\u0178",
  8982. "Zacute;": "\u0179",
  8983. "zacute;": "\u017A",
  8984. "Zcaron;": "\u017D",
  8985. "zcaron;": "\u017E",
  8986. "Zcy;": "\u0417",
  8987. "zcy;": "\u0437",
  8988. "Zdot;": "\u017B",
  8989. "zdot;": "\u017C",
  8990. "zeetrf;": "\u2128",
  8991. "ZeroWidthSpace;": "\u200B",
  8992. "Zeta;": "\u0396",
  8993. "zeta;": "\u03B6",
  8994. "zfr;": "\uD835\uDD37",
  8995. "Zfr;": "\u2128",
  8996. "ZHcy;": "\u0416",
  8997. "zhcy;": "\u0436",
  8998. "zigrarr;": "\u21DD",
  8999. "zopf;": "\uD835\uDD6B",
  9000. "Zopf;": "\u2124",
  9001. "Zscr;": "\uD835\uDCB5",
  9002. "zscr;": "\uD835\uDCCF",
  9003. "zwj;": "\u200D",
  9004. "zwnj;": "\u200C"
  9005. };
  9006. },
  9007. {}],
  9008. 13:[function(_dereq_,module,exports){
  9009. //
  9010. //
  9011. //
  9012. //
  9013. //
  9014. var util = _dereq_('util/');
  9015. var pSlice = Array.prototype.slice;
  9016. var hasOwn = Object.prototype.hasOwnProperty;
  9017. var assert = module.exports = ok;
  9018. assert.AssertionError = function AssertionError(options) {
  9019. this.name = 'AssertionError';
  9020. this.actual = options.actual;
  9021. this.expected = options.expected;
  9022. this.operator = options.operator;
  9023. if (options.message) {
  9024. this.message = options.message;
  9025. this.generatedMessage = false;
  9026. } else {
  9027. this.message = getMessage(this);
  9028. this.generatedMessage = true;
  9029. }
  9030. var stackStartFunction = options.stackStartFunction || fail;
  9031. if (Error.captureStackTrace) {
  9032. Error.captureStackTrace(this, stackStartFunction);
  9033. }
  9034. else {
  9035. var err = new Error();
  9036. if (err.stack) {
  9037. var out = err.stack;
  9038. var fn_name = stackStartFunction.name;
  9039. var idx = out.indexOf('\n' + fn_name);
  9040. if (idx >= 0) {
  9041. var next_line = out.indexOf('\n', idx + 1);
  9042. out = out.substring(next_line + 1);
  9043. }
  9044. this.stack = out;
  9045. }
  9046. }
  9047. };
  9048. util.inherits(assert.AssertionError, Error);
  9049. function replacer(key, value) {
  9050. if (util.isUndefined(value)) {
  9051. return '' + value;
  9052. }
  9053. if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) {
  9054. return value.toString();
  9055. }
  9056. if (util.isFunction(value) || util.isRegExp(value)) {
  9057. return value.toString();
  9058. }
  9059. return value;
  9060. }
  9061. function truncate(s, n) {
  9062. if (util.isString(s)) {
  9063. return s.length < n ? s : s.slice(0, n);
  9064. } else {
  9065. return s;
  9066. }
  9067. }
  9068. function getMessage(self) {
  9069. return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
  9070. self.operator + ' ' +
  9071. truncate(JSON.stringify(self.expected, replacer), 128);
  9072. }
  9073. function fail(actual, expected, message, operator, stackStartFunction) {
  9074. throw new assert.AssertionError({
  9075. message: message,
  9076. actual: actual,
  9077. expected: expected,
  9078. operator: operator,
  9079. stackStartFunction: stackStartFunction
  9080. });
  9081. }
  9082. assert.fail = fail;
  9083. function ok(value, message) {
  9084. if (!value) fail(value, true, message, '==', assert.ok);
  9085. }
  9086. assert.ok = ok;
  9087. assert.equal = function equal(actual, expected, message) {
  9088. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  9089. };
  9090. assert.notEqual = function notEqual(actual, expected, message) {
  9091. if (actual == expected) {
  9092. fail(actual, expected, message, '!=', assert.notEqual);
  9093. }
  9094. };
  9095. assert.deepEqual = function deepEqual(actual, expected, message) {
  9096. if (!_deepEqual(actual, expected)) {
  9097. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  9098. }
  9099. };
  9100. function _deepEqual(actual, expected) {
  9101. if (actual === expected) {
  9102. return true;
  9103. } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
  9104. if (actual.length != expected.length) return false;
  9105. for (var i = 0; i < actual.length; i++) {
  9106. if (actual[i] !== expected[i]) return false;
  9107. }
  9108. return true;
  9109. } else if (util.isDate(actual) && util.isDate(expected)) {
  9110. return actual.getTime() === expected.getTime();
  9111. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  9112. return actual.source === expected.source &&
  9113. actual.global === expected.global &&
  9114. actual.multiline === expected.multiline &&
  9115. actual.lastIndex === expected.lastIndex &&
  9116. actual.ignoreCase === expected.ignoreCase;
  9117. } else if (!util.isObject(actual) && !util.isObject(expected)) {
  9118. return actual == expected;
  9119. } else {
  9120. return objEquiv(actual, expected);
  9121. }
  9122. }
  9123. function isArguments(object) {
  9124. return Object.prototype.toString.call(object) == '[object Arguments]';
  9125. }
  9126. function objEquiv(a, b) {
  9127. if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
  9128. return false;
  9129. if (a.prototype !== b.prototype) return false;
  9130. if (isArguments(a)) {
  9131. if (!isArguments(b)) {
  9132. return false;
  9133. }
  9134. a = pSlice.call(a);
  9135. b = pSlice.call(b);
  9136. return _deepEqual(a, b);
  9137. }
  9138. try {
  9139. var ka = objectKeys(a),
  9140. kb = objectKeys(b),
  9141. key, i;
  9142. } catch (e) {//happens when one is a string literal and the other isn't
  9143. return false;
  9144. }
  9145. if (ka.length != kb.length)
  9146. return false;
  9147. ka.sort();
  9148. kb.sort();
  9149. for (i = ka.length - 1; i >= 0; i--) {
  9150. if (ka[i] != kb[i])
  9151. return false;
  9152. }
  9153. for (i = ka.length - 1; i >= 0; i--) {
  9154. key = ka[i];
  9155. if (!_deepEqual(a[key], b[key])) return false;
  9156. }
  9157. return true;
  9158. }
  9159. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  9160. if (_deepEqual(actual, expected)) {
  9161. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  9162. }
  9163. };
  9164. assert.strictEqual = function strictEqual(actual, expected, message) {
  9165. if (actual !== expected) {
  9166. fail(actual, expected, message, '===', assert.strictEqual);
  9167. }
  9168. };
  9169. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  9170. if (actual === expected) {
  9171. fail(actual, expected, message, '!==', assert.notStrictEqual);
  9172. }
  9173. };
  9174. function expectedException(actual, expected) {
  9175. if (!actual || !expected) {
  9176. return false;
  9177. }
  9178. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  9179. return expected.test(actual);
  9180. } else if (actual instanceof expected) {
  9181. return true;
  9182. } else if (expected.call({}, actual) === true) {
  9183. return true;
  9184. }
  9185. return false;
  9186. }
  9187. function _throws(shouldThrow, block, expected, message) {
  9188. var actual;
  9189. if (util.isString(expected)) {
  9190. message = expected;
  9191. expected = null;
  9192. }
  9193. try {
  9194. block();
  9195. } catch (e) {
  9196. actual = e;
  9197. }
  9198. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  9199. (message ? ' ' + message : '.');
  9200. if (shouldThrow && !actual) {
  9201. fail(actual, expected, 'Missing expected exception' + message);
  9202. }
  9203. if (!shouldThrow && expectedException(actual, expected)) {
  9204. fail(actual, expected, 'Got unwanted exception' + message);
  9205. }
  9206. if ((shouldThrow && actual && expected &&
  9207. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  9208. throw actual;
  9209. }
  9210. }
  9211. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  9212. _throws.apply(this, [true].concat(pSlice.call(arguments)));
  9213. };
  9214. assert.doesNotThrow = function(block, /*optional*/message) {
  9215. _throws.apply(this, [false].concat(pSlice.call(arguments)));
  9216. };
  9217. assert.ifError = function(err) { if (err) {throw err;}};
  9218. var objectKeys = Object.keys || function (obj) {
  9219. var keys = [];
  9220. for (var key in obj) {
  9221. if (hasOwn.call(obj, key)) keys.push(key);
  9222. }
  9223. return keys;
  9224. };
  9225. },
  9226. {"util/":15}],
  9227. 14:[function(_dereq_,module,exports){
  9228. module.exports = function isBuffer(arg) {
  9229. return arg && typeof arg === 'object'
  9230. && typeof arg.copy === 'function'
  9231. && typeof arg.fill === 'function'
  9232. && typeof arg.readUInt8 === 'function';
  9233. }
  9234. },
  9235. {}],
  9236. 15:[function(_dereq_,module,exports){
  9237. (function (process,global){
  9238. //
  9239. //
  9240. //
  9241. var formatRegExp = /%[sdj%]/g;
  9242. exports.format = function(f) {
  9243. if (!isString(f)) {
  9244. var objects = [];
  9245. for (var i = 0; i < arguments.length; i++) {
  9246. objects.push(inspect(arguments[i]));
  9247. }
  9248. return objects.join(' ');
  9249. }
  9250. var i = 1;
  9251. var args = arguments;
  9252. var len = args.length;
  9253. var str = String(f).replace(formatRegExp, function(x) {
  9254. if (x === '%%') return '%';
  9255. if (i >= len) return x;
  9256. switch (x) {
  9257. case '%s': return String(args[i++]);
  9258. case '%d': return Number(args[i++]);
  9259. case '%j':
  9260. try {
  9261. return JSON.stringify(args[i++]);
  9262. } catch (_) {
  9263. return '[Circular]';
  9264. }
  9265. default:
  9266. return x;
  9267. }
  9268. });
  9269. for (var x = args[i]; i < len; x = args[++i]) {
  9270. if (isNull(x) || !isObject(x)) {
  9271. str += ' ' + x;
  9272. } else {
  9273. str += ' ' + inspect(x);
  9274. }
  9275. }
  9276. return str;
  9277. };
  9278. exports.deprecate = function(fn, msg) {
  9279. if (isUndefined(global.process)) {
  9280. return function() {
  9281. return exports.deprecate(fn, msg).apply(this, arguments);
  9282. };
  9283. }
  9284. if (process.noDeprecation === true) {
  9285. return fn;
  9286. }
  9287. var warned = false;
  9288. function deprecated() {
  9289. if (!warned) {
  9290. if (process.throwDeprecation) {
  9291. throw new Error(msg);
  9292. } else if (process.traceDeprecation) {
  9293. console.trace(msg);
  9294. } else {
  9295. console.error(msg);
  9296. }
  9297. warned = true;
  9298. }
  9299. return fn.apply(this, arguments);
  9300. }
  9301. return deprecated;
  9302. };
  9303. var debugs = {};
  9304. var debugEnviron;
  9305. exports.debuglog = function(set) {
  9306. if (isUndefined(debugEnviron))
  9307. debugEnviron = process.env.NODE_DEBUG || '';
  9308. set = set.toUpperCase();
  9309. if (!debugs[set]) {
  9310. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  9311. var pid = process.pid;
  9312. debugs[set] = function() {
  9313. var msg = exports.format.apply(exports, arguments);
  9314. console.error('%s %d: %s', set, pid, msg);
  9315. };
  9316. } else {
  9317. debugs[set] = function() {};
  9318. }
  9319. }
  9320. return debugs[set];
  9321. };
  9322. function inspect(obj, opts) {
  9323. var ctx = {
  9324. seen: [],
  9325. stylize: stylizeNoColor
  9326. };
  9327. if (arguments.length >= 3) ctx.depth = arguments[2];
  9328. if (arguments.length >= 4) ctx.colors = arguments[3];
  9329. if (isBoolean(opts)) {
  9330. ctx.showHidden = opts;
  9331. } else if (opts) {
  9332. exports._extend(ctx, opts);
  9333. }
  9334. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  9335. if (isUndefined(ctx.depth)) ctx.depth = 2;
  9336. if (isUndefined(ctx.colors)) ctx.colors = false;
  9337. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  9338. if (ctx.colors) ctx.stylize = stylizeWithColor;
  9339. return formatValue(ctx, obj, ctx.depth);
  9340. }
  9341. exports.inspect = inspect;
  9342. inspect.colors = {
  9343. 'bold' : [1, 22],
  9344. 'italic' : [3, 23],
  9345. 'underline' : [4, 24],
  9346. 'inverse' : [7, 27],
  9347. 'white' : [37, 39],
  9348. 'grey' : [90, 39],
  9349. 'black' : [30, 39],
  9350. 'blue' : [34, 39],
  9351. 'cyan' : [36, 39],
  9352. 'green' : [32, 39],
  9353. 'magenta' : [35, 39],
  9354. 'red' : [31, 39],
  9355. 'yellow' : [33, 39]
  9356. };
  9357. inspect.styles = {
  9358. 'special': 'cyan',
  9359. 'number': 'yellow',
  9360. 'boolean': 'yellow',
  9361. 'undefined': 'grey',
  9362. 'null': 'bold',
  9363. 'string': 'green',
  9364. 'date': 'magenta',
  9365. 'regexp': 'red'
  9366. };
  9367. function stylizeWithColor(str, styleType) {
  9368. var style = inspect.styles[styleType];
  9369. if (style) {
  9370. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  9371. '\u001b[' + inspect.colors[style][1] + 'm';
  9372. } else {
  9373. return str;
  9374. }
  9375. }
  9376. function stylizeNoColor(str, styleType) {
  9377. return str;
  9378. }
  9379. function arrayToHash(array) {
  9380. var hash = {};
  9381. array.forEach(function(val, idx) {
  9382. hash[val] = true;
  9383. });
  9384. return hash;
  9385. }
  9386. function formatValue(ctx, value, recurseTimes) {
  9387. if (ctx.customInspect &&
  9388. value &&
  9389. isFunction(value.inspect) &&
  9390. value.inspect !== exports.inspect &&
  9391. !(value.constructor && value.constructor.prototype === value)) {
  9392. var ret = value.inspect(recurseTimes, ctx);
  9393. if (!isString(ret)) {
  9394. ret = formatValue(ctx, ret, recurseTimes);
  9395. }
  9396. return ret;
  9397. }
  9398. var primitive = formatPrimitive(ctx, value);
  9399. if (primitive) {
  9400. return primitive;
  9401. }
  9402. var keys = Object.keys(value);
  9403. var visibleKeys = arrayToHash(keys);
  9404. if (ctx.showHidden) {
  9405. keys = Object.getOwnPropertyNames(value);
  9406. }
  9407. if (isError(value)
  9408. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  9409. return formatError(value);
  9410. }
  9411. if (keys.length === 0) {
  9412. if (isFunction(value)) {
  9413. var name = value.name ? ': ' + value.name : '';
  9414. return ctx.stylize('[Function' + name + ']', 'special');
  9415. }
  9416. if (isRegExp(value)) {
  9417. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  9418. }
  9419. if (isDate(value)) {
  9420. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  9421. }
  9422. if (isError(value)) {
  9423. return formatError(value);
  9424. }
  9425. }
  9426. var base = '', array = false, braces = ['{', '}'];
  9427. if (isArray(value)) {
  9428. array = true;
  9429. braces = ['[', ']'];
  9430. }
  9431. if (isFunction(value)) {
  9432. var n = value.name ? ': ' + value.name : '';
  9433. base = ' [Function' + n + ']';
  9434. }
  9435. if (isRegExp(value)) {
  9436. base = ' ' + RegExp.prototype.toString.call(value);
  9437. }
  9438. if (isDate(value)) {
  9439. base = ' ' + Date.prototype.toUTCString.call(value);
  9440. }
  9441. if (isError(value)) {
  9442. base = ' ' + formatError(value);
  9443. }
  9444. if (keys.length === 0 && (!array || value.length == 0)) {
  9445. return braces[0] + base + braces[1];
  9446. }
  9447. if (recurseTimes < 0) {
  9448. if (isRegExp(value)) {
  9449. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  9450. } else {
  9451. return ctx.stylize('[Object]', 'special');
  9452. }
  9453. }
  9454. ctx.seen.push(value);
  9455. var output;
  9456. if (array) {
  9457. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  9458. } else {
  9459. output = keys.map(function(key) {
  9460. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  9461. });
  9462. }
  9463. ctx.seen.pop();
  9464. return reduceToSingleString(output, base, braces);
  9465. }
  9466. function formatPrimitive(ctx, value) {
  9467. if (isUndefined(value))
  9468. return ctx.stylize('undefined', 'undefined');
  9469. if (isString(value)) {
  9470. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  9471. .replace(/'/g, "\\'")
  9472. .replace(/\\"/g, '"') + '\'';
  9473. return ctx.stylize(simple, 'string');
  9474. }
  9475. if (isNumber(value))
  9476. return ctx.stylize('' + value, 'number');
  9477. if (isBoolean(value))
  9478. return ctx.stylize('' + value, 'boolean');
  9479. if (isNull(value))
  9480. return ctx.stylize('null', 'null');
  9481. }
  9482. function formatError(value) {
  9483. return '[' + Error.prototype.toString.call(value) + ']';
  9484. }
  9485. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  9486. var output = [];
  9487. for (var i = 0, l = value.length; i < l; ++i) {
  9488. if (hasOwnProperty(value, String(i))) {
  9489. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  9490. String(i), true));
  9491. } else {
  9492. output.push('');
  9493. }
  9494. }
  9495. keys.forEach(function(key) {
  9496. if (!key.match(/^\d+$/)) {
  9497. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  9498. key, true));
  9499. }
  9500. });
  9501. return output;
  9502. }
  9503. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  9504. var name, str, desc;
  9505. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  9506. if (desc.get) {
  9507. if (desc.set) {
  9508. str = ctx.stylize('[Getter/Setter]', 'special');
  9509. } else {
  9510. str = ctx.stylize('[Getter]', 'special');
  9511. }
  9512. } else {
  9513. if (desc.set) {
  9514. str = ctx.stylize('[Setter]', 'special');
  9515. }
  9516. }
  9517. if (!hasOwnProperty(visibleKeys, key)) {
  9518. name = '[' + key + ']';
  9519. }
  9520. if (!str) {
  9521. if (ctx.seen.indexOf(desc.value) < 0) {
  9522. if (isNull(recurseTimes)) {
  9523. str = formatValue(ctx, desc.value, null);
  9524. } else {
  9525. str = formatValue(ctx, desc.value, recurseTimes - 1);
  9526. }
  9527. if (str.indexOf('\n') > -1) {
  9528. if (array) {
  9529. str = str.split('\n').map(function(line) {
  9530. return ' ' + line;
  9531. }).join('\n').substr(2);
  9532. } else {
  9533. str = '\n' + str.split('\n').map(function(line) {
  9534. return ' ' + line;
  9535. }).join('\n');
  9536. }
  9537. }
  9538. } else {
  9539. str = ctx.stylize('[Circular]', 'special');
  9540. }
  9541. }
  9542. if (isUndefined(name)) {
  9543. if (array && key.match(/^\d+$/)) {
  9544. return str;
  9545. }
  9546. name = JSON.stringify('' + key);
  9547. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  9548. name = name.substr(1, name.length - 2);
  9549. name = ctx.stylize(name, 'name');
  9550. } else {
  9551. name = name.replace(/'/g, "\\'")
  9552. .replace(/\\"/g, '"')
  9553. .replace(/(^"|"$)/g, "'");
  9554. name = ctx.stylize(name, 'string');
  9555. }
  9556. }
  9557. return name + ': ' + str;
  9558. }
  9559. function reduceToSingleString(output, base, braces) {
  9560. var numLinesEst = 0;
  9561. var length = output.reduce(function(prev, cur) {
  9562. numLinesEst++;
  9563. if (cur.indexOf('\n') >= 0) numLinesEst++;
  9564. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  9565. }, 0);
  9566. if (length > 60) {
  9567. return braces[0] +
  9568. (base === '' ? '' : base + '\n ') +
  9569. ' ' +
  9570. output.join(',\n ') +
  9571. ' ' +
  9572. braces[1];
  9573. }
  9574. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  9575. }
  9576. function isArray(ar) {
  9577. return Array.isArray(ar);
  9578. }
  9579. exports.isArray = isArray;
  9580. function isBoolean(arg) {
  9581. return typeof arg === 'boolean';
  9582. }
  9583. exports.isBoolean = isBoolean;
  9584. function isNull(arg) {
  9585. return arg === null;
  9586. }
  9587. exports.isNull = isNull;
  9588. function isNullOrUndefined(arg) {
  9589. return arg == null;
  9590. }
  9591. exports.isNullOrUndefined = isNullOrUndefined;
  9592. function isNumber(arg) {
  9593. return typeof arg === 'number';
  9594. }
  9595. exports.isNumber = isNumber;
  9596. function isString(arg) {
  9597. return typeof arg === 'string';
  9598. }
  9599. exports.isString = isString;
  9600. function isSymbol(arg) {
  9601. return typeof arg === 'symbol';
  9602. }
  9603. exports.isSymbol = isSymbol;
  9604. function isUndefined(arg) {
  9605. return arg === void 0;
  9606. }
  9607. exports.isUndefined = isUndefined;
  9608. function isRegExp(re) {
  9609. return isObject(re) && objectToString(re) === '[object RegExp]';
  9610. }
  9611. exports.isRegExp = isRegExp;
  9612. function isObject(arg) {
  9613. return typeof arg === 'object' && arg !== null;
  9614. }
  9615. exports.isObject = isObject;
  9616. function isDate(d) {
  9617. return isObject(d) && objectToString(d) === '[object Date]';
  9618. }
  9619. exports.isDate = isDate;
  9620. function isError(e) {
  9621. return isObject(e) &&
  9622. (objectToString(e) === '[object Error]' || e instanceof Error);
  9623. }
  9624. exports.isError = isError;
  9625. function isFunction(arg) {
  9626. return typeof arg === 'function';
  9627. }
  9628. exports.isFunction = isFunction;
  9629. function isPrimitive(arg) {
  9630. return arg === null ||
  9631. typeof arg === 'boolean' ||
  9632. typeof arg === 'number' ||
  9633. typeof arg === 'string' ||
  9634. typeof arg === 'symbol' || // ES6 symbol
  9635. typeof arg === 'undefined';
  9636. }
  9637. exports.isPrimitive = isPrimitive;
  9638. exports.isBuffer = _dereq_('./support/isBuffer');
  9639. function objectToString(o) {
  9640. return Object.prototype.toString.call(o);
  9641. }
  9642. function pad(n) {
  9643. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  9644. }
  9645. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  9646. 'Oct', 'Nov', 'Dec'];
  9647. function timestamp() {
  9648. var d = new Date();
  9649. var time = [pad(d.getHours()),
  9650. pad(d.getMinutes()),
  9651. pad(d.getSeconds())].join(':');
  9652. return [d.getDate(), months[d.getMonth()], time].join(' ');
  9653. }
  9654. exports.log = function() {
  9655. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  9656. };
  9657. exports.inherits = _dereq_('inherits');
  9658. exports._extend = function(origin, add) {
  9659. if (!add || !isObject(add)) return origin;
  9660. var keys = Object.keys(add);
  9661. var i = keys.length;
  9662. while (i--) {
  9663. origin[keys[i]] = add[keys[i]];
  9664. }
  9665. return origin;
  9666. };
  9667. function hasOwnProperty(obj, prop) {
  9668. return Object.prototype.hasOwnProperty.call(obj, prop);
  9669. }
  9670. }).call(this,_dereq_("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  9671. },
  9672. {"./support/isBuffer":14,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}],
  9673. 16:[function(_dereq_,module,exports){
  9674. //
  9675. //
  9676. //
  9677. function EventEmitter() {
  9678. this._events = this._events || {};
  9679. this._maxListeners = this._maxListeners || undefined;
  9680. }
  9681. module.exports = EventEmitter;
  9682. EventEmitter.EventEmitter = EventEmitter;
  9683. EventEmitter.prototype._events = undefined;
  9684. EventEmitter.prototype._maxListeners = undefined;
  9685. EventEmitter.defaultMaxListeners = 10;
  9686. EventEmitter.prototype.setMaxListeners = function(n) {
  9687. if (!isNumber(n) || n < 0 || isNaN(n))
  9688. throw TypeError('n must be a positive number');
  9689. this._maxListeners = n;
  9690. return this;
  9691. };
  9692. EventEmitter.prototype.emit = function(type) {
  9693. var er, handler, len, args, i, listeners;
  9694. if (!this._events)
  9695. this._events = {};
  9696. if (type === 'error') {
  9697. if (!this._events.error ||
  9698. (isObject(this._events.error) && !this._events.error.length)) {
  9699. er = arguments[1];
  9700. if (er instanceof Error) {
  9701. throw er; // Unhandled 'error' event
  9702. } else {
  9703. throw TypeError('Uncaught, unspecified "error" event.');
  9704. }
  9705. return false;
  9706. }
  9707. }
  9708. handler = this._events[type];
  9709. if (isUndefined(handler))
  9710. return false;
  9711. if (isFunction(handler)) {
  9712. switch (arguments.length) {
  9713. case 1:
  9714. handler.call(this);
  9715. break;
  9716. case 2:
  9717. handler.call(this, arguments[1]);
  9718. break;
  9719. case 3:
  9720. handler.call(this, arguments[1], arguments[2]);
  9721. break;
  9722. default:
  9723. len = arguments.length;
  9724. args = new Array(len - 1);
  9725. for (i = 1; i < len; i++)
  9726. args[i - 1] = arguments[i];
  9727. handler.apply(this, args);
  9728. }
  9729. } else if (isObject(handler)) {
  9730. len = arguments.length;
  9731. args = new Array(len - 1);
  9732. for (i = 1; i < len; i++)
  9733. args[i - 1] = arguments[i];
  9734. listeners = handler.slice();
  9735. len = listeners.length;
  9736. for (i = 0; i < len; i++)
  9737. listeners[i].apply(this, args);
  9738. }
  9739. return true;
  9740. };
  9741. EventEmitter.prototype.addListener = function(type, listener) {
  9742. var m;
  9743. if (!isFunction(listener))
  9744. throw TypeError('listener must be a function');
  9745. if (!this._events)
  9746. this._events = {};
  9747. if (this._events.newListener)
  9748. this.emit('newListener', type,
  9749. isFunction(listener.listener) ?
  9750. listener.listener : listener);
  9751. if (!this._events[type])
  9752. this._events[type] = listener;
  9753. else if (isObject(this._events[type]))
  9754. this._events[type].push(listener);
  9755. else
  9756. this._events[type] = [this._events[type], listener];
  9757. if (isObject(this._events[type]) && !this._events[type].warned) {
  9758. var m;
  9759. if (!isUndefined(this._maxListeners)) {
  9760. m = this._maxListeners;
  9761. } else {
  9762. m = EventEmitter.defaultMaxListeners;
  9763. }
  9764. if (m && m > 0 && this._events[type].length > m) {
  9765. this._events[type].warned = true;
  9766. console.error('(node) warning: possible EventEmitter memory ' +
  9767. 'leak detected. %d listeners added. ' +
  9768. 'Use emitter.setMaxListeners() to increase limit.',
  9769. this._events[type].length);
  9770. console.trace();
  9771. }
  9772. }
  9773. return this;
  9774. };
  9775. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  9776. EventEmitter.prototype.once = function(type, listener) {
  9777. if (!isFunction(listener))
  9778. throw TypeError('listener must be a function');
  9779. var fired = false;
  9780. function g() {
  9781. this.removeListener(type, g);
  9782. if (!fired) {
  9783. fired = true;
  9784. listener.apply(this, arguments);
  9785. }
  9786. }
  9787. g.listener = listener;
  9788. this.on(type, g);
  9789. return this;
  9790. };
  9791. EventEmitter.prototype.removeListener = function(type, listener) {
  9792. var list, position, length, i;
  9793. if (!isFunction(listener))
  9794. throw TypeError('listener must be a function');
  9795. if (!this._events || !this._events[type])
  9796. return this;
  9797. list = this._events[type];
  9798. length = list.length;
  9799. position = -1;
  9800. if (list === listener ||
  9801. (isFunction(list.listener) && list.listener === listener)) {
  9802. delete this._events[type];
  9803. if (this._events.removeListener)
  9804. this.emit('removeListener', type, listener);
  9805. } else if (isObject(list)) {
  9806. for (i = length; i-- > 0;) {
  9807. if (list[i] === listener ||
  9808. (list[i].listener && list[i].listener === listener)) {
  9809. position = i;
  9810. break;
  9811. }
  9812. }
  9813. if (position < 0)
  9814. return this;
  9815. if (list.length === 1) {
  9816. list.length = 0;
  9817. delete this._events[type];
  9818. } else {
  9819. list.splice(position, 1);
  9820. }
  9821. if (this._events.removeListener)
  9822. this.emit('removeListener', type, listener);
  9823. }
  9824. return this;
  9825. };
  9826. EventEmitter.prototype.removeAllListeners = function(type) {
  9827. var key, listeners;
  9828. if (!this._events)
  9829. return this;
  9830. if (!this._events.removeListener) {
  9831. if (arguments.length === 0)
  9832. this._events = {};
  9833. else if (this._events[type])
  9834. delete this._events[type];
  9835. return this;
  9836. }
  9837. if (arguments.length === 0) {
  9838. for (key in this._events) {
  9839. if (key === 'removeListener') continue;
  9840. this.removeAllListeners(key);
  9841. }
  9842. this.removeAllListeners('removeListener');
  9843. this._events = {};
  9844. return this;
  9845. }
  9846. listeners = this._events[type];
  9847. if (isFunction(listeners)) {
  9848. this.removeListener(type, listeners);
  9849. } else {
  9850. while (listeners.length)
  9851. this.removeListener(type, listeners[listeners.length - 1]);
  9852. }
  9853. delete this._events[type];
  9854. return this;
  9855. };
  9856. EventEmitter.prototype.listeners = function(type) {
  9857. var ret;
  9858. if (!this._events || !this._events[type])
  9859. ret = [];
  9860. else if (isFunction(this._events[type]))
  9861. ret = [this._events[type]];
  9862. else
  9863. ret = this._events[type].slice();
  9864. return ret;
  9865. };
  9866. EventEmitter.listenerCount = function(emitter, type) {
  9867. var ret;
  9868. if (!emitter._events || !emitter._events[type])
  9869. ret = 0;
  9870. else if (isFunction(emitter._events[type]))
  9871. ret = 1;
  9872. else
  9873. ret = emitter._events[type].length;
  9874. return ret;
  9875. };
  9876. function isFunction(arg) {
  9877. return typeof arg === 'function';
  9878. }
  9879. function isNumber(arg) {
  9880. return typeof arg === 'number';
  9881. }
  9882. function isObject(arg) {
  9883. return typeof arg === 'object' && arg !== null;
  9884. }
  9885. function isUndefined(arg) {
  9886. return arg === void 0;
  9887. }
  9888. },
  9889. {}],
  9890. 17:[function(_dereq_,module,exports){
  9891. if (typeof Object.create === 'function') {
  9892. module.exports = function inherits(ctor, superCtor) {
  9893. ctor.super_ = superCtor
  9894. ctor.prototype = Object.create(superCtor.prototype, {
  9895. constructor: {
  9896. value: ctor,
  9897. enumerable: false,
  9898. writable: true,
  9899. configurable: true
  9900. }
  9901. });
  9902. };
  9903. } else {
  9904. module.exports = function inherits(ctor, superCtor) {
  9905. ctor.super_ = superCtor
  9906. var TempCtor = function () {}
  9907. TempCtor.prototype = superCtor.prototype
  9908. ctor.prototype = new TempCtor()
  9909. ctor.prototype.constructor = ctor
  9910. }
  9911. }
  9912. },
  9913. {}],
  9914. 18:[function(_dereq_,module,exports){
  9915. var process = module.exports = {};
  9916. process.nextTick = (function () {
  9917. var canSetImmediate = typeof window !== 'undefined'
  9918. && window.setImmediate;
  9919. var canPost = typeof window !== 'undefined'
  9920. && window.postMessage && window.addEventListener
  9921. ;
  9922. if (canSetImmediate) {
  9923. return function (f) { return window.setImmediate(f) };
  9924. }
  9925. if (canPost) {
  9926. var queue = [];
  9927. window.addEventListener('message', function (ev) {
  9928. var source = ev.source;
  9929. if ((source === window || source === null) && ev.data === 'process-tick') {
  9930. ev.stopPropagation();
  9931. if (queue.length > 0) {
  9932. var fn = queue.shift();
  9933. fn();
  9934. }
  9935. }
  9936. }, true);
  9937. return function nextTick(fn) {
  9938. queue.push(fn);
  9939. window.postMessage('process-tick', '*');
  9940. };
  9941. }
  9942. return function nextTick(fn) {
  9943. setTimeout(fn, 0);
  9944. };
  9945. })();
  9946. process.title = 'browser';
  9947. process.browser = true;
  9948. process.env = {};
  9949. process.argv = [];
  9950. function noop() {}
  9951. process.on = noop;
  9952. process.once = noop;
  9953. process.off = noop;
  9954. process.emit = noop;
  9955. process.binding = function (name) {
  9956. throw new Error('process.binding is not supported');
  9957. }
  9958. process.cwd = function () { return '/' };
  9959. process.chdir = function (dir) {
  9960. throw new Error('process.chdir is not supported');
  9961. };
  9962. },
  9963. {}],
  9964. 19:[function(_dereq_,module,exports){
  9965. module.exports=_dereq_(14)
  9966. },
  9967. {}],
  9968. 20:[function(_dereq_,module,exports){
  9969. module.exports=_dereq_(15)
  9970. },
  9971. {"./support/isBuffer":19,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}]},{},[9])
  9972. (9)
  9973. });
  9974. ace.define("ace/mode/html_worker",[], function(require, exports, module) {
  9975. "use strict";
  9976. var oop = require("../lib/oop");
  9977. var lang = require("../lib/lang");
  9978. var Mirror = require("../worker/mirror").Mirror;
  9979. var SAXParser = require("./html/saxparser").SAXParser;
  9980. var errorTypes = {
  9981. "expected-doctype-but-got-start-tag": "info",
  9982. "expected-doctype-but-got-chars": "info",
  9983. "non-html-root": "info"
  9984. };
  9985. var Worker = exports.Worker = function(sender) {
  9986. Mirror.call(this, sender);
  9987. this.setTimeout(400);
  9988. this.context = null;
  9989. };
  9990. oop.inherits(Worker, Mirror);
  9991. (function() {
  9992. this.setOptions = function(options) {
  9993. this.context = options.context;
  9994. };
  9995. this.onUpdate = function() {
  9996. var value = this.doc.getValue();
  9997. if (!value)
  9998. return;
  9999. var parser = new SAXParser();
  10000. var errors = [];
  10001. var noop = function(){};
  10002. parser.contentHandler = {
  10003. startDocument: noop,
  10004. endDocument: noop,
  10005. startElement: noop,
  10006. endElement: noop,
  10007. characters: noop
  10008. };
  10009. parser.errorHandler = {
  10010. error: function(message, location, code) {
  10011. errors.push({
  10012. row: location.line,
  10013. column: location.column,
  10014. text: message,
  10015. type: errorTypes[code] || "error"
  10016. });
  10017. }
  10018. };
  10019. if (this.context)
  10020. parser.parseFragment(value, this.context);
  10021. else
  10022. parser.parse(value);
  10023. this.sender.emit("error", errors);
  10024. };
  10025. }).call(Worker.prototype);
  10026. });
  10027. ace.define("ace/lib/es5-shim",[], function(require, exports, module) {
  10028. //
  10029. //
  10030. function Empty() {}
  10031. if (!Function.prototype.bind) {
  10032. Function.prototype.bind = function bind(that) { // .length is 1
  10033. var target = this;
  10034. if (typeof target != "function") {
  10035. throw new TypeError("Function.prototype.bind called on incompatible " + target);
  10036. }
  10037. var args = slice.call(arguments, 1); // for normal call
  10038. var bound = function () {
  10039. if (this instanceof bound) {
  10040. var result = target.apply(
  10041. this,
  10042. args.concat(slice.call(arguments))
  10043. );
  10044. if (Object(result) === result) {
  10045. return result;
  10046. }
  10047. return this;
  10048. } else {
  10049. return target.apply(
  10050. that,
  10051. args.concat(slice.call(arguments))
  10052. );
  10053. }
  10054. };
  10055. if(target.prototype) {
  10056. Empty.prototype = target.prototype;
  10057. bound.prototype = new Empty();
  10058. Empty.prototype = null;
  10059. }
  10060. //
  10061. return bound;
  10062. };
  10063. }
  10064. var call = Function.prototype.call;
  10065. var prototypeOfArray = Array.prototype;
  10066. var prototypeOfObject = Object.prototype;
  10067. var slice = prototypeOfArray.slice;
  10068. var _toString = call.bind(prototypeOfObject.toString);
  10069. var owns = call.bind(prototypeOfObject.hasOwnProperty);
  10070. var defineGetter;
  10071. var defineSetter;
  10072. var lookupGetter;
  10073. var lookupSetter;
  10074. var supportsAccessors;
  10075. if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
  10076. defineGetter = call.bind(prototypeOfObject.__defineGetter__);
  10077. defineSetter = call.bind(prototypeOfObject.__defineSetter__);
  10078. lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
  10079. lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
  10080. }
  10081. //
  10082. //
  10083. if ([1,2].splice(0).length != 2) {
  10084. if(function() { // test IE < 9 to splice bug - see issue #138
  10085. function makeArray(l) {
  10086. var a = new Array(l+2);
  10087. a[0] = a[1] = 0;
  10088. return a;
  10089. }
  10090. var array = [], lengthBefore;
  10091. array.splice.apply(array, makeArray(20));
  10092. array.splice.apply(array, makeArray(26));
  10093. lengthBefore = array.length; //46
  10094. array.splice(5, 0, "XXX"); // add one element
  10095. lengthBefore + 1 == array.length
  10096. if (lengthBefore + 1 == array.length) {
  10097. return true;// has right splice implementation without bugs
  10098. }
  10099. }()) {//IE 6/7
  10100. var array_splice = Array.prototype.splice;
  10101. Array.prototype.splice = function(start, deleteCount) {
  10102. if (!arguments.length) {
  10103. return [];
  10104. } else {
  10105. return array_splice.apply(this, [
  10106. start === void 0 ? 0 : start,
  10107. deleteCount === void 0 ? (this.length - start) : deleteCount
  10108. ].concat(slice.call(arguments, 2)))
  10109. }
  10110. };
  10111. } else {//IE8
  10112. Array.prototype.splice = function(pos, removeCount){
  10113. var length = this.length;
  10114. if (pos > 0) {
  10115. if (pos > length)
  10116. pos = length;
  10117. } else if (pos == void 0) {
  10118. pos = 0;
  10119. } else if (pos < 0) {
  10120. pos = Math.max(length + pos, 0);
  10121. }
  10122. if (!(pos+removeCount < length))
  10123. removeCount = length - pos;
  10124. var removed = this.slice(pos, pos+removeCount);
  10125. var insert = slice.call(arguments, 2);
  10126. var add = insert.length;
  10127. if (pos === length) {
  10128. if (add) {
  10129. this.push.apply(this, insert);
  10130. }
  10131. } else {
  10132. var remove = Math.min(removeCount, length - pos);
  10133. var tailOldPos = pos + remove;
  10134. var tailNewPos = tailOldPos + add - remove;
  10135. var tailCount = length - tailOldPos;
  10136. var lengthAfterRemove = length - remove;
  10137. if (tailNewPos < tailOldPos) { // case A
  10138. for (var i = 0; i < tailCount; ++i) {
  10139. this[tailNewPos+i] = this[tailOldPos+i];
  10140. }
  10141. } else if (tailNewPos > tailOldPos) { // case B
  10142. for (i = tailCount; i--; ) {
  10143. this[tailNewPos+i] = this[tailOldPos+i];
  10144. }
  10145. } // else, add == remove (nothing to do)
  10146. if (add && pos === lengthAfterRemove) {
  10147. this.length = lengthAfterRemove; // truncate array
  10148. this.push.apply(this, insert);
  10149. } else {
  10150. this.length = lengthAfterRemove + add; // reserves space
  10151. for (i = 0; i < add; ++i) {
  10152. this[pos+i] = insert[i];
  10153. }
  10154. }
  10155. }
  10156. return removed;
  10157. };
  10158. }
  10159. }
  10160. if (!Array.isArray) {
  10161. Array.isArray = function isArray(obj) {
  10162. return _toString(obj) == "[object Array]";
  10163. };
  10164. }
  10165. var boxedString = Object("a"),
  10166. splitString = boxedString[0] != "a" || !(0 in boxedString);
  10167. if (!Array.prototype.forEach) {
  10168. Array.prototype.forEach = function forEach(fun /*, thisp*/) {
  10169. var object = toObject(this),
  10170. self = splitString && _toString(this) == "[object String]" ?
  10171. this.split("") :
  10172. object,
  10173. thisp = arguments[1],
  10174. i = -1,
  10175. length = self.length >>> 0;
  10176. if (_toString(fun) != "[object Function]") {
  10177. throw new TypeError(); // TODO message
  10178. }
  10179. while (++i < length) {
  10180. if (i in self) {
  10181. fun.call(thisp, self[i], i, object);
  10182. }
  10183. }
  10184. };
  10185. }
  10186. if (!Array.prototype.map) {
  10187. Array.prototype.map = function map(fun /*, thisp*/) {
  10188. var object = toObject(this),
  10189. self = splitString && _toString(this) == "[object String]" ?
  10190. this.split("") :
  10191. object,
  10192. length = self.length >>> 0,
  10193. result = Array(length),
  10194. thisp = arguments[1];
  10195. if (_toString(fun) != "[object Function]") {
  10196. throw new TypeError(fun + " is not a function");
  10197. }
  10198. for (var i = 0; i < length; i++) {
  10199. if (i in self)
  10200. result[i] = fun.call(thisp, self[i], i, object);
  10201. }
  10202. return result;
  10203. };
  10204. }
  10205. if (!Array.prototype.filter) {
  10206. Array.prototype.filter = function filter(fun /*, thisp */) {
  10207. var object = toObject(this),
  10208. self = splitString && _toString(this) == "[object String]" ?
  10209. this.split("") :
  10210. object,
  10211. length = self.length >>> 0,
  10212. result = [],
  10213. value,
  10214. thisp = arguments[1];
  10215. if (_toString(fun) != "[object Function]") {
  10216. throw new TypeError(fun + " is not a function");
  10217. }
  10218. for (var i = 0; i < length; i++) {
  10219. if (i in self) {
  10220. value = self[i];
  10221. if (fun.call(thisp, value, i, object)) {
  10222. result.push(value);
  10223. }
  10224. }
  10225. }
  10226. return result;
  10227. };
  10228. }
  10229. if (!Array.prototype.every) {
  10230. Array.prototype.every = function every(fun /*, thisp */) {
  10231. var object = toObject(this),
  10232. self = splitString && _toString(this) == "[object String]" ?
  10233. this.split("") :
  10234. object,
  10235. length = self.length >>> 0,
  10236. thisp = arguments[1];
  10237. if (_toString(fun) != "[object Function]") {
  10238. throw new TypeError(fun + " is not a function");
  10239. }
  10240. for (var i = 0; i < length; i++) {
  10241. if (i in self && !fun.call(thisp, self[i], i, object)) {
  10242. return false;
  10243. }
  10244. }
  10245. return true;
  10246. };
  10247. }
  10248. if (!Array.prototype.some) {
  10249. Array.prototype.some = function some(fun /*, thisp */) {
  10250. var object = toObject(this),
  10251. self = splitString && _toString(this) == "[object String]" ?
  10252. this.split("") :
  10253. object,
  10254. length = self.length >>> 0,
  10255. thisp = arguments[1];
  10256. if (_toString(fun) != "[object Function]") {
  10257. throw new TypeError(fun + " is not a function");
  10258. }
  10259. for (var i = 0; i < length; i++) {
  10260. if (i in self && fun.call(thisp, self[i], i, object)) {
  10261. return true;
  10262. }
  10263. }
  10264. return false;
  10265. };
  10266. }
  10267. if (!Array.prototype.reduce) {
  10268. Array.prototype.reduce = function reduce(fun /*, initial*/) {
  10269. var object = toObject(this),
  10270. self = splitString && _toString(this) == "[object String]" ?
  10271. this.split("") :
  10272. object,
  10273. length = self.length >>> 0;
  10274. if (_toString(fun) != "[object Function]") {
  10275. throw new TypeError(fun + " is not a function");
  10276. }
  10277. if (!length && arguments.length == 1) {
  10278. throw new TypeError("reduce of empty array with no initial value");
  10279. }
  10280. var i = 0;
  10281. var result;
  10282. if (arguments.length >= 2) {
  10283. result = arguments[1];
  10284. } else {
  10285. do {
  10286. if (i in self) {
  10287. result = self[i++];
  10288. break;
  10289. }
  10290. if (++i >= length) {
  10291. throw new TypeError("reduce of empty array with no initial value");
  10292. }
  10293. } while (true);
  10294. }
  10295. for (; i < length; i++) {
  10296. if (i in self) {
  10297. result = fun.call(void 0, result, self[i], i, object);
  10298. }
  10299. }
  10300. return result;
  10301. };
  10302. }
  10303. if (!Array.prototype.reduceRight) {
  10304. Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
  10305. var object = toObject(this),
  10306. self = splitString && _toString(this) == "[object String]" ?
  10307. this.split("") :
  10308. object,
  10309. length = self.length >>> 0;
  10310. if (_toString(fun) != "[object Function]") {
  10311. throw new TypeError(fun + " is not a function");
  10312. }
  10313. if (!length && arguments.length == 1) {
  10314. throw new TypeError("reduceRight of empty array with no initial value");
  10315. }
  10316. var result, i = length - 1;
  10317. if (arguments.length >= 2) {
  10318. result = arguments[1];
  10319. } else {
  10320. do {
  10321. if (i in self) {
  10322. result = self[i--];
  10323. break;
  10324. }
  10325. if (--i < 0) {
  10326. throw new TypeError("reduceRight of empty array with no initial value");
  10327. }
  10328. } while (true);
  10329. }
  10330. do {
  10331. if (i in this) {
  10332. result = fun.call(void 0, result, self[i], i, object);
  10333. }
  10334. } while (i--);
  10335. return result;
  10336. };
  10337. }
  10338. if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
  10339. Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
  10340. var self = splitString && _toString(this) == "[object String]" ?
  10341. this.split("") :
  10342. toObject(this),
  10343. length = self.length >>> 0;
  10344. if (!length) {
  10345. return -1;
  10346. }
  10347. var i = 0;
  10348. if (arguments.length > 1) {
  10349. i = toInteger(arguments[1]);
  10350. }
  10351. i = i >= 0 ? i : Math.max(0, length + i);
  10352. for (; i < length; i++) {
  10353. if (i in self && self[i] === sought) {
  10354. return i;
  10355. }
  10356. }
  10357. return -1;
  10358. };
  10359. }
  10360. if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
  10361. Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
  10362. var self = splitString && _toString(this) == "[object String]" ?
  10363. this.split("") :
  10364. toObject(this),
  10365. length = self.length >>> 0;
  10366. if (!length) {
  10367. return -1;
  10368. }
  10369. var i = length - 1;
  10370. if (arguments.length > 1) {
  10371. i = Math.min(i, toInteger(arguments[1]));
  10372. }
  10373. i = i >= 0 ? i : length - Math.abs(i);
  10374. for (; i >= 0; i--) {
  10375. if (i in self && sought === self[i]) {
  10376. return i;
  10377. }
  10378. }
  10379. return -1;
  10380. };
  10381. }
  10382. //
  10383. //
  10384. if (!Object.getPrototypeOf) {
  10385. Object.getPrototypeOf = function getPrototypeOf(object) {
  10386. return object.__proto__ || (
  10387. object.constructor ?
  10388. object.constructor.prototype :
  10389. prototypeOfObject
  10390. );
  10391. };
  10392. }
  10393. if (!Object.getOwnPropertyDescriptor) {
  10394. var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
  10395. "non-object: ";
  10396. Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
  10397. if ((typeof object != "object" && typeof object != "function") || object === null)
  10398. throw new TypeError(ERR_NON_OBJECT + object);
  10399. if (!owns(object, property))
  10400. return;
  10401. var descriptor, getter, setter;
  10402. descriptor = { enumerable: true, configurable: true };
  10403. if (supportsAccessors) {
  10404. var prototype = object.__proto__;
  10405. object.__proto__ = prototypeOfObject;
  10406. var getter = lookupGetter(object, property);
  10407. var setter = lookupSetter(object, property);
  10408. object.__proto__ = prototype;
  10409. if (getter || setter) {
  10410. if (getter) descriptor.get = getter;
  10411. if (setter) descriptor.set = setter;
  10412. return descriptor;
  10413. }
  10414. }
  10415. descriptor.value = object[property];
  10416. return descriptor;
  10417. };
  10418. }
  10419. if (!Object.getOwnPropertyNames) {
  10420. Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
  10421. return Object.keys(object);
  10422. };
  10423. }
  10424. if (!Object.create) {
  10425. var createEmpty;
  10426. if (Object.prototype.__proto__ === null) {
  10427. createEmpty = function () {
  10428. return { "__proto__": null };
  10429. };
  10430. } else {
  10431. createEmpty = function () {
  10432. var empty = {};
  10433. for (var i in empty)
  10434. empty[i] = null;
  10435. empty.constructor =
  10436. empty.hasOwnProperty =
  10437. empty.propertyIsEnumerable =
  10438. empty.isPrototypeOf =
  10439. empty.toLocaleString =
  10440. empty.toString =
  10441. empty.valueOf =
  10442. empty.__proto__ = null;
  10443. return empty;
  10444. }
  10445. }
  10446. Object.create = function create(prototype, properties) {
  10447. var object;
  10448. if (prototype === null) {
  10449. object = createEmpty();
  10450. } else {
  10451. if (typeof prototype != "object")
  10452. throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
  10453. var Type = function () {};
  10454. Type.prototype = prototype;
  10455. object = new Type();
  10456. object.__proto__ = prototype;
  10457. }
  10458. if (properties !== void 0)
  10459. Object.defineProperties(object, properties);
  10460. return object;
  10461. };
  10462. }
  10463. function doesDefinePropertyWork(object) {
  10464. try {
  10465. Object.defineProperty(object, "sentinel", {});
  10466. return "sentinel" in object;
  10467. } catch (exception) {
  10468. }
  10469. }
  10470. if (Object.defineProperty) {
  10471. var definePropertyWorksOnObject = doesDefinePropertyWork({});
  10472. var definePropertyWorksOnDom = typeof document == "undefined" ||
  10473. doesDefinePropertyWork(document.createElement("div"));
  10474. if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
  10475. var definePropertyFallback = Object.defineProperty;
  10476. }
  10477. }
  10478. if (!Object.defineProperty || definePropertyFallback) {
  10479. var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
  10480. var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
  10481. var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
  10482. "on this javascript engine";
  10483. Object.defineProperty = function defineProperty(object, property, descriptor) {
  10484. if ((typeof object != "object" && typeof object != "function") || object === null)
  10485. throw new TypeError(ERR_NON_OBJECT_TARGET + object);
  10486. if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
  10487. throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
  10488. if (definePropertyFallback) {
  10489. try {
  10490. return definePropertyFallback.call(Object, object, property, descriptor);
  10491. } catch (exception) {
  10492. }
  10493. }
  10494. if (owns(descriptor, "value")) {
  10495. if (supportsAccessors && (lookupGetter(object, property) ||
  10496. lookupSetter(object, property)))
  10497. {
  10498. var prototype = object.__proto__;
  10499. object.__proto__ = prototypeOfObject;
  10500. delete object[property];
  10501. object[property] = descriptor.value;
  10502. object.__proto__ = prototype;
  10503. } else {
  10504. object[property] = descriptor.value;
  10505. }
  10506. } else {
  10507. if (!supportsAccessors)
  10508. throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
  10509. if (owns(descriptor, "get"))
  10510. defineGetter(object, property, descriptor.get);
  10511. if (owns(descriptor, "set"))
  10512. defineSetter(object, property, descriptor.set);
  10513. }
  10514. return object;
  10515. };
  10516. }
  10517. if (!Object.defineProperties) {
  10518. Object.defineProperties = function defineProperties(object, properties) {
  10519. for (var property in properties) {
  10520. if (owns(properties, property))
  10521. Object.defineProperty(object, property, properties[property]);
  10522. }
  10523. return object;
  10524. };
  10525. }
  10526. if (!Object.seal) {
  10527. Object.seal = function seal(object) {
  10528. return object;
  10529. };
  10530. }
  10531. if (!Object.freeze) {
  10532. Object.freeze = function freeze(object) {
  10533. return object;
  10534. };
  10535. }
  10536. try {
  10537. Object.freeze(function () {});
  10538. } catch (exception) {
  10539. Object.freeze = (function freeze(freezeObject) {
  10540. return function freeze(object) {
  10541. if (typeof object == "function") {
  10542. return object;
  10543. } else {
  10544. return freezeObject(object);
  10545. }
  10546. };
  10547. })(Object.freeze);
  10548. }
  10549. if (!Object.preventExtensions) {
  10550. Object.preventExtensions = function preventExtensions(object) {
  10551. return object;
  10552. };
  10553. }
  10554. if (!Object.isSealed) {
  10555. Object.isSealed = function isSealed(object) {
  10556. return false;
  10557. };
  10558. }
  10559. if (!Object.isFrozen) {
  10560. Object.isFrozen = function isFrozen(object) {
  10561. return false;
  10562. };
  10563. }
  10564. if (!Object.isExtensible) {
  10565. Object.isExtensible = function isExtensible(object) {
  10566. if (Object(object) === object) {
  10567. throw new TypeError(); // TODO message
  10568. }
  10569. var name = '';
  10570. while (owns(object, name)) {
  10571. name += '?';
  10572. }
  10573. object[name] = true;
  10574. var returnValue = owns(object, name);
  10575. delete object[name];
  10576. return returnValue;
  10577. };
  10578. }
  10579. if (!Object.keys) {
  10580. var hasDontEnumBug = true,
  10581. dontEnums = [
  10582. "toString",
  10583. "toLocaleString",
  10584. "valueOf",
  10585. "hasOwnProperty",
  10586. "isPrototypeOf",
  10587. "propertyIsEnumerable",
  10588. "constructor"
  10589. ],
  10590. dontEnumsLength = dontEnums.length;
  10591. for (var key in {"toString": null}) {
  10592. hasDontEnumBug = false;
  10593. }
  10594. Object.keys = function keys(object) {
  10595. if (
  10596. (typeof object != "object" && typeof object != "function") ||
  10597. object === null
  10598. ) {
  10599. throw new TypeError("Object.keys called on a non-object");
  10600. }
  10601. var keys = [];
  10602. for (var name in object) {
  10603. if (owns(object, name)) {
  10604. keys.push(name);
  10605. }
  10606. }
  10607. if (hasDontEnumBug) {
  10608. for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
  10609. var dontEnum = dontEnums[i];
  10610. if (owns(object, dontEnum)) {
  10611. keys.push(dontEnum);
  10612. }
  10613. }
  10614. }
  10615. return keys;
  10616. };
  10617. }
  10618. //
  10619. //
  10620. if (!Date.now) {
  10621. Date.now = function now() {
  10622. return new Date().getTime();
  10623. };
  10624. }
  10625. //
  10626. //
  10627. var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
  10628. "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
  10629. "\u2029\uFEFF";
  10630. if (!String.prototype.trim || ws.trim()) {
  10631. ws = "[" + ws + "]";
  10632. var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
  10633. trimEndRegexp = new RegExp(ws + ws + "*$");
  10634. String.prototype.trim = function trim() {
  10635. return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
  10636. };
  10637. }
  10638. //
  10639. //
  10640. function toInteger(n) {
  10641. n = +n;
  10642. if (n !== n) { // isNaN
  10643. n = 0;
  10644. } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
  10645. n = (n > 0 || -1) * Math.floor(Math.abs(n));
  10646. }
  10647. return n;
  10648. }
  10649. function isPrimitive(input) {
  10650. var type = typeof input;
  10651. return (
  10652. input === null ||
  10653. type === "undefined" ||
  10654. type === "boolean" ||
  10655. type === "number" ||
  10656. type === "string"
  10657. );
  10658. }
  10659. function toPrimitive(input) {
  10660. var val, valueOf, toString;
  10661. if (isPrimitive(input)) {
  10662. return input;
  10663. }
  10664. valueOf = input.valueOf;
  10665. if (typeof valueOf === "function") {
  10666. val = valueOf.call(input);
  10667. if (isPrimitive(val)) {
  10668. return val;
  10669. }
  10670. }
  10671. toString = input.toString;
  10672. if (typeof toString === "function") {
  10673. val = toString.call(input);
  10674. if (isPrimitive(val)) {
  10675. return val;
  10676. }
  10677. }
  10678. throw new TypeError();
  10679. }
  10680. var toObject = function (o) {
  10681. if (o == null) { // this matches both null and undefined
  10682. throw new TypeError("can't convert "+o+" to object");
  10683. }
  10684. return Object(o);
  10685. };
  10686. });