bundle.js 1.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId])
  10. /******/ return installedModules[moduleId].exports;
  11. /******/
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // identity function for calling harmony imports with the correct context
  37. /******/ __webpack_require__.i = function(value) { return value; };
  38. /******/
  39. /******/ // define getter function for harmony exports
  40. /******/ __webpack_require__.d = function(exports, name, getter) {
  41. /******/ if(!__webpack_require__.o(exports, name)) {
  42. /******/ Object.defineProperty(exports, name, {
  43. /******/ configurable: false,
  44. /******/ enumerable: true,
  45. /******/ get: getter
  46. /******/ });
  47. /******/ }
  48. /******/ };
  49. /******/
  50. /******/ // getDefaultExport function for compatibility with non-harmony modules
  51. /******/ __webpack_require__.n = function(module) {
  52. /******/ var getter = module && module.__esModule ?
  53. /******/ function getDefault() { return module['default']; } :
  54. /******/ function getModuleExports() { return module; };
  55. /******/ __webpack_require__.d(getter, 'a', getter);
  56. /******/ return getter;
  57. /******/ };
  58. /******/
  59. /******/ // Object.prototype.hasOwnProperty.call
  60. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  61. /******/
  62. /******/ // __webpack_public_path__
  63. /******/ __webpack_require__.p = "";
  64. /******/
  65. /******/ // Load entry module and return exports
  66. /******/ return __webpack_require__(__webpack_require__.s = 147);
  67. /******/ })
  68. /************************************************************************/
  69. /******/ ([
  70. /* 0 */
  71. /***/ (function(module, exports, __webpack_require__) {
  72. "use strict";
  73. /**
  74. * Copyright (c) 2013-present, Facebook, Inc.
  75. * All rights reserved.
  76. *
  77. * This source code is licensed under the BSD-style license found in the
  78. * LICENSE file in the root directory of this source tree. An additional grant
  79. * of patent rights can be found in the PATENTS file in the same directory.
  80. *
  81. */
  82. /**
  83. * Use invariant() to assert state which your program assumes to be true.
  84. *
  85. * Provide sprintf-style format (only %s is supported) and arguments
  86. * to provide information about what broke and what you were
  87. * expecting.
  88. *
  89. * The invariant message will be stripped in production, but the invariant
  90. * will remain to ensure logic does not differ in production.
  91. */
  92. var validateFormat = function validateFormat(format) {};
  93. if (false) {
  94. validateFormat = function validateFormat(format) {
  95. if (format === undefined) {
  96. throw new Error('invariant requires an error message argument');
  97. }
  98. };
  99. }
  100. function invariant(condition, format, a, b, c, d, e, f) {
  101. validateFormat(format);
  102. if (!condition) {
  103. var error;
  104. if (format === undefined) {
  105. error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
  106. } else {
  107. var args = [a, b, c, d, e, f];
  108. var argIndex = 0;
  109. error = new Error(format.replace(/%s/g, function () {
  110. return args[argIndex++];
  111. }));
  112. error.name = 'Invariant Violation';
  113. }
  114. error.framesToPop = 1; // we don't care about invariant's own frame
  115. throw error;
  116. }
  117. }
  118. module.exports = invariant;
  119. /***/ }),
  120. /* 1 */
  121. /***/ (function(module, exports, __webpack_require__) {
  122. "use strict";
  123. /**
  124. * Copyright 2014-2015, Facebook, Inc.
  125. * All rights reserved.
  126. *
  127. * This source code is licensed under the BSD-style license found in the
  128. * LICENSE file in the root directory of this source tree. An additional grant
  129. * of patent rights can be found in the PATENTS file in the same directory.
  130. *
  131. */
  132. var emptyFunction = __webpack_require__(10);
  133. /**
  134. * Similar to invariant but only logs a warning if the condition is not met.
  135. * This can be used to log issues in development environments in critical
  136. * paths. Removing the logging code for production environments will keep the
  137. * same logic and follow the same code paths.
  138. */
  139. var warning = emptyFunction;
  140. if (false) {
  141. (function () {
  142. var printWarning = function printWarning(format) {
  143. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  144. args[_key - 1] = arguments[_key];
  145. }
  146. var argIndex = 0;
  147. var message = 'Warning: ' + format.replace(/%s/g, function () {
  148. return args[argIndex++];
  149. });
  150. if (typeof console !== 'undefined') {
  151. console.error(message);
  152. }
  153. try {
  154. // --- Welcome to debugging React ---
  155. // This error was thrown as a convenience so that you can use this stack
  156. // to find the callsite that caused this warning to fire.
  157. throw new Error(message);
  158. } catch (x) {}
  159. };
  160. warning = function warning(condition, format) {
  161. if (format === undefined) {
  162. throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
  163. }
  164. if (format.indexOf('Failed Composite propType: ') === 0) {
  165. return; // Ignore CompositeComponent proptype check.
  166. }
  167. if (!condition) {
  168. for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  169. args[_key2 - 2] = arguments[_key2];
  170. }
  171. printWarning.apply(undefined, [format].concat(args));
  172. }
  173. };
  174. })();
  175. }
  176. module.exports = warning;
  177. /***/ }),
  178. /* 2 */
  179. /***/ (function(module, exports, __webpack_require__) {
  180. "use strict";
  181. /**
  182. * Copyright (c) 2013-present, Facebook, Inc.
  183. * All rights reserved.
  184. *
  185. * This source code is licensed under the BSD-style license found in the
  186. * LICENSE file in the root directory of this source tree. An additional grant
  187. * of patent rights can be found in the PATENTS file in the same directory.
  188. *
  189. *
  190. */
  191. /**
  192. * WARNING: DO NOT manually require this module.
  193. * This is a replacement for `invariant(...)` used by the error code system
  194. * and will _only_ be required by the corresponding babel pass.
  195. * It always throws.
  196. */
  197. function reactProdInvariant(code) {
  198. var argCount = arguments.length - 1;
  199. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  200. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  201. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  202. }
  203. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  204. var error = new Error(message);
  205. error.name = 'Invariant Violation';
  206. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  207. throw error;
  208. }
  209. module.exports = reactProdInvariant;
  210. /***/ }),
  211. /* 3 */
  212. /***/ (function(module, exports, __webpack_require__) {
  213. "use strict";
  214. /*
  215. object-assign
  216. (c) Sindre Sorhus
  217. @license MIT
  218. */
  219. /* eslint-disable no-unused-vars */
  220. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  221. var hasOwnProperty = Object.prototype.hasOwnProperty;
  222. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  223. function toObject(val) {
  224. if (val === null || val === undefined) {
  225. throw new TypeError('Object.assign cannot be called with null or undefined');
  226. }
  227. return Object(val);
  228. }
  229. function shouldUseNative() {
  230. try {
  231. if (!Object.assign) {
  232. return false;
  233. }
  234. // Detect buggy property enumeration order in older V8 versions.
  235. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  236. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  237. test1[5] = 'de';
  238. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  239. return false;
  240. }
  241. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  242. var test2 = {};
  243. for (var i = 0; i < 10; i++) {
  244. test2['_' + String.fromCharCode(i)] = i;
  245. }
  246. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  247. return test2[n];
  248. });
  249. if (order2.join('') !== '0123456789') {
  250. return false;
  251. }
  252. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  253. var test3 = {};
  254. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  255. test3[letter] = letter;
  256. });
  257. if (Object.keys(Object.assign({}, test3)).join('') !==
  258. 'abcdefghijklmnopqrst') {
  259. return false;
  260. }
  261. return true;
  262. } catch (err) {
  263. // We don't expect any of the above to throw, but better to be safe.
  264. return false;
  265. }
  266. }
  267. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  268. var from;
  269. var to = toObject(target);
  270. var symbols;
  271. for (var s = 1; s < arguments.length; s++) {
  272. from = Object(arguments[s]);
  273. for (var key in from) {
  274. if (hasOwnProperty.call(from, key)) {
  275. to[key] = from[key];
  276. }
  277. }
  278. if (getOwnPropertySymbols) {
  279. symbols = getOwnPropertySymbols(from);
  280. for (var i = 0; i < symbols.length; i++) {
  281. if (propIsEnumerable.call(from, symbols[i])) {
  282. to[symbols[i]] = from[symbols[i]];
  283. }
  284. }
  285. }
  286. }
  287. return to;
  288. };
  289. /***/ }),
  290. /* 4 */
  291. /***/ (function(module, exports) {
  292. /**
  293. * @author oldj
  294. * @blog https://oldj.net
  295. */
  296. 'use strict';
  297. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  298. var IS_DEV = process.env.ENV === 'dev';
  299. var _require = require('electron'),
  300. ipcRenderer = _require.ipcRenderer;
  301. var platform = process.platform;
  302. var EventEmitter = require('events');
  303. var evt = new EventEmitter();
  304. var max_listener_count = 20;
  305. evt.setMaxListeners(max_listener_count);
  306. ipcRenderer.setMaxListeners(max_listener_count);
  307. var x_get_idx = 0;
  308. /**
  309. * act
  310. * @param action {String}
  311. * @param args {Array}
  312. */
  313. function act(action) {
  314. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  315. args[_key - 1] = arguments[_key];
  316. }
  317. var fn = ['_cb', new Date().getTime(), x_get_idx++].join('_');
  318. var callback = void 0;
  319. if (args.length > 0 && typeof args[args.length - 1] === 'function') {
  320. callback = args.pop();
  321. }
  322. if (typeof callback === 'function') {
  323. ipcRenderer.once(fn, function (e, d) {
  324. return callback.apply(null, d);
  325. });
  326. }
  327. ipcRenderer.send('x', {
  328. action: action,
  329. data: args,
  330. callback: fn
  331. });
  332. }
  333. function pact(action) {
  334. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  335. args[_key2 - 1] = arguments[_key2];
  336. }
  337. return new Promise(function (resolve, reject) {
  338. args.push(function (err, result) {
  339. return err ? reject(err) : resolve(result);
  340. });
  341. act.apply(undefined, [action].concat(args));
  342. });
  343. }
  344. ipcRenderer.on('y', function (sender, d) {
  345. evt.emit.apply(evt, [d.event].concat(_toConsumableArray(d.data || [])));
  346. });
  347. module.exports = {
  348. IS_DEV: IS_DEV,
  349. platform: platform,
  350. act: act,
  351. pact: pact,
  352. on: function on() {
  353. return evt.on.apply(evt, arguments);
  354. },
  355. emit: function emit() {
  356. return evt.emit.apply(evt, arguments);
  357. }
  358. };
  359. /***/ }),
  360. /* 5 */
  361. /***/ (function(module, exports, __webpack_require__) {
  362. "use strict";
  363. /**
  364. * Copyright 2013-present, Facebook, Inc.
  365. * All rights reserved.
  366. *
  367. * This source code is licensed under the BSD-style license found in the
  368. * LICENSE file in the root directory of this source tree. An additional grant
  369. * of patent rights can be found in the PATENTS file in the same directory.
  370. *
  371. */
  372. var _prodInvariant = __webpack_require__(2);
  373. var DOMProperty = __webpack_require__(19);
  374. var ReactDOMComponentFlags = __webpack_require__(80);
  375. var invariant = __webpack_require__(0);
  376. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  377. var Flags = ReactDOMComponentFlags;
  378. var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
  379. /**
  380. * Check if a given node should be cached.
  381. */
  382. function shouldPrecacheNode(node, nodeID) {
  383. return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
  384. }
  385. /**
  386. * Drill down (through composites and empty components) until we get a host or
  387. * host text component.
  388. *
  389. * This is pretty polymorphic but unavoidable with the current structure we have
  390. * for `_renderedChildren`.
  391. */
  392. function getRenderedHostOrTextFromComponent(component) {
  393. var rendered;
  394. while (rendered = component._renderedComponent) {
  395. component = rendered;
  396. }
  397. return component;
  398. }
  399. /**
  400. * Populate `_hostNode` on the rendered host/text component with the given
  401. * DOM node. The passed `inst` can be a composite.
  402. */
  403. function precacheNode(inst, node) {
  404. var hostInst = getRenderedHostOrTextFromComponent(inst);
  405. hostInst._hostNode = node;
  406. node[internalInstanceKey] = hostInst;
  407. }
  408. function uncacheNode(inst) {
  409. var node = inst._hostNode;
  410. if (node) {
  411. delete node[internalInstanceKey];
  412. inst._hostNode = null;
  413. }
  414. }
  415. /**
  416. * Populate `_hostNode` on each child of `inst`, assuming that the children
  417. * match up with the DOM (element) children of `node`.
  418. *
  419. * We cache entire levels at once to avoid an n^2 problem where we access the
  420. * children of a node sequentially and have to walk from the start to our target
  421. * node every time.
  422. *
  423. * Since we update `_renderedChildren` and the actual DOM at (slightly)
  424. * different times, we could race here and see a newer `_renderedChildren` than
  425. * the DOM nodes we see. To avoid this, ReactMultiChild calls
  426. * `prepareToManageChildren` before we change `_renderedChildren`, at which
  427. * time the container's child nodes are always cached (until it unmounts).
  428. */
  429. function precacheChildNodes(inst, node) {
  430. if (inst._flags & Flags.hasCachedChildNodes) {
  431. return;
  432. }
  433. var children = inst._renderedChildren;
  434. var childNode = node.firstChild;
  435. outer: for (var name in children) {
  436. if (!children.hasOwnProperty(name)) {
  437. continue;
  438. }
  439. var childInst = children[name];
  440. var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
  441. if (childID === 0) {
  442. // We're currently unmounting this child in ReactMultiChild; skip it.
  443. continue;
  444. }
  445. // We assume the child nodes are in the same order as the child instances.
  446. for (; childNode !== null; childNode = childNode.nextSibling) {
  447. if (shouldPrecacheNode(childNode, childID)) {
  448. precacheNode(childInst, childNode);
  449. continue outer;
  450. }
  451. }
  452. // We reached the end of the DOM children without finding an ID match.
  453. true ? false ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0;
  454. }
  455. inst._flags |= Flags.hasCachedChildNodes;
  456. }
  457. /**
  458. * Given a DOM node, return the closest ReactDOMComponent or
  459. * ReactDOMTextComponent instance ancestor.
  460. */
  461. function getClosestInstanceFromNode(node) {
  462. if (node[internalInstanceKey]) {
  463. return node[internalInstanceKey];
  464. }
  465. // Walk up the tree until we find an ancestor whose instance we have cached.
  466. var parents = [];
  467. while (!node[internalInstanceKey]) {
  468. parents.push(node);
  469. if (node.parentNode) {
  470. node = node.parentNode;
  471. } else {
  472. // Top of the tree. This node must not be part of a React tree (or is
  473. // unmounted, potentially).
  474. return null;
  475. }
  476. }
  477. var closest;
  478. var inst;
  479. for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
  480. closest = inst;
  481. if (parents.length) {
  482. precacheChildNodes(inst, node);
  483. }
  484. }
  485. return closest;
  486. }
  487. /**
  488. * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
  489. * instance, or null if the node was not rendered by this React.
  490. */
  491. function getInstanceFromNode(node) {
  492. var inst = getClosestInstanceFromNode(node);
  493. if (inst != null && inst._hostNode === node) {
  494. return inst;
  495. } else {
  496. return null;
  497. }
  498. }
  499. /**
  500. * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
  501. * DOM node.
  502. */
  503. function getNodeFromInstance(inst) {
  504. // Without this first invariant, passing a non-DOM-component triggers the next
  505. // invariant for a missing parent, which is super confusing.
  506. !(inst._hostNode !== undefined) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  507. if (inst._hostNode) {
  508. return inst._hostNode;
  509. }
  510. // Walk up the tree until we find an ancestor whose DOM node we have cached.
  511. var parents = [];
  512. while (!inst._hostNode) {
  513. parents.push(inst);
  514. !inst._hostParent ? false ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0;
  515. inst = inst._hostParent;
  516. }
  517. // Now parents contains each ancestor that does *not* have a cached native
  518. // node, and `inst` is the deepest ancestor that does.
  519. for (; parents.length; inst = parents.pop()) {
  520. precacheChildNodes(inst, inst._hostNode);
  521. }
  522. return inst._hostNode;
  523. }
  524. var ReactDOMComponentTree = {
  525. getClosestInstanceFromNode: getClosestInstanceFromNode,
  526. getInstanceFromNode: getInstanceFromNode,
  527. getNodeFromInstance: getNodeFromInstance,
  528. precacheChildNodes: precacheChildNodes,
  529. precacheNode: precacheNode,
  530. uncacheNode: uncacheNode
  531. };
  532. module.exports = ReactDOMComponentTree;
  533. /***/ }),
  534. /* 6 */
  535. /***/ (function(module, exports) {
  536. /*
  537. MIT License http://www.opensource.org/licenses/mit-license.php
  538. Author Tobias Koppers @sokra
  539. */
  540. // css base code, injected by the css-loader
  541. module.exports = function() {
  542. var list = [];
  543. // return the list of modules as css string
  544. list.toString = function toString() {
  545. var result = [];
  546. for(var i = 0; i < this.length; i++) {
  547. var item = this[i];
  548. if(item[2]) {
  549. result.push("@media " + item[2] + "{" + item[1] + "}");
  550. } else {
  551. result.push(item[1]);
  552. }
  553. }
  554. return result.join("");
  555. };
  556. // import a list of modules into the list
  557. list.i = function(modules, mediaQuery) {
  558. if(typeof modules === "string")
  559. modules = [[null, modules, ""]];
  560. var alreadyImportedModules = {};
  561. for(var i = 0; i < this.length; i++) {
  562. var id = this[i][0];
  563. if(typeof id === "number")
  564. alreadyImportedModules[id] = true;
  565. }
  566. for(i = 0; i < modules.length; i++) {
  567. var item = modules[i];
  568. // skip already imported module
  569. // this implementation is not 100% perfect for weird media query combinations
  570. // when a module is imported multiple times with different media queries.
  571. // I hope this will never occur (Hey this way we have smaller bundles)
  572. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  573. if(mediaQuery && !item[2]) {
  574. item[2] = mediaQuery;
  575. } else if(mediaQuery) {
  576. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  577. }
  578. list.push(item);
  579. }
  580. }
  581. };
  582. return list;
  583. };
  584. /***/ }),
  585. /* 7 */
  586. /***/ (function(module, exports, __webpack_require__) {
  587. "use strict";
  588. module.exports = __webpack_require__(21);
  589. /***/ }),
  590. /* 8 */
  591. /***/ (function(module, exports, __webpack_require__) {
  592. /*
  593. MIT License http://www.opensource.org/licenses/mit-license.php
  594. Author Tobias Koppers @sokra
  595. */
  596. var stylesInDom = {},
  597. memoize = function(fn) {
  598. var memo;
  599. return function () {
  600. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  601. return memo;
  602. };
  603. },
  604. isOldIE = memoize(function() {
  605. // Test for IE <= 9 as proposed by Browserhacks
  606. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  607. // Tests for existence of standard globals is to allow style-loader
  608. // to operate correctly into non-standard environments
  609. // @see https://github.com/webpack-contrib/style-loader/issues/177
  610. return window && document && document.all && !window.atob;
  611. }),
  612. getElement = (function(fn) {
  613. var memo = {};
  614. return function(selector) {
  615. if (typeof memo[selector] === "undefined") {
  616. memo[selector] = fn.call(this, selector);
  617. }
  618. return memo[selector]
  619. };
  620. })(function (styleTarget) {
  621. return document.querySelector(styleTarget)
  622. }),
  623. singletonElement = null,
  624. singletonCounter = 0,
  625. styleElementsInsertedAtTop = [],
  626. fixUrls = __webpack_require__(104);
  627. module.exports = function(list, options) {
  628. if(typeof DEBUG !== "undefined" && DEBUG) {
  629. if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  630. }
  631. options = options || {};
  632. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  633. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  634. // tags it will allow on a page
  635. if (typeof options.singleton === "undefined") options.singleton = isOldIE();
  636. // By default, add <style> tags to the <head> element
  637. if (typeof options.insertInto === "undefined") options.insertInto = "head";
  638. // By default, add <style> tags to the bottom of the target
  639. if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
  640. var styles = listToStyles(list);
  641. addStylesToDom(styles, options);
  642. return function update(newList) {
  643. var mayRemove = [];
  644. for(var i = 0; i < styles.length; i++) {
  645. var item = styles[i];
  646. var domStyle = stylesInDom[item.id];
  647. domStyle.refs--;
  648. mayRemove.push(domStyle);
  649. }
  650. if(newList) {
  651. var newStyles = listToStyles(newList);
  652. addStylesToDom(newStyles, options);
  653. }
  654. for(var i = 0; i < mayRemove.length; i++) {
  655. var domStyle = mayRemove[i];
  656. if(domStyle.refs === 0) {
  657. for(var j = 0; j < domStyle.parts.length; j++)
  658. domStyle.parts[j]();
  659. delete stylesInDom[domStyle.id];
  660. }
  661. }
  662. };
  663. };
  664. function addStylesToDom(styles, options) {
  665. for(var i = 0; i < styles.length; i++) {
  666. var item = styles[i];
  667. var domStyle = stylesInDom[item.id];
  668. if(domStyle) {
  669. domStyle.refs++;
  670. for(var j = 0; j < domStyle.parts.length; j++) {
  671. domStyle.parts[j](item.parts[j]);
  672. }
  673. for(; j < item.parts.length; j++) {
  674. domStyle.parts.push(addStyle(item.parts[j], options));
  675. }
  676. } else {
  677. var parts = [];
  678. for(var j = 0; j < item.parts.length; j++) {
  679. parts.push(addStyle(item.parts[j], options));
  680. }
  681. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  682. }
  683. }
  684. }
  685. function listToStyles(list) {
  686. var styles = [];
  687. var newStyles = {};
  688. for(var i = 0; i < list.length; i++) {
  689. var item = list[i];
  690. var id = item[0];
  691. var css = item[1];
  692. var media = item[2];
  693. var sourceMap = item[3];
  694. var part = {css: css, media: media, sourceMap: sourceMap};
  695. if(!newStyles[id])
  696. styles.push(newStyles[id] = {id: id, parts: [part]});
  697. else
  698. newStyles[id].parts.push(part);
  699. }
  700. return styles;
  701. }
  702. function insertStyleElement(options, styleElement) {
  703. var styleTarget = getElement(options.insertInto)
  704. if (!styleTarget) {
  705. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  706. }
  707. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  708. if (options.insertAt === "top") {
  709. if(!lastStyleElementInsertedAtTop) {
  710. styleTarget.insertBefore(styleElement, styleTarget.firstChild);
  711. } else if(lastStyleElementInsertedAtTop.nextSibling) {
  712. styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
  713. } else {
  714. styleTarget.appendChild(styleElement);
  715. }
  716. styleElementsInsertedAtTop.push(styleElement);
  717. } else if (options.insertAt === "bottom") {
  718. styleTarget.appendChild(styleElement);
  719. } else {
  720. throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  721. }
  722. }
  723. function removeStyleElement(styleElement) {
  724. styleElement.parentNode.removeChild(styleElement);
  725. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  726. if(idx >= 0) {
  727. styleElementsInsertedAtTop.splice(idx, 1);
  728. }
  729. }
  730. function createStyleElement(options) {
  731. var styleElement = document.createElement("style");
  732. options.attrs.type = "text/css";
  733. attachTagAttrs(styleElement, options.attrs);
  734. insertStyleElement(options, styleElement);
  735. return styleElement;
  736. }
  737. function createLinkElement(options) {
  738. var linkElement = document.createElement("link");
  739. options.attrs.type = "text/css";
  740. options.attrs.rel = "stylesheet";
  741. attachTagAttrs(linkElement, options.attrs);
  742. insertStyleElement(options, linkElement);
  743. return linkElement;
  744. }
  745. function attachTagAttrs(element, attrs) {
  746. Object.keys(attrs).forEach(function (key) {
  747. element.setAttribute(key, attrs[key]);
  748. });
  749. }
  750. function addStyle(obj, options) {
  751. var styleElement, update, remove;
  752. if (options.singleton) {
  753. var styleIndex = singletonCounter++;
  754. styleElement = singletonElement || (singletonElement = createStyleElement(options));
  755. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
  756. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
  757. } else if(obj.sourceMap &&
  758. typeof URL === "function" &&
  759. typeof URL.createObjectURL === "function" &&
  760. typeof URL.revokeObjectURL === "function" &&
  761. typeof Blob === "function" &&
  762. typeof btoa === "function") {
  763. styleElement = createLinkElement(options);
  764. update = updateLink.bind(null, styleElement, options);
  765. remove = function() {
  766. removeStyleElement(styleElement);
  767. if(styleElement.href)
  768. URL.revokeObjectURL(styleElement.href);
  769. };
  770. } else {
  771. styleElement = createStyleElement(options);
  772. update = applyToTag.bind(null, styleElement);
  773. remove = function() {
  774. removeStyleElement(styleElement);
  775. };
  776. }
  777. update(obj);
  778. return function updateStyle(newObj) {
  779. if(newObj) {
  780. if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
  781. return;
  782. update(obj = newObj);
  783. } else {
  784. remove();
  785. }
  786. };
  787. }
  788. var replaceText = (function () {
  789. var textStore = [];
  790. return function (index, replacement) {
  791. textStore[index] = replacement;
  792. return textStore.filter(Boolean).join('\n');
  793. };
  794. })();
  795. function applyToSingletonTag(styleElement, index, remove, obj) {
  796. var css = remove ? "" : obj.css;
  797. if (styleElement.styleSheet) {
  798. styleElement.styleSheet.cssText = replaceText(index, css);
  799. } else {
  800. var cssNode = document.createTextNode(css);
  801. var childNodes = styleElement.childNodes;
  802. if (childNodes[index]) styleElement.removeChild(childNodes[index]);
  803. if (childNodes.length) {
  804. styleElement.insertBefore(cssNode, childNodes[index]);
  805. } else {
  806. styleElement.appendChild(cssNode);
  807. }
  808. }
  809. }
  810. function applyToTag(styleElement, obj) {
  811. var css = obj.css;
  812. var media = obj.media;
  813. if(media) {
  814. styleElement.setAttribute("media", media)
  815. }
  816. if(styleElement.styleSheet) {
  817. styleElement.styleSheet.cssText = css;
  818. } else {
  819. while(styleElement.firstChild) {
  820. styleElement.removeChild(styleElement.firstChild);
  821. }
  822. styleElement.appendChild(document.createTextNode(css));
  823. }
  824. }
  825. function updateLink(linkElement, options, obj) {
  826. var css = obj.css;
  827. var sourceMap = obj.sourceMap;
  828. /* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  829. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  830. on by default. Otherwise default to the convertToAbsoluteUrls option
  831. directly
  832. */
  833. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  834. if (options.convertToAbsoluteUrls || autoFixUrls){
  835. css = fixUrls(css);
  836. }
  837. if(sourceMap) {
  838. // http://stackoverflow.com/a/26603875
  839. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  840. }
  841. var blob = new Blob([css], { type: "text/css" });
  842. var oldSrc = linkElement.href;
  843. linkElement.href = URL.createObjectURL(blob);
  844. if(oldSrc)
  845. URL.revokeObjectURL(oldSrc);
  846. }
  847. /***/ }),
  848. /* 9 */
  849. /***/ (function(module, exports, __webpack_require__) {
  850. "use strict";
  851. /**
  852. * Copyright (c) 2013-present, Facebook, Inc.
  853. * All rights reserved.
  854. *
  855. * This source code is licensed under the BSD-style license found in the
  856. * LICENSE file in the root directory of this source tree. An additional grant
  857. * of patent rights can be found in the PATENTS file in the same directory.
  858. *
  859. */
  860. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  861. /**
  862. * Simple, lightweight module assisting with the detection and context of
  863. * Worker. Helps avoid circular dependencies and allows code to reason about
  864. * whether or not they are in a Worker, even if they never include the main
  865. * `ReactWorker` dependency.
  866. */
  867. var ExecutionEnvironment = {
  868. canUseDOM: canUseDOM,
  869. canUseWorkers: typeof Worker !== 'undefined',
  870. canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
  871. canUseViewport: canUseDOM && !!window.screen,
  872. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  873. };
  874. module.exports = ExecutionEnvironment;
  875. /***/ }),
  876. /* 10 */
  877. /***/ (function(module, exports, __webpack_require__) {
  878. "use strict";
  879. /**
  880. * Copyright (c) 2013-present, Facebook, Inc.
  881. * All rights reserved.
  882. *
  883. * This source code is licensed under the BSD-style license found in the
  884. * LICENSE file in the root directory of this source tree. An additional grant
  885. * of patent rights can be found in the PATENTS file in the same directory.
  886. *
  887. *
  888. */
  889. function makeEmptyFunction(arg) {
  890. return function () {
  891. return arg;
  892. };
  893. }
  894. /**
  895. * This function accepts and discards inputs; it has no side effects. This is
  896. * primarily useful idiomatically for overridable function endpoints which
  897. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  898. */
  899. var emptyFunction = function emptyFunction() {};
  900. emptyFunction.thatReturns = makeEmptyFunction;
  901. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  902. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  903. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  904. emptyFunction.thatReturnsThis = function () {
  905. return this;
  906. };
  907. emptyFunction.thatReturnsArgument = function (arg) {
  908. return arg;
  909. };
  910. module.exports = emptyFunction;
  911. /***/ }),
  912. /* 11 */
  913. /***/ (function(module, exports, __webpack_require__) {
  914. "use strict";
  915. /**
  916. * Copyright 2016-present, Facebook, Inc.
  917. * All rights reserved.
  918. *
  919. * This source code is licensed under the BSD-style license found in the
  920. * LICENSE file in the root directory of this source tree. An additional grant
  921. * of patent rights can be found in the PATENTS file in the same directory.
  922. *
  923. *
  924. */
  925. // Trust the developer to only use ReactInstrumentation with a __DEV__ check
  926. var debugTool = null;
  927. if (false) {
  928. var ReactDebugTool = require('./ReactDebugTool');
  929. debugTool = ReactDebugTool;
  930. }
  931. module.exports = { debugTool: debugTool };
  932. /***/ }),
  933. /* 12 */
  934. /***/ (function(module, exports, __webpack_require__) {
  935. "use strict";
  936. /**
  937. * Copyright 2013-present, Facebook, Inc.
  938. * All rights reserved.
  939. *
  940. * This source code is licensed under the BSD-style license found in the
  941. * LICENSE file in the root directory of this source tree. An additional grant
  942. * of patent rights can be found in the PATENTS file in the same directory.
  943. *
  944. */
  945. var _prodInvariant = __webpack_require__(2),
  946. _assign = __webpack_require__(3);
  947. var CallbackQueue = __webpack_require__(78);
  948. var PooledClass = __webpack_require__(15);
  949. var ReactFeatureFlags = __webpack_require__(83);
  950. var ReactReconciler = __webpack_require__(20);
  951. var Transaction = __webpack_require__(34);
  952. var invariant = __webpack_require__(0);
  953. var dirtyComponents = [];
  954. var updateBatchNumber = 0;
  955. var asapCallbackQueue = CallbackQueue.getPooled();
  956. var asapEnqueued = false;
  957. var batchingStrategy = null;
  958. function ensureInjected() {
  959. !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? false ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
  960. }
  961. var NESTED_UPDATES = {
  962. initialize: function () {
  963. this.dirtyComponentsLength = dirtyComponents.length;
  964. },
  965. close: function () {
  966. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  967. // Additional updates were enqueued by componentDidUpdate handlers or
  968. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  969. // these new updates so that if A's componentDidUpdate calls setState on
  970. // B, B will update before the callback A's updater provided when calling
  971. // setState.
  972. dirtyComponents.splice(0, this.dirtyComponentsLength);
  973. flushBatchedUpdates();
  974. } else {
  975. dirtyComponents.length = 0;
  976. }
  977. }
  978. };
  979. var UPDATE_QUEUEING = {
  980. initialize: function () {
  981. this.callbackQueue.reset();
  982. },
  983. close: function () {
  984. this.callbackQueue.notifyAll();
  985. }
  986. };
  987. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  988. function ReactUpdatesFlushTransaction() {
  989. this.reinitializeTransaction();
  990. this.dirtyComponentsLength = null;
  991. this.callbackQueue = CallbackQueue.getPooled();
  992. this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  993. /* useCreateElement */true);
  994. }
  995. _assign(ReactUpdatesFlushTransaction.prototype, Transaction, {
  996. getTransactionWrappers: function () {
  997. return TRANSACTION_WRAPPERS;
  998. },
  999. destructor: function () {
  1000. this.dirtyComponentsLength = null;
  1001. CallbackQueue.release(this.callbackQueue);
  1002. this.callbackQueue = null;
  1003. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  1004. this.reconcileTransaction = null;
  1005. },
  1006. perform: function (method, scope, a) {
  1007. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  1008. // with this transaction's wrappers around it.
  1009. return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
  1010. }
  1011. });
  1012. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  1013. function batchedUpdates(callback, a, b, c, d, e) {
  1014. ensureInjected();
  1015. return batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
  1016. }
  1017. /**
  1018. * Array comparator for ReactComponents by mount ordering.
  1019. *
  1020. * @param {ReactComponent} c1 first component you're comparing
  1021. * @param {ReactComponent} c2 second component you're comparing
  1022. * @return {number} Return value usable by Array.prototype.sort().
  1023. */
  1024. function mountOrderComparator(c1, c2) {
  1025. return c1._mountOrder - c2._mountOrder;
  1026. }
  1027. function runBatchedUpdates(transaction) {
  1028. var len = transaction.dirtyComponentsLength;
  1029. !(len === dirtyComponents.length) ? false ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;
  1030. // Since reconciling a component higher in the owner hierarchy usually (not
  1031. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  1032. // them before their children by sorting the array.
  1033. dirtyComponents.sort(mountOrderComparator);
  1034. // Any updates enqueued while reconciling must be performed after this entire
  1035. // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and
  1036. // C, B could update twice in a single batch if C's render enqueues an update
  1037. // to B (since B would have already updated, we should skip it, and the only
  1038. // way we can know to do so is by checking the batch counter).
  1039. updateBatchNumber++;
  1040. for (var i = 0; i < len; i++) {
  1041. // If a component is unmounted before pending changes apply, it will still
  1042. // be here, but we assume that it has cleared its _pendingCallbacks and
  1043. // that performUpdateIfNecessary is a noop.
  1044. var component = dirtyComponents[i];
  1045. // If performUpdateIfNecessary happens to enqueue any new updates, we
  1046. // shouldn't execute the callbacks until the next render happens, so
  1047. // stash the callbacks first
  1048. var callbacks = component._pendingCallbacks;
  1049. component._pendingCallbacks = null;
  1050. var markerName;
  1051. if (ReactFeatureFlags.logTopLevelRenders) {
  1052. var namedComponent = component;
  1053. // Duck type TopLevelWrapper. This is probably always true.
  1054. if (component._currentElement.type.isReactTopLevelWrapper) {
  1055. namedComponent = component._renderedComponent;
  1056. }
  1057. markerName = 'React update: ' + namedComponent.getName();
  1058. console.time(markerName);
  1059. }
  1060. ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);
  1061. if (markerName) {
  1062. console.timeEnd(markerName);
  1063. }
  1064. if (callbacks) {
  1065. for (var j = 0; j < callbacks.length; j++) {
  1066. transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
  1067. }
  1068. }
  1069. }
  1070. }
  1071. var flushBatchedUpdates = function () {
  1072. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  1073. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  1074. // componentDidUpdate) but we need to check here too in order to catch
  1075. // updates enqueued by setState callbacks and asap calls.
  1076. while (dirtyComponents.length || asapEnqueued) {
  1077. if (dirtyComponents.length) {
  1078. var transaction = ReactUpdatesFlushTransaction.getPooled();
  1079. transaction.perform(runBatchedUpdates, null, transaction);
  1080. ReactUpdatesFlushTransaction.release(transaction);
  1081. }
  1082. if (asapEnqueued) {
  1083. asapEnqueued = false;
  1084. var queue = asapCallbackQueue;
  1085. asapCallbackQueue = CallbackQueue.getPooled();
  1086. queue.notifyAll();
  1087. CallbackQueue.release(queue);
  1088. }
  1089. }
  1090. };
  1091. /**
  1092. * Mark a component as needing a rerender, adding an optional callback to a
  1093. * list of functions which will be executed once the rerender occurs.
  1094. */
  1095. function enqueueUpdate(component) {
  1096. ensureInjected();
  1097. // Various parts of our code (such as ReactCompositeComponent's
  1098. // _renderValidatedComponent) assume that calls to render aren't nested;
  1099. // verify that that's the case. (This is called by each top-level update
  1100. // function, like setState, forceUpdate, etc.; creation and
  1101. // destruction of top-level components is guarded in ReactMount.)
  1102. if (!batchingStrategy.isBatchingUpdates) {
  1103. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  1104. return;
  1105. }
  1106. dirtyComponents.push(component);
  1107. if (component._updateBatchNumber == null) {
  1108. component._updateBatchNumber = updateBatchNumber + 1;
  1109. }
  1110. }
  1111. /**
  1112. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  1113. * if no updates are currently being performed.
  1114. */
  1115. function asap(callback, context) {
  1116. !batchingStrategy.isBatchingUpdates ? false ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0;
  1117. asapCallbackQueue.enqueue(callback, context);
  1118. asapEnqueued = true;
  1119. }
  1120. var ReactUpdatesInjection = {
  1121. injectReconcileTransaction: function (ReconcileTransaction) {
  1122. !ReconcileTransaction ? false ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;
  1123. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  1124. },
  1125. injectBatchingStrategy: function (_batchingStrategy) {
  1126. !_batchingStrategy ? false ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;
  1127. !(typeof _batchingStrategy.batchedUpdates === 'function') ? false ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;
  1128. !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? false ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;
  1129. batchingStrategy = _batchingStrategy;
  1130. }
  1131. };
  1132. var ReactUpdates = {
  1133. /**
  1134. * React references `ReactReconcileTransaction` using this property in order
  1135. * to allow dependency injection.
  1136. *
  1137. * @internal
  1138. */
  1139. ReactReconcileTransaction: null,
  1140. batchedUpdates: batchedUpdates,
  1141. enqueueUpdate: enqueueUpdate,
  1142. flushBatchedUpdates: flushBatchedUpdates,
  1143. injection: ReactUpdatesInjection,
  1144. asap: asap
  1145. };
  1146. module.exports = ReactUpdates;
  1147. /***/ }),
  1148. /* 13 */
  1149. /***/ (function(module, exports, __webpack_require__) {
  1150. "use strict";
  1151. /**
  1152. * Copyright 2013-present, Facebook, Inc.
  1153. * All rights reserved.
  1154. *
  1155. * This source code is licensed under the BSD-style license found in the
  1156. * LICENSE file in the root directory of this source tree. An additional grant
  1157. * of patent rights can be found in the PATENTS file in the same directory.
  1158. *
  1159. */
  1160. var _assign = __webpack_require__(3);
  1161. var PooledClass = __webpack_require__(15);
  1162. var emptyFunction = __webpack_require__(10);
  1163. var warning = __webpack_require__(1);
  1164. var didWarnForAddedNewProperty = false;
  1165. var isProxySupported = typeof Proxy === 'function';
  1166. var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
  1167. /**
  1168. * @interface Event
  1169. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  1170. */
  1171. var EventInterface = {
  1172. type: null,
  1173. target: null,
  1174. // currentTarget is set when dispatching; no use in copying it here
  1175. currentTarget: emptyFunction.thatReturnsNull,
  1176. eventPhase: null,
  1177. bubbles: null,
  1178. cancelable: null,
  1179. timeStamp: function (event) {
  1180. return event.timeStamp || Date.now();
  1181. },
  1182. defaultPrevented: null,
  1183. isTrusted: null
  1184. };
  1185. /**
  1186. * Synthetic events are dispatched by event plugins, typically in response to a
  1187. * top-level event delegation handler.
  1188. *
  1189. * These systems should generally use pooling to reduce the frequency of garbage
  1190. * collection. The system should check `isPersistent` to determine whether the
  1191. * event should be released into the pool after being dispatched. Users that
  1192. * need a persisted event should invoke `persist`.
  1193. *
  1194. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  1195. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  1196. * DOM interface; custom application-specific events can also subclass this.
  1197. *
  1198. * @param {object} dispatchConfig Configuration used to dispatch this event.
  1199. * @param {*} targetInst Marker identifying the event target.
  1200. * @param {object} nativeEvent Native browser event.
  1201. * @param {DOMEventTarget} nativeEventTarget Target node.
  1202. */
  1203. function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
  1204. if (false) {
  1205. // these have a getter/setter for warnings
  1206. delete this.nativeEvent;
  1207. delete this.preventDefault;
  1208. delete this.stopPropagation;
  1209. }
  1210. this.dispatchConfig = dispatchConfig;
  1211. this._targetInst = targetInst;
  1212. this.nativeEvent = nativeEvent;
  1213. var Interface = this.constructor.Interface;
  1214. for (var propName in Interface) {
  1215. if (!Interface.hasOwnProperty(propName)) {
  1216. continue;
  1217. }
  1218. if (false) {
  1219. delete this[propName]; // this has a getter/setter for warnings
  1220. }
  1221. var normalize = Interface[propName];
  1222. if (normalize) {
  1223. this[propName] = normalize(nativeEvent);
  1224. } else {
  1225. if (propName === 'target') {
  1226. this.target = nativeEventTarget;
  1227. } else {
  1228. this[propName] = nativeEvent[propName];
  1229. }
  1230. }
  1231. }
  1232. var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
  1233. if (defaultPrevented) {
  1234. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  1235. } else {
  1236. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  1237. }
  1238. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  1239. return this;
  1240. }
  1241. _assign(SyntheticEvent.prototype, {
  1242. preventDefault: function () {
  1243. this.defaultPrevented = true;
  1244. var event = this.nativeEvent;
  1245. if (!event) {
  1246. return;
  1247. }
  1248. if (event.preventDefault) {
  1249. event.preventDefault();
  1250. } else if (typeof event.returnValue !== 'unknown') {
  1251. // eslint-disable-line valid-typeof
  1252. event.returnValue = false;
  1253. }
  1254. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  1255. },
  1256. stopPropagation: function () {
  1257. var event = this.nativeEvent;
  1258. if (!event) {
  1259. return;
  1260. }
  1261. if (event.stopPropagation) {
  1262. event.stopPropagation();
  1263. } else if (typeof event.cancelBubble !== 'unknown') {
  1264. // eslint-disable-line valid-typeof
  1265. // The ChangeEventPlugin registers a "propertychange" event for
  1266. // IE. This event does not support bubbling or cancelling, and
  1267. // any references to cancelBubble throw "Member not found". A
  1268. // typeof check of "unknown" circumvents this issue (and is also
  1269. // IE specific).
  1270. event.cancelBubble = true;
  1271. }
  1272. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  1273. },
  1274. /**
  1275. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  1276. * them back into the pool. This allows a way to hold onto a reference that
  1277. * won't be added back into the pool.
  1278. */
  1279. persist: function () {
  1280. this.isPersistent = emptyFunction.thatReturnsTrue;
  1281. },
  1282. /**
  1283. * Checks if this event should be released back into the pool.
  1284. *
  1285. * @return {boolean} True if this should not be released, false otherwise.
  1286. */
  1287. isPersistent: emptyFunction.thatReturnsFalse,
  1288. /**
  1289. * `PooledClass` looks for `destructor` on each instance it releases.
  1290. */
  1291. destructor: function () {
  1292. var Interface = this.constructor.Interface;
  1293. for (var propName in Interface) {
  1294. if (false) {
  1295. Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
  1296. } else {
  1297. this[propName] = null;
  1298. }
  1299. }
  1300. for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
  1301. this[shouldBeReleasedProperties[i]] = null;
  1302. }
  1303. if (false) {
  1304. Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
  1305. Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
  1306. Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
  1307. }
  1308. }
  1309. });
  1310. SyntheticEvent.Interface = EventInterface;
  1311. if (false) {
  1312. if (isProxySupported) {
  1313. /*eslint-disable no-func-assign */
  1314. SyntheticEvent = new Proxy(SyntheticEvent, {
  1315. construct: function (target, args) {
  1316. return this.apply(target, Object.create(target.prototype), args);
  1317. },
  1318. apply: function (constructor, that, args) {
  1319. return new Proxy(constructor.apply(that, args), {
  1320. set: function (target, prop, value) {
  1321. if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
  1322. process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
  1323. didWarnForAddedNewProperty = true;
  1324. }
  1325. target[prop] = value;
  1326. return true;
  1327. }
  1328. });
  1329. }
  1330. });
  1331. /*eslint-enable no-func-assign */
  1332. }
  1333. }
  1334. /**
  1335. * Helper to reduce boilerplate when creating subclasses.
  1336. *
  1337. * @param {function} Class
  1338. * @param {?object} Interface
  1339. */
  1340. SyntheticEvent.augmentClass = function (Class, Interface) {
  1341. var Super = this;
  1342. var E = function () {};
  1343. E.prototype = Super.prototype;
  1344. var prototype = new E();
  1345. _assign(prototype, Class.prototype);
  1346. Class.prototype = prototype;
  1347. Class.prototype.constructor = Class;
  1348. Class.Interface = _assign({}, Super.Interface, Interface);
  1349. Class.augmentClass = Super.augmentClass;
  1350. PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
  1351. };
  1352. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
  1353. module.exports = SyntheticEvent;
  1354. /**
  1355. * Helper to nullify syntheticEvent instance properties when destructing
  1356. *
  1357. * @param {object} SyntheticEvent
  1358. * @param {String} propName
  1359. * @return {object} defineProperty object
  1360. */
  1361. function getPooledWarningPropertyDefinition(propName, getVal) {
  1362. var isFunction = typeof getVal === 'function';
  1363. return {
  1364. configurable: true,
  1365. set: set,
  1366. get: get
  1367. };
  1368. function set(val) {
  1369. var action = isFunction ? 'setting the method' : 'setting the property';
  1370. warn(action, 'This is effectively a no-op');
  1371. return val;
  1372. }
  1373. function get() {
  1374. var action = isFunction ? 'accessing the method' : 'accessing the property';
  1375. var result = isFunction ? 'This is a no-op function' : 'This is set to null';
  1376. warn(action, result);
  1377. return getVal;
  1378. }
  1379. function warn(action, result) {
  1380. var warningCondition = false;
  1381. false ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
  1382. }
  1383. }
  1384. /***/ }),
  1385. /* 14 */
  1386. /***/ (function(module, exports, __webpack_require__) {
  1387. "use strict";
  1388. /**
  1389. * Copyright 2013-present, Facebook, Inc.
  1390. * All rights reserved.
  1391. *
  1392. * This source code is licensed under the BSD-style license found in the
  1393. * LICENSE file in the root directory of this source tree. An additional grant
  1394. * of patent rights can be found in the PATENTS file in the same directory.
  1395. *
  1396. *
  1397. */
  1398. /**
  1399. * Keeps track of the current owner.
  1400. *
  1401. * The current owner is the component who should own any components that are
  1402. * currently being constructed.
  1403. */
  1404. var ReactCurrentOwner = {
  1405. /**
  1406. * @internal
  1407. * @type {ReactComponent}
  1408. */
  1409. current: null
  1410. };
  1411. module.exports = ReactCurrentOwner;
  1412. /***/ }),
  1413. /* 15 */
  1414. /***/ (function(module, exports, __webpack_require__) {
  1415. "use strict";
  1416. /**
  1417. * Copyright 2013-present, Facebook, Inc.
  1418. * All rights reserved.
  1419. *
  1420. * This source code is licensed under the BSD-style license found in the
  1421. * LICENSE file in the root directory of this source tree. An additional grant
  1422. * of patent rights can be found in the PATENTS file in the same directory.
  1423. *
  1424. *
  1425. */
  1426. var _prodInvariant = __webpack_require__(2);
  1427. var invariant = __webpack_require__(0);
  1428. /**
  1429. * Static poolers. Several custom versions for each potential number of
  1430. * arguments. A completely generic pooler is easy to implement, but would
  1431. * require accessing the `arguments` object. In each of these, `this` refers to
  1432. * the Class itself, not an instance. If any others are needed, simply add them
  1433. * here, or in their own files.
  1434. */
  1435. var oneArgumentPooler = function (copyFieldsFrom) {
  1436. var Klass = this;
  1437. if (Klass.instancePool.length) {
  1438. var instance = Klass.instancePool.pop();
  1439. Klass.call(instance, copyFieldsFrom);
  1440. return instance;
  1441. } else {
  1442. return new Klass(copyFieldsFrom);
  1443. }
  1444. };
  1445. var twoArgumentPooler = function (a1, a2) {
  1446. var Klass = this;
  1447. if (Klass.instancePool.length) {
  1448. var instance = Klass.instancePool.pop();
  1449. Klass.call(instance, a1, a2);
  1450. return instance;
  1451. } else {
  1452. return new Klass(a1, a2);
  1453. }
  1454. };
  1455. var threeArgumentPooler = function (a1, a2, a3) {
  1456. var Klass = this;
  1457. if (Klass.instancePool.length) {
  1458. var instance = Klass.instancePool.pop();
  1459. Klass.call(instance, a1, a2, a3);
  1460. return instance;
  1461. } else {
  1462. return new Klass(a1, a2, a3);
  1463. }
  1464. };
  1465. var fourArgumentPooler = function (a1, a2, a3, a4) {
  1466. var Klass = this;
  1467. if (Klass.instancePool.length) {
  1468. var instance = Klass.instancePool.pop();
  1469. Klass.call(instance, a1, a2, a3, a4);
  1470. return instance;
  1471. } else {
  1472. return new Klass(a1, a2, a3, a4);
  1473. }
  1474. };
  1475. var standardReleaser = function (instance) {
  1476. var Klass = this;
  1477. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  1478. instance.destructor();
  1479. if (Klass.instancePool.length < Klass.poolSize) {
  1480. Klass.instancePool.push(instance);
  1481. }
  1482. };
  1483. var DEFAULT_POOL_SIZE = 10;
  1484. var DEFAULT_POOLER = oneArgumentPooler;
  1485. /**
  1486. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  1487. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  1488. * you give this may have a `poolSize` property, and will look for a
  1489. * prototypical `destructor` on instances.
  1490. *
  1491. * @param {Function} CopyConstructor Constructor that can be used to reset.
  1492. * @param {Function} pooler Customizable pooler.
  1493. */
  1494. var addPoolingTo = function (CopyConstructor, pooler) {
  1495. // Casting as any so that flow ignores the actual implementation and trusts
  1496. // it to match the type we declared
  1497. var NewKlass = CopyConstructor;
  1498. NewKlass.instancePool = [];
  1499. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  1500. if (!NewKlass.poolSize) {
  1501. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  1502. }
  1503. NewKlass.release = standardReleaser;
  1504. return NewKlass;
  1505. };
  1506. var PooledClass = {
  1507. addPoolingTo: addPoolingTo,
  1508. oneArgumentPooler: oneArgumentPooler,
  1509. twoArgumentPooler: twoArgumentPooler,
  1510. threeArgumentPooler: threeArgumentPooler,
  1511. fourArgumentPooler: fourArgumentPooler
  1512. };
  1513. module.exports = PooledClass;
  1514. /***/ }),
  1515. /* 16 */
  1516. /***/ (function(module, exports, __webpack_require__) {
  1517. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  1518. Copyright (c) 2016 Jed Watson.
  1519. Licensed under the MIT License (MIT), see
  1520. http://jedwatson.github.io/classnames
  1521. */
  1522. /* global define */
  1523. (function () {
  1524. 'use strict';
  1525. var hasOwn = {}.hasOwnProperty;
  1526. function classNames () {
  1527. var classes = [];
  1528. for (var i = 0; i < arguments.length; i++) {
  1529. var arg = arguments[i];
  1530. if (!arg) continue;
  1531. var argType = typeof arg;
  1532. if (argType === 'string' || argType === 'number') {
  1533. classes.push(arg);
  1534. } else if (Array.isArray(arg)) {
  1535. classes.push(classNames.apply(null, arg));
  1536. } else if (argType === 'object') {
  1537. for (var key in arg) {
  1538. if (hasOwn.call(arg, key) && arg[key]) {
  1539. classes.push(key);
  1540. }
  1541. }
  1542. }
  1543. }
  1544. return classes.join(' ');
  1545. }
  1546. if (typeof module !== 'undefined' && module.exports) {
  1547. module.exports = classNames;
  1548. } else if (true) {
  1549. // register as 'classnames', consistent with npm package name
  1550. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
  1551. return classNames;
  1552. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  1553. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1554. } else {
  1555. window.classNames = classNames;
  1556. }
  1557. }());
  1558. /***/ }),
  1559. /* 17 */
  1560. /***/ (function(module, exports, __webpack_require__) {
  1561. "use strict";
  1562. /**
  1563. * @author oldj
  1564. * @blog https://oldj.net
  1565. */
  1566. var _Agent = __webpack_require__(4);
  1567. var _Agent2 = _interopRequireDefault(_Agent);
  1568. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1569. module.exports = function (app, new_list) {
  1570. var hosts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1571. var state = { list: new_list };
  1572. _Agent2.default.pact('getSysHosts').then(function (sys_hosts) {
  1573. state.sys_hosts = sys_hosts;
  1574. if (hosts) {
  1575. state.current = hosts;
  1576. }
  1577. var current = app.state.current;
  1578. if (current.is_sys) {
  1579. state.current = sys_hosts;
  1580. }
  1581. app.setState(state, function () {
  1582. if (hosts) {
  1583. _Agent2.default.emit('select', hosts.id);
  1584. }
  1585. });
  1586. });
  1587. };
  1588. /***/ }),
  1589. /* 18 */
  1590. /***/ (function(module, exports, __webpack_require__) {
  1591. "use strict";
  1592. /**
  1593. * Copyright 2015-present, Facebook, Inc.
  1594. * All rights reserved.
  1595. *
  1596. * This source code is licensed under the BSD-style license found in the
  1597. * LICENSE file in the root directory of this source tree. An additional grant
  1598. * of patent rights can be found in the PATENTS file in the same directory.
  1599. *
  1600. */
  1601. var DOMNamespaces = __webpack_require__(50);
  1602. var setInnerHTML = __webpack_require__(36);
  1603. var createMicrosoftUnsafeLocalFunction = __webpack_require__(58);
  1604. var setTextContent = __webpack_require__(95);
  1605. var ELEMENT_NODE_TYPE = 1;
  1606. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  1607. /**
  1608. * In IE (8-11) and Edge, appending nodes with no children is dramatically
  1609. * faster than appending a full subtree, so we essentially queue up the
  1610. * .appendChild calls here and apply them so each node is added to its parent
  1611. * before any children are added.
  1612. *
  1613. * In other browsers, doing so is slower or neutral compared to the other order
  1614. * (in Firefox, twice as slow) so we only do this inversion in IE.
  1615. *
  1616. * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
  1617. */
  1618. var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
  1619. function insertTreeChildren(tree) {
  1620. if (!enableLazy) {
  1621. return;
  1622. }
  1623. var node = tree.node;
  1624. var children = tree.children;
  1625. if (children.length) {
  1626. for (var i = 0; i < children.length; i++) {
  1627. insertTreeBefore(node, children[i], null);
  1628. }
  1629. } else if (tree.html != null) {
  1630. setInnerHTML(node, tree.html);
  1631. } else if (tree.text != null) {
  1632. setTextContent(node, tree.text);
  1633. }
  1634. }
  1635. var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
  1636. // DocumentFragments aren't actually part of the DOM after insertion so
  1637. // appending children won't update the DOM. We need to ensure the fragment
  1638. // is properly populated first, breaking out of our lazy approach for just
  1639. // this level. Also, some <object> plugins (like Flash Player) will read
  1640. // <param> nodes immediately upon insertion into the DOM, so <object>
  1641. // must also be populated prior to insertion into the DOM.
  1642. if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) {
  1643. insertTreeChildren(tree);
  1644. parentNode.insertBefore(tree.node, referenceNode);
  1645. } else {
  1646. parentNode.insertBefore(tree.node, referenceNode);
  1647. insertTreeChildren(tree);
  1648. }
  1649. });
  1650. function replaceChildWithTree(oldNode, newTree) {
  1651. oldNode.parentNode.replaceChild(newTree.node, oldNode);
  1652. insertTreeChildren(newTree);
  1653. }
  1654. function queueChild(parentTree, childTree) {
  1655. if (enableLazy) {
  1656. parentTree.children.push(childTree);
  1657. } else {
  1658. parentTree.node.appendChild(childTree.node);
  1659. }
  1660. }
  1661. function queueHTML(tree, html) {
  1662. if (enableLazy) {
  1663. tree.html = html;
  1664. } else {
  1665. setInnerHTML(tree.node, html);
  1666. }
  1667. }
  1668. function queueText(tree, text) {
  1669. if (enableLazy) {
  1670. tree.text = text;
  1671. } else {
  1672. setTextContent(tree.node, text);
  1673. }
  1674. }
  1675. function toString() {
  1676. return this.node.nodeName;
  1677. }
  1678. function DOMLazyTree(node) {
  1679. return {
  1680. node: node,
  1681. children: [],
  1682. html: null,
  1683. text: null,
  1684. toString: toString
  1685. };
  1686. }
  1687. DOMLazyTree.insertTreeBefore = insertTreeBefore;
  1688. DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
  1689. DOMLazyTree.queueChild = queueChild;
  1690. DOMLazyTree.queueHTML = queueHTML;
  1691. DOMLazyTree.queueText = queueText;
  1692. module.exports = DOMLazyTree;
  1693. /***/ }),
  1694. /* 19 */
  1695. /***/ (function(module, exports, __webpack_require__) {
  1696. "use strict";
  1697. /**
  1698. * Copyright 2013-present, Facebook, Inc.
  1699. * All rights reserved.
  1700. *
  1701. * This source code is licensed under the BSD-style license found in the
  1702. * LICENSE file in the root directory of this source tree. An additional grant
  1703. * of patent rights can be found in the PATENTS file in the same directory.
  1704. *
  1705. */
  1706. var _prodInvariant = __webpack_require__(2);
  1707. var invariant = __webpack_require__(0);
  1708. function checkMask(value, bitmask) {
  1709. return (value & bitmask) === bitmask;
  1710. }
  1711. var DOMPropertyInjection = {
  1712. /**
  1713. * Mapping from normalized, camelcased property names to a configuration that
  1714. * specifies how the associated DOM property should be accessed or rendered.
  1715. */
  1716. MUST_USE_PROPERTY: 0x1,
  1717. HAS_BOOLEAN_VALUE: 0x4,
  1718. HAS_NUMERIC_VALUE: 0x8,
  1719. HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
  1720. HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
  1721. /**
  1722. * Inject some specialized knowledge about the DOM. This takes a config object
  1723. * with the following properties:
  1724. *
  1725. * isCustomAttribute: function that given an attribute name will return true
  1726. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1727. * attributes where it's impossible to enumerate all of the possible
  1728. * attribute names,
  1729. *
  1730. * Properties: object mapping DOM property name to one of the
  1731. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1732. * it won't get written to the DOM.
  1733. *
  1734. * DOMAttributeNames: object mapping React attribute name to the DOM
  1735. * attribute name. Attribute names not specified use the **lowercase**
  1736. * normalized name.
  1737. *
  1738. * DOMAttributeNamespaces: object mapping React attribute name to the DOM
  1739. * attribute namespace URL. (Attribute names not specified use no namespace.)
  1740. *
  1741. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1742. * Property names not specified use the normalized name.
  1743. *
  1744. * DOMMutationMethods: Properties that require special mutation methods. If
  1745. * `value` is undefined, the mutation method should unset the property.
  1746. *
  1747. * @param {object} domPropertyConfig the config as described above.
  1748. */
  1749. injectDOMPropertyConfig: function (domPropertyConfig) {
  1750. var Injection = DOMPropertyInjection;
  1751. var Properties = domPropertyConfig.Properties || {};
  1752. var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
  1753. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1754. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1755. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1756. if (domPropertyConfig.isCustomAttribute) {
  1757. DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
  1758. }
  1759. for (var propName in Properties) {
  1760. !!DOMProperty.properties.hasOwnProperty(propName) ? false ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0;
  1761. var lowerCased = propName.toLowerCase();
  1762. var propConfig = Properties[propName];
  1763. var propertyInfo = {
  1764. attributeName: lowerCased,
  1765. attributeNamespace: null,
  1766. propertyName: propName,
  1767. mutationMethod: null,
  1768. mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
  1769. hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
  1770. hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
  1771. hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
  1772. hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
  1773. };
  1774. !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? false ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;
  1775. if (false) {
  1776. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1777. }
  1778. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1779. var attributeName = DOMAttributeNames[propName];
  1780. propertyInfo.attributeName = attributeName;
  1781. if (false) {
  1782. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1783. }
  1784. }
  1785. if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
  1786. propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
  1787. }
  1788. if (DOMPropertyNames.hasOwnProperty(propName)) {
  1789. propertyInfo.propertyName = DOMPropertyNames[propName];
  1790. }
  1791. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1792. propertyInfo.mutationMethod = DOMMutationMethods[propName];
  1793. }
  1794. DOMProperty.properties[propName] = propertyInfo;
  1795. }
  1796. }
  1797. };
  1798. /* eslint-disable max-len */
  1799. var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
  1800. /* eslint-enable max-len */
  1801. /**
  1802. * DOMProperty exports lookup objects that can be used like functions:
  1803. *
  1804. * > DOMProperty.isValid['id']
  1805. * true
  1806. * > DOMProperty.isValid['foobar']
  1807. * undefined
  1808. *
  1809. * Although this may be confusing, it performs better in general.
  1810. *
  1811. * @see http://jsperf.com/key-exists
  1812. * @see http://jsperf.com/key-missing
  1813. */
  1814. var DOMProperty = {
  1815. ID_ATTRIBUTE_NAME: 'data-reactid',
  1816. ROOT_ATTRIBUTE_NAME: 'data-reactroot',
  1817. ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
  1818. ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
  1819. /**
  1820. * Map from property "standard name" to an object with info about how to set
  1821. * the property in the DOM. Each object contains:
  1822. *
  1823. * attributeName:
  1824. * Used when rendering markup or with `*Attribute()`.
  1825. * attributeNamespace
  1826. * propertyName:
  1827. * Used on DOM node instances. (This includes properties that mutate due to
  1828. * external factors.)
  1829. * mutationMethod:
  1830. * If non-null, used instead of the property or `setAttribute()` after
  1831. * initial render.
  1832. * mustUseProperty:
  1833. * Whether the property must be accessed and mutated as an object property.
  1834. * hasBooleanValue:
  1835. * Whether the property should be removed when set to a falsey value.
  1836. * hasNumericValue:
  1837. * Whether the property must be numeric or parse as a numeric and should be
  1838. * removed when set to a falsey value.
  1839. * hasPositiveNumericValue:
  1840. * Whether the property must be positive numeric or parse as a positive
  1841. * numeric and should be removed when set to a falsey value.
  1842. * hasOverloadedBooleanValue:
  1843. * Whether the property can be used as a flag as well as with a value.
  1844. * Removed when strictly equal to false; present without a value when
  1845. * strictly equal to true; present with a value otherwise.
  1846. */
  1847. properties: {},
  1848. /**
  1849. * Mapping from lowercase property names to the properly cased version, used
  1850. * to warn in the case of missing properties. Available only in __DEV__.
  1851. *
  1852. * autofocus is predefined, because adding it to the property whitelist
  1853. * causes unintended side effects.
  1854. *
  1855. * @type {Object}
  1856. */
  1857. getPossibleStandardName: false ? { autofocus: 'autoFocus' } : null,
  1858. /**
  1859. * All of the isCustomAttribute() functions that have been injected.
  1860. */
  1861. _isCustomAttributeFunctions: [],
  1862. /**
  1863. * Checks whether a property name is a custom attribute.
  1864. * @method
  1865. */
  1866. isCustomAttribute: function (attributeName) {
  1867. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1868. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1869. if (isCustomAttributeFn(attributeName)) {
  1870. return true;
  1871. }
  1872. }
  1873. return false;
  1874. },
  1875. injection: DOMPropertyInjection
  1876. };
  1877. module.exports = DOMProperty;
  1878. /***/ }),
  1879. /* 20 */
  1880. /***/ (function(module, exports, __webpack_require__) {
  1881. "use strict";
  1882. /**
  1883. * Copyright 2013-present, Facebook, Inc.
  1884. * All rights reserved.
  1885. *
  1886. * This source code is licensed under the BSD-style license found in the
  1887. * LICENSE file in the root directory of this source tree. An additional grant
  1888. * of patent rights can be found in the PATENTS file in the same directory.
  1889. *
  1890. */
  1891. var ReactRef = __webpack_require__(204);
  1892. var ReactInstrumentation = __webpack_require__(11);
  1893. var warning = __webpack_require__(1);
  1894. /**
  1895. * Helper to call ReactRef.attachRefs with this composite component, split out
  1896. * to avoid allocations in the transaction mount-ready queue.
  1897. */
  1898. function attachRefs() {
  1899. ReactRef.attachRefs(this, this._currentElement);
  1900. }
  1901. var ReactReconciler = {
  1902. /**
  1903. * Initializes the component, renders markup, and registers event listeners.
  1904. *
  1905. * @param {ReactComponent} internalInstance
  1906. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  1907. * @param {?object} the containing host component instance
  1908. * @param {?object} info about the host container
  1909. * @return {?string} Rendered markup to be inserted into the DOM.
  1910. * @final
  1911. * @internal
  1912. */
  1913. mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
  1914. ) {
  1915. if (false) {
  1916. if (internalInstance._debugID !== 0) {
  1917. ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
  1918. }
  1919. }
  1920. var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);
  1921. if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1922. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  1923. }
  1924. if (false) {
  1925. if (internalInstance._debugID !== 0) {
  1926. ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
  1927. }
  1928. }
  1929. return markup;
  1930. },
  1931. /**
  1932. * Returns a value that can be passed to
  1933. * ReactComponentEnvironment.replaceNodeWithMarkup.
  1934. */
  1935. getHostNode: function (internalInstance) {
  1936. return internalInstance.getHostNode();
  1937. },
  1938. /**
  1939. * Releases any resources allocated by `mountComponent`.
  1940. *
  1941. * @final
  1942. * @internal
  1943. */
  1944. unmountComponent: function (internalInstance, safely) {
  1945. if (false) {
  1946. if (internalInstance._debugID !== 0) {
  1947. ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);
  1948. }
  1949. }
  1950. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  1951. internalInstance.unmountComponent(safely);
  1952. if (false) {
  1953. if (internalInstance._debugID !== 0) {
  1954. ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
  1955. }
  1956. }
  1957. },
  1958. /**
  1959. * Update a component using a new element.
  1960. *
  1961. * @param {ReactComponent} internalInstance
  1962. * @param {ReactElement} nextElement
  1963. * @param {ReactReconcileTransaction} transaction
  1964. * @param {object} context
  1965. * @internal
  1966. */
  1967. receiveComponent: function (internalInstance, nextElement, transaction, context) {
  1968. var prevElement = internalInstance._currentElement;
  1969. if (nextElement === prevElement && context === internalInstance._context) {
  1970. // Since elements are immutable after the owner is rendered,
  1971. // we can do a cheap identity compare here to determine if this is a
  1972. // superfluous reconcile. It's possible for state to be mutable but such
  1973. // change should trigger an update of the owner which would recreate
  1974. // the element. We explicitly check for the existence of an owner since
  1975. // it's possible for an element created outside a composite to be
  1976. // deeply mutated and reused.
  1977. // TODO: Bailing out early is just a perf optimization right?
  1978. // TODO: Removing the return statement should affect correctness?
  1979. return;
  1980. }
  1981. if (false) {
  1982. if (internalInstance._debugID !== 0) {
  1983. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
  1984. }
  1985. }
  1986. var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
  1987. if (refsChanged) {
  1988. ReactRef.detachRefs(internalInstance, prevElement);
  1989. }
  1990. internalInstance.receiveComponent(nextElement, transaction, context);
  1991. if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1992. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  1993. }
  1994. if (false) {
  1995. if (internalInstance._debugID !== 0) {
  1996. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  1997. }
  1998. }
  1999. },
  2000. /**
  2001. * Flush any dirty changes in a component.
  2002. *
  2003. * @param {ReactComponent} internalInstance
  2004. * @param {ReactReconcileTransaction} transaction
  2005. * @internal
  2006. */
  2007. performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
  2008. if (internalInstance._updateBatchNumber !== updateBatchNumber) {
  2009. // The component's enqueued batch number should always be the current
  2010. // batch or the following one.
  2011. false ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;
  2012. return;
  2013. }
  2014. if (false) {
  2015. if (internalInstance._debugID !== 0) {
  2016. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
  2017. }
  2018. }
  2019. internalInstance.performUpdateIfNecessary(transaction);
  2020. if (false) {
  2021. if (internalInstance._debugID !== 0) {
  2022. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  2023. }
  2024. }
  2025. }
  2026. };
  2027. module.exports = ReactReconciler;
  2028. /***/ }),
  2029. /* 21 */
  2030. /***/ (function(module, exports, __webpack_require__) {
  2031. "use strict";
  2032. /**
  2033. * Copyright 2013-present, Facebook, Inc.
  2034. * All rights reserved.
  2035. *
  2036. * This source code is licensed under the BSD-style license found in the
  2037. * LICENSE file in the root directory of this source tree. An additional grant
  2038. * of patent rights can be found in the PATENTS file in the same directory.
  2039. *
  2040. */
  2041. var _assign = __webpack_require__(3);
  2042. var ReactChildren = __webpack_require__(234);
  2043. var ReactComponent = __webpack_require__(65);
  2044. var ReactPureComponent = __webpack_require__(239);
  2045. var ReactClass = __webpack_require__(235);
  2046. var ReactDOMFactories = __webpack_require__(236);
  2047. var ReactElement = __webpack_require__(22);
  2048. var ReactPropTypes = __webpack_require__(237);
  2049. var ReactVersion = __webpack_require__(240);
  2050. var onlyChild = __webpack_require__(241);
  2051. var warning = __webpack_require__(1);
  2052. var createElement = ReactElement.createElement;
  2053. var createFactory = ReactElement.createFactory;
  2054. var cloneElement = ReactElement.cloneElement;
  2055. if (false) {
  2056. var ReactElementValidator = require('./ReactElementValidator');
  2057. createElement = ReactElementValidator.createElement;
  2058. createFactory = ReactElementValidator.createFactory;
  2059. cloneElement = ReactElementValidator.cloneElement;
  2060. }
  2061. var __spread = _assign;
  2062. if (false) {
  2063. var warned = false;
  2064. __spread = function () {
  2065. process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
  2066. warned = true;
  2067. return _assign.apply(null, arguments);
  2068. };
  2069. }
  2070. var React = {
  2071. // Modern
  2072. Children: {
  2073. map: ReactChildren.map,
  2074. forEach: ReactChildren.forEach,
  2075. count: ReactChildren.count,
  2076. toArray: ReactChildren.toArray,
  2077. only: onlyChild
  2078. },
  2079. Component: ReactComponent,
  2080. PureComponent: ReactPureComponent,
  2081. createElement: createElement,
  2082. cloneElement: cloneElement,
  2083. isValidElement: ReactElement.isValidElement,
  2084. // Classic
  2085. PropTypes: ReactPropTypes,
  2086. createClass: ReactClass.createClass,
  2087. createFactory: createFactory,
  2088. createMixin: function (mixin) {
  2089. // Currently a noop. Will be used to validate and trace mixins.
  2090. return mixin;
  2091. },
  2092. // This looks DOM specific but these are actually isomorphic helpers
  2093. // since they are just generating DOM strings.
  2094. DOM: ReactDOMFactories,
  2095. version: ReactVersion,
  2096. // Deprecated hook for JSX spread, don't use this for anything.
  2097. __spread: __spread
  2098. };
  2099. module.exports = React;
  2100. /***/ }),
  2101. /* 22 */
  2102. /***/ (function(module, exports, __webpack_require__) {
  2103. "use strict";
  2104. /**
  2105. * Copyright 2014-present, Facebook, Inc.
  2106. * All rights reserved.
  2107. *
  2108. * This source code is licensed under the BSD-style license found in the
  2109. * LICENSE file in the root directory of this source tree. An additional grant
  2110. * of patent rights can be found in the PATENTS file in the same directory.
  2111. *
  2112. */
  2113. var _assign = __webpack_require__(3);
  2114. var ReactCurrentOwner = __webpack_require__(14);
  2115. var warning = __webpack_require__(1);
  2116. var canDefineProperty = __webpack_require__(100);
  2117. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2118. var REACT_ELEMENT_TYPE = __webpack_require__(98);
  2119. var RESERVED_PROPS = {
  2120. key: true,
  2121. ref: true,
  2122. __self: true,
  2123. __source: true
  2124. };
  2125. var specialPropKeyWarningShown, specialPropRefWarningShown;
  2126. function hasValidRef(config) {
  2127. if (false) {
  2128. if (hasOwnProperty.call(config, 'ref')) {
  2129. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  2130. if (getter && getter.isReactWarning) {
  2131. return false;
  2132. }
  2133. }
  2134. }
  2135. return config.ref !== undefined;
  2136. }
  2137. function hasValidKey(config) {
  2138. if (false) {
  2139. if (hasOwnProperty.call(config, 'key')) {
  2140. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  2141. if (getter && getter.isReactWarning) {
  2142. return false;
  2143. }
  2144. }
  2145. }
  2146. return config.key !== undefined;
  2147. }
  2148. function defineKeyPropWarningGetter(props, displayName) {
  2149. var warnAboutAccessingKey = function () {
  2150. if (!specialPropKeyWarningShown) {
  2151. specialPropKeyWarningShown = true;
  2152. false ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
  2153. }
  2154. };
  2155. warnAboutAccessingKey.isReactWarning = true;
  2156. Object.defineProperty(props, 'key', {
  2157. get: warnAboutAccessingKey,
  2158. configurable: true
  2159. });
  2160. }
  2161. function defineRefPropWarningGetter(props, displayName) {
  2162. var warnAboutAccessingRef = function () {
  2163. if (!specialPropRefWarningShown) {
  2164. specialPropRefWarningShown = true;
  2165. false ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
  2166. }
  2167. };
  2168. warnAboutAccessingRef.isReactWarning = true;
  2169. Object.defineProperty(props, 'ref', {
  2170. get: warnAboutAccessingRef,
  2171. configurable: true
  2172. });
  2173. }
  2174. /**
  2175. * Factory method to create a new React element. This no longer adheres to
  2176. * the class pattern, so do not use new to call it. Also, no instanceof check
  2177. * will work. Instead test $$typeof field against Symbol.for('react.element') to check
  2178. * if something is a React Element.
  2179. *
  2180. * @param {*} type
  2181. * @param {*} key
  2182. * @param {string|object} ref
  2183. * @param {*} self A *temporary* helper to detect places where `this` is
  2184. * different from the `owner` when React.createElement is called, so that we
  2185. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  2186. * functions, and as long as `this` and owner are the same, there will be no
  2187. * change in behavior.
  2188. * @param {*} source An annotation object (added by a transpiler or otherwise)
  2189. * indicating filename, line number, and/or other information.
  2190. * @param {*} owner
  2191. * @param {*} props
  2192. * @internal
  2193. */
  2194. var ReactElement = function (type, key, ref, self, source, owner, props) {
  2195. var element = {
  2196. // This tag allow us to uniquely identify this as a React Element
  2197. $$typeof: REACT_ELEMENT_TYPE,
  2198. // Built-in properties that belong on the element
  2199. type: type,
  2200. key: key,
  2201. ref: ref,
  2202. props: props,
  2203. // Record the component responsible for creating this element.
  2204. _owner: owner
  2205. };
  2206. if (false) {
  2207. // The validation flag is currently mutative. We put it on
  2208. // an external backing store so that we can freeze the whole object.
  2209. // This can be replaced with a WeakMap once they are implemented in
  2210. // commonly used development environments.
  2211. element._store = {};
  2212. // To make comparing ReactElements easier for testing purposes, we make
  2213. // the validation flag non-enumerable (where possible, which should
  2214. // include every environment we run tests in), so the test framework
  2215. // ignores it.
  2216. if (canDefineProperty) {
  2217. Object.defineProperty(element._store, 'validated', {
  2218. configurable: false,
  2219. enumerable: false,
  2220. writable: true,
  2221. value: false
  2222. });
  2223. // self and source are DEV only properties.
  2224. Object.defineProperty(element, '_self', {
  2225. configurable: false,
  2226. enumerable: false,
  2227. writable: false,
  2228. value: self
  2229. });
  2230. // Two elements created in two different places should be considered
  2231. // equal for testing purposes and therefore we hide it from enumeration.
  2232. Object.defineProperty(element, '_source', {
  2233. configurable: false,
  2234. enumerable: false,
  2235. writable: false,
  2236. value: source
  2237. });
  2238. } else {
  2239. element._store.validated = false;
  2240. element._self = self;
  2241. element._source = source;
  2242. }
  2243. if (Object.freeze) {
  2244. Object.freeze(element.props);
  2245. Object.freeze(element);
  2246. }
  2247. }
  2248. return element;
  2249. };
  2250. /**
  2251. * Create and return a new ReactElement of the given type.
  2252. * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
  2253. */
  2254. ReactElement.createElement = function (type, config, children) {
  2255. var propName;
  2256. // Reserved names are extracted
  2257. var props = {};
  2258. var key = null;
  2259. var ref = null;
  2260. var self = null;
  2261. var source = null;
  2262. if (config != null) {
  2263. if (hasValidRef(config)) {
  2264. ref = config.ref;
  2265. }
  2266. if (hasValidKey(config)) {
  2267. key = '' + config.key;
  2268. }
  2269. self = config.__self === undefined ? null : config.__self;
  2270. source = config.__source === undefined ? null : config.__source;
  2271. // Remaining properties are added to a new props object
  2272. for (propName in config) {
  2273. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2274. props[propName] = config[propName];
  2275. }
  2276. }
  2277. }
  2278. // Children can be more than one argument, and those are transferred onto
  2279. // the newly allocated props object.
  2280. var childrenLength = arguments.length - 2;
  2281. if (childrenLength === 1) {
  2282. props.children = children;
  2283. } else if (childrenLength > 1) {
  2284. var childArray = Array(childrenLength);
  2285. for (var i = 0; i < childrenLength; i++) {
  2286. childArray[i] = arguments[i + 2];
  2287. }
  2288. if (false) {
  2289. if (Object.freeze) {
  2290. Object.freeze(childArray);
  2291. }
  2292. }
  2293. props.children = childArray;
  2294. }
  2295. // Resolve default props
  2296. if (type && type.defaultProps) {
  2297. var defaultProps = type.defaultProps;
  2298. for (propName in defaultProps) {
  2299. if (props[propName] === undefined) {
  2300. props[propName] = defaultProps[propName];
  2301. }
  2302. }
  2303. }
  2304. if (false) {
  2305. if (key || ref) {
  2306. if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
  2307. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  2308. if (key) {
  2309. defineKeyPropWarningGetter(props, displayName);
  2310. }
  2311. if (ref) {
  2312. defineRefPropWarningGetter(props, displayName);
  2313. }
  2314. }
  2315. }
  2316. }
  2317. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  2318. };
  2319. /**
  2320. * Return a function that produces ReactElements of a given type.
  2321. * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
  2322. */
  2323. ReactElement.createFactory = function (type) {
  2324. var factory = ReactElement.createElement.bind(null, type);
  2325. // Expose the type on the factory and the prototype so that it can be
  2326. // easily accessed on elements. E.g. `<Foo />.type === Foo`.
  2327. // This should not be named `constructor` since this may not be the function
  2328. // that created the element, and it may not even be a constructor.
  2329. // Legacy hook TODO: Warn if this is accessed
  2330. factory.type = type;
  2331. return factory;
  2332. };
  2333. ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
  2334. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  2335. return newElement;
  2336. };
  2337. /**
  2338. * Clone and return a new ReactElement using element as the starting point.
  2339. * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
  2340. */
  2341. ReactElement.cloneElement = function (element, config, children) {
  2342. var propName;
  2343. // Original props are copied
  2344. var props = _assign({}, element.props);
  2345. // Reserved names are extracted
  2346. var key = element.key;
  2347. var ref = element.ref;
  2348. // Self is preserved since the owner is preserved.
  2349. var self = element._self;
  2350. // Source is preserved since cloneElement is unlikely to be targeted by a
  2351. // transpiler, and the original source is probably a better indicator of the
  2352. // true owner.
  2353. var source = element._source;
  2354. // Owner will be preserved, unless ref is overridden
  2355. var owner = element._owner;
  2356. if (config != null) {
  2357. if (hasValidRef(config)) {
  2358. // Silently steal the ref from the parent.
  2359. ref = config.ref;
  2360. owner = ReactCurrentOwner.current;
  2361. }
  2362. if (hasValidKey(config)) {
  2363. key = '' + config.key;
  2364. }
  2365. // Remaining properties override existing props
  2366. var defaultProps;
  2367. if (element.type && element.type.defaultProps) {
  2368. defaultProps = element.type.defaultProps;
  2369. }
  2370. for (propName in config) {
  2371. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2372. if (config[propName] === undefined && defaultProps !== undefined) {
  2373. // Resolve default props
  2374. props[propName] = defaultProps[propName];
  2375. } else {
  2376. props[propName] = config[propName];
  2377. }
  2378. }
  2379. }
  2380. }
  2381. // Children can be more than one argument, and those are transferred onto
  2382. // the newly allocated props object.
  2383. var childrenLength = arguments.length - 2;
  2384. if (childrenLength === 1) {
  2385. props.children = children;
  2386. } else if (childrenLength > 1) {
  2387. var childArray = Array(childrenLength);
  2388. for (var i = 0; i < childrenLength; i++) {
  2389. childArray[i] = arguments[i + 2];
  2390. }
  2391. props.children = childArray;
  2392. }
  2393. return ReactElement(element.type, key, ref, self, source, owner, props);
  2394. };
  2395. /**
  2396. * Verifies the object is a ReactElement.
  2397. * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
  2398. * @param {?object} object
  2399. * @return {boolean} True if `object` is a valid component.
  2400. * @final
  2401. */
  2402. ReactElement.isValidElement = function (object) {
  2403. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  2404. };
  2405. module.exports = ReactElement;
  2406. /***/ }),
  2407. /* 23 */
  2408. /***/ (function(module, exports, __webpack_require__) {
  2409. "use strict";
  2410. /**
  2411. * Copyright (c) 2013-present, Facebook, Inc.
  2412. * All rights reserved.
  2413. *
  2414. * This source code is licensed under the BSD-style license found in the
  2415. * LICENSE file in the root directory of this source tree. An additional grant
  2416. * of patent rights can be found in the PATENTS file in the same directory.
  2417. *
  2418. *
  2419. */
  2420. /**
  2421. * WARNING: DO NOT manually require this module.
  2422. * This is a replacement for `invariant(...)` used by the error code system
  2423. * and will _only_ be required by the corresponding babel pass.
  2424. * It always throws.
  2425. */
  2426. function reactProdInvariant(code) {
  2427. var argCount = arguments.length - 1;
  2428. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  2429. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  2430. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  2431. }
  2432. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  2433. var error = new Error(message);
  2434. error.name = 'Invariant Violation';
  2435. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  2436. throw error;
  2437. }
  2438. module.exports = reactProdInvariant;
  2439. /***/ }),
  2440. /* 24 */
  2441. /***/ (function(module, exports, __webpack_require__) {
  2442. "use strict";
  2443. /**
  2444. * Copyright (c) 2013-present, Facebook, Inc.
  2445. * All rights reserved.
  2446. *
  2447. * This source code is licensed under the BSD-style license found in the
  2448. * LICENSE file in the root directory of this source tree. An additional grant
  2449. * of patent rights can be found in the PATENTS file in the same directory.
  2450. *
  2451. */
  2452. var emptyObject = {};
  2453. if (false) {
  2454. Object.freeze(emptyObject);
  2455. }
  2456. module.exports = emptyObject;
  2457. /***/ }),
  2458. /* 25 */
  2459. /***/ (function(module, exports, __webpack_require__) {
  2460. "use strict";
  2461. /**
  2462. * Copyright 2013-present, Facebook, Inc.
  2463. * All rights reserved.
  2464. *
  2465. * This source code is licensed under the BSD-style license found in the
  2466. * LICENSE file in the root directory of this source tree. An additional grant
  2467. * of patent rights can be found in the PATENTS file in the same directory.
  2468. *
  2469. */
  2470. var _prodInvariant = __webpack_require__(2);
  2471. var EventPluginRegistry = __webpack_require__(51);
  2472. var EventPluginUtils = __webpack_require__(52);
  2473. var ReactErrorUtils = __webpack_require__(56);
  2474. var accumulateInto = __webpack_require__(89);
  2475. var forEachAccumulated = __webpack_require__(90);
  2476. var invariant = __webpack_require__(0);
  2477. /**
  2478. * Internal store for event listeners
  2479. */
  2480. var listenerBank = {};
  2481. /**
  2482. * Internal queue of events that have accumulated their dispatches and are
  2483. * waiting to have their dispatches executed.
  2484. */
  2485. var eventQueue = null;
  2486. /**
  2487. * Dispatches an event and releases it back into the pool, unless persistent.
  2488. *
  2489. * @param {?object} event Synthetic event to be dispatched.
  2490. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2491. * @private
  2492. */
  2493. var executeDispatchesAndRelease = function (event, simulated) {
  2494. if (event) {
  2495. EventPluginUtils.executeDispatchesInOrder(event, simulated);
  2496. if (!event.isPersistent()) {
  2497. event.constructor.release(event);
  2498. }
  2499. }
  2500. };
  2501. var executeDispatchesAndReleaseSimulated = function (e) {
  2502. return executeDispatchesAndRelease(e, true);
  2503. };
  2504. var executeDispatchesAndReleaseTopLevel = function (e) {
  2505. return executeDispatchesAndRelease(e, false);
  2506. };
  2507. var getDictionaryKey = function (inst) {
  2508. // Prevents V8 performance issue:
  2509. // https://github.com/facebook/react/pull/7232
  2510. return '.' + inst._rootNodeID;
  2511. };
  2512. function isInteractive(tag) {
  2513. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  2514. }
  2515. function shouldPreventMouseEvent(name, type, props) {
  2516. switch (name) {
  2517. case 'onClick':
  2518. case 'onClickCapture':
  2519. case 'onDoubleClick':
  2520. case 'onDoubleClickCapture':
  2521. case 'onMouseDown':
  2522. case 'onMouseDownCapture':
  2523. case 'onMouseMove':
  2524. case 'onMouseMoveCapture':
  2525. case 'onMouseUp':
  2526. case 'onMouseUpCapture':
  2527. return !!(props.disabled && isInteractive(type));
  2528. default:
  2529. return false;
  2530. }
  2531. }
  2532. /**
  2533. * This is a unified interface for event plugins to be installed and configured.
  2534. *
  2535. * Event plugins can implement the following properties:
  2536. *
  2537. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2538. * Required. When a top-level event is fired, this method is expected to
  2539. * extract synthetic events that will in turn be queued and dispatched.
  2540. *
  2541. * `eventTypes` {object}
  2542. * Optional, plugins that fire events must publish a mapping of registration
  2543. * names that are used to register listeners. Values of this mapping must
  2544. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2545. *
  2546. * `executeDispatch` {function(object, function, string)}
  2547. * Optional, allows plugins to override how an event gets dispatched. By
  2548. * default, the listener is simply invoked.
  2549. *
  2550. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2551. *
  2552. * @public
  2553. */
  2554. var EventPluginHub = {
  2555. /**
  2556. * Methods for injecting dependencies.
  2557. */
  2558. injection: {
  2559. /**
  2560. * @param {array} InjectedEventPluginOrder
  2561. * @public
  2562. */
  2563. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2564. /**
  2565. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2566. */
  2567. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2568. },
  2569. /**
  2570. * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
  2571. *
  2572. * @param {object} inst The instance, which is the source of events.
  2573. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2574. * @param {function} listener The callback to store.
  2575. */
  2576. putListener: function (inst, registrationName, listener) {
  2577. !(typeof listener === 'function') ? false ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0;
  2578. var key = getDictionaryKey(inst);
  2579. var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2580. bankForRegistrationName[key] = listener;
  2581. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2582. if (PluginModule && PluginModule.didPutListener) {
  2583. PluginModule.didPutListener(inst, registrationName, listener);
  2584. }
  2585. },
  2586. /**
  2587. * @param {object} inst The instance, which is the source of events.
  2588. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2589. * @return {?function} The stored callback.
  2590. */
  2591. getListener: function (inst, registrationName) {
  2592. // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
  2593. // live here; needs to be moved to a better place soon
  2594. var bankForRegistrationName = listenerBank[registrationName];
  2595. if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) {
  2596. return null;
  2597. }
  2598. var key = getDictionaryKey(inst);
  2599. return bankForRegistrationName && bankForRegistrationName[key];
  2600. },
  2601. /**
  2602. * Deletes a listener from the registration bank.
  2603. *
  2604. * @param {object} inst The instance, which is the source of events.
  2605. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2606. */
  2607. deleteListener: function (inst, registrationName) {
  2608. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2609. if (PluginModule && PluginModule.willDeleteListener) {
  2610. PluginModule.willDeleteListener(inst, registrationName);
  2611. }
  2612. var bankForRegistrationName = listenerBank[registrationName];
  2613. // TODO: This should never be null -- when is it?
  2614. if (bankForRegistrationName) {
  2615. var key = getDictionaryKey(inst);
  2616. delete bankForRegistrationName[key];
  2617. }
  2618. },
  2619. /**
  2620. * Deletes all listeners for the DOM element with the supplied ID.
  2621. *
  2622. * @param {object} inst The instance, which is the source of events.
  2623. */
  2624. deleteAllListeners: function (inst) {
  2625. var key = getDictionaryKey(inst);
  2626. for (var registrationName in listenerBank) {
  2627. if (!listenerBank.hasOwnProperty(registrationName)) {
  2628. continue;
  2629. }
  2630. if (!listenerBank[registrationName][key]) {
  2631. continue;
  2632. }
  2633. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2634. if (PluginModule && PluginModule.willDeleteListener) {
  2635. PluginModule.willDeleteListener(inst, registrationName);
  2636. }
  2637. delete listenerBank[registrationName][key];
  2638. }
  2639. },
  2640. /**
  2641. * Allows registered plugins an opportunity to extract events from top-level
  2642. * native browser events.
  2643. *
  2644. * @return {*} An accumulation of synthetic events.
  2645. * @internal
  2646. */
  2647. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  2648. var events;
  2649. var plugins = EventPluginRegistry.plugins;
  2650. for (var i = 0; i < plugins.length; i++) {
  2651. // Not every plugin in the ordering may be loaded at runtime.
  2652. var possiblePlugin = plugins[i];
  2653. if (possiblePlugin) {
  2654. var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  2655. if (extractedEvents) {
  2656. events = accumulateInto(events, extractedEvents);
  2657. }
  2658. }
  2659. }
  2660. return events;
  2661. },
  2662. /**
  2663. * Enqueues a synthetic event that should be dispatched when
  2664. * `processEventQueue` is invoked.
  2665. *
  2666. * @param {*} events An accumulation of synthetic events.
  2667. * @internal
  2668. */
  2669. enqueueEvents: function (events) {
  2670. if (events) {
  2671. eventQueue = accumulateInto(eventQueue, events);
  2672. }
  2673. },
  2674. /**
  2675. * Dispatches all synthetic events on the event queue.
  2676. *
  2677. * @internal
  2678. */
  2679. processEventQueue: function (simulated) {
  2680. // Set `eventQueue` to null before processing it so that we can tell if more
  2681. // events get enqueued while processing.
  2682. var processingEventQueue = eventQueue;
  2683. eventQueue = null;
  2684. if (simulated) {
  2685. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
  2686. } else {
  2687. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
  2688. }
  2689. !!eventQueue ? false ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0;
  2690. // This would be a good time to rethrow if any of the event handlers threw.
  2691. ReactErrorUtils.rethrowCaughtError();
  2692. },
  2693. /**
  2694. * These are needed for tests only. Do not use!
  2695. */
  2696. __purge: function () {
  2697. listenerBank = {};
  2698. },
  2699. __getListenerBank: function () {
  2700. return listenerBank;
  2701. }
  2702. };
  2703. module.exports = EventPluginHub;
  2704. /***/ }),
  2705. /* 26 */
  2706. /***/ (function(module, exports, __webpack_require__) {
  2707. "use strict";
  2708. /**
  2709. * Copyright 2013-present, Facebook, Inc.
  2710. * All rights reserved.
  2711. *
  2712. * This source code is licensed under the BSD-style license found in the
  2713. * LICENSE file in the root directory of this source tree. An additional grant
  2714. * of patent rights can be found in the PATENTS file in the same directory.
  2715. *
  2716. */
  2717. var EventPluginHub = __webpack_require__(25);
  2718. var EventPluginUtils = __webpack_require__(52);
  2719. var accumulateInto = __webpack_require__(89);
  2720. var forEachAccumulated = __webpack_require__(90);
  2721. var warning = __webpack_require__(1);
  2722. var getListener = EventPluginHub.getListener;
  2723. /**
  2724. * Some event types have a notion of different registration names for different
  2725. * "phases" of propagation. This finds listeners by a given phase.
  2726. */
  2727. function listenerAtPhase(inst, event, propagationPhase) {
  2728. var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  2729. return getListener(inst, registrationName);
  2730. }
  2731. /**
  2732. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  2733. * here, allows us to not have to bind or create functions for each event.
  2734. * Mutating the event's members allows us to not have to create a wrapping
  2735. * "dispatch" object that pairs the event with the listener.
  2736. */
  2737. function accumulateDirectionalDispatches(inst, phase, event) {
  2738. if (false) {
  2739. process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
  2740. }
  2741. var listener = listenerAtPhase(inst, event, phase);
  2742. if (listener) {
  2743. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2744. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2745. }
  2746. }
  2747. /**
  2748. * Collect dispatches (must be entirely collected before dispatching - see unit
  2749. * tests). Lazily allocate the array to conserve memory. We must loop through
  2750. * each event and perform the traversal for each one. We cannot perform a
  2751. * single traversal for the entire collection of events because each event may
  2752. * have a different target.
  2753. */
  2754. function accumulateTwoPhaseDispatchesSingle(event) {
  2755. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2756. EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
  2757. }
  2758. }
  2759. /**
  2760. * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
  2761. */
  2762. function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
  2763. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2764. var targetInst = event._targetInst;
  2765. var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
  2766. EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
  2767. }
  2768. }
  2769. /**
  2770. * Accumulates without regard to direction, does not look for phased
  2771. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  2772. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  2773. */
  2774. function accumulateDispatches(inst, ignoredDirection, event) {
  2775. if (event && event.dispatchConfig.registrationName) {
  2776. var registrationName = event.dispatchConfig.registrationName;
  2777. var listener = getListener(inst, registrationName);
  2778. if (listener) {
  2779. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2780. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2781. }
  2782. }
  2783. }
  2784. /**
  2785. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  2786. * `dispatchMarker`.
  2787. * @param {SyntheticEvent} event
  2788. */
  2789. function accumulateDirectDispatchesSingle(event) {
  2790. if (event && event.dispatchConfig.registrationName) {
  2791. accumulateDispatches(event._targetInst, null, event);
  2792. }
  2793. }
  2794. function accumulateTwoPhaseDispatches(events) {
  2795. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  2796. }
  2797. function accumulateTwoPhaseDispatchesSkipTarget(events) {
  2798. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
  2799. }
  2800. function accumulateEnterLeaveDispatches(leave, enter, from, to) {
  2801. EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
  2802. }
  2803. function accumulateDirectDispatches(events) {
  2804. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  2805. }
  2806. /**
  2807. * A small set of propagation patterns, each of which will accept a small amount
  2808. * of information, and generate a set of "dispatch ready event objects" - which
  2809. * are sets of events that have already been annotated with a set of dispatched
  2810. * listener functions/ids. The API is designed this way to discourage these
  2811. * propagation strategies from actually executing the dispatches, since we
  2812. * always want to collect the entire set of dispatches before executing event a
  2813. * single one.
  2814. *
  2815. * @constructor EventPropagators
  2816. */
  2817. var EventPropagators = {
  2818. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  2819. accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
  2820. accumulateDirectDispatches: accumulateDirectDispatches,
  2821. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  2822. };
  2823. module.exports = EventPropagators;
  2824. /***/ }),
  2825. /* 27 */
  2826. /***/ (function(module, exports, __webpack_require__) {
  2827. "use strict";
  2828. /**
  2829. * Copyright 2013-present, Facebook, Inc.
  2830. * All rights reserved.
  2831. *
  2832. * This source code is licensed under the BSD-style license found in the
  2833. * LICENSE file in the root directory of this source tree. An additional grant
  2834. * of patent rights can be found in the PATENTS file in the same directory.
  2835. *
  2836. */
  2837. /**
  2838. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  2839. * instance (key) and the internal representation (value). This allows public
  2840. * methods to accept the user facing instance as an argument and map them back
  2841. * to internal methods.
  2842. */
  2843. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  2844. var ReactInstanceMap = {
  2845. /**
  2846. * This API should be called `delete` but we'd have to make sure to always
  2847. * transform these to strings for IE support. When this transform is fully
  2848. * supported we can rename it.
  2849. */
  2850. remove: function (key) {
  2851. key._reactInternalInstance = undefined;
  2852. },
  2853. get: function (key) {
  2854. return key._reactInternalInstance;
  2855. },
  2856. has: function (key) {
  2857. return key._reactInternalInstance !== undefined;
  2858. },
  2859. set: function (key, value) {
  2860. key._reactInternalInstance = value;
  2861. }
  2862. };
  2863. module.exports = ReactInstanceMap;
  2864. /***/ }),
  2865. /* 28 */
  2866. /***/ (function(module, exports, __webpack_require__) {
  2867. "use strict";
  2868. /**
  2869. * Copyright 2013-present, Facebook, Inc.
  2870. * All rights reserved.
  2871. *
  2872. * This source code is licensed under the BSD-style license found in the
  2873. * LICENSE file in the root directory of this source tree. An additional grant
  2874. * of patent rights can be found in the PATENTS file in the same directory.
  2875. *
  2876. */
  2877. var SyntheticEvent = __webpack_require__(13);
  2878. var getEventTarget = __webpack_require__(61);
  2879. /**
  2880. * @interface UIEvent
  2881. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  2882. */
  2883. var UIEventInterface = {
  2884. view: function (event) {
  2885. if (event.view) {
  2886. return event.view;
  2887. }
  2888. var target = getEventTarget(event);
  2889. if (target.window === target) {
  2890. // target is a window object
  2891. return target;
  2892. }
  2893. var doc = target.ownerDocument;
  2894. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2895. if (doc) {
  2896. return doc.defaultView || doc.parentWindow;
  2897. } else {
  2898. return window;
  2899. }
  2900. },
  2901. detail: function (event) {
  2902. return event.detail || 0;
  2903. }
  2904. };
  2905. /**
  2906. * @param {object} dispatchConfig Configuration used to dispatch this event.
  2907. * @param {string} dispatchMarker Marker identifying the event target.
  2908. * @param {object} nativeEvent Native browser event.
  2909. * @extends {SyntheticEvent}
  2910. */
  2911. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  2912. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  2913. }
  2914. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  2915. module.exports = SyntheticUIEvent;
  2916. /***/ }),
  2917. /* 29 */
  2918. /***/ (function(module, exports, __webpack_require__) {
  2919. "use strict";
  2920. /**
  2921. * @author oldj
  2922. * @blog https://oldj.net
  2923. */
  2924. var _Agent = __webpack_require__(4);
  2925. var _Agent2 = _interopRequireDefault(_Agent);
  2926. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2927. var req = __webpack_require__(154);
  2928. exports.reg = function (app) {
  2929. req.keys().map(function (fn) {
  2930. var m = fn.match(/^\.\/([\w\-]+)\.js$/);
  2931. var name = m ? m[1] : null;
  2932. if (!name || name === 'index') return;
  2933. _Agent2.default.on(name, function () {
  2934. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  2935. args[_key] = arguments[_key];
  2936. }
  2937. var fn = __webpack_require__(153)("./" + name);
  2938. fn.apply(undefined, [app].concat(args));
  2939. });
  2940. });
  2941. };
  2942. /***/ }),
  2943. /* 30 */
  2944. /***/ (function(module, exports, __webpack_require__) {
  2945. "use strict";
  2946. /**
  2947. * @author oldj
  2948. * @blog https://oldj.net
  2949. */
  2950. var _Agent = __webpack_require__(4);
  2951. var _Agent2 = _interopRequireDefault(_Agent);
  2952. var _list_updated = __webpack_require__(17);
  2953. var _list_updated2 = _interopRequireDefault(_list_updated);
  2954. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2955. module.exports = function (app, list) {
  2956. var hosts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  2957. _Agent2.default.pact('saveHosts', list).then(function (new_list) {
  2958. (0, _list_updated2.default)(app, new_list, hosts);
  2959. }).catch(function (e) {
  2960. console.log(e);
  2961. });
  2962. };
  2963. /***/ }),
  2964. /* 31 */
  2965. /***/ (function(module, exports, __webpack_require__) {
  2966. "use strict";
  2967. /**
  2968. * @author oldj
  2969. * @blog https://oldj.net
  2970. */
  2971. //import Agent from '../Agent'
  2972. //import cleanData from '../../app/server/cleanData'
  2973. var _save = __webpack_require__(30);
  2974. var _save2 = _interopRequireDefault(_save);
  2975. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2976. module.exports = function (app, hosts) {
  2977. var list = app.state.list.slice(0);
  2978. var idx = list.findIndex(function (item) {
  2979. return item.id === hosts.id;
  2980. });
  2981. if (idx === -1) {
  2982. list.push(Object.assign({}, hosts));
  2983. } else {
  2984. var old_hosts = list[idx];
  2985. list.splice(idx, 1, Object.assign({}, old_hosts, hosts));
  2986. }
  2987. //list = cleanData(list)
  2988. (0, _save2.default)(app, list, hosts);
  2989. };
  2990. /***/ }),
  2991. /* 32 */
  2992. /***/ (function(module, exports, __webpack_require__) {
  2993. "use strict";
  2994. /**
  2995. * Copyright 2013-present, Facebook, Inc.
  2996. * All rights reserved.
  2997. *
  2998. * This source code is licensed under the BSD-style license found in the
  2999. * LICENSE file in the root directory of this source tree. An additional grant
  3000. * of patent rights can be found in the PATENTS file in the same directory.
  3001. *
  3002. */
  3003. var _assign = __webpack_require__(3);
  3004. var EventPluginRegistry = __webpack_require__(51);
  3005. var ReactEventEmitterMixin = __webpack_require__(196);
  3006. var ViewportMetrics = __webpack_require__(88);
  3007. var getVendorPrefixedEventName = __webpack_require__(229);
  3008. var isEventSupported = __webpack_require__(62);
  3009. /**
  3010. * Summary of `ReactBrowserEventEmitter` event handling:
  3011. *
  3012. * - Top-level delegation is used to trap most native browser events. This
  3013. * may only occur in the main thread and is the responsibility of
  3014. * ReactEventListener, which is injected and can therefore support pluggable
  3015. * event sources. This is the only work that occurs in the main thread.
  3016. *
  3017. * - We normalize and de-duplicate events to account for browser quirks. This
  3018. * may be done in the worker thread.
  3019. *
  3020. * - Forward these native events (with the associated top-level type used to
  3021. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  3022. * to extract any synthetic events.
  3023. *
  3024. * - The `EventPluginHub` will then process each event by annotating them with
  3025. * "dispatches", a sequence of listeners and IDs that care about that event.
  3026. *
  3027. * - The `EventPluginHub` then dispatches the events.
  3028. *
  3029. * Overview of React and the event system:
  3030. *
  3031. * +------------+ .
  3032. * | DOM | .
  3033. * +------------+ .
  3034. * | .
  3035. * v .
  3036. * +------------+ .
  3037. * | ReactEvent | .
  3038. * | Listener | .
  3039. * +------------+ . +-----------+
  3040. * | . +--------+|SimpleEvent|
  3041. * | . | |Plugin |
  3042. * +-----|------+ . v +-----------+
  3043. * | | | . +--------------+ +------------+
  3044. * | +-----------.--->|EventPluginHub| | Event |
  3045. * | | . | | +-----------+ | Propagators|
  3046. * | ReactEvent | . | | |TapEvent | |------------|
  3047. * | Emitter | . | |<---+|Plugin | |other plugin|
  3048. * | | . | | +-----------+ | utilities |
  3049. * | +-----------.--->| | +------------+
  3050. * | | | . +--------------+
  3051. * +-----|------+ . ^ +-----------+
  3052. * | . | |Enter/Leave|
  3053. * + . +-------+|Plugin |
  3054. * +-------------+ . +-----------+
  3055. * | application | .
  3056. * |-------------| .
  3057. * | | .
  3058. * | | .
  3059. * +-------------+ .
  3060. * .
  3061. * React Core . General Purpose Event Plugin System
  3062. */
  3063. var hasEventPageXY;
  3064. var alreadyListeningTo = {};
  3065. var isMonitoringScrollValue = false;
  3066. var reactTopListenersCounter = 0;
  3067. // For events like 'submit' which don't consistently bubble (which we trap at a
  3068. // lower node than `document`), binding at `document` would cause duplicate
  3069. // events so we don't include them here
  3070. var topEventMapping = {
  3071. topAbort: 'abort',
  3072. topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
  3073. topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
  3074. topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
  3075. topBlur: 'blur',
  3076. topCanPlay: 'canplay',
  3077. topCanPlayThrough: 'canplaythrough',
  3078. topChange: 'change',
  3079. topClick: 'click',
  3080. topCompositionEnd: 'compositionend',
  3081. topCompositionStart: 'compositionstart',
  3082. topCompositionUpdate: 'compositionupdate',
  3083. topContextMenu: 'contextmenu',
  3084. topCopy: 'copy',
  3085. topCut: 'cut',
  3086. topDoubleClick: 'dblclick',
  3087. topDrag: 'drag',
  3088. topDragEnd: 'dragend',
  3089. topDragEnter: 'dragenter',
  3090. topDragExit: 'dragexit',
  3091. topDragLeave: 'dragleave',
  3092. topDragOver: 'dragover',
  3093. topDragStart: 'dragstart',
  3094. topDrop: 'drop',
  3095. topDurationChange: 'durationchange',
  3096. topEmptied: 'emptied',
  3097. topEncrypted: 'encrypted',
  3098. topEnded: 'ended',
  3099. topError: 'error',
  3100. topFocus: 'focus',
  3101. topInput: 'input',
  3102. topKeyDown: 'keydown',
  3103. topKeyPress: 'keypress',
  3104. topKeyUp: 'keyup',
  3105. topLoadedData: 'loadeddata',
  3106. topLoadedMetadata: 'loadedmetadata',
  3107. topLoadStart: 'loadstart',
  3108. topMouseDown: 'mousedown',
  3109. topMouseMove: 'mousemove',
  3110. topMouseOut: 'mouseout',
  3111. topMouseOver: 'mouseover',
  3112. topMouseUp: 'mouseup',
  3113. topPaste: 'paste',
  3114. topPause: 'pause',
  3115. topPlay: 'play',
  3116. topPlaying: 'playing',
  3117. topProgress: 'progress',
  3118. topRateChange: 'ratechange',
  3119. topScroll: 'scroll',
  3120. topSeeked: 'seeked',
  3121. topSeeking: 'seeking',
  3122. topSelectionChange: 'selectionchange',
  3123. topStalled: 'stalled',
  3124. topSuspend: 'suspend',
  3125. topTextInput: 'textInput',
  3126. topTimeUpdate: 'timeupdate',
  3127. topTouchCancel: 'touchcancel',
  3128. topTouchEnd: 'touchend',
  3129. topTouchMove: 'touchmove',
  3130. topTouchStart: 'touchstart',
  3131. topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
  3132. topVolumeChange: 'volumechange',
  3133. topWaiting: 'waiting',
  3134. topWheel: 'wheel'
  3135. };
  3136. /**
  3137. * To ensure no conflicts with other potential React instances on the page
  3138. */
  3139. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3140. function getListeningForDocument(mountAt) {
  3141. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3142. // directly.
  3143. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3144. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3145. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3146. }
  3147. return alreadyListeningTo[mountAt[topListenersIDKey]];
  3148. }
  3149. /**
  3150. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  3151. * example:
  3152. *
  3153. * EventPluginHub.putListener('myID', 'onClick', myFunction);
  3154. *
  3155. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  3156. *
  3157. * @internal
  3158. */
  3159. var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
  3160. /**
  3161. * Injectable event backend
  3162. */
  3163. ReactEventListener: null,
  3164. injection: {
  3165. /**
  3166. * @param {object} ReactEventListener
  3167. */
  3168. injectReactEventListener: function (ReactEventListener) {
  3169. ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
  3170. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  3171. }
  3172. },
  3173. /**
  3174. * Sets whether or not any created callbacks should be enabled.
  3175. *
  3176. * @param {boolean} enabled True if callbacks should be enabled.
  3177. */
  3178. setEnabled: function (enabled) {
  3179. if (ReactBrowserEventEmitter.ReactEventListener) {
  3180. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  3181. }
  3182. },
  3183. /**
  3184. * @return {boolean} True if callbacks are enabled.
  3185. */
  3186. isEnabled: function () {
  3187. return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
  3188. },
  3189. /**
  3190. * We listen for bubbled touch events on the document object.
  3191. *
  3192. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  3193. * mounting `onmousemove` events at some node that was not the document
  3194. * element. The symptoms were that if your mouse is not moving over something
  3195. * contained within that mount point (for example on the background) the
  3196. * top-level listeners for `onmousemove` won't be called. However, if you
  3197. * register the `mousemove` on the document object, then it will of course
  3198. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  3199. * top-level listeners to the document object only, at least for these
  3200. * movement types of events and possibly all events.
  3201. *
  3202. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  3203. *
  3204. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  3205. * they bubble to document.
  3206. *
  3207. * @param {string} registrationName Name of listener (e.g. `onClick`).
  3208. * @param {object} contentDocumentHandle Document which owns the container
  3209. */
  3210. listenTo: function (registrationName, contentDocumentHandle) {
  3211. var mountAt = contentDocumentHandle;
  3212. var isListening = getListeningForDocument(mountAt);
  3213. var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
  3214. for (var i = 0; i < dependencies.length; i++) {
  3215. var dependency = dependencies[i];
  3216. if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  3217. if (dependency === 'topWheel') {
  3218. if (isEventSupported('wheel')) {
  3219. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt);
  3220. } else if (isEventSupported('mousewheel')) {
  3221. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt);
  3222. } else {
  3223. // Firefox needs to capture a different mouse scroll event.
  3224. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  3225. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt);
  3226. }
  3227. } else if (dependency === 'topScroll') {
  3228. if (isEventSupported('scroll', true)) {
  3229. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt);
  3230. } else {
  3231. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
  3232. }
  3233. } else if (dependency === 'topFocus' || dependency === 'topBlur') {
  3234. if (isEventSupported('focus', true)) {
  3235. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt);
  3236. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt);
  3237. } else if (isEventSupported('focusin')) {
  3238. // IE has `focusin` and `focusout` events which bubble.
  3239. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  3240. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt);
  3241. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt);
  3242. }
  3243. // to make sure blur and focus event listeners are only attached once
  3244. isListening.topBlur = true;
  3245. isListening.topFocus = true;
  3246. } else if (topEventMapping.hasOwnProperty(dependency)) {
  3247. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
  3248. }
  3249. isListening[dependency] = true;
  3250. }
  3251. }
  3252. },
  3253. trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
  3254. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
  3255. },
  3256. trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
  3257. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
  3258. },
  3259. /**
  3260. * Protect against document.createEvent() returning null
  3261. * Some popup blocker extensions appear to do this:
  3262. * https://github.com/facebook/react/issues/6887
  3263. */
  3264. supportsEventPageXY: function () {
  3265. if (!document.createEvent) {
  3266. return false;
  3267. }
  3268. var ev = document.createEvent('MouseEvent');
  3269. return ev != null && 'pageX' in ev;
  3270. },
  3271. /**
  3272. * Listens to window scroll and resize events. We cache scroll values so that
  3273. * application code can access them without triggering reflows.
  3274. *
  3275. * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
  3276. * pageX/pageY isn't supported (legacy browsers).
  3277. *
  3278. * NOTE: Scroll events do not bubble.
  3279. *
  3280. * @see http://www.quirksmode.org/dom/events/scroll.html
  3281. */
  3282. ensureScrollValueMonitoring: function () {
  3283. if (hasEventPageXY === undefined) {
  3284. hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
  3285. }
  3286. if (!hasEventPageXY && !isMonitoringScrollValue) {
  3287. var refresh = ViewportMetrics.refreshScrollValues;
  3288. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  3289. isMonitoringScrollValue = true;
  3290. }
  3291. }
  3292. });
  3293. module.exports = ReactBrowserEventEmitter;
  3294. /***/ }),
  3295. /* 33 */
  3296. /***/ (function(module, exports, __webpack_require__) {
  3297. "use strict";
  3298. /**
  3299. * Copyright 2013-present, Facebook, Inc.
  3300. * All rights reserved.
  3301. *
  3302. * This source code is licensed under the BSD-style license found in the
  3303. * LICENSE file in the root directory of this source tree. An additional grant
  3304. * of patent rights can be found in the PATENTS file in the same directory.
  3305. *
  3306. */
  3307. var SyntheticUIEvent = __webpack_require__(28);
  3308. var ViewportMetrics = __webpack_require__(88);
  3309. var getEventModifierState = __webpack_require__(60);
  3310. /**
  3311. * @interface MouseEvent
  3312. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  3313. */
  3314. var MouseEventInterface = {
  3315. screenX: null,
  3316. screenY: null,
  3317. clientX: null,
  3318. clientY: null,
  3319. ctrlKey: null,
  3320. shiftKey: null,
  3321. altKey: null,
  3322. metaKey: null,
  3323. getModifierState: getEventModifierState,
  3324. button: function (event) {
  3325. // Webkit, Firefox, IE9+
  3326. // which: 1 2 3
  3327. // button: 0 1 2 (standard)
  3328. var button = event.button;
  3329. if ('which' in event) {
  3330. return button;
  3331. }
  3332. // IE<9
  3333. // which: undefined
  3334. // button: 0 0 0
  3335. // button: 1 4 2 (onmouseup)
  3336. return button === 2 ? 2 : button === 4 ? 1 : 0;
  3337. },
  3338. buttons: null,
  3339. relatedTarget: function (event) {
  3340. return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
  3341. },
  3342. // "Proprietary" Interface.
  3343. pageX: function (event) {
  3344. return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
  3345. },
  3346. pageY: function (event) {
  3347. return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
  3348. }
  3349. };
  3350. /**
  3351. * @param {object} dispatchConfig Configuration used to dispatch this event.
  3352. * @param {string} dispatchMarker Marker identifying the event target.
  3353. * @param {object} nativeEvent Native browser event.
  3354. * @extends {SyntheticUIEvent}
  3355. */
  3356. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  3357. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  3358. }
  3359. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  3360. module.exports = SyntheticMouseEvent;
  3361. /***/ }),
  3362. /* 34 */
  3363. /***/ (function(module, exports, __webpack_require__) {
  3364. "use strict";
  3365. /**
  3366. * Copyright 2013-present, Facebook, Inc.
  3367. * All rights reserved.
  3368. *
  3369. * This source code is licensed under the BSD-style license found in the
  3370. * LICENSE file in the root directory of this source tree. An additional grant
  3371. * of patent rights can be found in the PATENTS file in the same directory.
  3372. *
  3373. *
  3374. */
  3375. var _prodInvariant = __webpack_require__(2);
  3376. var invariant = __webpack_require__(0);
  3377. var OBSERVED_ERROR = {};
  3378. /**
  3379. * `Transaction` creates a black box that is able to wrap any method such that
  3380. * certain invariants are maintained before and after the method is invoked
  3381. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  3382. * instantiates a transaction can provide enforcers of the invariants at
  3383. * creation time. The `Transaction` class itself will supply one additional
  3384. * automatic invariant for you - the invariant that any transaction instance
  3385. * should not be run while it is already being run. You would typically create a
  3386. * single instance of a `Transaction` for reuse multiple times, that potentially
  3387. * is used to wrap several different methods. Wrappers are extremely simple -
  3388. * they only require implementing two methods.
  3389. *
  3390. * <pre>
  3391. * wrappers (injected at creation time)
  3392. * + +
  3393. * | |
  3394. * +-----------------|--------|--------------+
  3395. * | v | |
  3396. * | +---------------+ | |
  3397. * | +--| wrapper1 |---|----+ |
  3398. * | | +---------------+ v | |
  3399. * | | +-------------+ | |
  3400. * | | +----| wrapper2 |--------+ |
  3401. * | | | +-------------+ | | |
  3402. * | | | | | |
  3403. * | v v v v | wrapper
  3404. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  3405. * perform(anyMethod) | | | | | | | | | | | | maintained
  3406. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  3407. * | | | | | | | | | | | |
  3408. * | | | | | | | | | | | |
  3409. * | | | | | | | | | | | |
  3410. * | +---+ +---+ +---------+ +---+ +---+ |
  3411. * | initialize close |
  3412. * +-----------------------------------------+
  3413. * </pre>
  3414. *
  3415. * Use cases:
  3416. * - Preserving the input selection ranges before/after reconciliation.
  3417. * Restoring selection even in the event of an unexpected error.
  3418. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  3419. * while guaranteeing that afterwards, the event system is reactivated.
  3420. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  3421. * reconciliation takes place in a worker thread.
  3422. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  3423. * content.
  3424. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  3425. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  3426. * - (Future use case): Layout calculations before and after DOM updates.
  3427. *
  3428. * Transactional plugin API:
  3429. * - A module that has an `initialize` method that returns any precomputation.
  3430. * - and a `close` method that accepts the precomputation. `close` is invoked
  3431. * when the wrapped process is completed, or has failed.
  3432. *
  3433. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  3434. * that implement `initialize` and `close`.
  3435. * @return {Transaction} Single transaction for reuse in thread.
  3436. *
  3437. * @class Transaction
  3438. */
  3439. var TransactionImpl = {
  3440. /**
  3441. * Sets up this instance so that it is prepared for collecting metrics. Does
  3442. * so such that this setup method may be used on an instance that is already
  3443. * initialized, in a way that does not consume additional memory upon reuse.
  3444. * That can be useful if you decide to make your subclass of this mixin a
  3445. * "PooledClass".
  3446. */
  3447. reinitializeTransaction: function () {
  3448. this.transactionWrappers = this.getTransactionWrappers();
  3449. if (this.wrapperInitData) {
  3450. this.wrapperInitData.length = 0;
  3451. } else {
  3452. this.wrapperInitData = [];
  3453. }
  3454. this._isInTransaction = false;
  3455. },
  3456. _isInTransaction: false,
  3457. /**
  3458. * @abstract
  3459. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  3460. */
  3461. getTransactionWrappers: null,
  3462. isInTransaction: function () {
  3463. return !!this._isInTransaction;
  3464. },
  3465. /**
  3466. * Executes the function within a safety window. Use this for the top level
  3467. * methods that result in large amounts of computation/mutations that would
  3468. * need to be safety checked. The optional arguments helps prevent the need
  3469. * to bind in many cases.
  3470. *
  3471. * @param {function} method Member of scope to call.
  3472. * @param {Object} scope Scope to invoke from.
  3473. * @param {Object?=} a Argument to pass to the method.
  3474. * @param {Object?=} b Argument to pass to the method.
  3475. * @param {Object?=} c Argument to pass to the method.
  3476. * @param {Object?=} d Argument to pass to the method.
  3477. * @param {Object?=} e Argument to pass to the method.
  3478. * @param {Object?=} f Argument to pass to the method.
  3479. *
  3480. * @return {*} Return value from `method`.
  3481. */
  3482. perform: function (method, scope, a, b, c, d, e, f) {
  3483. !!this.isInTransaction() ? false ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
  3484. var errorThrown;
  3485. var ret;
  3486. try {
  3487. this._isInTransaction = true;
  3488. // Catching errors makes debugging more difficult, so we start with
  3489. // errorThrown set to true before setting it to false after calling
  3490. // close -- if it's still set to true in the finally block, it means
  3491. // one of these calls threw.
  3492. errorThrown = true;
  3493. this.initializeAll(0);
  3494. ret = method.call(scope, a, b, c, d, e, f);
  3495. errorThrown = false;
  3496. } finally {
  3497. try {
  3498. if (errorThrown) {
  3499. // If `method` throws, prefer to show that stack trace over any thrown
  3500. // by invoking `closeAll`.
  3501. try {
  3502. this.closeAll(0);
  3503. } catch (err) {}
  3504. } else {
  3505. // Since `method` didn't throw, we don't want to silence the exception
  3506. // here.
  3507. this.closeAll(0);
  3508. }
  3509. } finally {
  3510. this._isInTransaction = false;
  3511. }
  3512. }
  3513. return ret;
  3514. },
  3515. initializeAll: function (startIndex) {
  3516. var transactionWrappers = this.transactionWrappers;
  3517. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3518. var wrapper = transactionWrappers[i];
  3519. try {
  3520. // Catching errors makes debugging more difficult, so we start with the
  3521. // OBSERVED_ERROR state before overwriting it with the real return value
  3522. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  3523. // block, it means wrapper.initialize threw.
  3524. this.wrapperInitData[i] = OBSERVED_ERROR;
  3525. this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
  3526. } finally {
  3527. if (this.wrapperInitData[i] === OBSERVED_ERROR) {
  3528. // The initializer for wrapper i threw an error; initialize the
  3529. // remaining wrappers but silence any exceptions from them to ensure
  3530. // that the first error is the one to bubble up.
  3531. try {
  3532. this.initializeAll(i + 1);
  3533. } catch (err) {}
  3534. }
  3535. }
  3536. }
  3537. },
  3538. /**
  3539. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  3540. * them the respective return values of `this.transactionWrappers.init[i]`
  3541. * (`close`rs that correspond to initializers that failed will not be
  3542. * invoked).
  3543. */
  3544. closeAll: function (startIndex) {
  3545. !this.isInTransaction() ? false ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
  3546. var transactionWrappers = this.transactionWrappers;
  3547. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3548. var wrapper = transactionWrappers[i];
  3549. var initData = this.wrapperInitData[i];
  3550. var errorThrown;
  3551. try {
  3552. // Catching errors makes debugging more difficult, so we start with
  3553. // errorThrown set to true before setting it to false after calling
  3554. // close -- if it's still set to true in the finally block, it means
  3555. // wrapper.close threw.
  3556. errorThrown = true;
  3557. if (initData !== OBSERVED_ERROR && wrapper.close) {
  3558. wrapper.close.call(this, initData);
  3559. }
  3560. errorThrown = false;
  3561. } finally {
  3562. if (errorThrown) {
  3563. // The closer for wrapper i threw an error; close the remaining
  3564. // wrappers but silence any exceptions from them to ensure that the
  3565. // first error is the one to bubble up.
  3566. try {
  3567. this.closeAll(i + 1);
  3568. } catch (e) {}
  3569. }
  3570. }
  3571. }
  3572. this.wrapperInitData.length = 0;
  3573. }
  3574. };
  3575. module.exports = TransactionImpl;
  3576. /***/ }),
  3577. /* 35 */
  3578. /***/ (function(module, exports, __webpack_require__) {
  3579. "use strict";
  3580. /**
  3581. * Copyright 2016-present, Facebook, Inc.
  3582. * All rights reserved.
  3583. *
  3584. * This source code is licensed under the BSD-style license found in the
  3585. * LICENSE file in the root directory of this source tree. An additional grant
  3586. * of patent rights can be found in the PATENTS file in the same directory.
  3587. *
  3588. * Based on the escape-html library, which is used under the MIT License below:
  3589. *
  3590. * Copyright (c) 2012-2013 TJ Holowaychuk
  3591. * Copyright (c) 2015 Andreas Lubbe
  3592. * Copyright (c) 2015 Tiancheng "Timothy" Gu
  3593. *
  3594. * Permission is hereby granted, free of charge, to any person obtaining
  3595. * a copy of this software and associated documentation files (the
  3596. * 'Software'), to deal in the Software without restriction, including
  3597. * without limitation the rights to use, copy, modify, merge, publish,
  3598. * distribute, sublicense, and/or sell copies of the Software, and to
  3599. * permit persons to whom the Software is furnished to do so, subject to
  3600. * the following conditions:
  3601. *
  3602. * The above copyright notice and this permission notice shall be
  3603. * included in all copies or substantial portions of the Software.
  3604. *
  3605. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  3606. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3607. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  3608. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  3609. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  3610. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  3611. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  3612. *
  3613. */
  3614. // code copied and modified from escape-html
  3615. /**
  3616. * Module variables.
  3617. * @private
  3618. */
  3619. var matchHtmlRegExp = /["'&<>]/;
  3620. /**
  3621. * Escape special characters in the given string of html.
  3622. *
  3623. * @param {string} string The string to escape for inserting into HTML
  3624. * @return {string}
  3625. * @public
  3626. */
  3627. function escapeHtml(string) {
  3628. var str = '' + string;
  3629. var match = matchHtmlRegExp.exec(str);
  3630. if (!match) {
  3631. return str;
  3632. }
  3633. var escape;
  3634. var html = '';
  3635. var index = 0;
  3636. var lastIndex = 0;
  3637. for (index = match.index; index < str.length; index++) {
  3638. switch (str.charCodeAt(index)) {
  3639. case 34:
  3640. // "
  3641. escape = '&quot;';
  3642. break;
  3643. case 38:
  3644. // &
  3645. escape = '&amp;';
  3646. break;
  3647. case 39:
  3648. // '
  3649. escape = '&#x27;'; // modified from escape-html; used to be '&#39'
  3650. break;
  3651. case 60:
  3652. // <
  3653. escape = '&lt;';
  3654. break;
  3655. case 62:
  3656. // >
  3657. escape = '&gt;';
  3658. break;
  3659. default:
  3660. continue;
  3661. }
  3662. if (lastIndex !== index) {
  3663. html += str.substring(lastIndex, index);
  3664. }
  3665. lastIndex = index + 1;
  3666. html += escape;
  3667. }
  3668. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  3669. }
  3670. // end code copied and modified from escape-html
  3671. /**
  3672. * Escapes text to prevent scripting attacks.
  3673. *
  3674. * @param {*} text Text value to escape.
  3675. * @return {string} An escaped string.
  3676. */
  3677. function escapeTextContentForBrowser(text) {
  3678. if (typeof text === 'boolean' || typeof text === 'number') {
  3679. // this shortcircuit helps perf for types that we know will never have
  3680. // special characters, especially given that this function is used often
  3681. // for numeric dom ids.
  3682. return '' + text;
  3683. }
  3684. return escapeHtml(text);
  3685. }
  3686. module.exports = escapeTextContentForBrowser;
  3687. /***/ }),
  3688. /* 36 */
  3689. /***/ (function(module, exports, __webpack_require__) {
  3690. "use strict";
  3691. /**
  3692. * Copyright 2013-present, Facebook, Inc.
  3693. * All rights reserved.
  3694. *
  3695. * This source code is licensed under the BSD-style license found in the
  3696. * LICENSE file in the root directory of this source tree. An additional grant
  3697. * of patent rights can be found in the PATENTS file in the same directory.
  3698. *
  3699. */
  3700. var ExecutionEnvironment = __webpack_require__(9);
  3701. var DOMNamespaces = __webpack_require__(50);
  3702. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  3703. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  3704. var createMicrosoftUnsafeLocalFunction = __webpack_require__(58);
  3705. // SVG temp container for IE lacking innerHTML
  3706. var reusableSVGContainer;
  3707. /**
  3708. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  3709. * even in IE8.
  3710. *
  3711. * @param {DOMElement} node
  3712. * @param {string} html
  3713. * @internal
  3714. */
  3715. var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
  3716. // IE does not have innerHTML for SVG nodes, so instead we inject the
  3717. // new markup in a temp node and then move the child nodes across into
  3718. // the target node
  3719. if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
  3720. reusableSVGContainer = reusableSVGContainer || document.createElement('div');
  3721. reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
  3722. var svgNode = reusableSVGContainer.firstChild;
  3723. while (svgNode.firstChild) {
  3724. node.appendChild(svgNode.firstChild);
  3725. }
  3726. } else {
  3727. node.innerHTML = html;
  3728. }
  3729. });
  3730. if (ExecutionEnvironment.canUseDOM) {
  3731. // IE8: When updating a just created node with innerHTML only leading
  3732. // whitespace is removed. When updating an existing node with innerHTML
  3733. // whitespace in root TextNodes is also collapsed.
  3734. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  3735. // Feature detection; only IE8 is known to behave improperly like this.
  3736. var testElement = document.createElement('div');
  3737. testElement.innerHTML = ' ';
  3738. if (testElement.innerHTML === '') {
  3739. setInnerHTML = function (node, html) {
  3740. // Magic theory: IE8 supposedly differentiates between added and updated
  3741. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  3742. // from worse whitespace behavior. Re-adding a node like this triggers
  3743. // the initial and more favorable whitespace behavior.
  3744. // TODO: What to do on a detached node?
  3745. if (node.parentNode) {
  3746. node.parentNode.replaceChild(node, node);
  3747. }
  3748. // We also implement a workaround for non-visible tags disappearing into
  3749. // thin air on IE8, this only happens if there is no visible text
  3750. // in-front of the non-visible tags. Piggyback on the whitespace fix
  3751. // and simply check if any non-visible tags appear in the source.
  3752. if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  3753. // Recover leading whitespace by temporarily prepending any character.
  3754. // \uFEFF has the potential advantage of being zero-width/invisible.
  3755. // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
  3756. // in hopes that this is preserved even if "\uFEFF" is transformed to
  3757. // the actual Unicode character (by Babel, for example).
  3758. // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
  3759. node.innerHTML = String.fromCharCode(0xFEFF) + html;
  3760. // deleteData leaves an empty `TextNode` which offsets the index of all
  3761. // children. Definitely want to avoid this.
  3762. var textNode = node.firstChild;
  3763. if (textNode.data.length === 1) {
  3764. node.removeChild(textNode);
  3765. } else {
  3766. textNode.deleteData(0, 1);
  3767. }
  3768. } else {
  3769. node.innerHTML = html;
  3770. }
  3771. };
  3772. }
  3773. testElement = null;
  3774. }
  3775. module.exports = setInnerHTML;
  3776. /***/ }),
  3777. /* 37 */
  3778. /***/ (function(module, exports, __webpack_require__) {
  3779. "use strict";
  3780. /**
  3781. * @author oldj
  3782. * @blog https://oldj.net
  3783. */
  3784. var _Agent = __webpack_require__(4);
  3785. var _Agent2 = _interopRequireDefault(_Agent);
  3786. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3787. module.exports = function (app, hosts) {
  3788. var list = app.state.list;
  3789. _Agent2.default.pact('checkNeedRemoteRefresh', list, hosts).then(function (list) {
  3790. if (!list) return;
  3791. _Agent2.default.emit('list_updated', list);
  3792. }).catch(function (e) {
  3793. console.log(e);
  3794. });
  3795. };
  3796. /***/ }),
  3797. /* 38 */
  3798. /***/ (function(module, exports, __webpack_require__) {
  3799. "use strict";
  3800. /**
  3801. * @author oldj
  3802. * @blog https://oldj.net
  3803. */
  3804. var _Agent = __webpack_require__(4);
  3805. var _Agent2 = _interopRequireDefault(_Agent);
  3806. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3807. module.exports = function (app, hosts) {
  3808. var list = app.state.list;
  3809. var idx = list.findIndex(function (item) {
  3810. return item.id === hosts.id;
  3811. });
  3812. if (idx === -1) {
  3813. return;
  3814. }
  3815. list.splice(idx, 1);
  3816. _Agent2.default.pact('saveHosts', list).then(function () {
  3817. app.setState({ list: list }, function () {
  3818. // 选中下一个 hosts
  3819. var next_hosts = list[idx] || list[idx - 1] || null;
  3820. if (next_hosts) {
  3821. app.setState({ current: next_hosts });
  3822. }
  3823. });
  3824. }).catch(function (e) {
  3825. return console.log(e);
  3826. });
  3827. };
  3828. /***/ }),
  3829. /* 39 */
  3830. /***/ (function(module, exports, __webpack_require__) {
  3831. "use strict";
  3832. /**
  3833. * @author oldj
  3834. * @blog https://oldj.net
  3835. */
  3836. var _Agent = __webpack_require__(4);
  3837. var _Agent2 = _interopRequireDefault(_Agent);
  3838. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3839. module.exports = function () {
  3840. _Agent2.default.pact('esc');
  3841. _Agent2.default.pact('sudoCancel');
  3842. };
  3843. /***/ }),
  3844. /* 40 */
  3845. /***/ (function(module, exports, __webpack_require__) {
  3846. "use strict";
  3847. /**
  3848. * @author oldj
  3849. * @blog https://oldj.net
  3850. */
  3851. module.exports = function (app, callback) {
  3852. var list = app.state.list;
  3853. var ids = list.filter(function (item) {
  3854. return item.on;
  3855. }).map(function (item) {
  3856. return item.id;
  3857. });
  3858. callback(ids);
  3859. };
  3860. /***/ }),
  3861. /* 41 */
  3862. /***/ (function(module, exports, __webpack_require__) {
  3863. "use strict";
  3864. /**
  3865. * @author oldj
  3866. * @blog https://oldj.net
  3867. */
  3868. module.exports = function (app) {
  3869. app.loadHosts();
  3870. };
  3871. /***/ }),
  3872. /* 42 */
  3873. /***/ (function(module, exports, __webpack_require__) {
  3874. "use strict";
  3875. /**
  3876. * @author oldj
  3877. * @blog https://oldj.net
  3878. */
  3879. var _Agent = __webpack_require__(4);
  3880. var _Agent2 = _interopRequireDefault(_Agent);
  3881. var _list_updated = __webpack_require__(17);
  3882. var _list_updated2 = _interopRequireDefault(_list_updated);
  3883. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3884. module.exports = function (app, ids) {
  3885. var list = app.state.list;
  3886. var new_list = [];
  3887. ids.map(function (id) {
  3888. var item = list.find(function (i) {
  3889. return i.id === id;
  3890. });
  3891. if (item) {
  3892. new_list.push(item);
  3893. }
  3894. });
  3895. _Agent2.default.pact('saveHosts', new_list).then(function (list) {
  3896. (0, _list_updated2.default)(app, list);
  3897. }).catch(function (e) {
  3898. return console.log(e);
  3899. });
  3900. };
  3901. /***/ }),
  3902. /* 43 */
  3903. /***/ (function(module, exports, __webpack_require__) {
  3904. "use strict";
  3905. /**
  3906. * @author oldj
  3907. * @blog https://oldj.net
  3908. */
  3909. var _Agent = __webpack_require__(4);
  3910. var _Agent2 = _interopRequireDefault(_Agent);
  3911. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3912. module.exports = function () {
  3913. _Agent2.default.pact('sudoCancel');
  3914. };
  3915. /***/ }),
  3916. /* 44 */
  3917. /***/ (function(module, exports, __webpack_require__) {
  3918. "use strict";
  3919. /**
  3920. * @author oldj
  3921. * @blog https://oldj.net
  3922. */
  3923. var _Agent = __webpack_require__(4);
  3924. var _Agent2 = _interopRequireDefault(_Agent);
  3925. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3926. module.exports = function (app, pswd) {
  3927. _Agent2.default.pact('sudoPSWD', pswd);
  3928. };
  3929. /***/ }),
  3930. /* 45 */
  3931. /***/ (function(module, exports, __webpack_require__) {
  3932. "use strict";
  3933. /**
  3934. * @author oldj
  3935. * @blog https://oldj.net
  3936. */
  3937. var _Agent = __webpack_require__(4);
  3938. var _Agent2 = _interopRequireDefault(_Agent);
  3939. var _save = __webpack_require__(30);
  3940. var _save2 = _interopRequireDefault(_save);
  3941. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3942. module.exports = function (app, hosts) {
  3943. hosts.on = !hosts.on;
  3944. _Agent2.default.pact('getPref').then(function (pref) {
  3945. var list = app.state.list.slice(0);
  3946. var is_single = pref.choice_mode === 'single';
  3947. if (is_single && hosts.on) {
  3948. list.map(function (item) {
  3949. if (item.id !== hosts.id) {
  3950. item.on = false;
  3951. }
  3952. });
  3953. }
  3954. return list;
  3955. }).then(function (list) {
  3956. var idx = list.findIndex(function (item) {
  3957. return item.id === hosts.id;
  3958. });
  3959. if (idx === -1) {
  3960. list.push(Object.assign({}, hosts));
  3961. } else {
  3962. var old_hosts = list[idx];
  3963. list.splice(idx, 1, Object.assign({}, old_hosts, hosts));
  3964. }
  3965. (0, _save2.default)(app, list, hosts);
  3966. });
  3967. _Agent2.default.pact('statRecord', 'switch');
  3968. };
  3969. /***/ }),
  3970. /* 46 */
  3971. /***/ (function(module, exports, __webpack_require__) {
  3972. "use strict";
  3973. /**
  3974. * @author oldj
  3975. * @blog https://oldj.net
  3976. */
  3977. var _Agent = __webpack_require__(4);
  3978. var _Agent2 = _interopRequireDefault(_Agent);
  3979. var _list_updated = __webpack_require__(17);
  3980. var _list_updated2 = _interopRequireDefault(_list_updated);
  3981. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3982. module.exports = function (app, on, on_ids, callback) {
  3983. var list = app.state.list;
  3984. var new_list = list.map(function (item) {
  3985. var new_item = Object.assign({}, item);
  3986. new_item.on = !!(on && on_ids.includes(item.id));
  3987. return new_item;
  3988. });
  3989. _Agent2.default.pact('saveHosts', new_list).then(function () {
  3990. //app.setState({list: new_list})
  3991. (0, _list_updated2.default)(app, new_list);
  3992. //app.forceUpdate()
  3993. callback();
  3994. }).catch(function (e) {
  3995. return callback(e);
  3996. });
  3997. };
  3998. /***/ }),
  3999. /* 47 */
  4000. /***/ (function(module, exports, __webpack_require__) {
  4001. "use strict";
  4002. /**
  4003. * @author oldj
  4004. * @blog http://oldj.net
  4005. */
  4006. Object.defineProperty(exports, "__esModule", {
  4007. value: true
  4008. });
  4009. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4010. var _react = __webpack_require__(7);
  4011. var _react2 = _interopRequireDefault(_react);
  4012. var _Agent = __webpack_require__(4);
  4013. var _Agent2 = _interopRequireDefault(_Agent);
  4014. __webpack_require__(109);
  4015. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4016. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4017. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4018. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4019. var MyFrame = function (_React$Component) {
  4020. _inherits(MyFrame, _React$Component);
  4021. function MyFrame(props) {
  4022. _classCallCheck(this, MyFrame);
  4023. return _possibleConstructorReturn(this, (MyFrame.__proto__ || Object.getPrototypeOf(MyFrame)).call(this, props));
  4024. }
  4025. _createClass(MyFrame, [{
  4026. key: 'componentDidMount',
  4027. value: function componentDidMount() {
  4028. var _this2 = this;
  4029. _Agent2.default.on('esc', function () {
  4030. _this2.onCancel();
  4031. });
  4032. }
  4033. }, {
  4034. key: 'onOK',
  4035. value: function onOK() {
  4036. this.props.onOK();
  4037. }
  4038. }, {
  4039. key: 'onCancel',
  4040. value: function onCancel() {
  4041. this.props.onCancel();
  4042. }
  4043. }, {
  4044. key: 'renderFootButtons',
  4045. value: function renderFootButtons() {
  4046. var html = [];
  4047. var lang = this.props.lang;
  4048. html.push(_react2.default.createElement(
  4049. 'div',
  4050. {
  4051. className: 'button btn-cancel',
  4052. key: 'btn-cancel',
  4053. onClick: this.onCancel.bind(this)
  4054. },
  4055. this.props.cancel_title || lang.cancel
  4056. ));
  4057. html.push(_react2.default.createElement(
  4058. 'div',
  4059. {
  4060. className: 'button btn-ok btn-default',
  4061. key: 'btn-ok',
  4062. onClick: this.onOK.bind(this)
  4063. },
  4064. this.props.ok_title || lang.ok
  4065. ));
  4066. return html;
  4067. }
  4068. }, {
  4069. key: 'render',
  4070. value: function render() {
  4071. if (!this.props.show) {
  4072. return null;
  4073. }
  4074. return _react2.default.createElement(
  4075. 'div',
  4076. { className: 'frame', ref: 'frame' },
  4077. _react2.default.createElement('div', { className: 'overlay' }),
  4078. _react2.default.createElement(
  4079. 'div',
  4080. { className: 'prompt' },
  4081. _react2.default.createElement(
  4082. 'div',
  4083. { className: 'head' },
  4084. this.props.head
  4085. ),
  4086. _react2.default.createElement(
  4087. 'div',
  4088. { className: 'body' },
  4089. this.props.body
  4090. ),
  4091. _react2.default.createElement(
  4092. 'div',
  4093. { className: 'foot' },
  4094. this.renderFootButtons()
  4095. )
  4096. )
  4097. );
  4098. }
  4099. }]);
  4100. return MyFrame;
  4101. }(_react2.default.Component);
  4102. exports.default = MyFrame;
  4103. /***/ }),
  4104. /* 48 */
  4105. /***/ (function(module, exports, __webpack_require__) {
  4106. "use strict";
  4107. /**
  4108. * Copyright (c) 2013-present, Facebook, Inc.
  4109. * All rights reserved.
  4110. *
  4111. * This source code is licensed under the BSD-style license found in the
  4112. * LICENSE file in the root directory of this source tree. An additional grant
  4113. * of patent rights can be found in the PATENTS file in the same directory.
  4114. *
  4115. * @typechecks
  4116. *
  4117. */
  4118. /*eslint-disable no-self-compare */
  4119. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4120. /**
  4121. * inlined Object.is polyfill to avoid requiring consumers ship their own
  4122. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  4123. */
  4124. function is(x, y) {
  4125. // SameValue algorithm
  4126. if (x === y) {
  4127. // Steps 1-5, 7-10
  4128. // Steps 6.b-6.e: +0 != -0
  4129. // Added the nonzero y check to make Flow happy, but it is redundant
  4130. return x !== 0 || y !== 0 || 1 / x === 1 / y;
  4131. } else {
  4132. // Step 6.a: NaN == NaN
  4133. return x !== x && y !== y;
  4134. }
  4135. }
  4136. /**
  4137. * Performs equality by iterating through keys on an object and returning false
  4138. * when any key has values which are not strictly equal between the arguments.
  4139. * Returns true when the values of all keys are strictly equal.
  4140. */
  4141. function shallowEqual(objA, objB) {
  4142. if (is(objA, objB)) {
  4143. return true;
  4144. }
  4145. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  4146. return false;
  4147. }
  4148. var keysA = Object.keys(objA);
  4149. var keysB = Object.keys(objB);
  4150. if (keysA.length !== keysB.length) {
  4151. return false;
  4152. }
  4153. // Test for A's keys different from B.
  4154. for (var i = 0; i < keysA.length; i++) {
  4155. if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
  4156. return false;
  4157. }
  4158. }
  4159. return true;
  4160. }
  4161. module.exports = shallowEqual;
  4162. /***/ }),
  4163. /* 49 */
  4164. /***/ (function(module, exports, __webpack_require__) {
  4165. "use strict";
  4166. /**
  4167. * Copyright 2013-present, Facebook, Inc.
  4168. * All rights reserved.
  4169. *
  4170. * This source code is licensed under the BSD-style license found in the
  4171. * LICENSE file in the root directory of this source tree. An additional grant
  4172. * of patent rights can be found in the PATENTS file in the same directory.
  4173. *
  4174. */
  4175. var DOMLazyTree = __webpack_require__(18);
  4176. var Danger = __webpack_require__(173);
  4177. var ReactDOMComponentTree = __webpack_require__(5);
  4178. var ReactInstrumentation = __webpack_require__(11);
  4179. var createMicrosoftUnsafeLocalFunction = __webpack_require__(58);
  4180. var setInnerHTML = __webpack_require__(36);
  4181. var setTextContent = __webpack_require__(95);
  4182. function getNodeAfter(parentNode, node) {
  4183. // Special case for text components, which return [open, close] comments
  4184. // from getHostNode.
  4185. if (Array.isArray(node)) {
  4186. node = node[1];
  4187. }
  4188. return node ? node.nextSibling : parentNode.firstChild;
  4189. }
  4190. /**
  4191. * Inserts `childNode` as a child of `parentNode` at the `index`.
  4192. *
  4193. * @param {DOMElement} parentNode Parent node in which to insert.
  4194. * @param {DOMElement} childNode Child node to insert.
  4195. * @param {number} index Index at which to insert the child.
  4196. * @internal
  4197. */
  4198. var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
  4199. // We rely exclusively on `insertBefore(node, null)` instead of also using
  4200. // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
  4201. // we are careful to use `null`.)
  4202. parentNode.insertBefore(childNode, referenceNode);
  4203. });
  4204. function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
  4205. DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
  4206. }
  4207. function moveChild(parentNode, childNode, referenceNode) {
  4208. if (Array.isArray(childNode)) {
  4209. moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
  4210. } else {
  4211. insertChildAt(parentNode, childNode, referenceNode);
  4212. }
  4213. }
  4214. function removeChild(parentNode, childNode) {
  4215. if (Array.isArray(childNode)) {
  4216. var closingComment = childNode[1];
  4217. childNode = childNode[0];
  4218. removeDelimitedText(parentNode, childNode, closingComment);
  4219. parentNode.removeChild(closingComment);
  4220. }
  4221. parentNode.removeChild(childNode);
  4222. }
  4223. function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
  4224. var node = openingComment;
  4225. while (true) {
  4226. var nextNode = node.nextSibling;
  4227. insertChildAt(parentNode, node, referenceNode);
  4228. if (node === closingComment) {
  4229. break;
  4230. }
  4231. node = nextNode;
  4232. }
  4233. }
  4234. function removeDelimitedText(parentNode, startNode, closingComment) {
  4235. while (true) {
  4236. var node = startNode.nextSibling;
  4237. if (node === closingComment) {
  4238. // The closing comment is removed by ReactMultiChild.
  4239. break;
  4240. } else {
  4241. parentNode.removeChild(node);
  4242. }
  4243. }
  4244. }
  4245. function replaceDelimitedText(openingComment, closingComment, stringText) {
  4246. var parentNode = openingComment.parentNode;
  4247. var nodeAfterComment = openingComment.nextSibling;
  4248. if (nodeAfterComment === closingComment) {
  4249. // There are no text nodes between the opening and closing comments; insert
  4250. // a new one if stringText isn't empty.
  4251. if (stringText) {
  4252. insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
  4253. }
  4254. } else {
  4255. if (stringText) {
  4256. // Set the text content of the first node after the opening comment, and
  4257. // remove all following nodes up until the closing comment.
  4258. setTextContent(nodeAfterComment, stringText);
  4259. removeDelimitedText(parentNode, nodeAfterComment, closingComment);
  4260. } else {
  4261. removeDelimitedText(parentNode, openingComment, closingComment);
  4262. }
  4263. }
  4264. if (false) {
  4265. ReactInstrumentation.debugTool.onHostOperation({
  4266. instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID,
  4267. type: 'replace text',
  4268. payload: stringText
  4269. });
  4270. }
  4271. }
  4272. var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
  4273. if (false) {
  4274. dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
  4275. Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
  4276. if (prevInstance._debugID !== 0) {
  4277. ReactInstrumentation.debugTool.onHostOperation({
  4278. instanceID: prevInstance._debugID,
  4279. type: 'replace with',
  4280. payload: markup.toString()
  4281. });
  4282. } else {
  4283. var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
  4284. if (nextInstance._debugID !== 0) {
  4285. ReactInstrumentation.debugTool.onHostOperation({
  4286. instanceID: nextInstance._debugID,
  4287. type: 'mount',
  4288. payload: markup.toString()
  4289. });
  4290. }
  4291. }
  4292. };
  4293. }
  4294. /**
  4295. * Operations for updating with DOM children.
  4296. */
  4297. var DOMChildrenOperations = {
  4298. dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
  4299. replaceDelimitedText: replaceDelimitedText,
  4300. /**
  4301. * Updates a component's children by processing a series of updates. The
  4302. * update configurations are each expected to have a `parentNode` property.
  4303. *
  4304. * @param {array<object>} updates List of update configurations.
  4305. * @internal
  4306. */
  4307. processUpdates: function (parentNode, updates) {
  4308. if (false) {
  4309. var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
  4310. }
  4311. for (var k = 0; k < updates.length; k++) {
  4312. var update = updates[k];
  4313. switch (update.type) {
  4314. case 'INSERT_MARKUP':
  4315. insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
  4316. if (false) {
  4317. ReactInstrumentation.debugTool.onHostOperation({
  4318. instanceID: parentNodeDebugID,
  4319. type: 'insert child',
  4320. payload: { toIndex: update.toIndex, content: update.content.toString() }
  4321. });
  4322. }
  4323. break;
  4324. case 'MOVE_EXISTING':
  4325. moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
  4326. if (false) {
  4327. ReactInstrumentation.debugTool.onHostOperation({
  4328. instanceID: parentNodeDebugID,
  4329. type: 'move child',
  4330. payload: { fromIndex: update.fromIndex, toIndex: update.toIndex }
  4331. });
  4332. }
  4333. break;
  4334. case 'SET_MARKUP':
  4335. setInnerHTML(parentNode, update.content);
  4336. if (false) {
  4337. ReactInstrumentation.debugTool.onHostOperation({
  4338. instanceID: parentNodeDebugID,
  4339. type: 'replace children',
  4340. payload: update.content.toString()
  4341. });
  4342. }
  4343. break;
  4344. case 'TEXT_CONTENT':
  4345. setTextContent(parentNode, update.content);
  4346. if (false) {
  4347. ReactInstrumentation.debugTool.onHostOperation({
  4348. instanceID: parentNodeDebugID,
  4349. type: 'replace text',
  4350. payload: update.content.toString()
  4351. });
  4352. }
  4353. break;
  4354. case 'REMOVE_NODE':
  4355. removeChild(parentNode, update.fromNode);
  4356. if (false) {
  4357. ReactInstrumentation.debugTool.onHostOperation({
  4358. instanceID: parentNodeDebugID,
  4359. type: 'remove child',
  4360. payload: { fromIndex: update.fromIndex }
  4361. });
  4362. }
  4363. break;
  4364. }
  4365. }
  4366. }
  4367. };
  4368. module.exports = DOMChildrenOperations;
  4369. /***/ }),
  4370. /* 50 */
  4371. /***/ (function(module, exports, __webpack_require__) {
  4372. "use strict";
  4373. /**
  4374. * Copyright 2013-present, Facebook, Inc.
  4375. * All rights reserved.
  4376. *
  4377. * This source code is licensed under the BSD-style license found in the
  4378. * LICENSE file in the root directory of this source tree. An additional grant
  4379. * of patent rights can be found in the PATENTS file in the same directory.
  4380. *
  4381. */
  4382. var DOMNamespaces = {
  4383. html: 'http://www.w3.org/1999/xhtml',
  4384. mathml: 'http://www.w3.org/1998/Math/MathML',
  4385. svg: 'http://www.w3.org/2000/svg'
  4386. };
  4387. module.exports = DOMNamespaces;
  4388. /***/ }),
  4389. /* 51 */
  4390. /***/ (function(module, exports, __webpack_require__) {
  4391. "use strict";
  4392. /**
  4393. * Copyright 2013-present, Facebook, Inc.
  4394. * All rights reserved.
  4395. *
  4396. * This source code is licensed under the BSD-style license found in the
  4397. * LICENSE file in the root directory of this source tree. An additional grant
  4398. * of patent rights can be found in the PATENTS file in the same directory.
  4399. *
  4400. *
  4401. */
  4402. var _prodInvariant = __webpack_require__(2);
  4403. var invariant = __webpack_require__(0);
  4404. /**
  4405. * Injectable ordering of event plugins.
  4406. */
  4407. var eventPluginOrder = null;
  4408. /**
  4409. * Injectable mapping from names to event plugin modules.
  4410. */
  4411. var namesToPlugins = {};
  4412. /**
  4413. * Recomputes the plugin list using the injected plugins and plugin ordering.
  4414. *
  4415. * @private
  4416. */
  4417. function recomputePluginOrdering() {
  4418. if (!eventPluginOrder) {
  4419. // Wait until an `eventPluginOrder` is injected.
  4420. return;
  4421. }
  4422. for (var pluginName in namesToPlugins) {
  4423. var pluginModule = namesToPlugins[pluginName];
  4424. var pluginIndex = eventPluginOrder.indexOf(pluginName);
  4425. !(pluginIndex > -1) ? false ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0;
  4426. if (EventPluginRegistry.plugins[pluginIndex]) {
  4427. continue;
  4428. }
  4429. !pluginModule.extractEvents ? false ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
  4430. EventPluginRegistry.plugins[pluginIndex] = pluginModule;
  4431. var publishedEvents = pluginModule.eventTypes;
  4432. for (var eventName in publishedEvents) {
  4433. !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? false ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0;
  4434. }
  4435. }
  4436. }
  4437. /**
  4438. * Publishes an event so that it can be dispatched by the supplied plugin.
  4439. *
  4440. * @param {object} dispatchConfig Dispatch configuration for the event.
  4441. * @param {object} PluginModule Plugin publishing the event.
  4442. * @return {boolean} True if the event was successfully published.
  4443. * @private
  4444. */
  4445. function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
  4446. !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? false ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0;
  4447. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  4448. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  4449. if (phasedRegistrationNames) {
  4450. for (var phaseName in phasedRegistrationNames) {
  4451. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  4452. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  4453. publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
  4454. }
  4455. }
  4456. return true;
  4457. } else if (dispatchConfig.registrationName) {
  4458. publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
  4459. return true;
  4460. }
  4461. return false;
  4462. }
  4463. /**
  4464. * Publishes a registration name that is used to identify dispatched events and
  4465. * can be used with `EventPluginHub.putListener` to register listeners.
  4466. *
  4467. * @param {string} registrationName Registration name to add.
  4468. * @param {object} PluginModule Plugin publishing the event.
  4469. * @private
  4470. */
  4471. function publishRegistrationName(registrationName, pluginModule, eventName) {
  4472. !!EventPluginRegistry.registrationNameModules[registrationName] ? false ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0;
  4473. EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
  4474. EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
  4475. if (false) {
  4476. var lowerCasedName = registrationName.toLowerCase();
  4477. EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
  4478. if (registrationName === 'onDoubleClick') {
  4479. EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
  4480. }
  4481. }
  4482. }
  4483. /**
  4484. * Registers plugins so that they can extract and dispatch events.
  4485. *
  4486. * @see {EventPluginHub}
  4487. */
  4488. var EventPluginRegistry = {
  4489. /**
  4490. * Ordered list of injected plugins.
  4491. */
  4492. plugins: [],
  4493. /**
  4494. * Mapping from event name to dispatch config
  4495. */
  4496. eventNameDispatchConfigs: {},
  4497. /**
  4498. * Mapping from registration name to plugin module
  4499. */
  4500. registrationNameModules: {},
  4501. /**
  4502. * Mapping from registration name to event name
  4503. */
  4504. registrationNameDependencies: {},
  4505. /**
  4506. * Mapping from lowercase registration names to the properly cased version,
  4507. * used to warn in the case of missing event handlers. Available
  4508. * only in __DEV__.
  4509. * @type {Object}
  4510. */
  4511. possibleRegistrationNames: false ? {} : null,
  4512. // Trust the developer to only use possibleRegistrationNames in __DEV__
  4513. /**
  4514. * Injects an ordering of plugins (by plugin name). This allows the ordering
  4515. * to be decoupled from injection of the actual plugins so that ordering is
  4516. * always deterministic regardless of packaging, on-the-fly injection, etc.
  4517. *
  4518. * @param {array} InjectedEventPluginOrder
  4519. * @internal
  4520. * @see {EventPluginHub.injection.injectEventPluginOrder}
  4521. */
  4522. injectEventPluginOrder: function (injectedEventPluginOrder) {
  4523. !!eventPluginOrder ? false ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0;
  4524. // Clone the ordering so it cannot be dynamically mutated.
  4525. eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
  4526. recomputePluginOrdering();
  4527. },
  4528. /**
  4529. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  4530. * in the ordering injected by `injectEventPluginOrder`.
  4531. *
  4532. * Plugins can be injected as part of page initialization or on-the-fly.
  4533. *
  4534. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  4535. * @internal
  4536. * @see {EventPluginHub.injection.injectEventPluginsByName}
  4537. */
  4538. injectEventPluginsByName: function (injectedNamesToPlugins) {
  4539. var isOrderingDirty = false;
  4540. for (var pluginName in injectedNamesToPlugins) {
  4541. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  4542. continue;
  4543. }
  4544. var pluginModule = injectedNamesToPlugins[pluginName];
  4545. if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
  4546. !!namesToPlugins[pluginName] ? false ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
  4547. namesToPlugins[pluginName] = pluginModule;
  4548. isOrderingDirty = true;
  4549. }
  4550. }
  4551. if (isOrderingDirty) {
  4552. recomputePluginOrdering();
  4553. }
  4554. },
  4555. /**
  4556. * Looks up the plugin for the supplied event.
  4557. *
  4558. * @param {object} event A synthetic event.
  4559. * @return {?object} The plugin that created the supplied event.
  4560. * @internal
  4561. */
  4562. getPluginModuleForEvent: function (event) {
  4563. var dispatchConfig = event.dispatchConfig;
  4564. if (dispatchConfig.registrationName) {
  4565. return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
  4566. }
  4567. if (dispatchConfig.phasedRegistrationNames !== undefined) {
  4568. // pulling phasedRegistrationNames out of dispatchConfig helps Flow see
  4569. // that it is not undefined.
  4570. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  4571. for (var phase in phasedRegistrationNames) {
  4572. if (!phasedRegistrationNames.hasOwnProperty(phase)) {
  4573. continue;
  4574. }
  4575. var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]];
  4576. if (pluginModule) {
  4577. return pluginModule;
  4578. }
  4579. }
  4580. }
  4581. return null;
  4582. },
  4583. /**
  4584. * Exposed for unit testing.
  4585. * @private
  4586. */
  4587. _resetEventPlugins: function () {
  4588. eventPluginOrder = null;
  4589. for (var pluginName in namesToPlugins) {
  4590. if (namesToPlugins.hasOwnProperty(pluginName)) {
  4591. delete namesToPlugins[pluginName];
  4592. }
  4593. }
  4594. EventPluginRegistry.plugins.length = 0;
  4595. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  4596. for (var eventName in eventNameDispatchConfigs) {
  4597. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  4598. delete eventNameDispatchConfigs[eventName];
  4599. }
  4600. }
  4601. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  4602. for (var registrationName in registrationNameModules) {
  4603. if (registrationNameModules.hasOwnProperty(registrationName)) {
  4604. delete registrationNameModules[registrationName];
  4605. }
  4606. }
  4607. if (false) {
  4608. var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
  4609. for (var lowerCasedName in possibleRegistrationNames) {
  4610. if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
  4611. delete possibleRegistrationNames[lowerCasedName];
  4612. }
  4613. }
  4614. }
  4615. }
  4616. };
  4617. module.exports = EventPluginRegistry;
  4618. /***/ }),
  4619. /* 52 */
  4620. /***/ (function(module, exports, __webpack_require__) {
  4621. "use strict";
  4622. /**
  4623. * Copyright 2013-present, Facebook, Inc.
  4624. * All rights reserved.
  4625. *
  4626. * This source code is licensed under the BSD-style license found in the
  4627. * LICENSE file in the root directory of this source tree. An additional grant
  4628. * of patent rights can be found in the PATENTS file in the same directory.
  4629. *
  4630. */
  4631. var _prodInvariant = __webpack_require__(2);
  4632. var ReactErrorUtils = __webpack_require__(56);
  4633. var invariant = __webpack_require__(0);
  4634. var warning = __webpack_require__(1);
  4635. /**
  4636. * Injected dependencies:
  4637. */
  4638. /**
  4639. * - `ComponentTree`: [required] Module that can convert between React instances
  4640. * and actual node references.
  4641. */
  4642. var ComponentTree;
  4643. var TreeTraversal;
  4644. var injection = {
  4645. injectComponentTree: function (Injected) {
  4646. ComponentTree = Injected;
  4647. if (false) {
  4648. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
  4649. }
  4650. },
  4651. injectTreeTraversal: function (Injected) {
  4652. TreeTraversal = Injected;
  4653. if (false) {
  4654. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
  4655. }
  4656. }
  4657. };
  4658. function isEndish(topLevelType) {
  4659. return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
  4660. }
  4661. function isMoveish(topLevelType) {
  4662. return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
  4663. }
  4664. function isStartish(topLevelType) {
  4665. return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
  4666. }
  4667. var validateEventDispatches;
  4668. if (false) {
  4669. validateEventDispatches = function (event) {
  4670. var dispatchListeners = event._dispatchListeners;
  4671. var dispatchInstances = event._dispatchInstances;
  4672. var listenersIsArr = Array.isArray(dispatchListeners);
  4673. var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
  4674. var instancesIsArr = Array.isArray(dispatchInstances);
  4675. var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
  4676. process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
  4677. };
  4678. }
  4679. /**
  4680. * Dispatch the event to the listener.
  4681. * @param {SyntheticEvent} event SyntheticEvent to handle
  4682. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  4683. * @param {function} listener Application-level callback
  4684. * @param {*} inst Internal component instance
  4685. */
  4686. function executeDispatch(event, simulated, listener, inst) {
  4687. var type = event.type || 'unknown-event';
  4688. event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
  4689. if (simulated) {
  4690. ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
  4691. } else {
  4692. ReactErrorUtils.invokeGuardedCallback(type, listener, event);
  4693. }
  4694. event.currentTarget = null;
  4695. }
  4696. /**
  4697. * Standard/simple iteration through an event's collected dispatches.
  4698. */
  4699. function executeDispatchesInOrder(event, simulated) {
  4700. var dispatchListeners = event._dispatchListeners;
  4701. var dispatchInstances = event._dispatchInstances;
  4702. if (false) {
  4703. validateEventDispatches(event);
  4704. }
  4705. if (Array.isArray(dispatchListeners)) {
  4706. for (var i = 0; i < dispatchListeners.length; i++) {
  4707. if (event.isPropagationStopped()) {
  4708. break;
  4709. }
  4710. // Listeners and Instances are two parallel arrays that are always in sync.
  4711. executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
  4712. }
  4713. } else if (dispatchListeners) {
  4714. executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
  4715. }
  4716. event._dispatchListeners = null;
  4717. event._dispatchInstances = null;
  4718. }
  4719. /**
  4720. * Standard/simple iteration through an event's collected dispatches, but stops
  4721. * at the first dispatch execution returning true, and returns that id.
  4722. *
  4723. * @return {?string} id of the first dispatch execution who's listener returns
  4724. * true, or null if no listener returned true.
  4725. */
  4726. function executeDispatchesInOrderStopAtTrueImpl(event) {
  4727. var dispatchListeners = event._dispatchListeners;
  4728. var dispatchInstances = event._dispatchInstances;
  4729. if (false) {
  4730. validateEventDispatches(event);
  4731. }
  4732. if (Array.isArray(dispatchListeners)) {
  4733. for (var i = 0; i < dispatchListeners.length; i++) {
  4734. if (event.isPropagationStopped()) {
  4735. break;
  4736. }
  4737. // Listeners and Instances are two parallel arrays that are always in sync.
  4738. if (dispatchListeners[i](event, dispatchInstances[i])) {
  4739. return dispatchInstances[i];
  4740. }
  4741. }
  4742. } else if (dispatchListeners) {
  4743. if (dispatchListeners(event, dispatchInstances)) {
  4744. return dispatchInstances;
  4745. }
  4746. }
  4747. return null;
  4748. }
  4749. /**
  4750. * @see executeDispatchesInOrderStopAtTrueImpl
  4751. */
  4752. function executeDispatchesInOrderStopAtTrue(event) {
  4753. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  4754. event._dispatchInstances = null;
  4755. event._dispatchListeners = null;
  4756. return ret;
  4757. }
  4758. /**
  4759. * Execution of a "direct" dispatch - there must be at most one dispatch
  4760. * accumulated on the event or it is considered an error. It doesn't really make
  4761. * sense for an event with multiple dispatches (bubbled) to keep track of the
  4762. * return values at each dispatch execution, but it does tend to make sense when
  4763. * dealing with "direct" dispatches.
  4764. *
  4765. * @return {*} The return value of executing the single dispatch.
  4766. */
  4767. function executeDirectDispatch(event) {
  4768. if (false) {
  4769. validateEventDispatches(event);
  4770. }
  4771. var dispatchListener = event._dispatchListeners;
  4772. var dispatchInstance = event._dispatchInstances;
  4773. !!Array.isArray(dispatchListener) ? false ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
  4774. event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
  4775. var res = dispatchListener ? dispatchListener(event) : null;
  4776. event.currentTarget = null;
  4777. event._dispatchListeners = null;
  4778. event._dispatchInstances = null;
  4779. return res;
  4780. }
  4781. /**
  4782. * @param {SyntheticEvent} event
  4783. * @return {boolean} True iff number of dispatches accumulated is greater than 0.
  4784. */
  4785. function hasDispatches(event) {
  4786. return !!event._dispatchListeners;
  4787. }
  4788. /**
  4789. * General utilities that are useful in creating custom Event Plugins.
  4790. */
  4791. var EventPluginUtils = {
  4792. isEndish: isEndish,
  4793. isMoveish: isMoveish,
  4794. isStartish: isStartish,
  4795. executeDirectDispatch: executeDirectDispatch,
  4796. executeDispatchesInOrder: executeDispatchesInOrder,
  4797. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  4798. hasDispatches: hasDispatches,
  4799. getInstanceFromNode: function (node) {
  4800. return ComponentTree.getInstanceFromNode(node);
  4801. },
  4802. getNodeFromInstance: function (node) {
  4803. return ComponentTree.getNodeFromInstance(node);
  4804. },
  4805. isAncestor: function (a, b) {
  4806. return TreeTraversal.isAncestor(a, b);
  4807. },
  4808. getLowestCommonAncestor: function (a, b) {
  4809. return TreeTraversal.getLowestCommonAncestor(a, b);
  4810. },
  4811. getParentInstance: function (inst) {
  4812. return TreeTraversal.getParentInstance(inst);
  4813. },
  4814. traverseTwoPhase: function (target, fn, arg) {
  4815. return TreeTraversal.traverseTwoPhase(target, fn, arg);
  4816. },
  4817. traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
  4818. return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
  4819. },
  4820. injection: injection
  4821. };
  4822. module.exports = EventPluginUtils;
  4823. /***/ }),
  4824. /* 53 */
  4825. /***/ (function(module, exports, __webpack_require__) {
  4826. "use strict";
  4827. /**
  4828. * Copyright 2013-present, Facebook, Inc.
  4829. * All rights reserved.
  4830. *
  4831. * This source code is licensed under the BSD-style license found in the
  4832. * LICENSE file in the root directory of this source tree. An additional grant
  4833. * of patent rights can be found in the PATENTS file in the same directory.
  4834. *
  4835. *
  4836. */
  4837. /**
  4838. * Escape and wrap key so it is safe to use as a reactid
  4839. *
  4840. * @param {string} key to be escaped.
  4841. * @return {string} the escaped key.
  4842. */
  4843. function escape(key) {
  4844. var escapeRegex = /[=:]/g;
  4845. var escaperLookup = {
  4846. '=': '=0',
  4847. ':': '=2'
  4848. };
  4849. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  4850. return escaperLookup[match];
  4851. });
  4852. return '$' + escapedString;
  4853. }
  4854. /**
  4855. * Unescape and unwrap key for human-readable display
  4856. *
  4857. * @param {string} key to unescape.
  4858. * @return {string} the unescaped key.
  4859. */
  4860. function unescape(key) {
  4861. var unescapeRegex = /(=0|=2)/g;
  4862. var unescaperLookup = {
  4863. '=0': '=',
  4864. '=2': ':'
  4865. };
  4866. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  4867. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  4868. return unescaperLookup[match];
  4869. });
  4870. }
  4871. var KeyEscapeUtils = {
  4872. escape: escape,
  4873. unescape: unescape
  4874. };
  4875. module.exports = KeyEscapeUtils;
  4876. /***/ }),
  4877. /* 54 */
  4878. /***/ (function(module, exports, __webpack_require__) {
  4879. "use strict";
  4880. /**
  4881. * Copyright 2013-present, Facebook, Inc.
  4882. * All rights reserved.
  4883. *
  4884. * This source code is licensed under the BSD-style license found in the
  4885. * LICENSE file in the root directory of this source tree. An additional grant
  4886. * of patent rights can be found in the PATENTS file in the same directory.
  4887. *
  4888. */
  4889. var _prodInvariant = __webpack_require__(2);
  4890. var React = __webpack_require__(21);
  4891. var ReactPropTypesSecret = __webpack_require__(202);
  4892. var invariant = __webpack_require__(0);
  4893. var warning = __webpack_require__(1);
  4894. var hasReadOnlyValue = {
  4895. 'button': true,
  4896. 'checkbox': true,
  4897. 'image': true,
  4898. 'hidden': true,
  4899. 'radio': true,
  4900. 'reset': true,
  4901. 'submit': true
  4902. };
  4903. function _assertSingleLink(inputProps) {
  4904. !(inputProps.checkedLink == null || inputProps.valueLink == null) ? false ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0;
  4905. }
  4906. function _assertValueLink(inputProps) {
  4907. _assertSingleLink(inputProps);
  4908. !(inputProps.value == null && inputProps.onChange == null) ? false ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0;
  4909. }
  4910. function _assertCheckedLink(inputProps) {
  4911. _assertSingleLink(inputProps);
  4912. !(inputProps.checked == null && inputProps.onChange == null) ? false ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0;
  4913. }
  4914. var propTypes = {
  4915. value: function (props, propName, componentName) {
  4916. if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
  4917. return null;
  4918. }
  4919. return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  4920. },
  4921. checked: function (props, propName, componentName) {
  4922. if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
  4923. return null;
  4924. }
  4925. return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
  4926. },
  4927. onChange: React.PropTypes.func
  4928. };
  4929. var loggedTypeFailures = {};
  4930. function getDeclarationErrorAddendum(owner) {
  4931. if (owner) {
  4932. var name = owner.getName();
  4933. if (name) {
  4934. return ' Check the render method of `' + name + '`.';
  4935. }
  4936. }
  4937. return '';
  4938. }
  4939. /**
  4940. * Provide a linked `value` attribute for controlled forms. You should not use
  4941. * this outside of the ReactDOM controlled form components.
  4942. */
  4943. var LinkedValueUtils = {
  4944. checkPropTypes: function (tagName, props, owner) {
  4945. for (var propName in propTypes) {
  4946. if (propTypes.hasOwnProperty(propName)) {
  4947. var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
  4948. }
  4949. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  4950. // Only monitor this failure once because there tends to be a lot of the
  4951. // same error.
  4952. loggedTypeFailures[error.message] = true;
  4953. var addendum = getDeclarationErrorAddendum(owner);
  4954. false ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
  4955. }
  4956. }
  4957. },
  4958. /**
  4959. * @param {object} inputProps Props for form component
  4960. * @return {*} current value of the input either from value prop or link.
  4961. */
  4962. getValue: function (inputProps) {
  4963. if (inputProps.valueLink) {
  4964. _assertValueLink(inputProps);
  4965. return inputProps.valueLink.value;
  4966. }
  4967. return inputProps.value;
  4968. },
  4969. /**
  4970. * @param {object} inputProps Props for form component
  4971. * @return {*} current checked status of the input either from checked prop
  4972. * or link.
  4973. */
  4974. getChecked: function (inputProps) {
  4975. if (inputProps.checkedLink) {
  4976. _assertCheckedLink(inputProps);
  4977. return inputProps.checkedLink.value;
  4978. }
  4979. return inputProps.checked;
  4980. },
  4981. /**
  4982. * @param {object} inputProps Props for form component
  4983. * @param {SyntheticEvent} event change event to handle
  4984. */
  4985. executeOnChange: function (inputProps, event) {
  4986. if (inputProps.valueLink) {
  4987. _assertValueLink(inputProps);
  4988. return inputProps.valueLink.requestChange(event.target.value);
  4989. } else if (inputProps.checkedLink) {
  4990. _assertCheckedLink(inputProps);
  4991. return inputProps.checkedLink.requestChange(event.target.checked);
  4992. } else if (inputProps.onChange) {
  4993. return inputProps.onChange.call(undefined, event);
  4994. }
  4995. }
  4996. };
  4997. module.exports = LinkedValueUtils;
  4998. /***/ }),
  4999. /* 55 */
  5000. /***/ (function(module, exports, __webpack_require__) {
  5001. "use strict";
  5002. /**
  5003. * Copyright 2014-present, Facebook, Inc.
  5004. * All rights reserved.
  5005. *
  5006. * This source code is licensed under the BSD-style license found in the
  5007. * LICENSE file in the root directory of this source tree. An additional grant
  5008. * of patent rights can be found in the PATENTS file in the same directory.
  5009. *
  5010. *
  5011. */
  5012. var _prodInvariant = __webpack_require__(2);
  5013. var invariant = __webpack_require__(0);
  5014. var injected = false;
  5015. var ReactComponentEnvironment = {
  5016. /**
  5017. * Optionally injectable hook for swapping out mount images in the middle of
  5018. * the tree.
  5019. */
  5020. replaceNodeWithMarkup: null,
  5021. /**
  5022. * Optionally injectable hook for processing a queue of child updates. Will
  5023. * later move into MultiChildComponents.
  5024. */
  5025. processChildrenUpdates: null,
  5026. injection: {
  5027. injectEnvironment: function (environment) {
  5028. !!injected ? false ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
  5029. ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
  5030. ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
  5031. injected = true;
  5032. }
  5033. }
  5034. };
  5035. module.exports = ReactComponentEnvironment;
  5036. /***/ }),
  5037. /* 56 */
  5038. /***/ (function(module, exports, __webpack_require__) {
  5039. "use strict";
  5040. /**
  5041. * Copyright 2013-present, Facebook, Inc.
  5042. * All rights reserved.
  5043. *
  5044. * This source code is licensed under the BSD-style license found in the
  5045. * LICENSE file in the root directory of this source tree. An additional grant
  5046. * of patent rights can be found in the PATENTS file in the same directory.
  5047. *
  5048. *
  5049. */
  5050. var caughtError = null;
  5051. /**
  5052. * Call a function while guarding against errors that happens within it.
  5053. *
  5054. * @param {String} name of the guard to use for logging or debugging
  5055. * @param {Function} func The function to invoke
  5056. * @param {*} a First argument
  5057. * @param {*} b Second argument
  5058. */
  5059. function invokeGuardedCallback(name, func, a) {
  5060. try {
  5061. func(a);
  5062. } catch (x) {
  5063. if (caughtError === null) {
  5064. caughtError = x;
  5065. }
  5066. }
  5067. }
  5068. var ReactErrorUtils = {
  5069. invokeGuardedCallback: invokeGuardedCallback,
  5070. /**
  5071. * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
  5072. * handler are sure to be rethrown by rethrowCaughtError.
  5073. */
  5074. invokeGuardedCallbackWithCatch: invokeGuardedCallback,
  5075. /**
  5076. * During execution of guarded functions we will capture the first error which
  5077. * we will rethrow to be handled by the top level error handler.
  5078. */
  5079. rethrowCaughtError: function () {
  5080. if (caughtError) {
  5081. var error = caughtError;
  5082. caughtError = null;
  5083. throw error;
  5084. }
  5085. }
  5086. };
  5087. if (false) {
  5088. /**
  5089. * To help development we can get better devtools integration by simulating a
  5090. * real browser event.
  5091. */
  5092. if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
  5093. var fakeNode = document.createElement('react');
  5094. ReactErrorUtils.invokeGuardedCallback = function (name, func, a) {
  5095. var boundFunc = func.bind(null, a);
  5096. var evtType = 'react-' + name;
  5097. fakeNode.addEventListener(evtType, boundFunc, false);
  5098. var evt = document.createEvent('Event');
  5099. // $FlowFixMe https://github.com/facebook/flow/issues/2336
  5100. evt.initEvent(evtType, false, false);
  5101. fakeNode.dispatchEvent(evt);
  5102. fakeNode.removeEventListener(evtType, boundFunc, false);
  5103. };
  5104. }
  5105. }
  5106. module.exports = ReactErrorUtils;
  5107. /***/ }),
  5108. /* 57 */
  5109. /***/ (function(module, exports, __webpack_require__) {
  5110. "use strict";
  5111. /**
  5112. * Copyright 2015-present, Facebook, Inc.
  5113. * All rights reserved.
  5114. *
  5115. * This source code is licensed under the BSD-style license found in the
  5116. * LICENSE file in the root directory of this source tree. An additional grant
  5117. * of patent rights can be found in the PATENTS file in the same directory.
  5118. *
  5119. */
  5120. var _prodInvariant = __webpack_require__(2);
  5121. var ReactCurrentOwner = __webpack_require__(14);
  5122. var ReactInstanceMap = __webpack_require__(27);
  5123. var ReactInstrumentation = __webpack_require__(11);
  5124. var ReactUpdates = __webpack_require__(12);
  5125. var invariant = __webpack_require__(0);
  5126. var warning = __webpack_require__(1);
  5127. function enqueueUpdate(internalInstance) {
  5128. ReactUpdates.enqueueUpdate(internalInstance);
  5129. }
  5130. function formatUnexpectedArgument(arg) {
  5131. var type = typeof arg;
  5132. if (type !== 'object') {
  5133. return type;
  5134. }
  5135. var displayName = arg.constructor && arg.constructor.name || type;
  5136. var keys = Object.keys(arg);
  5137. if (keys.length > 0 && keys.length < 20) {
  5138. return displayName + ' (keys: ' + keys.join(', ') + ')';
  5139. }
  5140. return displayName;
  5141. }
  5142. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  5143. var internalInstance = ReactInstanceMap.get(publicInstance);
  5144. if (!internalInstance) {
  5145. if (false) {
  5146. var ctor = publicInstance.constructor;
  5147. // Only warn when we have a callerName. Otherwise we should be silent.
  5148. // We're probably calling from enqueueCallback. We don't want to warn
  5149. // there because we already warned for the corresponding lifecycle method.
  5150. process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0;
  5151. }
  5152. return null;
  5153. }
  5154. if (false) {
  5155. process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
  5156. }
  5157. return internalInstance;
  5158. }
  5159. /**
  5160. * ReactUpdateQueue allows for state updates to be scheduled into a later
  5161. * reconciliation step.
  5162. */
  5163. var ReactUpdateQueue = {
  5164. /**
  5165. * Checks whether or not this composite component is mounted.
  5166. * @param {ReactClass} publicInstance The instance we want to test.
  5167. * @return {boolean} True if mounted, false otherwise.
  5168. * @protected
  5169. * @final
  5170. */
  5171. isMounted: function (publicInstance) {
  5172. if (false) {
  5173. var owner = ReactCurrentOwner.current;
  5174. if (owner !== null) {
  5175. process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
  5176. owner._warnedAboutRefsInRender = true;
  5177. }
  5178. }
  5179. var internalInstance = ReactInstanceMap.get(publicInstance);
  5180. if (internalInstance) {
  5181. // During componentWillMount and render this will still be null but after
  5182. // that will always render to something. At least for now. So we can use
  5183. // this hack.
  5184. return !!internalInstance._renderedComponent;
  5185. } else {
  5186. return false;
  5187. }
  5188. },
  5189. /**
  5190. * Enqueue a callback that will be executed after all the pending updates
  5191. * have processed.
  5192. *
  5193. * @param {ReactClass} publicInstance The instance to use as `this` context.
  5194. * @param {?function} callback Called after state is updated.
  5195. * @param {string} callerName Name of the calling function in the public API.
  5196. * @internal
  5197. */
  5198. enqueueCallback: function (publicInstance, callback, callerName) {
  5199. ReactUpdateQueue.validateCallback(callback, callerName);
  5200. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  5201. // Previously we would throw an error if we didn't have an internal
  5202. // instance. Since we want to make it a no-op instead, we mirror the same
  5203. // behavior we have in other enqueue* methods.
  5204. // We also need to ignore callbacks in componentWillMount. See
  5205. // enqueueUpdates.
  5206. if (!internalInstance) {
  5207. return null;
  5208. }
  5209. if (internalInstance._pendingCallbacks) {
  5210. internalInstance._pendingCallbacks.push(callback);
  5211. } else {
  5212. internalInstance._pendingCallbacks = [callback];
  5213. }
  5214. // TODO: The callback here is ignored when setState is called from
  5215. // componentWillMount. Either fix it or disallow doing so completely in
  5216. // favor of getInitialState. Alternatively, we can disallow
  5217. // componentWillMount during server-side rendering.
  5218. enqueueUpdate(internalInstance);
  5219. },
  5220. enqueueCallbackInternal: function (internalInstance, callback) {
  5221. if (internalInstance._pendingCallbacks) {
  5222. internalInstance._pendingCallbacks.push(callback);
  5223. } else {
  5224. internalInstance._pendingCallbacks = [callback];
  5225. }
  5226. enqueueUpdate(internalInstance);
  5227. },
  5228. /**
  5229. * Forces an update. This should only be invoked when it is known with
  5230. * certainty that we are **not** in a DOM transaction.
  5231. *
  5232. * You may want to call this when you know that some deeper aspect of the
  5233. * component's state has changed but `setState` was not called.
  5234. *
  5235. * This will not invoke `shouldComponentUpdate`, but it will invoke
  5236. * `componentWillUpdate` and `componentDidUpdate`.
  5237. *
  5238. * @param {ReactClass} publicInstance The instance that should rerender.
  5239. * @internal
  5240. */
  5241. enqueueForceUpdate: function (publicInstance) {
  5242. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
  5243. if (!internalInstance) {
  5244. return;
  5245. }
  5246. internalInstance._pendingForceUpdate = true;
  5247. enqueueUpdate(internalInstance);
  5248. },
  5249. /**
  5250. * Replaces all of the state. Always use this or `setState` to mutate state.
  5251. * You should treat `this.state` as immutable.
  5252. *
  5253. * There is no guarantee that `this.state` will be immediately updated, so
  5254. * accessing `this.state` after calling this method may return the old value.
  5255. *
  5256. * @param {ReactClass} publicInstance The instance that should rerender.
  5257. * @param {object} completeState Next state.
  5258. * @internal
  5259. */
  5260. enqueueReplaceState: function (publicInstance, completeState) {
  5261. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
  5262. if (!internalInstance) {
  5263. return;
  5264. }
  5265. internalInstance._pendingStateQueue = [completeState];
  5266. internalInstance._pendingReplaceState = true;
  5267. enqueueUpdate(internalInstance);
  5268. },
  5269. /**
  5270. * Sets a subset of the state. This only exists because _pendingState is
  5271. * internal. This provides a merging strategy that is not available to deep
  5272. * properties which is confusing. TODO: Expose pendingState or don't use it
  5273. * during the merge.
  5274. *
  5275. * @param {ReactClass} publicInstance The instance that should rerender.
  5276. * @param {object} partialState Next partial state to be merged with state.
  5277. * @internal
  5278. */
  5279. enqueueSetState: function (publicInstance, partialState) {
  5280. if (false) {
  5281. ReactInstrumentation.debugTool.onSetState();
  5282. process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
  5283. }
  5284. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
  5285. if (!internalInstance) {
  5286. return;
  5287. }
  5288. var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
  5289. queue.push(partialState);
  5290. enqueueUpdate(internalInstance);
  5291. },
  5292. enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
  5293. internalInstance._pendingElement = nextElement;
  5294. // TODO: introduce _pendingContext instead of setting it directly.
  5295. internalInstance._context = nextContext;
  5296. enqueueUpdate(internalInstance);
  5297. },
  5298. validateCallback: function (callback, callerName) {
  5299. !(!callback || typeof callback === 'function') ? false ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0;
  5300. }
  5301. };
  5302. module.exports = ReactUpdateQueue;
  5303. /***/ }),
  5304. /* 58 */
  5305. /***/ (function(module, exports, __webpack_require__) {
  5306. "use strict";
  5307. /**
  5308. * Copyright 2013-present, Facebook, Inc.
  5309. * All rights reserved.
  5310. *
  5311. * This source code is licensed under the BSD-style license found in the
  5312. * LICENSE file in the root directory of this source tree. An additional grant
  5313. * of patent rights can be found in the PATENTS file in the same directory.
  5314. *
  5315. */
  5316. /* globals MSApp */
  5317. /**
  5318. * Create a function which has 'unsafe' privileges (required by windows8 apps)
  5319. */
  5320. var createMicrosoftUnsafeLocalFunction = function (func) {
  5321. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  5322. return function (arg0, arg1, arg2, arg3) {
  5323. MSApp.execUnsafeLocalFunction(function () {
  5324. return func(arg0, arg1, arg2, arg3);
  5325. });
  5326. };
  5327. } else {
  5328. return func;
  5329. }
  5330. };
  5331. module.exports = createMicrosoftUnsafeLocalFunction;
  5332. /***/ }),
  5333. /* 59 */
  5334. /***/ (function(module, exports, __webpack_require__) {
  5335. "use strict";
  5336. /**
  5337. * Copyright 2013-present, Facebook, Inc.
  5338. * All rights reserved.
  5339. *
  5340. * This source code is licensed under the BSD-style license found in the
  5341. * LICENSE file in the root directory of this source tree. An additional grant
  5342. * of patent rights can be found in the PATENTS file in the same directory.
  5343. *
  5344. */
  5345. /**
  5346. * `charCode` represents the actual "character code" and is safe to use with
  5347. * `String.fromCharCode`. As such, only keys that correspond to printable
  5348. * characters produce a valid `charCode`, the only exception to this is Enter.
  5349. * The Tab-key is considered non-printable and does not have a `charCode`,
  5350. * presumably because it does not produce a tab-character in browsers.
  5351. *
  5352. * @param {object} nativeEvent Native browser event.
  5353. * @return {number} Normalized `charCode` property.
  5354. */
  5355. function getEventCharCode(nativeEvent) {
  5356. var charCode;
  5357. var keyCode = nativeEvent.keyCode;
  5358. if ('charCode' in nativeEvent) {
  5359. charCode = nativeEvent.charCode;
  5360. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  5361. if (charCode === 0 && keyCode === 13) {
  5362. charCode = 13;
  5363. }
  5364. } else {
  5365. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  5366. charCode = keyCode;
  5367. }
  5368. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  5369. // Must not discard the (non-)printable Enter-key.
  5370. if (charCode >= 32 || charCode === 13) {
  5371. return charCode;
  5372. }
  5373. return 0;
  5374. }
  5375. module.exports = getEventCharCode;
  5376. /***/ }),
  5377. /* 60 */
  5378. /***/ (function(module, exports, __webpack_require__) {
  5379. "use strict";
  5380. /**
  5381. * Copyright 2013-present, Facebook, Inc.
  5382. * All rights reserved.
  5383. *
  5384. * This source code is licensed under the BSD-style license found in the
  5385. * LICENSE file in the root directory of this source tree. An additional grant
  5386. * of patent rights can be found in the PATENTS file in the same directory.
  5387. *
  5388. */
  5389. /**
  5390. * Translation from modifier key to the associated property in the event.
  5391. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  5392. */
  5393. var modifierKeyToProp = {
  5394. 'Alt': 'altKey',
  5395. 'Control': 'ctrlKey',
  5396. 'Meta': 'metaKey',
  5397. 'Shift': 'shiftKey'
  5398. };
  5399. // IE8 does not implement getModifierState so we simply map it to the only
  5400. // modifier keys exposed by the event itself, does not support Lock-keys.
  5401. // Currently, all major browsers except Chrome seems to support Lock-keys.
  5402. function modifierStateGetter(keyArg) {
  5403. var syntheticEvent = this;
  5404. var nativeEvent = syntheticEvent.nativeEvent;
  5405. if (nativeEvent.getModifierState) {
  5406. return nativeEvent.getModifierState(keyArg);
  5407. }
  5408. var keyProp = modifierKeyToProp[keyArg];
  5409. return keyProp ? !!nativeEvent[keyProp] : false;
  5410. }
  5411. function getEventModifierState(nativeEvent) {
  5412. return modifierStateGetter;
  5413. }
  5414. module.exports = getEventModifierState;
  5415. /***/ }),
  5416. /* 61 */
  5417. /***/ (function(module, exports, __webpack_require__) {
  5418. "use strict";
  5419. /**
  5420. * Copyright 2013-present, Facebook, Inc.
  5421. * All rights reserved.
  5422. *
  5423. * This source code is licensed under the BSD-style license found in the
  5424. * LICENSE file in the root directory of this source tree. An additional grant
  5425. * of patent rights can be found in the PATENTS file in the same directory.
  5426. *
  5427. */
  5428. /**
  5429. * Gets the target node from a native browser event by accounting for
  5430. * inconsistencies in browser DOM APIs.
  5431. *
  5432. * @param {object} nativeEvent Native browser event.
  5433. * @return {DOMEventTarget} Target node.
  5434. */
  5435. function getEventTarget(nativeEvent) {
  5436. var target = nativeEvent.target || nativeEvent.srcElement || window;
  5437. // Normalize SVG <use> element events #4963
  5438. if (target.correspondingUseElement) {
  5439. target = target.correspondingUseElement;
  5440. }
  5441. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  5442. // @see http://www.quirksmode.org/js/events_properties.html
  5443. return target.nodeType === 3 ? target.parentNode : target;
  5444. }
  5445. module.exports = getEventTarget;
  5446. /***/ }),
  5447. /* 62 */
  5448. /***/ (function(module, exports, __webpack_require__) {
  5449. "use strict";
  5450. /**
  5451. * Copyright 2013-present, Facebook, Inc.
  5452. * All rights reserved.
  5453. *
  5454. * This source code is licensed under the BSD-style license found in the
  5455. * LICENSE file in the root directory of this source tree. An additional grant
  5456. * of patent rights can be found in the PATENTS file in the same directory.
  5457. *
  5458. */
  5459. var ExecutionEnvironment = __webpack_require__(9);
  5460. var useHasFeature;
  5461. if (ExecutionEnvironment.canUseDOM) {
  5462. useHasFeature = document.implementation && document.implementation.hasFeature &&
  5463. // always returns true in newer browsers as per the standard.
  5464. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  5465. document.implementation.hasFeature('', '') !== true;
  5466. }
  5467. /**
  5468. * Checks if an event is supported in the current execution environment.
  5469. *
  5470. * NOTE: This will not work correctly for non-generic events such as `change`,
  5471. * `reset`, `load`, `error`, and `select`.
  5472. *
  5473. * Borrows from Modernizr.
  5474. *
  5475. * @param {string} eventNameSuffix Event name, e.g. "click".
  5476. * @param {?boolean} capture Check if the capture phase is supported.
  5477. * @return {boolean} True if the event is supported.
  5478. * @internal
  5479. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  5480. */
  5481. function isEventSupported(eventNameSuffix, capture) {
  5482. if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
  5483. return false;
  5484. }
  5485. var eventName = 'on' + eventNameSuffix;
  5486. var isSupported = eventName in document;
  5487. if (!isSupported) {
  5488. var element = document.createElement('div');
  5489. element.setAttribute(eventName, 'return;');
  5490. isSupported = typeof element[eventName] === 'function';
  5491. }
  5492. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  5493. // This is the only way to test support for the `wheel` event in IE9+.
  5494. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  5495. }
  5496. return isSupported;
  5497. }
  5498. module.exports = isEventSupported;
  5499. /***/ }),
  5500. /* 63 */
  5501. /***/ (function(module, exports, __webpack_require__) {
  5502. "use strict";
  5503. /**
  5504. * Copyright 2013-present, Facebook, Inc.
  5505. * All rights reserved.
  5506. *
  5507. * This source code is licensed under the BSD-style license found in the
  5508. * LICENSE file in the root directory of this source tree. An additional grant
  5509. * of patent rights can be found in the PATENTS file in the same directory.
  5510. *
  5511. */
  5512. /**
  5513. * Given a `prevElement` and `nextElement`, determines if the existing
  5514. * instance should be updated as opposed to being destroyed or replaced by a new
  5515. * instance. Both arguments are elements. This ensures that this logic can
  5516. * operate on stateless trees without any backing instance.
  5517. *
  5518. * @param {?object} prevElement
  5519. * @param {?object} nextElement
  5520. * @return {boolean} True if the existing instance should be updated.
  5521. * @protected
  5522. */
  5523. function shouldUpdateReactComponent(prevElement, nextElement) {
  5524. var prevEmpty = prevElement === null || prevElement === false;
  5525. var nextEmpty = nextElement === null || nextElement === false;
  5526. if (prevEmpty || nextEmpty) {
  5527. return prevEmpty === nextEmpty;
  5528. }
  5529. var prevType = typeof prevElement;
  5530. var nextType = typeof nextElement;
  5531. if (prevType === 'string' || prevType === 'number') {
  5532. return nextType === 'string' || nextType === 'number';
  5533. } else {
  5534. return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
  5535. }
  5536. }
  5537. module.exports = shouldUpdateReactComponent;
  5538. /***/ }),
  5539. /* 64 */
  5540. /***/ (function(module, exports, __webpack_require__) {
  5541. "use strict";
  5542. /**
  5543. * Copyright 2015-present, Facebook, Inc.
  5544. * All rights reserved.
  5545. *
  5546. * This source code is licensed under the BSD-style license found in the
  5547. * LICENSE file in the root directory of this source tree. An additional grant
  5548. * of patent rights can be found in the PATENTS file in the same directory.
  5549. *
  5550. */
  5551. var _assign = __webpack_require__(3);
  5552. var emptyFunction = __webpack_require__(10);
  5553. var warning = __webpack_require__(1);
  5554. var validateDOMNesting = emptyFunction;
  5555. if (false) {
  5556. // This validation code was written based on the HTML5 parsing spec:
  5557. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  5558. //
  5559. // Note: this does not catch all invalid nesting, nor does it try to (as it's
  5560. // not clear what practical benefit doing so provides); instead, we warn only
  5561. // for cases where the parser will give a parse tree differing from what React
  5562. // intended. For example, <b><div></div></b> is invalid but we don't warn
  5563. // because it still parses correctly; we do warn for other cases like nested
  5564. // <p> tags where the beginning of the second element implicitly closes the
  5565. // first, causing a confusing mess.
  5566. // https://html.spec.whatwg.org/multipage/syntax.html#special
  5567. var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
  5568. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  5569. var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
  5570. // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
  5571. // TODO: Distinguish by namespace here -- for <title>, including it here
  5572. // errs on the side of fewer warnings
  5573. 'foreignObject', 'desc', 'title'];
  5574. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
  5575. var buttonScopeTags = inScopeTags.concat(['button']);
  5576. // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
  5577. var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
  5578. var emptyAncestorInfo = {
  5579. current: null,
  5580. formTag: null,
  5581. aTagInScope: null,
  5582. buttonTagInScope: null,
  5583. nobrTagInScope: null,
  5584. pTagInButtonScope: null,
  5585. listItemTagAutoclosing: null,
  5586. dlItemTagAutoclosing: null
  5587. };
  5588. var updatedAncestorInfo = function (oldInfo, tag, instance) {
  5589. var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
  5590. var info = { tag: tag, instance: instance };
  5591. if (inScopeTags.indexOf(tag) !== -1) {
  5592. ancestorInfo.aTagInScope = null;
  5593. ancestorInfo.buttonTagInScope = null;
  5594. ancestorInfo.nobrTagInScope = null;
  5595. }
  5596. if (buttonScopeTags.indexOf(tag) !== -1) {
  5597. ancestorInfo.pTagInButtonScope = null;
  5598. }
  5599. // See rules for 'li', 'dd', 'dt' start tags in
  5600. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  5601. if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
  5602. ancestorInfo.listItemTagAutoclosing = null;
  5603. ancestorInfo.dlItemTagAutoclosing = null;
  5604. }
  5605. ancestorInfo.current = info;
  5606. if (tag === 'form') {
  5607. ancestorInfo.formTag = info;
  5608. }
  5609. if (tag === 'a') {
  5610. ancestorInfo.aTagInScope = info;
  5611. }
  5612. if (tag === 'button') {
  5613. ancestorInfo.buttonTagInScope = info;
  5614. }
  5615. if (tag === 'nobr') {
  5616. ancestorInfo.nobrTagInScope = info;
  5617. }
  5618. if (tag === 'p') {
  5619. ancestorInfo.pTagInButtonScope = info;
  5620. }
  5621. if (tag === 'li') {
  5622. ancestorInfo.listItemTagAutoclosing = info;
  5623. }
  5624. if (tag === 'dd' || tag === 'dt') {
  5625. ancestorInfo.dlItemTagAutoclosing = info;
  5626. }
  5627. return ancestorInfo;
  5628. };
  5629. /**
  5630. * Returns whether
  5631. */
  5632. var isTagValidWithParent = function (tag, parentTag) {
  5633. // First, let's check if we're in an unusual parsing mode...
  5634. switch (parentTag) {
  5635. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
  5636. case 'select':
  5637. return tag === 'option' || tag === 'optgroup' || tag === '#text';
  5638. case 'optgroup':
  5639. return tag === 'option' || tag === '#text';
  5640. // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
  5641. // but
  5642. case 'option':
  5643. return tag === '#text';
  5644. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
  5645. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
  5646. // No special behavior since these rules fall back to "in body" mode for
  5647. // all except special table nodes which cause bad parsing behavior anyway.
  5648. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
  5649. case 'tr':
  5650. return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
  5651. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
  5652. case 'tbody':
  5653. case 'thead':
  5654. case 'tfoot':
  5655. return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
  5656. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
  5657. case 'colgroup':
  5658. return tag === 'col' || tag === 'template';
  5659. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
  5660. case 'table':
  5661. return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
  5662. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  5663. case 'head':
  5664. return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  5665. // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  5666. case 'html':
  5667. return tag === 'head' || tag === 'body';
  5668. case '#document':
  5669. return tag === 'html';
  5670. }
  5671. // Probably in the "in body" parsing mode, so we outlaw only tag combos
  5672. // where the parsing rules cause implicit opens or closes to be added.
  5673. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  5674. switch (tag) {
  5675. case 'h1':
  5676. case 'h2':
  5677. case 'h3':
  5678. case 'h4':
  5679. case 'h5':
  5680. case 'h6':
  5681. return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
  5682. case 'rp':
  5683. case 'rt':
  5684. return impliedEndTags.indexOf(parentTag) === -1;
  5685. case 'body':
  5686. case 'caption':
  5687. case 'col':
  5688. case 'colgroup':
  5689. case 'frame':
  5690. case 'head':
  5691. case 'html':
  5692. case 'tbody':
  5693. case 'td':
  5694. case 'tfoot':
  5695. case 'th':
  5696. case 'thead':
  5697. case 'tr':
  5698. // These tags are only valid with a few parents that have special child
  5699. // parsing rules -- if we're down here, then none of those matched and
  5700. // so we allow it only if we don't know what the parent is, as all other
  5701. // cases are invalid.
  5702. return parentTag == null;
  5703. }
  5704. return true;
  5705. };
  5706. /**
  5707. * Returns whether
  5708. */
  5709. var findInvalidAncestorForTag = function (tag, ancestorInfo) {
  5710. switch (tag) {
  5711. case 'address':
  5712. case 'article':
  5713. case 'aside':
  5714. case 'blockquote':
  5715. case 'center':
  5716. case 'details':
  5717. case 'dialog':
  5718. case 'dir':
  5719. case 'div':
  5720. case 'dl':
  5721. case 'fieldset':
  5722. case 'figcaption':
  5723. case 'figure':
  5724. case 'footer':
  5725. case 'header':
  5726. case 'hgroup':
  5727. case 'main':
  5728. case 'menu':
  5729. case 'nav':
  5730. case 'ol':
  5731. case 'p':
  5732. case 'section':
  5733. case 'summary':
  5734. case 'ul':
  5735. case 'pre':
  5736. case 'listing':
  5737. case 'table':
  5738. case 'hr':
  5739. case 'xmp':
  5740. case 'h1':
  5741. case 'h2':
  5742. case 'h3':
  5743. case 'h4':
  5744. case 'h5':
  5745. case 'h6':
  5746. return ancestorInfo.pTagInButtonScope;
  5747. case 'form':
  5748. return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
  5749. case 'li':
  5750. return ancestorInfo.listItemTagAutoclosing;
  5751. case 'dd':
  5752. case 'dt':
  5753. return ancestorInfo.dlItemTagAutoclosing;
  5754. case 'button':
  5755. return ancestorInfo.buttonTagInScope;
  5756. case 'a':
  5757. // Spec says something about storing a list of markers, but it sounds
  5758. // equivalent to this check.
  5759. return ancestorInfo.aTagInScope;
  5760. case 'nobr':
  5761. return ancestorInfo.nobrTagInScope;
  5762. }
  5763. return null;
  5764. };
  5765. /**
  5766. * Given a ReactCompositeComponent instance, return a list of its recursive
  5767. * owners, starting at the root and ending with the instance itself.
  5768. */
  5769. var findOwnerStack = function (instance) {
  5770. if (!instance) {
  5771. return [];
  5772. }
  5773. var stack = [];
  5774. do {
  5775. stack.push(instance);
  5776. } while (instance = instance._currentElement._owner);
  5777. stack.reverse();
  5778. return stack;
  5779. };
  5780. var didWarn = {};
  5781. validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) {
  5782. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  5783. var parentInfo = ancestorInfo.current;
  5784. var parentTag = parentInfo && parentInfo.tag;
  5785. if (childText != null) {
  5786. process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
  5787. childTag = '#text';
  5788. }
  5789. var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
  5790. var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
  5791. var problematic = invalidParent || invalidAncestor;
  5792. if (problematic) {
  5793. var ancestorTag = problematic.tag;
  5794. var ancestorInstance = problematic.instance;
  5795. var childOwner = childInstance && childInstance._currentElement._owner;
  5796. var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
  5797. var childOwners = findOwnerStack(childOwner);
  5798. var ancestorOwners = findOwnerStack(ancestorOwner);
  5799. var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
  5800. var i;
  5801. var deepestCommon = -1;
  5802. for (i = 0; i < minStackLen; i++) {
  5803. if (childOwners[i] === ancestorOwners[i]) {
  5804. deepestCommon = i;
  5805. } else {
  5806. break;
  5807. }
  5808. }
  5809. var UNKNOWN = '(unknown)';
  5810. var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
  5811. return inst.getName() || UNKNOWN;
  5812. });
  5813. var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
  5814. return inst.getName() || UNKNOWN;
  5815. });
  5816. var ownerInfo = [].concat(
  5817. // If the parent and child instances have a common owner ancestor, start
  5818. // with that -- otherwise we just start with the parent's owners.
  5819. deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
  5820. // If we're warning about an invalid (non-parent) ancestry, add '...'
  5821. invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
  5822. var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
  5823. if (didWarn[warnKey]) {
  5824. return;
  5825. }
  5826. didWarn[warnKey] = true;
  5827. var tagDisplayName = childTag;
  5828. var whitespaceInfo = '';
  5829. if (childTag === '#text') {
  5830. if (/\S/.test(childText)) {
  5831. tagDisplayName = 'Text nodes';
  5832. } else {
  5833. tagDisplayName = 'Whitespace text nodes';
  5834. whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.';
  5835. }
  5836. } else {
  5837. tagDisplayName = '<' + childTag + '>';
  5838. }
  5839. if (invalidParent) {
  5840. var info = '';
  5841. if (ancestorTag === 'table' && childTag === 'tr') {
  5842. info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
  5843. }
  5844. process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0;
  5845. } else {
  5846. process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
  5847. }
  5848. }
  5849. };
  5850. validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
  5851. // For testing
  5852. validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
  5853. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  5854. var parentInfo = ancestorInfo.current;
  5855. var parentTag = parentInfo && parentInfo.tag;
  5856. return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
  5857. };
  5858. }
  5859. module.exports = validateDOMNesting;
  5860. /***/ }),
  5861. /* 65 */
  5862. /***/ (function(module, exports, __webpack_require__) {
  5863. "use strict";
  5864. /**
  5865. * Copyright 2013-present, Facebook, Inc.
  5866. * All rights reserved.
  5867. *
  5868. * This source code is licensed under the BSD-style license found in the
  5869. * LICENSE file in the root directory of this source tree. An additional grant
  5870. * of patent rights can be found in the PATENTS file in the same directory.
  5871. *
  5872. */
  5873. var _prodInvariant = __webpack_require__(23);
  5874. var ReactNoopUpdateQueue = __webpack_require__(66);
  5875. var canDefineProperty = __webpack_require__(100);
  5876. var emptyObject = __webpack_require__(24);
  5877. var invariant = __webpack_require__(0);
  5878. var warning = __webpack_require__(1);
  5879. /**
  5880. * Base class helpers for the updating state of a component.
  5881. */
  5882. function ReactComponent(props, context, updater) {
  5883. this.props = props;
  5884. this.context = context;
  5885. this.refs = emptyObject;
  5886. // We initialize the default updater but the real one gets injected by the
  5887. // renderer.
  5888. this.updater = updater || ReactNoopUpdateQueue;
  5889. }
  5890. ReactComponent.prototype.isReactComponent = {};
  5891. /**
  5892. * Sets a subset of the state. Always use this to mutate
  5893. * state. You should treat `this.state` as immutable.
  5894. *
  5895. * There is no guarantee that `this.state` will be immediately updated, so
  5896. * accessing `this.state` after calling this method may return the old value.
  5897. *
  5898. * There is no guarantee that calls to `setState` will run synchronously,
  5899. * as they may eventually be batched together. You can provide an optional
  5900. * callback that will be executed when the call to setState is actually
  5901. * completed.
  5902. *
  5903. * When a function is provided to setState, it will be called at some point in
  5904. * the future (not synchronously). It will be called with the up to date
  5905. * component arguments (state, props, context). These values can be different
  5906. * from this.* because your function may be called after receiveProps but before
  5907. * shouldComponentUpdate, and this new state, props, and context will not yet be
  5908. * assigned to this.
  5909. *
  5910. * @param {object|function} partialState Next partial state or function to
  5911. * produce next partial state to be merged with current state.
  5912. * @param {?function} callback Called after state is updated.
  5913. * @final
  5914. * @protected
  5915. */
  5916. ReactComponent.prototype.setState = function (partialState, callback) {
  5917. !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? false ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
  5918. this.updater.enqueueSetState(this, partialState);
  5919. if (callback) {
  5920. this.updater.enqueueCallback(this, callback, 'setState');
  5921. }
  5922. };
  5923. /**
  5924. * Forces an update. This should only be invoked when it is known with
  5925. * certainty that we are **not** in a DOM transaction.
  5926. *
  5927. * You may want to call this when you know that some deeper aspect of the
  5928. * component's state has changed but `setState` was not called.
  5929. *
  5930. * This will not invoke `shouldComponentUpdate`, but it will invoke
  5931. * `componentWillUpdate` and `componentDidUpdate`.
  5932. *
  5933. * @param {?function} callback Called after update is complete.
  5934. * @final
  5935. * @protected
  5936. */
  5937. ReactComponent.prototype.forceUpdate = function (callback) {
  5938. this.updater.enqueueForceUpdate(this);
  5939. if (callback) {
  5940. this.updater.enqueueCallback(this, callback, 'forceUpdate');
  5941. }
  5942. };
  5943. /**
  5944. * Deprecated APIs. These APIs used to exist on classic React classes but since
  5945. * we would like to deprecate them, we're not going to move them over to this
  5946. * modern base class. Instead, we define a getter that warns if it's accessed.
  5947. */
  5948. if (false) {
  5949. var deprecatedAPIs = {
  5950. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  5951. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  5952. };
  5953. var defineDeprecationWarning = function (methodName, info) {
  5954. if (canDefineProperty) {
  5955. Object.defineProperty(ReactComponent.prototype, methodName, {
  5956. get: function () {
  5957. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
  5958. return undefined;
  5959. }
  5960. });
  5961. }
  5962. };
  5963. for (var fnName in deprecatedAPIs) {
  5964. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  5965. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  5966. }
  5967. }
  5968. }
  5969. module.exports = ReactComponent;
  5970. /***/ }),
  5971. /* 66 */
  5972. /***/ (function(module, exports, __webpack_require__) {
  5973. "use strict";
  5974. /**
  5975. * Copyright 2015-present, Facebook, Inc.
  5976. * All rights reserved.
  5977. *
  5978. * This source code is licensed under the BSD-style license found in the
  5979. * LICENSE file in the root directory of this source tree. An additional grant
  5980. * of patent rights can be found in the PATENTS file in the same directory.
  5981. *
  5982. */
  5983. var warning = __webpack_require__(1);
  5984. function warnNoop(publicInstance, callerName) {
  5985. if (false) {
  5986. var constructor = publicInstance.constructor;
  5987. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
  5988. }
  5989. }
  5990. /**
  5991. * This is the abstract API for an update queue.
  5992. */
  5993. var ReactNoopUpdateQueue = {
  5994. /**
  5995. * Checks whether or not this composite component is mounted.
  5996. * @param {ReactClass} publicInstance The instance we want to test.
  5997. * @return {boolean} True if mounted, false otherwise.
  5998. * @protected
  5999. * @final
  6000. */
  6001. isMounted: function (publicInstance) {
  6002. return false;
  6003. },
  6004. /**
  6005. * Enqueue a callback that will be executed after all the pending updates
  6006. * have processed.
  6007. *
  6008. * @param {ReactClass} publicInstance The instance to use as `this` context.
  6009. * @param {?function} callback Called after state is updated.
  6010. * @internal
  6011. */
  6012. enqueueCallback: function (publicInstance, callback) {},
  6013. /**
  6014. * Forces an update. This should only be invoked when it is known with
  6015. * certainty that we are **not** in a DOM transaction.
  6016. *
  6017. * You may want to call this when you know that some deeper aspect of the
  6018. * component's state has changed but `setState` was not called.
  6019. *
  6020. * This will not invoke `shouldComponentUpdate`, but it will invoke
  6021. * `componentWillUpdate` and `componentDidUpdate`.
  6022. *
  6023. * @param {ReactClass} publicInstance The instance that should rerender.
  6024. * @internal
  6025. */
  6026. enqueueForceUpdate: function (publicInstance) {
  6027. warnNoop(publicInstance, 'forceUpdate');
  6028. },
  6029. /**
  6030. * Replaces all of the state. Always use this or `setState` to mutate state.
  6031. * You should treat `this.state` as immutable.
  6032. *
  6033. * There is no guarantee that `this.state` will be immediately updated, so
  6034. * accessing `this.state` after calling this method may return the old value.
  6035. *
  6036. * @param {ReactClass} publicInstance The instance that should rerender.
  6037. * @param {object} completeState Next state.
  6038. * @internal
  6039. */
  6040. enqueueReplaceState: function (publicInstance, completeState) {
  6041. warnNoop(publicInstance, 'replaceState');
  6042. },
  6043. /**
  6044. * Sets a subset of the state. This only exists because _pendingState is
  6045. * internal. This provides a merging strategy that is not available to deep
  6046. * properties which is confusing. TODO: Expose pendingState or don't use it
  6047. * during the merge.
  6048. *
  6049. * @param {ReactClass} publicInstance The instance that should rerender.
  6050. * @param {object} partialState Next partial state to be merged with state.
  6051. * @internal
  6052. */
  6053. enqueueSetState: function (publicInstance, partialState) {
  6054. warnNoop(publicInstance, 'setState');
  6055. }
  6056. };
  6057. module.exports = ReactNoopUpdateQueue;
  6058. /***/ }),
  6059. /* 67 */
  6060. /***/ (function(module, exports, __webpack_require__) {
  6061. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  6062. // Distributed under an MIT license: http://codemirror.net/LICENSE
  6063. // This is CodeMirror (http://codemirror.net), a code editor
  6064. // implemented in JavaScript on top of the browser's DOM.
  6065. //
  6066. // You can find some technical background for some of the code below
  6067. // at http://marijnhaverbeke.nl/blog/#cm-internals .
  6068. (function (global, factory) {
  6069. true ? module.exports = factory() :
  6070. typeof define === 'function' && define.amd ? define(factory) :
  6071. (global.CodeMirror = factory());
  6072. }(this, (function () { 'use strict';
  6073. // Kludges for bugs and behavior differences that can't be feature
  6074. // detected are enabled based on userAgent etc sniffing.
  6075. var userAgent = navigator.userAgent;
  6076. var platform = navigator.platform;
  6077. var gecko = /gecko\/\d/i.test(userAgent);
  6078. var ie_upto10 = /MSIE \d/.test(userAgent);
  6079. var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
  6080. var edge = /Edge\/(\d+)/.exec(userAgent);
  6081. var ie = ie_upto10 || ie_11up || edge;
  6082. var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
  6083. var webkit = !edge && /WebKit\//.test(userAgent);
  6084. var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
  6085. var chrome = !edge && /Chrome\//.test(userAgent);
  6086. var presto = /Opera\//.test(userAgent);
  6087. var safari = /Apple Computer/.test(navigator.vendor);
  6088. var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
  6089. var phantom = /PhantomJS/.test(userAgent);
  6090. var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
  6091. var android = /Android/.test(userAgent);
  6092. // This is woefully incomplete. Suggestions for alternative methods welcome.
  6093. var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
  6094. var mac = ios || /Mac/.test(platform);
  6095. var chromeOS = /\bCrOS\b/.test(userAgent);
  6096. var windows = /win/i.test(platform);
  6097. var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
  6098. if (presto_version) { presto_version = Number(presto_version[1]); }
  6099. if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
  6100. // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
  6101. var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
  6102. var captureRightClick = gecko || (ie && ie_version >= 9);
  6103. function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
  6104. var rmClass = function(node, cls) {
  6105. var current = node.className;
  6106. var match = classTest(cls).exec(current);
  6107. if (match) {
  6108. var after = current.slice(match.index + match[0].length);
  6109. node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
  6110. }
  6111. };
  6112. function removeChildren(e) {
  6113. for (var count = e.childNodes.length; count > 0; --count)
  6114. { e.removeChild(e.firstChild); }
  6115. return e
  6116. }
  6117. function removeChildrenAndAdd(parent, e) {
  6118. return removeChildren(parent).appendChild(e)
  6119. }
  6120. function elt(tag, content, className, style) {
  6121. var e = document.createElement(tag);
  6122. if (className) { e.className = className; }
  6123. if (style) { e.style.cssText = style; }
  6124. if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
  6125. else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
  6126. return e
  6127. }
  6128. // wrapper for elt, which removes the elt from the accessibility tree
  6129. function eltP(tag, content, className, style) {
  6130. var e = elt(tag, content, className, style);
  6131. e.setAttribute("role", "presentation");
  6132. return e
  6133. }
  6134. var range;
  6135. if (document.createRange) { range = function(node, start, end, endNode) {
  6136. var r = document.createRange();
  6137. r.setEnd(endNode || node, end);
  6138. r.setStart(node, start);
  6139. return r
  6140. }; }
  6141. else { range = function(node, start, end) {
  6142. var r = document.body.createTextRange();
  6143. try { r.moveToElementText(node.parentNode); }
  6144. catch(e) { return r }
  6145. r.collapse(true);
  6146. r.moveEnd("character", end);
  6147. r.moveStart("character", start);
  6148. return r
  6149. }; }
  6150. function contains(parent, child) {
  6151. if (child.nodeType == 3) // Android browser always returns false when child is a textnode
  6152. { child = child.parentNode; }
  6153. if (parent.contains)
  6154. { return parent.contains(child) }
  6155. do {
  6156. if (child.nodeType == 11) { child = child.host; }
  6157. if (child == parent) { return true }
  6158. } while (child = child.parentNode)
  6159. }
  6160. function activeElt() {
  6161. // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
  6162. // IE < 10 will throw when accessed while the page is loading or in an iframe.
  6163. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
  6164. var activeElement;
  6165. try {
  6166. activeElement = document.activeElement;
  6167. } catch(e) {
  6168. activeElement = document.body || null;
  6169. }
  6170. while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
  6171. { activeElement = activeElement.shadowRoot.activeElement; }
  6172. return activeElement
  6173. }
  6174. function addClass(node, cls) {
  6175. var current = node.className;
  6176. if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
  6177. }
  6178. function joinClasses(a, b) {
  6179. var as = a.split(" ");
  6180. for (var i = 0; i < as.length; i++)
  6181. { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
  6182. return b
  6183. }
  6184. var selectInput = function(node) { node.select(); };
  6185. if (ios) // Mobile Safari apparently has a bug where select() is broken.
  6186. { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
  6187. else if (ie) // Suppress mysterious IE10 errors
  6188. { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
  6189. function bind(f) {
  6190. var args = Array.prototype.slice.call(arguments, 1);
  6191. return function(){return f.apply(null, args)}
  6192. }
  6193. function copyObj(obj, target, overwrite) {
  6194. if (!target) { target = {}; }
  6195. for (var prop in obj)
  6196. { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
  6197. { target[prop] = obj[prop]; } }
  6198. return target
  6199. }
  6200. // Counts the column offset in a string, taking tabs into account.
  6201. // Used mostly to find indentation.
  6202. function countColumn(string, end, tabSize, startIndex, startValue) {
  6203. if (end == null) {
  6204. end = string.search(/[^\s\u00a0]/);
  6205. if (end == -1) { end = string.length; }
  6206. }
  6207. for (var i = startIndex || 0, n = startValue || 0;;) {
  6208. var nextTab = string.indexOf("\t", i);
  6209. if (nextTab < 0 || nextTab >= end)
  6210. { return n + (end - i) }
  6211. n += nextTab - i;
  6212. n += tabSize - (n % tabSize);
  6213. i = nextTab + 1;
  6214. }
  6215. }
  6216. var Delayed = function() {this.id = null;};
  6217. Delayed.prototype.set = function (ms, f) {
  6218. clearTimeout(this.id);
  6219. this.id = setTimeout(f, ms);
  6220. };
  6221. function indexOf(array, elt) {
  6222. for (var i = 0; i < array.length; ++i)
  6223. { if (array[i] == elt) { return i } }
  6224. return -1
  6225. }
  6226. // Number of pixels added to scroller and sizer to hide scrollbar
  6227. var scrollerGap = 30;
  6228. // Returned or thrown by various protocols to signal 'I'm not
  6229. // handling this'.
  6230. var Pass = {toString: function(){return "CodeMirror.Pass"}};
  6231. // Reused option objects for setSelection & friends
  6232. var sel_dontScroll = {scroll: false};
  6233. var sel_mouse = {origin: "*mouse"};
  6234. var sel_move = {origin: "+move"};
  6235. // The inverse of countColumn -- find the offset that corresponds to
  6236. // a particular column.
  6237. function findColumn(string, goal, tabSize) {
  6238. for (var pos = 0, col = 0;;) {
  6239. var nextTab = string.indexOf("\t", pos);
  6240. if (nextTab == -1) { nextTab = string.length; }
  6241. var skipped = nextTab - pos;
  6242. if (nextTab == string.length || col + skipped >= goal)
  6243. { return pos + Math.min(skipped, goal - col) }
  6244. col += nextTab - pos;
  6245. col += tabSize - (col % tabSize);
  6246. pos = nextTab + 1;
  6247. if (col >= goal) { return pos }
  6248. }
  6249. }
  6250. var spaceStrs = [""];
  6251. function spaceStr(n) {
  6252. while (spaceStrs.length <= n)
  6253. { spaceStrs.push(lst(spaceStrs) + " "); }
  6254. return spaceStrs[n]
  6255. }
  6256. function lst(arr) { return arr[arr.length-1] }
  6257. function map(array, f) {
  6258. var out = [];
  6259. for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
  6260. return out
  6261. }
  6262. function insertSorted(array, value, score) {
  6263. var pos = 0, priority = score(value);
  6264. while (pos < array.length && score(array[pos]) <= priority) { pos++; }
  6265. array.splice(pos, 0, value);
  6266. }
  6267. function nothing() {}
  6268. function createObj(base, props) {
  6269. var inst;
  6270. if (Object.create) {
  6271. inst = Object.create(base);
  6272. } else {
  6273. nothing.prototype = base;
  6274. inst = new nothing();
  6275. }
  6276. if (props) { copyObj(props, inst); }
  6277. return inst
  6278. }
  6279. var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
  6280. function isWordCharBasic(ch) {
  6281. return /\w/.test(ch) || ch > "\x80" &&
  6282. (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
  6283. }
  6284. function isWordChar(ch, helper) {
  6285. if (!helper) { return isWordCharBasic(ch) }
  6286. if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
  6287. return helper.test(ch)
  6288. }
  6289. function isEmpty(obj) {
  6290. for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
  6291. return true
  6292. }
  6293. // Extending unicode characters. A series of a non-extending char +
  6294. // any number of extending chars is treated as a single unit as far
  6295. // as editing and measuring is concerned. This is not fully correct,
  6296. // since some scripts/fonts/browsers also treat other configurations
  6297. // of code points as a group.
  6298. var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
  6299. function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
  6300. // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
  6301. function skipExtendingChars(str, pos, dir) {
  6302. while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
  6303. return pos
  6304. }
  6305. // Returns the value from the range [`from`; `to`] that satisfies
  6306. // `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
  6307. function findFirst(pred, from, to) {
  6308. for (;;) {
  6309. if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
  6310. var mid = Math.floor((from + to) / 2);
  6311. if (pred(mid)) { to = mid; }
  6312. else { from = mid; }
  6313. }
  6314. }
  6315. // The display handles the DOM integration, both for input reading
  6316. // and content drawing. It holds references to DOM nodes and
  6317. // display-related state.
  6318. function Display(place, doc, input) {
  6319. var d = this;
  6320. this.input = input;
  6321. // Covers bottom-right square when both scrollbars are present.
  6322. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
  6323. d.scrollbarFiller.setAttribute("cm-not-content", "true");
  6324. // Covers bottom of gutter when coverGutterNextToScrollbar is on
  6325. // and h scrollbar is present.
  6326. d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
  6327. d.gutterFiller.setAttribute("cm-not-content", "true");
  6328. // Will contain the actual code, positioned to cover the viewport.
  6329. d.lineDiv = eltP("div", null, "CodeMirror-code");
  6330. // Elements are added to these to represent selection and cursors.
  6331. d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
  6332. d.cursorDiv = elt("div", null, "CodeMirror-cursors");
  6333. // A visibility: hidden element used to find the size of things.
  6334. d.measure = elt("div", null, "CodeMirror-measure");
  6335. // When lines outside of the viewport are measured, they are drawn in this.
  6336. d.lineMeasure = elt("div", null, "CodeMirror-measure");
  6337. // Wraps everything that needs to exist inside the vertically-padded coordinate system
  6338. d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
  6339. null, "position: relative; outline: none");
  6340. var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
  6341. // Moved around its parent to cover visible view.
  6342. d.mover = elt("div", [lines], null, "position: relative");
  6343. // Set to the height of the document, allowing scrolling.
  6344. d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
  6345. d.sizerWidth = null;
  6346. // Behavior of elts with overflow: auto and padding is
  6347. // inconsistent across browsers. This is used to ensure the
  6348. // scrollable area is big enough.
  6349. d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
  6350. // Will contain the gutters, if any.
  6351. d.gutters = elt("div", null, "CodeMirror-gutters");
  6352. d.lineGutter = null;
  6353. // Actual scrollable element.
  6354. d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
  6355. d.scroller.setAttribute("tabIndex", "-1");
  6356. // The element in which the editor lives.
  6357. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
  6358. // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
  6359. if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
  6360. if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
  6361. if (place) {
  6362. if (place.appendChild) { place.appendChild(d.wrapper); }
  6363. else { place(d.wrapper); }
  6364. }
  6365. // Current rendered range (may be bigger than the view window).
  6366. d.viewFrom = d.viewTo = doc.first;
  6367. d.reportedViewFrom = d.reportedViewTo = doc.first;
  6368. // Information about the rendered lines.
  6369. d.view = [];
  6370. d.renderedView = null;
  6371. // Holds info about a single rendered line when it was rendered
  6372. // for measurement, while not in view.
  6373. d.externalMeasured = null;
  6374. // Empty space (in pixels) above the view
  6375. d.viewOffset = 0;
  6376. d.lastWrapHeight = d.lastWrapWidth = 0;
  6377. d.updateLineNumbers = null;
  6378. d.nativeBarWidth = d.barHeight = d.barWidth = 0;
  6379. d.scrollbarsClipped = false;
  6380. // Used to only resize the line number gutter when necessary (when
  6381. // the amount of lines crosses a boundary that makes its width change)
  6382. d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
  6383. // Set to true when a non-horizontal-scrolling line widget is
  6384. // added. As an optimization, line widget aligning is skipped when
  6385. // this is false.
  6386. d.alignWidgets = false;
  6387. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  6388. // Tracks the maximum line length so that the horizontal scrollbar
  6389. // can be kept static when scrolling.
  6390. d.maxLine = null;
  6391. d.maxLineLength = 0;
  6392. d.maxLineChanged = false;
  6393. // Used for measuring wheel scrolling granularity
  6394. d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
  6395. // True when shift is held down.
  6396. d.shift = false;
  6397. // Used to track whether anything happened since the context menu
  6398. // was opened.
  6399. d.selForContextMenu = null;
  6400. d.activeTouch = null;
  6401. input.init(d);
  6402. }
  6403. // Find the line object corresponding to the given line number.
  6404. function getLine(doc, n) {
  6405. n -= doc.first;
  6406. if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
  6407. var chunk = doc;
  6408. while (!chunk.lines) {
  6409. for (var i = 0;; ++i) {
  6410. var child = chunk.children[i], sz = child.chunkSize();
  6411. if (n < sz) { chunk = child; break }
  6412. n -= sz;
  6413. }
  6414. }
  6415. return chunk.lines[n]
  6416. }
  6417. // Get the part of a document between two positions, as an array of
  6418. // strings.
  6419. function getBetween(doc, start, end) {
  6420. var out = [], n = start.line;
  6421. doc.iter(start.line, end.line + 1, function (line) {
  6422. var text = line.text;
  6423. if (n == end.line) { text = text.slice(0, end.ch); }
  6424. if (n == start.line) { text = text.slice(start.ch); }
  6425. out.push(text);
  6426. ++n;
  6427. });
  6428. return out
  6429. }
  6430. // Get the lines between from and to, as array of strings.
  6431. function getLines(doc, from, to) {
  6432. var out = [];
  6433. doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
  6434. return out
  6435. }
  6436. // Update the height of a line, propagating the height change
  6437. // upwards to parent nodes.
  6438. function updateLineHeight(line, height) {
  6439. var diff = height - line.height;
  6440. if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
  6441. }
  6442. // Given a line object, find its line number by walking up through
  6443. // its parent links.
  6444. function lineNo(line) {
  6445. if (line.parent == null) { return null }
  6446. var cur = line.parent, no = indexOf(cur.lines, line);
  6447. for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
  6448. for (var i = 0;; ++i) {
  6449. if (chunk.children[i] == cur) { break }
  6450. no += chunk.children[i].chunkSize();
  6451. }
  6452. }
  6453. return no + cur.first
  6454. }
  6455. // Find the line at the given vertical position, using the height
  6456. // information in the document tree.
  6457. function lineAtHeight(chunk, h) {
  6458. var n = chunk.first;
  6459. outer: do {
  6460. for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
  6461. var child = chunk.children[i$1], ch = child.height;
  6462. if (h < ch) { chunk = child; continue outer }
  6463. h -= ch;
  6464. n += child.chunkSize();
  6465. }
  6466. return n
  6467. } while (!chunk.lines)
  6468. var i = 0;
  6469. for (; i < chunk.lines.length; ++i) {
  6470. var line = chunk.lines[i], lh = line.height;
  6471. if (h < lh) { break }
  6472. h -= lh;
  6473. }
  6474. return n + i
  6475. }
  6476. function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
  6477. function lineNumberFor(options, i) {
  6478. return String(options.lineNumberFormatter(i + options.firstLineNumber))
  6479. }
  6480. // A Pos instance represents a position within the text.
  6481. function Pos(line, ch, sticky) {
  6482. if ( sticky === void 0 ) sticky = null;
  6483. if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
  6484. this.line = line;
  6485. this.ch = ch;
  6486. this.sticky = sticky;
  6487. }
  6488. // Compare two positions, return 0 if they are the same, a negative
  6489. // number when a is less, and a positive number otherwise.
  6490. function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
  6491. function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
  6492. function copyPos(x) {return Pos(x.line, x.ch)}
  6493. function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
  6494. function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
  6495. // Most of the external API clips given positions to make sure they
  6496. // actually exist within the document.
  6497. function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
  6498. function clipPos(doc, pos) {
  6499. if (pos.line < doc.first) { return Pos(doc.first, 0) }
  6500. var last = doc.first + doc.size - 1;
  6501. if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
  6502. return clipToLen(pos, getLine(doc, pos.line).text.length)
  6503. }
  6504. function clipToLen(pos, linelen) {
  6505. var ch = pos.ch;
  6506. if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
  6507. else if (ch < 0) { return Pos(pos.line, 0) }
  6508. else { return pos }
  6509. }
  6510. function clipPosArray(doc, array) {
  6511. var out = [];
  6512. for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
  6513. return out
  6514. }
  6515. // Optimize some code when these features are not used.
  6516. var sawReadOnlySpans = false;
  6517. var sawCollapsedSpans = false;
  6518. function seeReadOnlySpans() {
  6519. sawReadOnlySpans = true;
  6520. }
  6521. function seeCollapsedSpans() {
  6522. sawCollapsedSpans = true;
  6523. }
  6524. // TEXTMARKER SPANS
  6525. function MarkedSpan(marker, from, to) {
  6526. this.marker = marker;
  6527. this.from = from; this.to = to;
  6528. }
  6529. // Search an array of spans for a span matching the given marker.
  6530. function getMarkedSpanFor(spans, marker) {
  6531. if (spans) { for (var i = 0; i < spans.length; ++i) {
  6532. var span = spans[i];
  6533. if (span.marker == marker) { return span }
  6534. } }
  6535. }
  6536. // Remove a span from an array, returning undefined if no spans are
  6537. // left (we don't store arrays for lines without spans).
  6538. function removeMarkedSpan(spans, span) {
  6539. var r;
  6540. for (var i = 0; i < spans.length; ++i)
  6541. { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
  6542. return r
  6543. }
  6544. // Add a span to a line.
  6545. function addMarkedSpan(line, span) {
  6546. line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
  6547. span.marker.attachLine(line);
  6548. }
  6549. // Used for the algorithm that adjusts markers for a change in the
  6550. // document. These functions cut an array of spans at a given
  6551. // character position, returning an array of remaining chunks (or
  6552. // undefined if nothing remains).
  6553. function markedSpansBefore(old, startCh, isInsert) {
  6554. var nw;
  6555. if (old) { for (var i = 0; i < old.length; ++i) {
  6556. var span = old[i], marker = span.marker;
  6557. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
  6558. if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
  6559. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
  6560. }
  6561. } }
  6562. return nw
  6563. }
  6564. function markedSpansAfter(old, endCh, isInsert) {
  6565. var nw;
  6566. if (old) { for (var i = 0; i < old.length; ++i) {
  6567. var span = old[i], marker = span.marker;
  6568. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
  6569. if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
  6570. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
  6571. span.to == null ? null : span.to - endCh));
  6572. }
  6573. } }
  6574. return nw
  6575. }
  6576. // Given a change object, compute the new set of marker spans that
  6577. // cover the line in which the change took place. Removes spans
  6578. // entirely within the change, reconnects spans belonging to the
  6579. // same marker that appear on both sides of the change, and cuts off
  6580. // spans partially within the change. Returns an array of span
  6581. // arrays with one element for each line in (after) the change.
  6582. function stretchSpansOverChange(doc, change) {
  6583. if (change.full) { return null }
  6584. var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
  6585. var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
  6586. if (!oldFirst && !oldLast) { return null }
  6587. var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
  6588. // Get the spans that 'stick out' on both sides
  6589. var first = markedSpansBefore(oldFirst, startCh, isInsert);
  6590. var last = markedSpansAfter(oldLast, endCh, isInsert);
  6591. // Next, merge those two ends
  6592. var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
  6593. if (first) {
  6594. // Fix up .to properties of first
  6595. for (var i = 0; i < first.length; ++i) {
  6596. var span = first[i];
  6597. if (span.to == null) {
  6598. var found = getMarkedSpanFor(last, span.marker);
  6599. if (!found) { span.to = startCh; }
  6600. else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
  6601. }
  6602. }
  6603. }
  6604. if (last) {
  6605. // Fix up .from in last (or move them into first in case of sameLine)
  6606. for (var i$1 = 0; i$1 < last.length; ++i$1) {
  6607. var span$1 = last[i$1];
  6608. if (span$1.to != null) { span$1.to += offset; }
  6609. if (span$1.from == null) {
  6610. var found$1 = getMarkedSpanFor(first, span$1.marker);
  6611. if (!found$1) {
  6612. span$1.from = offset;
  6613. if (sameLine) { (first || (first = [])).push(span$1); }
  6614. }
  6615. } else {
  6616. span$1.from += offset;
  6617. if (sameLine) { (first || (first = [])).push(span$1); }
  6618. }
  6619. }
  6620. }
  6621. // Make sure we didn't create any zero-length spans
  6622. if (first) { first = clearEmptySpans(first); }
  6623. if (last && last != first) { last = clearEmptySpans(last); }
  6624. var newMarkers = [first];
  6625. if (!sameLine) {
  6626. // Fill gap with whole-line-spans
  6627. var gap = change.text.length - 2, gapMarkers;
  6628. if (gap > 0 && first)
  6629. { for (var i$2 = 0; i$2 < first.length; ++i$2)
  6630. { if (first[i$2].to == null)
  6631. { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
  6632. for (var i$3 = 0; i$3 < gap; ++i$3)
  6633. { newMarkers.push(gapMarkers); }
  6634. newMarkers.push(last);
  6635. }
  6636. return newMarkers
  6637. }
  6638. // Remove spans that are empty and don't have a clearWhenEmpty
  6639. // option of false.
  6640. function clearEmptySpans(spans) {
  6641. for (var i = 0; i < spans.length; ++i) {
  6642. var span = spans[i];
  6643. if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
  6644. { spans.splice(i--, 1); }
  6645. }
  6646. if (!spans.length) { return null }
  6647. return spans
  6648. }
  6649. // Used to 'clip' out readOnly ranges when making a change.
  6650. function removeReadOnlyRanges(doc, from, to) {
  6651. var markers = null;
  6652. doc.iter(from.line, to.line + 1, function (line) {
  6653. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  6654. var mark = line.markedSpans[i].marker;
  6655. if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
  6656. { (markers || (markers = [])).push(mark); }
  6657. } }
  6658. });
  6659. if (!markers) { return null }
  6660. var parts = [{from: from, to: to}];
  6661. for (var i = 0; i < markers.length; ++i) {
  6662. var mk = markers[i], m = mk.find(0);
  6663. for (var j = 0; j < parts.length; ++j) {
  6664. var p = parts[j];
  6665. if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
  6666. var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
  6667. if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
  6668. { newParts.push({from: p.from, to: m.from}); }
  6669. if (dto > 0 || !mk.inclusiveRight && !dto)
  6670. { newParts.push({from: m.to, to: p.to}); }
  6671. parts.splice.apply(parts, newParts);
  6672. j += newParts.length - 3;
  6673. }
  6674. }
  6675. return parts
  6676. }
  6677. // Connect or disconnect spans from a line.
  6678. function detachMarkedSpans(line) {
  6679. var spans = line.markedSpans;
  6680. if (!spans) { return }
  6681. for (var i = 0; i < spans.length; ++i)
  6682. { spans[i].marker.detachLine(line); }
  6683. line.markedSpans = null;
  6684. }
  6685. function attachMarkedSpans(line, spans) {
  6686. if (!spans) { return }
  6687. for (var i = 0; i < spans.length; ++i)
  6688. { spans[i].marker.attachLine(line); }
  6689. line.markedSpans = spans;
  6690. }
  6691. // Helpers used when computing which overlapping collapsed span
  6692. // counts as the larger one.
  6693. function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
  6694. function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
  6695. // Returns a number indicating which of two overlapping collapsed
  6696. // spans is larger (and thus includes the other). Falls back to
  6697. // comparing ids when the spans cover exactly the same range.
  6698. function compareCollapsedMarkers(a, b) {
  6699. var lenDiff = a.lines.length - b.lines.length;
  6700. if (lenDiff != 0) { return lenDiff }
  6701. var aPos = a.find(), bPos = b.find();
  6702. var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
  6703. if (fromCmp) { return -fromCmp }
  6704. var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
  6705. if (toCmp) { return toCmp }
  6706. return b.id - a.id
  6707. }
  6708. // Find out whether a line ends or starts in a collapsed span. If
  6709. // so, return the marker for that span.
  6710. function collapsedSpanAtSide(line, start) {
  6711. var sps = sawCollapsedSpans && line.markedSpans, found;
  6712. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  6713. sp = sps[i];
  6714. if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
  6715. (!found || compareCollapsedMarkers(found, sp.marker) < 0))
  6716. { found = sp.marker; }
  6717. } }
  6718. return found
  6719. }
  6720. function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
  6721. function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
  6722. // Test whether there exists a collapsed span that partially
  6723. // overlaps (covers the start or end, but not both) of a new span.
  6724. // Such overlap is not allowed.
  6725. function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
  6726. var line = getLine(doc, lineNo$$1);
  6727. var sps = sawCollapsedSpans && line.markedSpans;
  6728. if (sps) { for (var i = 0; i < sps.length; ++i) {
  6729. var sp = sps[i];
  6730. if (!sp.marker.collapsed) { continue }
  6731. var found = sp.marker.find(0);
  6732. var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
  6733. var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
  6734. if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
  6735. if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
  6736. fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
  6737. { return true }
  6738. } }
  6739. }
  6740. // A visual line is a line as drawn on the screen. Folding, for
  6741. // example, can cause multiple logical lines to appear on the same
  6742. // visual line. This finds the start of the visual line that the
  6743. // given line is part of (usually that is the line itself).
  6744. function visualLine(line) {
  6745. var merged;
  6746. while (merged = collapsedSpanAtStart(line))
  6747. { line = merged.find(-1, true).line; }
  6748. return line
  6749. }
  6750. function visualLineEnd(line) {
  6751. var merged;
  6752. while (merged = collapsedSpanAtEnd(line))
  6753. { line = merged.find(1, true).line; }
  6754. return line
  6755. }
  6756. // Returns an array of logical lines that continue the visual line
  6757. // started by the argument, or undefined if there are no such lines.
  6758. function visualLineContinued(line) {
  6759. var merged, lines;
  6760. while (merged = collapsedSpanAtEnd(line)) {
  6761. line = merged.find(1, true).line
  6762. ;(lines || (lines = [])).push(line);
  6763. }
  6764. return lines
  6765. }
  6766. // Get the line number of the start of the visual line that the
  6767. // given line number is part of.
  6768. function visualLineNo(doc, lineN) {
  6769. var line = getLine(doc, lineN), vis = visualLine(line);
  6770. if (line == vis) { return lineN }
  6771. return lineNo(vis)
  6772. }
  6773. // Get the line number of the start of the next visual line after
  6774. // the given line.
  6775. function visualLineEndNo(doc, lineN) {
  6776. if (lineN > doc.lastLine()) { return lineN }
  6777. var line = getLine(doc, lineN), merged;
  6778. if (!lineIsHidden(doc, line)) { return lineN }
  6779. while (merged = collapsedSpanAtEnd(line))
  6780. { line = merged.find(1, true).line; }
  6781. return lineNo(line) + 1
  6782. }
  6783. // Compute whether a line is hidden. Lines count as hidden when they
  6784. // are part of a visual line that starts with another line, or when
  6785. // they are entirely covered by collapsed, non-widget span.
  6786. function lineIsHidden(doc, line) {
  6787. var sps = sawCollapsedSpans && line.markedSpans;
  6788. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  6789. sp = sps[i];
  6790. if (!sp.marker.collapsed) { continue }
  6791. if (sp.from == null) { return true }
  6792. if (sp.marker.widgetNode) { continue }
  6793. if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
  6794. { return true }
  6795. } }
  6796. }
  6797. function lineIsHiddenInner(doc, line, span) {
  6798. if (span.to == null) {
  6799. var end = span.marker.find(1, true);
  6800. return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
  6801. }
  6802. if (span.marker.inclusiveRight && span.to == line.text.length)
  6803. { return true }
  6804. for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
  6805. sp = line.markedSpans[i];
  6806. if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
  6807. (sp.to == null || sp.to != span.from) &&
  6808. (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
  6809. lineIsHiddenInner(doc, line, sp)) { return true }
  6810. }
  6811. }
  6812. // Find the height above the given line.
  6813. function heightAtLine(lineObj) {
  6814. lineObj = visualLine(lineObj);
  6815. var h = 0, chunk = lineObj.parent;
  6816. for (var i = 0; i < chunk.lines.length; ++i) {
  6817. var line = chunk.lines[i];
  6818. if (line == lineObj) { break }
  6819. else { h += line.height; }
  6820. }
  6821. for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
  6822. for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
  6823. var cur = p.children[i$1];
  6824. if (cur == chunk) { break }
  6825. else { h += cur.height; }
  6826. }
  6827. }
  6828. return h
  6829. }
  6830. // Compute the character length of a line, taking into account
  6831. // collapsed ranges (see markText) that might hide parts, and join
  6832. // other lines onto it.
  6833. function lineLength(line) {
  6834. if (line.height == 0) { return 0 }
  6835. var len = line.text.length, merged, cur = line;
  6836. while (merged = collapsedSpanAtStart(cur)) {
  6837. var found = merged.find(0, true);
  6838. cur = found.from.line;
  6839. len += found.from.ch - found.to.ch;
  6840. }
  6841. cur = line;
  6842. while (merged = collapsedSpanAtEnd(cur)) {
  6843. var found$1 = merged.find(0, true);
  6844. len -= cur.text.length - found$1.from.ch;
  6845. cur = found$1.to.line;
  6846. len += cur.text.length - found$1.to.ch;
  6847. }
  6848. return len
  6849. }
  6850. // Find the longest line in the document.
  6851. function findMaxLine(cm) {
  6852. var d = cm.display, doc = cm.doc;
  6853. d.maxLine = getLine(doc, doc.first);
  6854. d.maxLineLength = lineLength(d.maxLine);
  6855. d.maxLineChanged = true;
  6856. doc.iter(function (line) {
  6857. var len = lineLength(line);
  6858. if (len > d.maxLineLength) {
  6859. d.maxLineLength = len;
  6860. d.maxLine = line;
  6861. }
  6862. });
  6863. }
  6864. // BIDI HELPERS
  6865. function iterateBidiSections(order, from, to, f) {
  6866. if (!order) { return f(from, to, "ltr") }
  6867. var found = false;
  6868. for (var i = 0; i < order.length; ++i) {
  6869. var part = order[i];
  6870. if (part.from < to && part.to > from || from == to && part.to == from) {
  6871. f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
  6872. found = true;
  6873. }
  6874. }
  6875. if (!found) { f(from, to, "ltr"); }
  6876. }
  6877. var bidiOther = null;
  6878. function getBidiPartAt(order, ch, sticky) {
  6879. var found;
  6880. bidiOther = null;
  6881. for (var i = 0; i < order.length; ++i) {
  6882. var cur = order[i];
  6883. if (cur.from < ch && cur.to > ch) { return i }
  6884. if (cur.to == ch) {
  6885. if (cur.from != cur.to && sticky == "before") { found = i; }
  6886. else { bidiOther = i; }
  6887. }
  6888. if (cur.from == ch) {
  6889. if (cur.from != cur.to && sticky != "before") { found = i; }
  6890. else { bidiOther = i; }
  6891. }
  6892. }
  6893. return found != null ? found : bidiOther
  6894. }
  6895. // Bidirectional ordering algorithm
  6896. // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
  6897. // that this (partially) implements.
  6898. // One-char codes used for character types:
  6899. // L (L): Left-to-Right
  6900. // R (R): Right-to-Left
  6901. // r (AL): Right-to-Left Arabic
  6902. // 1 (EN): European Number
  6903. // + (ES): European Number Separator
  6904. // % (ET): European Number Terminator
  6905. // n (AN): Arabic Number
  6906. // , (CS): Common Number Separator
  6907. // m (NSM): Non-Spacing Mark
  6908. // b (BN): Boundary Neutral
  6909. // s (B): Paragraph Separator
  6910. // t (S): Segment Separator
  6911. // w (WS): Whitespace
  6912. // N (ON): Other Neutrals
  6913. // Returns null if characters are ordered as they appear
  6914. // (left-to-right), or an array of sections ({from, to, level}
  6915. // objects) in the order in which they occur visually.
  6916. var bidiOrdering = (function() {
  6917. // Character types for codepoints 0 to 0xff
  6918. var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
  6919. // Character types for codepoints 0x600 to 0x6f9
  6920. var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
  6921. function charType(code) {
  6922. if (code <= 0xf7) { return lowTypes.charAt(code) }
  6923. else if (0x590 <= code && code <= 0x5f4) { return "R" }
  6924. else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
  6925. else if (0x6ee <= code && code <= 0x8ac) { return "r" }
  6926. else if (0x2000 <= code && code <= 0x200b) { return "w" }
  6927. else if (code == 0x200c) { return "b" }
  6928. else { return "L" }
  6929. }
  6930. var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
  6931. var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
  6932. function BidiSpan(level, from, to) {
  6933. this.level = level;
  6934. this.from = from; this.to = to;
  6935. }
  6936. return function(str, direction) {
  6937. var outerType = direction == "ltr" ? "L" : "R";
  6938. if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
  6939. var len = str.length, types = [];
  6940. for (var i = 0; i < len; ++i)
  6941. { types.push(charType(str.charCodeAt(i))); }
  6942. // W1. Examine each non-spacing mark (NSM) in the level run, and
  6943. // change the type of the NSM to the type of the previous
  6944. // character. If the NSM is at the start of the level run, it will
  6945. // get the type of sor.
  6946. for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
  6947. var type = types[i$1];
  6948. if (type == "m") { types[i$1] = prev; }
  6949. else { prev = type; }
  6950. }
  6951. // W2. Search backwards from each instance of a European number
  6952. // until the first strong type (R, L, AL, or sor) is found. If an
  6953. // AL is found, change the type of the European number to Arabic
  6954. // number.
  6955. // W3. Change all ALs to R.
  6956. for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
  6957. var type$1 = types[i$2];
  6958. if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
  6959. else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
  6960. }
  6961. // W4. A single European separator between two European numbers
  6962. // changes to a European number. A single common separator between
  6963. // two numbers of the same type changes to that type.
  6964. for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
  6965. var type$2 = types[i$3];
  6966. if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
  6967. else if (type$2 == "," && prev$1 == types[i$3+1] &&
  6968. (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
  6969. prev$1 = type$2;
  6970. }
  6971. // W5. A sequence of European terminators adjacent to European
  6972. // numbers changes to all European numbers.
  6973. // W6. Otherwise, separators and terminators change to Other
  6974. // Neutral.
  6975. for (var i$4 = 0; i$4 < len; ++i$4) {
  6976. var type$3 = types[i$4];
  6977. if (type$3 == ",") { types[i$4] = "N"; }
  6978. else if (type$3 == "%") {
  6979. var end = (void 0);
  6980. for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
  6981. var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
  6982. for (var j = i$4; j < end; ++j) { types[j] = replace; }
  6983. i$4 = end - 1;
  6984. }
  6985. }
  6986. // W7. Search backwards from each instance of a European number
  6987. // until the first strong type (R, L, or sor) is found. If an L is
  6988. // found, then change the type of the European number to L.
  6989. for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
  6990. var type$4 = types[i$5];
  6991. if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
  6992. else if (isStrong.test(type$4)) { cur$1 = type$4; }
  6993. }
  6994. // N1. A sequence of neutrals takes the direction of the
  6995. // surrounding strong text if the text on both sides has the same
  6996. // direction. European and Arabic numbers act as if they were R in
  6997. // terms of their influence on neutrals. Start-of-level-run (sor)
  6998. // and end-of-level-run (eor) are used at level run boundaries.
  6999. // N2. Any remaining neutrals take the embedding direction.
  7000. for (var i$6 = 0; i$6 < len; ++i$6) {
  7001. if (isNeutral.test(types[i$6])) {
  7002. var end$1 = (void 0);
  7003. for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
  7004. var before = (i$6 ? types[i$6-1] : outerType) == "L";
  7005. var after = (end$1 < len ? types[end$1] : outerType) == "L";
  7006. var replace$1 = before == after ? (before ? "L" : "R") : outerType;
  7007. for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
  7008. i$6 = end$1 - 1;
  7009. }
  7010. }
  7011. // Here we depart from the documented algorithm, in order to avoid
  7012. // building up an actual levels array. Since there are only three
  7013. // levels (0, 1, 2) in an implementation that doesn't take
  7014. // explicit embedding into account, we can build up the order on
  7015. // the fly, without following the level-based algorithm.
  7016. var order = [], m;
  7017. for (var i$7 = 0; i$7 < len;) {
  7018. if (countsAsLeft.test(types[i$7])) {
  7019. var start = i$7;
  7020. for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
  7021. order.push(new BidiSpan(0, start, i$7));
  7022. } else {
  7023. var pos = i$7, at = order.length;
  7024. for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
  7025. for (var j$2 = pos; j$2 < i$7;) {
  7026. if (countsAsNum.test(types[j$2])) {
  7027. if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
  7028. var nstart = j$2;
  7029. for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
  7030. order.splice(at, 0, new BidiSpan(2, nstart, j$2));
  7031. pos = j$2;
  7032. } else { ++j$2; }
  7033. }
  7034. if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
  7035. }
  7036. }
  7037. if (order[0].level == 1 && (m = str.match(/^\s+/))) {
  7038. order[0].from = m[0].length;
  7039. order.unshift(new BidiSpan(0, 0, m[0].length));
  7040. }
  7041. if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
  7042. lst(order).to -= m[0].length;
  7043. order.push(new BidiSpan(0, len - m[0].length, len));
  7044. }
  7045. return direction == "rtl" ? order.reverse() : order
  7046. }
  7047. })();
  7048. // Get the bidi ordering for the given line (and cache it). Returns
  7049. // false for lines that are fully left-to-right, and an array of
  7050. // BidiSpan objects otherwise.
  7051. function getOrder(line, direction) {
  7052. var order = line.order;
  7053. if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
  7054. return order
  7055. }
  7056. function moveCharLogically(line, ch, dir) {
  7057. var target = skipExtendingChars(line.text, ch + dir, dir);
  7058. return target < 0 || target > line.text.length ? null : target
  7059. }
  7060. function moveLogically(line, start, dir) {
  7061. var ch = moveCharLogically(line, start.ch, dir);
  7062. return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
  7063. }
  7064. function endOfLine(visually, cm, lineObj, lineNo, dir) {
  7065. if (visually) {
  7066. var order = getOrder(lineObj, cm.doc.direction);
  7067. if (order) {
  7068. var part = dir < 0 ? lst(order) : order[0];
  7069. var moveInStorageOrder = (dir < 0) == (part.level == 1);
  7070. var sticky = moveInStorageOrder ? "after" : "before";
  7071. var ch;
  7072. // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
  7073. // it could be that the last bidi part is not on the last visual line,
  7074. // since visual lines contain content order-consecutive chunks.
  7075. // Thus, in rtl, we are looking for the first (content-order) character
  7076. // in the rtl chunk that is on the last line (that is, the same line
  7077. // as the last (content-order) character).
  7078. if (part.level > 0) {
  7079. var prep = prepareMeasureForLine(cm, lineObj);
  7080. ch = dir < 0 ? lineObj.text.length - 1 : 0;
  7081. var targetTop = measureCharPrepared(cm, prep, ch).top;
  7082. ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
  7083. if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true); }
  7084. } else { ch = dir < 0 ? part.to : part.from; }
  7085. return new Pos(lineNo, ch, sticky)
  7086. }
  7087. }
  7088. return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
  7089. }
  7090. function moveVisually(cm, line, start, dir) {
  7091. var bidi = getOrder(line, cm.doc.direction);
  7092. if (!bidi) { return moveLogically(line, start, dir) }
  7093. if (start.ch >= line.text.length) {
  7094. start.ch = line.text.length;
  7095. start.sticky = "before";
  7096. } else if (start.ch <= 0) {
  7097. start.ch = 0;
  7098. start.sticky = "after";
  7099. }
  7100. var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
  7101. if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
  7102. // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
  7103. // nothing interesting happens.
  7104. return moveLogically(line, start, dir)
  7105. }
  7106. var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
  7107. var prep;
  7108. var getWrappedLineExtent = function (ch) {
  7109. if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
  7110. prep = prep || prepareMeasureForLine(cm, line);
  7111. return wrappedLineExtentChar(cm, line, prep, ch)
  7112. };
  7113. var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
  7114. if (cm.doc.direction == "rtl" || part.level == 1) {
  7115. var moveInStorageOrder = (part.level == 1) == (dir < 0);
  7116. var ch = mv(start, moveInStorageOrder ? 1 : -1);
  7117. if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
  7118. // Case 2: We move within an rtl part or in an rtl editor on the same visual line
  7119. var sticky = moveInStorageOrder ? "before" : "after";
  7120. return new Pos(start.line, ch, sticky)
  7121. }
  7122. }
  7123. // Case 3: Could not move within this bidi part in this visual line, so leave
  7124. // the current bidi part
  7125. var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
  7126. var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
  7127. ? new Pos(start.line, mv(ch, 1), "before")
  7128. : new Pos(start.line, ch, "after"); };
  7129. for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
  7130. var part = bidi[partPos];
  7131. var moveInStorageOrder = (dir > 0) == (part.level != 1);
  7132. var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
  7133. if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
  7134. ch = moveInStorageOrder ? part.from : mv(part.to, -1);
  7135. if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
  7136. }
  7137. };
  7138. // Case 3a: Look for other bidi parts on the same visual line
  7139. var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
  7140. if (res) { return res }
  7141. // Case 3b: Look for other bidi parts on the next visual line
  7142. var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
  7143. if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
  7144. res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
  7145. if (res) { return res }
  7146. }
  7147. // Case 4: Nowhere to move
  7148. return null
  7149. }
  7150. // EVENT HANDLING
  7151. // Lightweight event framework. on/off also work on DOM nodes,
  7152. // registering native DOM handlers.
  7153. var noHandlers = [];
  7154. var on = function(emitter, type, f) {
  7155. if (emitter.addEventListener) {
  7156. emitter.addEventListener(type, f, false);
  7157. } else if (emitter.attachEvent) {
  7158. emitter.attachEvent("on" + type, f);
  7159. } else {
  7160. var map$$1 = emitter._handlers || (emitter._handlers = {});
  7161. map$$1[type] = (map$$1[type] || noHandlers).concat(f);
  7162. }
  7163. };
  7164. function getHandlers(emitter, type) {
  7165. return emitter._handlers && emitter._handlers[type] || noHandlers
  7166. }
  7167. function off(emitter, type, f) {
  7168. if (emitter.removeEventListener) {
  7169. emitter.removeEventListener(type, f, false);
  7170. } else if (emitter.detachEvent) {
  7171. emitter.detachEvent("on" + type, f);
  7172. } else {
  7173. var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
  7174. if (arr) {
  7175. var index = indexOf(arr, f);
  7176. if (index > -1)
  7177. { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
  7178. }
  7179. }
  7180. }
  7181. function signal(emitter, type /*, values...*/) {
  7182. var handlers = getHandlers(emitter, type);
  7183. if (!handlers.length) { return }
  7184. var args = Array.prototype.slice.call(arguments, 2);
  7185. for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
  7186. }
  7187. // The DOM events that CodeMirror handles can be overridden by
  7188. // registering a (non-DOM) handler on the editor for the event name,
  7189. // and preventDefault-ing the event in that handler.
  7190. function signalDOMEvent(cm, e, override) {
  7191. if (typeof e == "string")
  7192. { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
  7193. signal(cm, override || e.type, cm, e);
  7194. return e_defaultPrevented(e) || e.codemirrorIgnore
  7195. }
  7196. function signalCursorActivity(cm) {
  7197. var arr = cm._handlers && cm._handlers.cursorActivity;
  7198. if (!arr) { return }
  7199. var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
  7200. for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
  7201. { set.push(arr[i]); } }
  7202. }
  7203. function hasHandler(emitter, type) {
  7204. return getHandlers(emitter, type).length > 0
  7205. }
  7206. // Add on and off methods to a constructor's prototype, to make
  7207. // registering events on such objects more convenient.
  7208. function eventMixin(ctor) {
  7209. ctor.prototype.on = function(type, f) {on(this, type, f);};
  7210. ctor.prototype.off = function(type, f) {off(this, type, f);};
  7211. }
  7212. // Due to the fact that we still support jurassic IE versions, some
  7213. // compatibility wrappers are needed.
  7214. function e_preventDefault(e) {
  7215. if (e.preventDefault) { e.preventDefault(); }
  7216. else { e.returnValue = false; }
  7217. }
  7218. function e_stopPropagation(e) {
  7219. if (e.stopPropagation) { e.stopPropagation(); }
  7220. else { e.cancelBubble = true; }
  7221. }
  7222. function e_defaultPrevented(e) {
  7223. return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
  7224. }
  7225. function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
  7226. function e_target(e) {return e.target || e.srcElement}
  7227. function e_button(e) {
  7228. var b = e.which;
  7229. if (b == null) {
  7230. if (e.button & 1) { b = 1; }
  7231. else if (e.button & 2) { b = 3; }
  7232. else if (e.button & 4) { b = 2; }
  7233. }
  7234. if (mac && e.ctrlKey && b == 1) { b = 3; }
  7235. return b
  7236. }
  7237. // Detect drag-and-drop
  7238. var dragAndDrop = function() {
  7239. // There is *some* kind of drag-and-drop support in IE6-8, but I
  7240. // couldn't get it to work yet.
  7241. if (ie && ie_version < 9) { return false }
  7242. var div = elt('div');
  7243. return "draggable" in div || "dragDrop" in div
  7244. }();
  7245. var zwspSupported;
  7246. function zeroWidthElement(measure) {
  7247. if (zwspSupported == null) {
  7248. var test = elt("span", "\u200b");
  7249. removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
  7250. if (measure.firstChild.offsetHeight != 0)
  7251. { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
  7252. }
  7253. var node = zwspSupported ? elt("span", "\u200b") :
  7254. elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
  7255. node.setAttribute("cm-text", "");
  7256. return node
  7257. }
  7258. // Feature-detect IE's crummy client rect reporting for bidi text
  7259. var badBidiRects;
  7260. function hasBadBidiRects(measure) {
  7261. if (badBidiRects != null) { return badBidiRects }
  7262. var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
  7263. var r0 = range(txt, 0, 1).getBoundingClientRect();
  7264. var r1 = range(txt, 1, 2).getBoundingClientRect();
  7265. removeChildren(measure);
  7266. if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
  7267. return badBidiRects = (r1.right - r0.right < 3)
  7268. }
  7269. // See if "".split is the broken IE version, if so, provide an
  7270. // alternative way to split lines.
  7271. var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
  7272. var pos = 0, result = [], l = string.length;
  7273. while (pos <= l) {
  7274. var nl = string.indexOf("\n", pos);
  7275. if (nl == -1) { nl = string.length; }
  7276. var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
  7277. var rt = line.indexOf("\r");
  7278. if (rt != -1) {
  7279. result.push(line.slice(0, rt));
  7280. pos += rt + 1;
  7281. } else {
  7282. result.push(line);
  7283. pos = nl + 1;
  7284. }
  7285. }
  7286. return result
  7287. } : function (string) { return string.split(/\r\n?|\n/); };
  7288. var hasSelection = window.getSelection ? function (te) {
  7289. try { return te.selectionStart != te.selectionEnd }
  7290. catch(e) { return false }
  7291. } : function (te) {
  7292. var range$$1;
  7293. try {range$$1 = te.ownerDocument.selection.createRange();}
  7294. catch(e) {}
  7295. if (!range$$1 || range$$1.parentElement() != te) { return false }
  7296. return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
  7297. };
  7298. var hasCopyEvent = (function () {
  7299. var e = elt("div");
  7300. if ("oncopy" in e) { return true }
  7301. e.setAttribute("oncopy", "return;");
  7302. return typeof e.oncopy == "function"
  7303. })();
  7304. var badZoomedRects = null;
  7305. function hasBadZoomedRects(measure) {
  7306. if (badZoomedRects != null) { return badZoomedRects }
  7307. var node = removeChildrenAndAdd(measure, elt("span", "x"));
  7308. var normal = node.getBoundingClientRect();
  7309. var fromRange = range(node, 0, 1).getBoundingClientRect();
  7310. return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
  7311. }
  7312. // Known modes, by name and by MIME
  7313. var modes = {};
  7314. var mimeModes = {};
  7315. // Extra arguments are stored as the mode's dependencies, which is
  7316. // used by (legacy) mechanisms like loadmode.js to automatically
  7317. // load a mode. (Preferred mechanism is the require/define calls.)
  7318. function defineMode(name, mode) {
  7319. if (arguments.length > 2)
  7320. { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
  7321. modes[name] = mode;
  7322. }
  7323. function defineMIME(mime, spec) {
  7324. mimeModes[mime] = spec;
  7325. }
  7326. // Given a MIME type, a {name, ...options} config object, or a name
  7327. // string, return a mode config object.
  7328. function resolveMode(spec) {
  7329. if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
  7330. spec = mimeModes[spec];
  7331. } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
  7332. var found = mimeModes[spec.name];
  7333. if (typeof found == "string") { found = {name: found}; }
  7334. spec = createObj(found, spec);
  7335. spec.name = found.name;
  7336. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
  7337. return resolveMode("application/xml")
  7338. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
  7339. return resolveMode("application/json")
  7340. }
  7341. if (typeof spec == "string") { return {name: spec} }
  7342. else { return spec || {name: "null"} }
  7343. }
  7344. // Given a mode spec (anything that resolveMode accepts), find and
  7345. // initialize an actual mode object.
  7346. function getMode(options, spec) {
  7347. spec = resolveMode(spec);
  7348. var mfactory = modes[spec.name];
  7349. if (!mfactory) { return getMode(options, "text/plain") }
  7350. var modeObj = mfactory(options, spec);
  7351. if (modeExtensions.hasOwnProperty(spec.name)) {
  7352. var exts = modeExtensions[spec.name];
  7353. for (var prop in exts) {
  7354. if (!exts.hasOwnProperty(prop)) { continue }
  7355. if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
  7356. modeObj[prop] = exts[prop];
  7357. }
  7358. }
  7359. modeObj.name = spec.name;
  7360. if (spec.helperType) { modeObj.helperType = spec.helperType; }
  7361. if (spec.modeProps) { for (var prop$1 in spec.modeProps)
  7362. { modeObj[prop$1] = spec.modeProps[prop$1]; } }
  7363. return modeObj
  7364. }
  7365. // This can be used to attach properties to mode objects from
  7366. // outside the actual mode definition.
  7367. var modeExtensions = {};
  7368. function extendMode(mode, properties) {
  7369. var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
  7370. copyObj(properties, exts);
  7371. }
  7372. function copyState(mode, state) {
  7373. if (state === true) { return state }
  7374. if (mode.copyState) { return mode.copyState(state) }
  7375. var nstate = {};
  7376. for (var n in state) {
  7377. var val = state[n];
  7378. if (val instanceof Array) { val = val.concat([]); }
  7379. nstate[n] = val;
  7380. }
  7381. return nstate
  7382. }
  7383. // Given a mode and a state (for that mode), find the inner mode and
  7384. // state at the position that the state refers to.
  7385. function innerMode(mode, state) {
  7386. var info;
  7387. while (mode.innerMode) {
  7388. info = mode.innerMode(state);
  7389. if (!info || info.mode == mode) { break }
  7390. state = info.state;
  7391. mode = info.mode;
  7392. }
  7393. return info || {mode: mode, state: state}
  7394. }
  7395. function startState(mode, a1, a2) {
  7396. return mode.startState ? mode.startState(a1, a2) : true
  7397. }
  7398. // STRING STREAM
  7399. // Fed to the mode parsers, provides helper functions to make
  7400. // parsers more succinct.
  7401. var StringStream = function(string, tabSize) {
  7402. this.pos = this.start = 0;
  7403. this.string = string;
  7404. this.tabSize = tabSize || 8;
  7405. this.lastColumnPos = this.lastColumnValue = 0;
  7406. this.lineStart = 0;
  7407. };
  7408. StringStream.prototype.eol = function () {return this.pos >= this.string.length};
  7409. StringStream.prototype.sol = function () {return this.pos == this.lineStart};
  7410. StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
  7411. StringStream.prototype.next = function () {
  7412. if (this.pos < this.string.length)
  7413. { return this.string.charAt(this.pos++) }
  7414. };
  7415. StringStream.prototype.eat = function (match) {
  7416. var ch = this.string.charAt(this.pos);
  7417. var ok;
  7418. if (typeof match == "string") { ok = ch == match; }
  7419. else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
  7420. if (ok) {++this.pos; return ch}
  7421. };
  7422. StringStream.prototype.eatWhile = function (match) {
  7423. var start = this.pos;
  7424. while (this.eat(match)){}
  7425. return this.pos > start
  7426. };
  7427. StringStream.prototype.eatSpace = function () {
  7428. var this$1 = this;
  7429. var start = this.pos;
  7430. while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
  7431. return this.pos > start
  7432. };
  7433. StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
  7434. StringStream.prototype.skipTo = function (ch) {
  7435. var found = this.string.indexOf(ch, this.pos);
  7436. if (found > -1) {this.pos = found; return true}
  7437. };
  7438. StringStream.prototype.backUp = function (n) {this.pos -= n;};
  7439. StringStream.prototype.column = function () {
  7440. if (this.lastColumnPos < this.start) {
  7441. this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
  7442. this.lastColumnPos = this.start;
  7443. }
  7444. return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  7445. };
  7446. StringStream.prototype.indentation = function () {
  7447. return countColumn(this.string, null, this.tabSize) -
  7448. (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  7449. };
  7450. StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
  7451. if (typeof pattern == "string") {
  7452. var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
  7453. var substr = this.string.substr(this.pos, pattern.length);
  7454. if (cased(substr) == cased(pattern)) {
  7455. if (consume !== false) { this.pos += pattern.length; }
  7456. return true
  7457. }
  7458. } else {
  7459. var match = this.string.slice(this.pos).match(pattern);
  7460. if (match && match.index > 0) { return null }
  7461. if (match && consume !== false) { this.pos += match[0].length; }
  7462. return match
  7463. }
  7464. };
  7465. StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
  7466. StringStream.prototype.hideFirstChars = function (n, inner) {
  7467. this.lineStart += n;
  7468. try { return inner() }
  7469. finally { this.lineStart -= n; }
  7470. };
  7471. // Compute a style array (an array starting with a mode generation
  7472. // -- for invalidation -- followed by pairs of end positions and
  7473. // style strings), which is used to highlight the tokens on the
  7474. // line.
  7475. function highlightLine(cm, line, state, forceToEnd) {
  7476. // A styles array always starts with a number identifying the
  7477. // mode/overlays that it is based on (for easy invalidation).
  7478. var st = [cm.state.modeGen], lineClasses = {};
  7479. // Compute the base array of styles
  7480. runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
  7481. lineClasses, forceToEnd);
  7482. // Run overlays, adjust style array.
  7483. var loop = function ( o ) {
  7484. var overlay = cm.state.overlays[o], i = 1, at = 0;
  7485. runMode(cm, line.text, overlay.mode, true, function (end, style) {
  7486. var start = i;
  7487. // Ensure there's a token end at the current position, and that i points at it
  7488. while (at < end) {
  7489. var i_end = st[i];
  7490. if (i_end > end)
  7491. { st.splice(i, 1, end, st[i+1], i_end); }
  7492. i += 2;
  7493. at = Math.min(end, i_end);
  7494. }
  7495. if (!style) { return }
  7496. if (overlay.opaque) {
  7497. st.splice(start, i - start, end, "overlay " + style);
  7498. i = start + 2;
  7499. } else {
  7500. for (; start < i; start += 2) {
  7501. var cur = st[start+1];
  7502. st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
  7503. }
  7504. }
  7505. }, lineClasses);
  7506. };
  7507. for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
  7508. return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
  7509. }
  7510. function getLineStyles(cm, line, updateFrontier) {
  7511. if (!line.styles || line.styles[0] != cm.state.modeGen) {
  7512. var state = getStateBefore(cm, lineNo(line));
  7513. var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);
  7514. line.stateAfter = state;
  7515. line.styles = result.styles;
  7516. if (result.classes) { line.styleClasses = result.classes; }
  7517. else if (line.styleClasses) { line.styleClasses = null; }
  7518. if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++; }
  7519. }
  7520. return line.styles
  7521. }
  7522. function getStateBefore(cm, n, precise) {
  7523. var doc = cm.doc, display = cm.display;
  7524. if (!doc.mode.startState) { return true }
  7525. var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
  7526. if (!state) { state = startState(doc.mode); }
  7527. else { state = copyState(doc.mode, state); }
  7528. doc.iter(pos, n, function (line) {
  7529. processLine(cm, line.text, state);
  7530. var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
  7531. line.stateAfter = save ? copyState(doc.mode, state) : null;
  7532. ++pos;
  7533. });
  7534. if (precise) { doc.frontier = pos; }
  7535. return state
  7536. }
  7537. // Lightweight form of highlight -- proceed over this line and
  7538. // update state, but don't save a style array. Used for lines that
  7539. // aren't currently visible.
  7540. function processLine(cm, text, state, startAt) {
  7541. var mode = cm.doc.mode;
  7542. var stream = new StringStream(text, cm.options.tabSize);
  7543. stream.start = stream.pos = startAt || 0;
  7544. if (text == "") { callBlankLine(mode, state); }
  7545. while (!stream.eol()) {
  7546. readToken(mode, stream, state);
  7547. stream.start = stream.pos;
  7548. }
  7549. }
  7550. function callBlankLine(mode, state) {
  7551. if (mode.blankLine) { return mode.blankLine(state) }
  7552. if (!mode.innerMode) { return }
  7553. var inner = innerMode(mode, state);
  7554. if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
  7555. }
  7556. function readToken(mode, stream, state, inner) {
  7557. for (var i = 0; i < 10; i++) {
  7558. if (inner) { inner[0] = innerMode(mode, state).mode; }
  7559. var style = mode.token(stream, state);
  7560. if (stream.pos > stream.start) { return style }
  7561. }
  7562. throw new Error("Mode " + mode.name + " failed to advance stream.")
  7563. }
  7564. // Utility for getTokenAt and getLineTokens
  7565. function takeToken(cm, pos, precise, asArray) {
  7566. var getObj = function (copy) { return ({
  7567. start: stream.start, end: stream.pos,
  7568. string: stream.current(),
  7569. type: style || null,
  7570. state: copy ? copyState(doc.mode, state) : state
  7571. }); };
  7572. var doc = cm.doc, mode = doc.mode, style;
  7573. pos = clipPos(doc, pos);
  7574. var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);
  7575. var stream = new StringStream(line.text, cm.options.tabSize), tokens;
  7576. if (asArray) { tokens = []; }
  7577. while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
  7578. stream.start = stream.pos;
  7579. style = readToken(mode, stream, state);
  7580. if (asArray) { tokens.push(getObj(true)); }
  7581. }
  7582. return asArray ? tokens : getObj()
  7583. }
  7584. function extractLineClasses(type, output) {
  7585. if (type) { for (;;) {
  7586. var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
  7587. if (!lineClass) { break }
  7588. type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
  7589. var prop = lineClass[1] ? "bgClass" : "textClass";
  7590. if (output[prop] == null)
  7591. { output[prop] = lineClass[2]; }
  7592. else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
  7593. { output[prop] += " " + lineClass[2]; }
  7594. } }
  7595. return type
  7596. }
  7597. // Run the given mode's parser over a line, calling f for each token.
  7598. function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
  7599. var flattenSpans = mode.flattenSpans;
  7600. if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
  7601. var curStart = 0, curStyle = null;
  7602. var stream = new StringStream(text, cm.options.tabSize), style;
  7603. var inner = cm.options.addModeClass && [null];
  7604. if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses); }
  7605. while (!stream.eol()) {
  7606. if (stream.pos > cm.options.maxHighlightLength) {
  7607. flattenSpans = false;
  7608. if (forceToEnd) { processLine(cm, text, state, stream.pos); }
  7609. stream.pos = text.length;
  7610. style = null;
  7611. } else {
  7612. style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);
  7613. }
  7614. if (inner) {
  7615. var mName = inner[0].name;
  7616. if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
  7617. }
  7618. if (!flattenSpans || curStyle != style) {
  7619. while (curStart < stream.start) {
  7620. curStart = Math.min(stream.start, curStart + 5000);
  7621. f(curStart, curStyle);
  7622. }
  7623. curStyle = style;
  7624. }
  7625. stream.start = stream.pos;
  7626. }
  7627. while (curStart < stream.pos) {
  7628. // Webkit seems to refuse to render text nodes longer than 57444
  7629. // characters, and returns inaccurate measurements in nodes
  7630. // starting around 5000 chars.
  7631. var pos = Math.min(stream.pos, curStart + 5000);
  7632. f(pos, curStyle);
  7633. curStart = pos;
  7634. }
  7635. }
  7636. // Finds the line to start with when starting a parse. Tries to
  7637. // find a line with a stateAfter, so that it can start with a
  7638. // valid state. If that fails, it returns the line with the
  7639. // smallest indentation, which tends to need the least context to
  7640. // parse correctly.
  7641. function findStartLine(cm, n, precise) {
  7642. var minindent, minline, doc = cm.doc;
  7643. var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
  7644. for (var search = n; search > lim; --search) {
  7645. if (search <= doc.first) { return doc.first }
  7646. var line = getLine(doc, search - 1);
  7647. if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
  7648. var indented = countColumn(line.text, null, cm.options.tabSize);
  7649. if (minline == null || minindent > indented) {
  7650. minline = search - 1;
  7651. minindent = indented;
  7652. }
  7653. }
  7654. return minline
  7655. }
  7656. // LINE DATA STRUCTURE
  7657. // Line objects. These hold state related to a line, including
  7658. // highlighting info (the styles array).
  7659. var Line = function(text, markedSpans, estimateHeight) {
  7660. this.text = text;
  7661. attachMarkedSpans(this, markedSpans);
  7662. this.height = estimateHeight ? estimateHeight(this) : 1;
  7663. };
  7664. Line.prototype.lineNo = function () { return lineNo(this) };
  7665. eventMixin(Line);
  7666. // Change the content (text, markers) of a line. Automatically
  7667. // invalidates cached information and tries to re-estimate the
  7668. // line's height.
  7669. function updateLine(line, text, markedSpans, estimateHeight) {
  7670. line.text = text;
  7671. if (line.stateAfter) { line.stateAfter = null; }
  7672. if (line.styles) { line.styles = null; }
  7673. if (line.order != null) { line.order = null; }
  7674. detachMarkedSpans(line);
  7675. attachMarkedSpans(line, markedSpans);
  7676. var estHeight = estimateHeight ? estimateHeight(line) : 1;
  7677. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  7678. }
  7679. // Detach a line from the document tree and its markers.
  7680. function cleanUpLine(line) {
  7681. line.parent = null;
  7682. detachMarkedSpans(line);
  7683. }
  7684. // Convert a style as returned by a mode (either null, or a string
  7685. // containing one or more styles) to a CSS style. This is cached,
  7686. // and also looks for line-wide styles.
  7687. var styleToClassCache = {};
  7688. var styleToClassCacheWithMode = {};
  7689. function interpretTokenStyle(style, options) {
  7690. if (!style || /^\s*$/.test(style)) { return null }
  7691. var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
  7692. return cache[style] ||
  7693. (cache[style] = style.replace(/\S+/g, "cm-$&"))
  7694. }
  7695. // Render the DOM representation of the text of a line. Also builds
  7696. // up a 'line map', which points at the DOM nodes that represent
  7697. // specific stretches of text, and is used by the measuring code.
  7698. // The returned object contains the DOM node, this map, and
  7699. // information about line-wide styles that were set by the mode.
  7700. function buildLineContent(cm, lineView) {
  7701. // The padding-right forces the element to have a 'border', which
  7702. // is needed on Webkit to be able to get line-level bounding
  7703. // rectangles for it (in measureChar).
  7704. var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
  7705. var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
  7706. col: 0, pos: 0, cm: cm,
  7707. trailingSpace: false,
  7708. splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")};
  7709. lineView.measure = {};
  7710. // Iterate over the logical lines that make up this visual line.
  7711. for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
  7712. var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
  7713. builder.pos = 0;
  7714. builder.addToken = buildToken;
  7715. // Optionally wire in some hacks into the token-rendering
  7716. // algorithm, to deal with browser quirks.
  7717. if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
  7718. { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
  7719. builder.map = [];
  7720. var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
  7721. insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
  7722. if (line.styleClasses) {
  7723. if (line.styleClasses.bgClass)
  7724. { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
  7725. if (line.styleClasses.textClass)
  7726. { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
  7727. }
  7728. // Ensure at least a single node is present, for measuring.
  7729. if (builder.map.length == 0)
  7730. { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
  7731. // Store the map and a cache object for the current logical line
  7732. if (i == 0) {
  7733. lineView.measure.map = builder.map;
  7734. lineView.measure.cache = {};
  7735. } else {
  7736. (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
  7737. ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
  7738. }
  7739. }
  7740. // See issue #2901
  7741. if (webkit) {
  7742. var last = builder.content.lastChild;
  7743. if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
  7744. { builder.content.className = "cm-tab-wrap-hack"; }
  7745. }
  7746. signal(cm, "renderLine", cm, lineView.line, builder.pre);
  7747. if (builder.pre.className)
  7748. { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
  7749. return builder
  7750. }
  7751. function defaultSpecialCharPlaceholder(ch) {
  7752. var token = elt("span", "\u2022", "cm-invalidchar");
  7753. token.title = "\\u" + ch.charCodeAt(0).toString(16);
  7754. token.setAttribute("aria-label", token.title);
  7755. return token
  7756. }
  7757. // Build up the DOM representation for a single token, and add it to
  7758. // the line map. Takes care to render special characters separately.
  7759. function buildToken(builder, text, style, startStyle, endStyle, title, css) {
  7760. if (!text) { return }
  7761. var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
  7762. var special = builder.cm.state.specialChars, mustWrap = false;
  7763. var content;
  7764. if (!special.test(text)) {
  7765. builder.col += text.length;
  7766. content = document.createTextNode(displayText);
  7767. builder.map.push(builder.pos, builder.pos + text.length, content);
  7768. if (ie && ie_version < 9) { mustWrap = true; }
  7769. builder.pos += text.length;
  7770. } else {
  7771. content = document.createDocumentFragment();
  7772. var pos = 0;
  7773. while (true) {
  7774. special.lastIndex = pos;
  7775. var m = special.exec(text);
  7776. var skipped = m ? m.index - pos : text.length - pos;
  7777. if (skipped) {
  7778. var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
  7779. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
  7780. else { content.appendChild(txt); }
  7781. builder.map.push(builder.pos, builder.pos + skipped, txt);
  7782. builder.col += skipped;
  7783. builder.pos += skipped;
  7784. }
  7785. if (!m) { break }
  7786. pos += skipped + 1;
  7787. var txt$1 = (void 0);
  7788. if (m[0] == "\t") {
  7789. var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
  7790. txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
  7791. txt$1.setAttribute("role", "presentation");
  7792. txt$1.setAttribute("cm-text", "\t");
  7793. builder.col += tabWidth;
  7794. } else if (m[0] == "\r" || m[0] == "\n") {
  7795. txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
  7796. txt$1.setAttribute("cm-text", m[0]);
  7797. builder.col += 1;
  7798. } else {
  7799. txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
  7800. txt$1.setAttribute("cm-text", m[0]);
  7801. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
  7802. else { content.appendChild(txt$1); }
  7803. builder.col += 1;
  7804. }
  7805. builder.map.push(builder.pos, builder.pos + 1, txt$1);
  7806. builder.pos++;
  7807. }
  7808. }
  7809. builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
  7810. if (style || startStyle || endStyle || mustWrap || css) {
  7811. var fullStyle = style || "";
  7812. if (startStyle) { fullStyle += startStyle; }
  7813. if (endStyle) { fullStyle += endStyle; }
  7814. var token = elt("span", [content], fullStyle, css);
  7815. if (title) { token.title = title; }
  7816. return builder.content.appendChild(token)
  7817. }
  7818. builder.content.appendChild(content);
  7819. }
  7820. function splitSpaces(text, trailingBefore) {
  7821. if (text.length > 1 && !/ /.test(text)) { return text }
  7822. var spaceBefore = trailingBefore, result = "";
  7823. for (var i = 0; i < text.length; i++) {
  7824. var ch = text.charAt(i);
  7825. if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
  7826. { ch = "\u00a0"; }
  7827. result += ch;
  7828. spaceBefore = ch == " ";
  7829. }
  7830. return result
  7831. }
  7832. // Work around nonsense dimensions being reported for stretches of
  7833. // right-to-left text.
  7834. function buildTokenBadBidi(inner, order) {
  7835. return function (builder, text, style, startStyle, endStyle, title, css) {
  7836. style = style ? style + " cm-force-border" : "cm-force-border";
  7837. var start = builder.pos, end = start + text.length;
  7838. for (;;) {
  7839. // Find the part that overlaps with the start of this text
  7840. var part = (void 0);
  7841. for (var i = 0; i < order.length; i++) {
  7842. part = order[i];
  7843. if (part.to > start && part.from <= start) { break }
  7844. }
  7845. if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
  7846. inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);
  7847. startStyle = null;
  7848. text = text.slice(part.to - start);
  7849. start = part.to;
  7850. }
  7851. }
  7852. }
  7853. function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
  7854. var widget = !ignoreWidget && marker.widgetNode;
  7855. if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
  7856. if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
  7857. if (!widget)
  7858. { widget = builder.content.appendChild(document.createElement("span")); }
  7859. widget.setAttribute("cm-marker", marker.id);
  7860. }
  7861. if (widget) {
  7862. builder.cm.display.input.setUneditable(widget);
  7863. builder.content.appendChild(widget);
  7864. }
  7865. builder.pos += size;
  7866. builder.trailingSpace = false;
  7867. }
  7868. // Outputs a number of spans to make up a line, taking highlighting
  7869. // and marked text into account.
  7870. function insertLineContent(line, builder, styles) {
  7871. var spans = line.markedSpans, allText = line.text, at = 0;
  7872. if (!spans) {
  7873. for (var i$1 = 1; i$1 < styles.length; i$1+=2)
  7874. { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
  7875. return
  7876. }
  7877. var len = allText.length, pos = 0, i = 1, text = "", style, css;
  7878. var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
  7879. for (;;) {
  7880. if (nextChange == pos) { // Update current marker set
  7881. spanStyle = spanEndStyle = spanStartStyle = title = css = "";
  7882. collapsed = null; nextChange = Infinity;
  7883. var foundBookmarks = [], endStyles = (void 0);
  7884. for (var j = 0; j < spans.length; ++j) {
  7885. var sp = spans[j], m = sp.marker;
  7886. if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
  7887. foundBookmarks.push(m);
  7888. } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
  7889. if (sp.to != null && sp.to != pos && nextChange > sp.to) {
  7890. nextChange = sp.to;
  7891. spanEndStyle = "";
  7892. }
  7893. if (m.className) { spanStyle += " " + m.className; }
  7894. if (m.css) { css = (css ? css + ";" : "") + m.css; }
  7895. if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
  7896. if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
  7897. if (m.title && !title) { title = m.title; }
  7898. if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
  7899. { collapsed = sp; }
  7900. } else if (sp.from > pos && nextChange > sp.from) {
  7901. nextChange = sp.from;
  7902. }
  7903. }
  7904. if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
  7905. { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
  7906. if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
  7907. { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
  7908. if (collapsed && (collapsed.from || 0) == pos) {
  7909. buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
  7910. collapsed.marker, collapsed.from == null);
  7911. if (collapsed.to == null) { return }
  7912. if (collapsed.to == pos) { collapsed = false; }
  7913. }
  7914. }
  7915. if (pos >= len) { break }
  7916. var upto = Math.min(len, nextChange);
  7917. while (true) {
  7918. if (text) {
  7919. var end = pos + text.length;
  7920. if (!collapsed) {
  7921. var tokenText = end > upto ? text.slice(0, upto - pos) : text;
  7922. builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
  7923. spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css);
  7924. }
  7925. if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
  7926. pos = end;
  7927. spanStartStyle = "";
  7928. }
  7929. text = allText.slice(at, at = styles[i++]);
  7930. style = interpretTokenStyle(styles[i++], builder.cm.options);
  7931. }
  7932. }
  7933. }
  7934. // These objects are used to represent the visible (currently drawn)
  7935. // part of the document. A LineView may correspond to multiple
  7936. // logical lines, if those are connected by collapsed ranges.
  7937. function LineView(doc, line, lineN) {
  7938. // The starting line
  7939. this.line = line;
  7940. // Continuing lines, if any
  7941. this.rest = visualLineContinued(line);
  7942. // Number of logical lines in this visual line
  7943. this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
  7944. this.node = this.text = null;
  7945. this.hidden = lineIsHidden(doc, line);
  7946. }
  7947. // Create a range of LineView objects for the given lines.
  7948. function buildViewArray(cm, from, to) {
  7949. var array = [], nextPos;
  7950. for (var pos = from; pos < to; pos = nextPos) {
  7951. var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
  7952. nextPos = pos + view.size;
  7953. array.push(view);
  7954. }
  7955. return array
  7956. }
  7957. var operationGroup = null;
  7958. function pushOperation(op) {
  7959. if (operationGroup) {
  7960. operationGroup.ops.push(op);
  7961. } else {
  7962. op.ownsGroup = operationGroup = {
  7963. ops: [op],
  7964. delayedCallbacks: []
  7965. };
  7966. }
  7967. }
  7968. function fireCallbacksForOps(group) {
  7969. // Calls delayed callbacks and cursorActivity handlers until no
  7970. // new ones appear
  7971. var callbacks = group.delayedCallbacks, i = 0;
  7972. do {
  7973. for (; i < callbacks.length; i++)
  7974. { callbacks[i].call(null); }
  7975. for (var j = 0; j < group.ops.length; j++) {
  7976. var op = group.ops[j];
  7977. if (op.cursorActivityHandlers)
  7978. { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
  7979. { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
  7980. }
  7981. } while (i < callbacks.length)
  7982. }
  7983. function finishOperation(op, endCb) {
  7984. var group = op.ownsGroup;
  7985. if (!group) { return }
  7986. try { fireCallbacksForOps(group); }
  7987. finally {
  7988. operationGroup = null;
  7989. endCb(group);
  7990. }
  7991. }
  7992. var orphanDelayedCallbacks = null;
  7993. // Often, we want to signal events at a point where we are in the
  7994. // middle of some work, but don't want the handler to start calling
  7995. // other methods on the editor, which might be in an inconsistent
  7996. // state or simply not expect any other events to happen.
  7997. // signalLater looks whether there are any handlers, and schedules
  7998. // them to be executed when the last operation ends, or, if no
  7999. // operation is active, when a timeout fires.
  8000. function signalLater(emitter, type /*, values...*/) {
  8001. var arr = getHandlers(emitter, type);
  8002. if (!arr.length) { return }
  8003. var args = Array.prototype.slice.call(arguments, 2), list;
  8004. if (operationGroup) {
  8005. list = operationGroup.delayedCallbacks;
  8006. } else if (orphanDelayedCallbacks) {
  8007. list = orphanDelayedCallbacks;
  8008. } else {
  8009. list = orphanDelayedCallbacks = [];
  8010. setTimeout(fireOrphanDelayed, 0);
  8011. }
  8012. var loop = function ( i ) {
  8013. list.push(function () { return arr[i].apply(null, args); });
  8014. };
  8015. for (var i = 0; i < arr.length; ++i)
  8016. loop( i );
  8017. }
  8018. function fireOrphanDelayed() {
  8019. var delayed = orphanDelayedCallbacks;
  8020. orphanDelayedCallbacks = null;
  8021. for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
  8022. }
  8023. // When an aspect of a line changes, a string is added to
  8024. // lineView.changes. This updates the relevant part of the line's
  8025. // DOM structure.
  8026. function updateLineForChanges(cm, lineView, lineN, dims) {
  8027. for (var j = 0; j < lineView.changes.length; j++) {
  8028. var type = lineView.changes[j];
  8029. if (type == "text") { updateLineText(cm, lineView); }
  8030. else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
  8031. else if (type == "class") { updateLineClasses(cm, lineView); }
  8032. else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
  8033. }
  8034. lineView.changes = null;
  8035. }
  8036. // Lines with gutter elements, widgets or a background class need to
  8037. // be wrapped, and have the extra elements added to the wrapper div
  8038. function ensureLineWrapped(lineView) {
  8039. if (lineView.node == lineView.text) {
  8040. lineView.node = elt("div", null, null, "position: relative");
  8041. if (lineView.text.parentNode)
  8042. { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
  8043. lineView.node.appendChild(lineView.text);
  8044. if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
  8045. }
  8046. return lineView.node
  8047. }
  8048. function updateLineBackground(cm, lineView) {
  8049. var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
  8050. if (cls) { cls += " CodeMirror-linebackground"; }
  8051. if (lineView.background) {
  8052. if (cls) { lineView.background.className = cls; }
  8053. else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
  8054. } else if (cls) {
  8055. var wrap = ensureLineWrapped(lineView);
  8056. lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
  8057. cm.display.input.setUneditable(lineView.background);
  8058. }
  8059. }
  8060. // Wrapper around buildLineContent which will reuse the structure
  8061. // in display.externalMeasured when possible.
  8062. function getLineContent(cm, lineView) {
  8063. var ext = cm.display.externalMeasured;
  8064. if (ext && ext.line == lineView.line) {
  8065. cm.display.externalMeasured = null;
  8066. lineView.measure = ext.measure;
  8067. return ext.built
  8068. }
  8069. return buildLineContent(cm, lineView)
  8070. }
  8071. // Redraw the line's text. Interacts with the background and text
  8072. // classes because the mode may output tokens that influence these
  8073. // classes.
  8074. function updateLineText(cm, lineView) {
  8075. var cls = lineView.text.className;
  8076. var built = getLineContent(cm, lineView);
  8077. if (lineView.text == lineView.node) { lineView.node = built.pre; }
  8078. lineView.text.parentNode.replaceChild(built.pre, lineView.text);
  8079. lineView.text = built.pre;
  8080. if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
  8081. lineView.bgClass = built.bgClass;
  8082. lineView.textClass = built.textClass;
  8083. updateLineClasses(cm, lineView);
  8084. } else if (cls) {
  8085. lineView.text.className = cls;
  8086. }
  8087. }
  8088. function updateLineClasses(cm, lineView) {
  8089. updateLineBackground(cm, lineView);
  8090. if (lineView.line.wrapClass)
  8091. { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
  8092. else if (lineView.node != lineView.text)
  8093. { lineView.node.className = ""; }
  8094. var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
  8095. lineView.text.className = textClass || "";
  8096. }
  8097. function updateLineGutter(cm, lineView, lineN, dims) {
  8098. if (lineView.gutter) {
  8099. lineView.node.removeChild(lineView.gutter);
  8100. lineView.gutter = null;
  8101. }
  8102. if (lineView.gutterBackground) {
  8103. lineView.node.removeChild(lineView.gutterBackground);
  8104. lineView.gutterBackground = null;
  8105. }
  8106. if (lineView.line.gutterClass) {
  8107. var wrap = ensureLineWrapped(lineView);
  8108. lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
  8109. ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
  8110. cm.display.input.setUneditable(lineView.gutterBackground);
  8111. wrap.insertBefore(lineView.gutterBackground, lineView.text);
  8112. }
  8113. var markers = lineView.line.gutterMarkers;
  8114. if (cm.options.lineNumbers || markers) {
  8115. var wrap$1 = ensureLineWrapped(lineView);
  8116. var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
  8117. cm.display.input.setUneditable(gutterWrap);
  8118. wrap$1.insertBefore(gutterWrap, lineView.text);
  8119. if (lineView.line.gutterClass)
  8120. { gutterWrap.className += " " + lineView.line.gutterClass; }
  8121. if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
  8122. { lineView.lineNumber = gutterWrap.appendChild(
  8123. elt("div", lineNumberFor(cm.options, lineN),
  8124. "CodeMirror-linenumber CodeMirror-gutter-elt",
  8125. ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
  8126. if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
  8127. var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
  8128. if (found)
  8129. { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
  8130. ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
  8131. } }
  8132. }
  8133. }
  8134. function updateLineWidgets(cm, lineView, dims) {
  8135. if (lineView.alignable) { lineView.alignable = null; }
  8136. for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
  8137. next = node.nextSibling;
  8138. if (node.className == "CodeMirror-linewidget")
  8139. { lineView.node.removeChild(node); }
  8140. }
  8141. insertLineWidgets(cm, lineView, dims);
  8142. }
  8143. // Build a line's DOM representation from scratch
  8144. function buildLineElement(cm, lineView, lineN, dims) {
  8145. var built = getLineContent(cm, lineView);
  8146. lineView.text = lineView.node = built.pre;
  8147. if (built.bgClass) { lineView.bgClass = built.bgClass; }
  8148. if (built.textClass) { lineView.textClass = built.textClass; }
  8149. updateLineClasses(cm, lineView);
  8150. updateLineGutter(cm, lineView, lineN, dims);
  8151. insertLineWidgets(cm, lineView, dims);
  8152. return lineView.node
  8153. }
  8154. // A lineView may contain multiple logical lines (when merged by
  8155. // collapsed spans). The widgets for all of them need to be drawn.
  8156. function insertLineWidgets(cm, lineView, dims) {
  8157. insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
  8158. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  8159. { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
  8160. }
  8161. function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
  8162. if (!line.widgets) { return }
  8163. var wrap = ensureLineWrapped(lineView);
  8164. for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
  8165. var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
  8166. if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
  8167. positionLineWidget(widget, node, lineView, dims);
  8168. cm.display.input.setUneditable(node);
  8169. if (allowAbove && widget.above)
  8170. { wrap.insertBefore(node, lineView.gutter || lineView.text); }
  8171. else
  8172. { wrap.appendChild(node); }
  8173. signalLater(widget, "redraw");
  8174. }
  8175. }
  8176. function positionLineWidget(widget, node, lineView, dims) {
  8177. if (widget.noHScroll) {
  8178. (lineView.alignable || (lineView.alignable = [])).push(node);
  8179. var width = dims.wrapperWidth;
  8180. node.style.left = dims.fixedPos + "px";
  8181. if (!widget.coverGutter) {
  8182. width -= dims.gutterTotalWidth;
  8183. node.style.paddingLeft = dims.gutterTotalWidth + "px";
  8184. }
  8185. node.style.width = width + "px";
  8186. }
  8187. if (widget.coverGutter) {
  8188. node.style.zIndex = 5;
  8189. node.style.position = "relative";
  8190. if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
  8191. }
  8192. }
  8193. function widgetHeight(widget) {
  8194. if (widget.height != null) { return widget.height }
  8195. var cm = widget.doc.cm;
  8196. if (!cm) { return 0 }
  8197. if (!contains(document.body, widget.node)) {
  8198. var parentStyle = "position: relative;";
  8199. if (widget.coverGutter)
  8200. { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
  8201. if (widget.noHScroll)
  8202. { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
  8203. removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
  8204. }
  8205. return widget.height = widget.node.parentNode.offsetHeight
  8206. }
  8207. // Return true when the given mouse event happened in a widget
  8208. function eventInWidget(display, e) {
  8209. for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
  8210. if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
  8211. (n.parentNode == display.sizer && n != display.mover))
  8212. { return true }
  8213. }
  8214. }
  8215. // POSITION MEASUREMENT
  8216. function paddingTop(display) {return display.lineSpace.offsetTop}
  8217. function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
  8218. function paddingH(display) {
  8219. if (display.cachedPaddingH) { return display.cachedPaddingH }
  8220. var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
  8221. var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
  8222. var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
  8223. if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
  8224. return data
  8225. }
  8226. function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
  8227. function displayWidth(cm) {
  8228. return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
  8229. }
  8230. function displayHeight(cm) {
  8231. return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
  8232. }
  8233. // Ensure the lineView.wrapping.heights array is populated. This is
  8234. // an array of bottom offsets for the lines that make up a drawn
  8235. // line. When lineWrapping is on, there might be more than one
  8236. // height.
  8237. function ensureLineHeights(cm, lineView, rect) {
  8238. var wrapping = cm.options.lineWrapping;
  8239. var curWidth = wrapping && displayWidth(cm);
  8240. if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
  8241. var heights = lineView.measure.heights = [];
  8242. if (wrapping) {
  8243. lineView.measure.width = curWidth;
  8244. var rects = lineView.text.firstChild.getClientRects();
  8245. for (var i = 0; i < rects.length - 1; i++) {
  8246. var cur = rects[i], next = rects[i + 1];
  8247. if (Math.abs(cur.bottom - next.bottom) > 2)
  8248. { heights.push((cur.bottom + next.top) / 2 - rect.top); }
  8249. }
  8250. }
  8251. heights.push(rect.bottom - rect.top);
  8252. }
  8253. }
  8254. // Find a line map (mapping character offsets to text nodes) and a
  8255. // measurement cache for the given line number. (A line view might
  8256. // contain multiple lines when collapsed ranges are present.)
  8257. function mapFromLineView(lineView, line, lineN) {
  8258. if (lineView.line == line)
  8259. { return {map: lineView.measure.map, cache: lineView.measure.cache} }
  8260. for (var i = 0; i < lineView.rest.length; i++)
  8261. { if (lineView.rest[i] == line)
  8262. { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
  8263. for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
  8264. { if (lineNo(lineView.rest[i$1]) > lineN)
  8265. { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
  8266. }
  8267. // Render a line into the hidden node display.externalMeasured. Used
  8268. // when measurement is needed for a line that's not in the viewport.
  8269. function updateExternalMeasurement(cm, line) {
  8270. line = visualLine(line);
  8271. var lineN = lineNo(line);
  8272. var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
  8273. view.lineN = lineN;
  8274. var built = view.built = buildLineContent(cm, view);
  8275. view.text = built.pre;
  8276. removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
  8277. return view
  8278. }
  8279. // Get a {top, bottom, left, right} box (in line-local coordinates)
  8280. // for a given character.
  8281. function measureChar(cm, line, ch, bias) {
  8282. return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
  8283. }
  8284. // Find a line view that corresponds to the given line number.
  8285. function findViewForLine(cm, lineN) {
  8286. if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
  8287. { return cm.display.view[findViewIndex(cm, lineN)] }
  8288. var ext = cm.display.externalMeasured;
  8289. if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
  8290. { return ext }
  8291. }
  8292. // Measurement can be split in two steps, the set-up work that
  8293. // applies to the whole line, and the measurement of the actual
  8294. // character. Functions like coordsChar, that need to do a lot of
  8295. // measurements in a row, can thus ensure that the set-up work is
  8296. // only done once.
  8297. function prepareMeasureForLine(cm, line) {
  8298. var lineN = lineNo(line);
  8299. var view = findViewForLine(cm, lineN);
  8300. if (view && !view.text) {
  8301. view = null;
  8302. } else if (view && view.changes) {
  8303. updateLineForChanges(cm, view, lineN, getDimensions(cm));
  8304. cm.curOp.forceUpdate = true;
  8305. }
  8306. if (!view)
  8307. { view = updateExternalMeasurement(cm, line); }
  8308. var info = mapFromLineView(view, line, lineN);
  8309. return {
  8310. line: line, view: view, rect: null,
  8311. map: info.map, cache: info.cache, before: info.before,
  8312. hasHeights: false
  8313. }
  8314. }
  8315. // Given a prepared measurement object, measures the position of an
  8316. // actual character (or fetches it from the cache).
  8317. function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
  8318. if (prepared.before) { ch = -1; }
  8319. var key = ch + (bias || ""), found;
  8320. if (prepared.cache.hasOwnProperty(key)) {
  8321. found = prepared.cache[key];
  8322. } else {
  8323. if (!prepared.rect)
  8324. { prepared.rect = prepared.view.text.getBoundingClientRect(); }
  8325. if (!prepared.hasHeights) {
  8326. ensureLineHeights(cm, prepared.view, prepared.rect);
  8327. prepared.hasHeights = true;
  8328. }
  8329. found = measureCharInner(cm, prepared, ch, bias);
  8330. if (!found.bogus) { prepared.cache[key] = found; }
  8331. }
  8332. return {left: found.left, right: found.right,
  8333. top: varHeight ? found.rtop : found.top,
  8334. bottom: varHeight ? found.rbottom : found.bottom}
  8335. }
  8336. var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
  8337. function nodeAndOffsetInLineMap(map$$1, ch, bias) {
  8338. var node, start, end, collapse, mStart, mEnd;
  8339. // First, search the line map for the text node corresponding to,
  8340. // or closest to, the target character.
  8341. for (var i = 0; i < map$$1.length; i += 3) {
  8342. mStart = map$$1[i];
  8343. mEnd = map$$1[i + 1];
  8344. if (ch < mStart) {
  8345. start = 0; end = 1;
  8346. collapse = "left";
  8347. } else if (ch < mEnd) {
  8348. start = ch - mStart;
  8349. end = start + 1;
  8350. } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
  8351. end = mEnd - mStart;
  8352. start = end - 1;
  8353. if (ch >= mEnd) { collapse = "right"; }
  8354. }
  8355. if (start != null) {
  8356. node = map$$1[i + 2];
  8357. if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
  8358. { collapse = bias; }
  8359. if (bias == "left" && start == 0)
  8360. { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
  8361. node = map$$1[(i -= 3) + 2];
  8362. collapse = "left";
  8363. } }
  8364. if (bias == "right" && start == mEnd - mStart)
  8365. { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
  8366. node = map$$1[(i += 3) + 2];
  8367. collapse = "right";
  8368. } }
  8369. break
  8370. }
  8371. }
  8372. return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
  8373. }
  8374. function getUsefulRect(rects, bias) {
  8375. var rect = nullRect;
  8376. if (bias == "left") { for (var i = 0; i < rects.length; i++) {
  8377. if ((rect = rects[i]).left != rect.right) { break }
  8378. } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
  8379. if ((rect = rects[i$1]).left != rect.right) { break }
  8380. } }
  8381. return rect
  8382. }
  8383. function measureCharInner(cm, prepared, ch, bias) {
  8384. var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
  8385. var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
  8386. var rect;
  8387. if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
  8388. for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
  8389. while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
  8390. while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
  8391. if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
  8392. { rect = node.parentNode.getBoundingClientRect(); }
  8393. else
  8394. { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
  8395. if (rect.left || rect.right || start == 0) { break }
  8396. end = start;
  8397. start = start - 1;
  8398. collapse = "right";
  8399. }
  8400. if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
  8401. } else { // If it is a widget, simply get the box for the whole widget.
  8402. if (start > 0) { collapse = bias = "right"; }
  8403. var rects;
  8404. if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
  8405. { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
  8406. else
  8407. { rect = node.getBoundingClientRect(); }
  8408. }
  8409. if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
  8410. var rSpan = node.parentNode.getClientRects()[0];
  8411. if (rSpan)
  8412. { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
  8413. else
  8414. { rect = nullRect; }
  8415. }
  8416. var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
  8417. var mid = (rtop + rbot) / 2;
  8418. var heights = prepared.view.measure.heights;
  8419. var i = 0;
  8420. for (; i < heights.length - 1; i++)
  8421. { if (mid < heights[i]) { break } }
  8422. var top = i ? heights[i - 1] : 0, bot = heights[i];
  8423. var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
  8424. right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
  8425. top: top, bottom: bot};
  8426. if (!rect.left && !rect.right) { result.bogus = true; }
  8427. if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
  8428. return result
  8429. }
  8430. // Work around problem with bounding client rects on ranges being
  8431. // returned incorrectly when zoomed on IE10 and below.
  8432. function maybeUpdateRectForZooming(measure, rect) {
  8433. if (!window.screen || screen.logicalXDPI == null ||
  8434. screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
  8435. { return rect }
  8436. var scaleX = screen.logicalXDPI / screen.deviceXDPI;
  8437. var scaleY = screen.logicalYDPI / screen.deviceYDPI;
  8438. return {left: rect.left * scaleX, right: rect.right * scaleX,
  8439. top: rect.top * scaleY, bottom: rect.bottom * scaleY}
  8440. }
  8441. function clearLineMeasurementCacheFor(lineView) {
  8442. if (lineView.measure) {
  8443. lineView.measure.cache = {};
  8444. lineView.measure.heights = null;
  8445. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  8446. { lineView.measure.caches[i] = {}; } }
  8447. }
  8448. }
  8449. function clearLineMeasurementCache(cm) {
  8450. cm.display.externalMeasure = null;
  8451. removeChildren(cm.display.lineMeasure);
  8452. for (var i = 0; i < cm.display.view.length; i++)
  8453. { clearLineMeasurementCacheFor(cm.display.view[i]); }
  8454. }
  8455. function clearCaches(cm) {
  8456. clearLineMeasurementCache(cm);
  8457. cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
  8458. if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
  8459. cm.display.lineNumChars = null;
  8460. }
  8461. function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft }
  8462. function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop }
  8463. // Converts a {top, bottom, left, right} box from line-local
  8464. // coordinates into another coordinate system. Context may be one of
  8465. // "line", "div" (display.lineDiv), "local"./null (editor), "window",
  8466. // or "page".
  8467. function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
  8468. if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
  8469. var size = widgetHeight(lineObj.widgets[i]);
  8470. rect.top += size; rect.bottom += size;
  8471. } } }
  8472. if (context == "line") { return rect }
  8473. if (!context) { context = "local"; }
  8474. var yOff = heightAtLine(lineObj);
  8475. if (context == "local") { yOff += paddingTop(cm.display); }
  8476. else { yOff -= cm.display.viewOffset; }
  8477. if (context == "page" || context == "window") {
  8478. var lOff = cm.display.lineSpace.getBoundingClientRect();
  8479. yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
  8480. var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
  8481. rect.left += xOff; rect.right += xOff;
  8482. }
  8483. rect.top += yOff; rect.bottom += yOff;
  8484. return rect
  8485. }
  8486. // Coverts a box from "div" coords to another coordinate system.
  8487. // Context may be "window", "page", "div", or "local"./null.
  8488. function fromCoordSystem(cm, coords, context) {
  8489. if (context == "div") { return coords }
  8490. var left = coords.left, top = coords.top;
  8491. // First move into "page" coordinate system
  8492. if (context == "page") {
  8493. left -= pageScrollX();
  8494. top -= pageScrollY();
  8495. } else if (context == "local" || !context) {
  8496. var localBox = cm.display.sizer.getBoundingClientRect();
  8497. left += localBox.left;
  8498. top += localBox.top;
  8499. }
  8500. var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
  8501. return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
  8502. }
  8503. function charCoords(cm, pos, context, lineObj, bias) {
  8504. if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
  8505. return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
  8506. }
  8507. // Returns a box for a given cursor position, which may have an
  8508. // 'other' property containing the position of the secondary cursor
  8509. // on a bidi boundary.
  8510. // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
  8511. // and after `char - 1` in writing order of `char - 1`
  8512. // A cursor Pos(line, char, "after") is on the same visual line as `char`
  8513. // and before `char` in writing order of `char`
  8514. // Examples (upper-case letters are RTL, lower-case are LTR):
  8515. // Pos(0, 1, ...)
  8516. // before after
  8517. // ab a|b a|b
  8518. // aB a|B aB|
  8519. // Ab |Ab A|b
  8520. // AB B|A B|A
  8521. // Every position after the last character on a line is considered to stick
  8522. // to the last character on the line.
  8523. function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
  8524. lineObj = lineObj || getLine(cm.doc, pos.line);
  8525. if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
  8526. function get(ch, right) {
  8527. var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
  8528. if (right) { m.left = m.right; } else { m.right = m.left; }
  8529. return intoCoordSystem(cm, lineObj, m, context)
  8530. }
  8531. var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
  8532. if (ch >= lineObj.text.length) {
  8533. ch = lineObj.text.length;
  8534. sticky = "before";
  8535. } else if (ch <= 0) {
  8536. ch = 0;
  8537. sticky = "after";
  8538. }
  8539. if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
  8540. function getBidi(ch, partPos, invert) {
  8541. var part = order[partPos], right = (part.level % 2) != 0;
  8542. return get(invert ? ch - 1 : ch, right != invert)
  8543. }
  8544. var partPos = getBidiPartAt(order, ch, sticky);
  8545. var other = bidiOther;
  8546. var val = getBidi(ch, partPos, sticky == "before");
  8547. if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
  8548. return val
  8549. }
  8550. // Used to cheaply estimate the coordinates for a position. Used for
  8551. // intermediate scroll updates.
  8552. function estimateCoords(cm, pos) {
  8553. var left = 0;
  8554. pos = clipPos(cm.doc, pos);
  8555. if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
  8556. var lineObj = getLine(cm.doc, pos.line);
  8557. var top = heightAtLine(lineObj) + paddingTop(cm.display);
  8558. return {left: left, right: left, top: top, bottom: top + lineObj.height}
  8559. }
  8560. // Positions returned by coordsChar contain some extra information.
  8561. // xRel is the relative x position of the input coordinates compared
  8562. // to the found position (so xRel > 0 means the coordinates are to
  8563. // the right of the character position, for example). When outside
  8564. // is true, that means the coordinates lie outside the line's
  8565. // vertical range.
  8566. function PosWithInfo(line, ch, sticky, outside, xRel) {
  8567. var pos = Pos(line, ch, sticky);
  8568. pos.xRel = xRel;
  8569. if (outside) { pos.outside = true; }
  8570. return pos
  8571. }
  8572. // Compute the character position closest to the given coordinates.
  8573. // Input must be lineSpace-local ("div" coordinate system).
  8574. function coordsChar(cm, x, y) {
  8575. var doc = cm.doc;
  8576. y += cm.display.viewOffset;
  8577. if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
  8578. var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
  8579. if (lineN > last)
  8580. { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
  8581. if (x < 0) { x = 0; }
  8582. var lineObj = getLine(doc, lineN);
  8583. for (;;) {
  8584. var found = coordsCharInner(cm, lineObj, lineN, x, y);
  8585. var merged = collapsedSpanAtEnd(lineObj);
  8586. var mergedPos = merged && merged.find(0, true);
  8587. if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
  8588. { lineN = lineNo(lineObj = mergedPos.to.line); }
  8589. else
  8590. { return found }
  8591. }
  8592. }
  8593. function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
  8594. var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); };
  8595. var end = lineObj.text.length;
  8596. var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0);
  8597. end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end);
  8598. return {begin: begin, end: end}
  8599. }
  8600. function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
  8601. var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
  8602. return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
  8603. }
  8604. function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
  8605. y -= heightAtLine(lineObj);
  8606. var begin = 0, end = lineObj.text.length;
  8607. var preparedMeasure = prepareMeasureForLine(cm, lineObj);
  8608. var pos;
  8609. var order = getOrder(lineObj, cm.doc.direction);
  8610. if (order) {
  8611. if (cm.options.lineWrapping) {
  8612. var assign;
  8613. ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign));
  8614. }
  8615. pos = new Pos(lineNo$$1, begin);
  8616. var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left;
  8617. var dir = beginLeft < x ? 1 : -1;
  8618. var prevDiff, diff = beginLeft - x, prevPos;
  8619. do {
  8620. prevDiff = diff;
  8621. prevPos = pos;
  8622. pos = moveVisually(cm, lineObj, pos, dir);
  8623. if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
  8624. pos = prevPos;
  8625. break
  8626. }
  8627. diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x;
  8628. } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
  8629. if (Math.abs(diff) > Math.abs(prevDiff)) {
  8630. if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
  8631. pos = prevPos;
  8632. }
  8633. } else {
  8634. var ch = findFirst(function (ch) {
  8635. var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line");
  8636. if (box.top > y) {
  8637. // For the cursor stickiness
  8638. end = Math.min(ch, end);
  8639. return true
  8640. }
  8641. else if (box.bottom <= y) { return false }
  8642. else if (box.left > x) { return true }
  8643. else if (box.right < x) { return false }
  8644. else { return (x - box.left < box.right - x) }
  8645. }, begin, end);
  8646. ch = skipExtendingChars(lineObj.text, ch, 1);
  8647. pos = new Pos(lineNo$$1, ch, ch == end ? "before" : "after");
  8648. }
  8649. var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure);
  8650. if (y < coords.top || coords.bottom < y) { pos.outside = true; }
  8651. pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0);
  8652. return pos
  8653. }
  8654. var measureText;
  8655. // Compute the default text height.
  8656. function textHeight(display) {
  8657. if (display.cachedTextHeight != null) { return display.cachedTextHeight }
  8658. if (measureText == null) {
  8659. measureText = elt("pre");
  8660. // Measure a bunch of lines, for browsers that compute
  8661. // fractional heights.
  8662. for (var i = 0; i < 49; ++i) {
  8663. measureText.appendChild(document.createTextNode("x"));
  8664. measureText.appendChild(elt("br"));
  8665. }
  8666. measureText.appendChild(document.createTextNode("x"));
  8667. }
  8668. removeChildrenAndAdd(display.measure, measureText);
  8669. var height = measureText.offsetHeight / 50;
  8670. if (height > 3) { display.cachedTextHeight = height; }
  8671. removeChildren(display.measure);
  8672. return height || 1
  8673. }
  8674. // Compute the default character width.
  8675. function charWidth(display) {
  8676. if (display.cachedCharWidth != null) { return display.cachedCharWidth }
  8677. var anchor = elt("span", "xxxxxxxxxx");
  8678. var pre = elt("pre", [anchor]);
  8679. removeChildrenAndAdd(display.measure, pre);
  8680. var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
  8681. if (width > 2) { display.cachedCharWidth = width; }
  8682. return width || 10
  8683. }
  8684. // Do a bulk-read of the DOM positions and sizes needed to draw the
  8685. // view, so that we don't interleave reading and writing to the DOM.
  8686. function getDimensions(cm) {
  8687. var d = cm.display, left = {}, width = {};
  8688. var gutterLeft = d.gutters.clientLeft;
  8689. for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
  8690. left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
  8691. width[cm.options.gutters[i]] = n.clientWidth;
  8692. }
  8693. return {fixedPos: compensateForHScroll(d),
  8694. gutterTotalWidth: d.gutters.offsetWidth,
  8695. gutterLeft: left,
  8696. gutterWidth: width,
  8697. wrapperWidth: d.wrapper.clientWidth}
  8698. }
  8699. // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
  8700. // but using getBoundingClientRect to get a sub-pixel-accurate
  8701. // result.
  8702. function compensateForHScroll(display) {
  8703. return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
  8704. }
  8705. // Returns a function that estimates the height of a line, to use as
  8706. // first approximation until the line becomes visible (and is thus
  8707. // properly measurable).
  8708. function estimateHeight(cm) {
  8709. var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
  8710. var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
  8711. return function (line) {
  8712. if (lineIsHidden(cm.doc, line)) { return 0 }
  8713. var widgetsHeight = 0;
  8714. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
  8715. if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
  8716. } }
  8717. if (wrapping)
  8718. { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
  8719. else
  8720. { return widgetsHeight + th }
  8721. }
  8722. }
  8723. function estimateLineHeights(cm) {
  8724. var doc = cm.doc, est = estimateHeight(cm);
  8725. doc.iter(function (line) {
  8726. var estHeight = est(line);
  8727. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  8728. });
  8729. }
  8730. // Given a mouse event, find the corresponding position. If liberal
  8731. // is false, it checks whether a gutter or scrollbar was clicked,
  8732. // and returns null if it was. forRect is used by rectangular
  8733. // selections, and tries to estimate a character position even for
  8734. // coordinates beyond the right of the text.
  8735. function posFromMouse(cm, e, liberal, forRect) {
  8736. var display = cm.display;
  8737. if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
  8738. var x, y, space = display.lineSpace.getBoundingClientRect();
  8739. // Fails unpredictably on IE[67] when mouse is dragged around quickly.
  8740. try { x = e.clientX - space.left; y = e.clientY - space.top; }
  8741. catch (e) { return null }
  8742. var coords = coordsChar(cm, x, y), line;
  8743. if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
  8744. var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
  8745. coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
  8746. }
  8747. return coords
  8748. }
  8749. // Find the view element corresponding to a given line. Return null
  8750. // when the line isn't visible.
  8751. function findViewIndex(cm, n) {
  8752. if (n >= cm.display.viewTo) { return null }
  8753. n -= cm.display.viewFrom;
  8754. if (n < 0) { return null }
  8755. var view = cm.display.view;
  8756. for (var i = 0; i < view.length; i++) {
  8757. n -= view[i].size;
  8758. if (n < 0) { return i }
  8759. }
  8760. }
  8761. function updateSelection(cm) {
  8762. cm.display.input.showSelection(cm.display.input.prepareSelection());
  8763. }
  8764. function prepareSelection(cm, primary) {
  8765. var doc = cm.doc, result = {};
  8766. var curFragment = result.cursors = document.createDocumentFragment();
  8767. var selFragment = result.selection = document.createDocumentFragment();
  8768. for (var i = 0; i < doc.sel.ranges.length; i++) {
  8769. if (primary === false && i == doc.sel.primIndex) { continue }
  8770. var range$$1 = doc.sel.ranges[i];
  8771. if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
  8772. var collapsed = range$$1.empty();
  8773. if (collapsed || cm.options.showCursorWhenSelecting)
  8774. { drawSelectionCursor(cm, range$$1.head, curFragment); }
  8775. if (!collapsed)
  8776. { drawSelectionRange(cm, range$$1, selFragment); }
  8777. }
  8778. return result
  8779. }
  8780. // Draws a cursor for the given range
  8781. function drawSelectionCursor(cm, head, output) {
  8782. var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
  8783. var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
  8784. cursor.style.left = pos.left + "px";
  8785. cursor.style.top = pos.top + "px";
  8786. cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
  8787. if (pos.other) {
  8788. // Secondary cursor, shown when on a 'jump' in bi-directional text
  8789. var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
  8790. otherCursor.style.display = "";
  8791. otherCursor.style.left = pos.other.left + "px";
  8792. otherCursor.style.top = pos.other.top + "px";
  8793. otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
  8794. }
  8795. }
  8796. // Draws the given range as a highlighted selection
  8797. function drawSelectionRange(cm, range$$1, output) {
  8798. var display = cm.display, doc = cm.doc;
  8799. var fragment = document.createDocumentFragment();
  8800. var padding = paddingH(cm.display), leftSide = padding.left;
  8801. var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
  8802. function add(left, top, width, bottom) {
  8803. if (top < 0) { top = 0; }
  8804. top = Math.round(top);
  8805. bottom = Math.round(bottom);
  8806. fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
  8807. }
  8808. function drawForLine(line, fromArg, toArg) {
  8809. var lineObj = getLine(doc, line);
  8810. var lineLen = lineObj.text.length;
  8811. var start, end;
  8812. function coords(ch, bias) {
  8813. return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
  8814. }
  8815. iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
  8816. var leftPos = coords(from, "left"), rightPos, left, right;
  8817. if (from == to) {
  8818. rightPos = leftPos;
  8819. left = right = leftPos.left;
  8820. } else {
  8821. rightPos = coords(to - 1, "right");
  8822. if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
  8823. left = leftPos.left;
  8824. right = rightPos.right;
  8825. }
  8826. if (fromArg == null && from == 0) { left = leftSide; }
  8827. if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
  8828. add(left, leftPos.top, null, leftPos.bottom);
  8829. left = leftSide;
  8830. if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); }
  8831. }
  8832. if (toArg == null && to == lineLen) { right = rightSide; }
  8833. if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
  8834. { start = leftPos; }
  8835. if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
  8836. { end = rightPos; }
  8837. if (left < leftSide + 1) { left = leftSide; }
  8838. add(left, rightPos.top, right - left, rightPos.bottom);
  8839. });
  8840. return {start: start, end: end}
  8841. }
  8842. var sFrom = range$$1.from(), sTo = range$$1.to();
  8843. if (sFrom.line == sTo.line) {
  8844. drawForLine(sFrom.line, sFrom.ch, sTo.ch);
  8845. } else {
  8846. var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
  8847. var singleVLine = visualLine(fromLine) == visualLine(toLine);
  8848. var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
  8849. var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
  8850. if (singleVLine) {
  8851. if (leftEnd.top < rightStart.top - 2) {
  8852. add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
  8853. add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
  8854. } else {
  8855. add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
  8856. }
  8857. }
  8858. if (leftEnd.bottom < rightStart.top)
  8859. { add(leftSide, leftEnd.bottom, null, rightStart.top); }
  8860. }
  8861. output.appendChild(fragment);
  8862. }
  8863. // Cursor-blinking
  8864. function restartBlink(cm) {
  8865. if (!cm.state.focused) { return }
  8866. var display = cm.display;
  8867. clearInterval(display.blinker);
  8868. var on = true;
  8869. display.cursorDiv.style.visibility = "";
  8870. if (cm.options.cursorBlinkRate > 0)
  8871. { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
  8872. cm.options.cursorBlinkRate); }
  8873. else if (cm.options.cursorBlinkRate < 0)
  8874. { display.cursorDiv.style.visibility = "hidden"; }
  8875. }
  8876. function ensureFocus(cm) {
  8877. if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
  8878. }
  8879. function delayBlurEvent(cm) {
  8880. cm.state.delayingBlurEvent = true;
  8881. setTimeout(function () { if (cm.state.delayingBlurEvent) {
  8882. cm.state.delayingBlurEvent = false;
  8883. onBlur(cm);
  8884. } }, 100);
  8885. }
  8886. function onFocus(cm, e) {
  8887. if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
  8888. if (cm.options.readOnly == "nocursor") { return }
  8889. if (!cm.state.focused) {
  8890. signal(cm, "focus", cm, e);
  8891. cm.state.focused = true;
  8892. addClass(cm.display.wrapper, "CodeMirror-focused");
  8893. // This test prevents this from firing when a context
  8894. // menu is closed (since the input reset would kill the
  8895. // select-all detection hack)
  8896. if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
  8897. cm.display.input.reset();
  8898. if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
  8899. }
  8900. cm.display.input.receivedFocus();
  8901. }
  8902. restartBlink(cm);
  8903. }
  8904. function onBlur(cm, e) {
  8905. if (cm.state.delayingBlurEvent) { return }
  8906. if (cm.state.focused) {
  8907. signal(cm, "blur", cm, e);
  8908. cm.state.focused = false;
  8909. rmClass(cm.display.wrapper, "CodeMirror-focused");
  8910. }
  8911. clearInterval(cm.display.blinker);
  8912. setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
  8913. }
  8914. // Re-align line numbers and gutter marks to compensate for
  8915. // horizontal scrolling.
  8916. function alignHorizontally(cm) {
  8917. var display = cm.display, view = display.view;
  8918. if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
  8919. var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
  8920. var gutterW = display.gutters.offsetWidth, left = comp + "px";
  8921. for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
  8922. if (cm.options.fixedGutter) {
  8923. if (view[i].gutter)
  8924. { view[i].gutter.style.left = left; }
  8925. if (view[i].gutterBackground)
  8926. { view[i].gutterBackground.style.left = left; }
  8927. }
  8928. var align = view[i].alignable;
  8929. if (align) { for (var j = 0; j < align.length; j++)
  8930. { align[j].style.left = left; } }
  8931. } }
  8932. if (cm.options.fixedGutter)
  8933. { display.gutters.style.left = (comp + gutterW) + "px"; }
  8934. }
  8935. // Used to ensure that the line number gutter is still the right
  8936. // size for the current document size. Returns true when an update
  8937. // is needed.
  8938. function maybeUpdateLineNumberWidth(cm) {
  8939. if (!cm.options.lineNumbers) { return false }
  8940. var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
  8941. if (last.length != display.lineNumChars) {
  8942. var test = display.measure.appendChild(elt("div", [elt("div", last)],
  8943. "CodeMirror-linenumber CodeMirror-gutter-elt"));
  8944. var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
  8945. display.lineGutter.style.width = "";
  8946. display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
  8947. display.lineNumWidth = display.lineNumInnerWidth + padding;
  8948. display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
  8949. display.lineGutter.style.width = display.lineNumWidth + "px";
  8950. updateGutterSpace(cm);
  8951. return true
  8952. }
  8953. return false
  8954. }
  8955. // Read the actual heights of the rendered lines, and update their
  8956. // stored heights to match.
  8957. function updateHeightsInViewport(cm) {
  8958. var display = cm.display;
  8959. var prevBottom = display.lineDiv.offsetTop;
  8960. for (var i = 0; i < display.view.length; i++) {
  8961. var cur = display.view[i], height = (void 0);
  8962. if (cur.hidden) { continue }
  8963. if (ie && ie_version < 8) {
  8964. var bot = cur.node.offsetTop + cur.node.offsetHeight;
  8965. height = bot - prevBottom;
  8966. prevBottom = bot;
  8967. } else {
  8968. var box = cur.node.getBoundingClientRect();
  8969. height = box.bottom - box.top;
  8970. }
  8971. var diff = cur.line.height - height;
  8972. if (height < 2) { height = textHeight(display); }
  8973. if (diff > .001 || diff < -.001) {
  8974. updateLineHeight(cur.line, height);
  8975. updateWidgetHeight(cur.line);
  8976. if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
  8977. { updateWidgetHeight(cur.rest[j]); } }
  8978. }
  8979. }
  8980. }
  8981. // Read and store the height of line widgets associated with the
  8982. // given line.
  8983. function updateWidgetHeight(line) {
  8984. if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
  8985. { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }
  8986. }
  8987. // Compute the lines that are visible in a given viewport (defaults
  8988. // the the current scroll position). viewport may contain top,
  8989. // height, and ensure (see op.scrollToPos) properties.
  8990. function visibleLines(display, doc, viewport) {
  8991. var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
  8992. top = Math.floor(top - paddingTop(display));
  8993. var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
  8994. var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
  8995. // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
  8996. // forces those lines into the viewport (if possible).
  8997. if (viewport && viewport.ensure) {
  8998. var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
  8999. if (ensureFrom < from) {
  9000. from = ensureFrom;
  9001. to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
  9002. } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
  9003. from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
  9004. to = ensureTo;
  9005. }
  9006. }
  9007. return {from: from, to: Math.max(to, from + 1)}
  9008. }
  9009. // Sync the scrollable area and scrollbars, ensure the viewport
  9010. // covers the visible area.
  9011. function setScrollTop(cm, val) {
  9012. if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
  9013. cm.doc.scrollTop = val;
  9014. if (!gecko) { updateDisplaySimple(cm, {top: val}); }
  9015. if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
  9016. cm.display.scrollbars.setScrollTop(val);
  9017. if (gecko) { updateDisplaySimple(cm); }
  9018. startWorker(cm, 100);
  9019. }
  9020. // Sync scroller and scrollbar, ensure the gutter elements are
  9021. // aligned.
  9022. function setScrollLeft(cm, val, isScroller) {
  9023. if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return }
  9024. val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
  9025. cm.doc.scrollLeft = val;
  9026. alignHorizontally(cm);
  9027. if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
  9028. cm.display.scrollbars.setScrollLeft(val);
  9029. }
  9030. // Since the delta values reported on mouse wheel events are
  9031. // unstandardized between browsers and even browser versions, and
  9032. // generally horribly unpredictable, this code starts by measuring
  9033. // the scroll effect that the first few mouse wheel events have,
  9034. // and, from that, detects the way it can convert deltas to pixel
  9035. // offsets afterwards.
  9036. //
  9037. // The reason we want to know the amount a wheel event will scroll
  9038. // is that it gives us a chance to update the display before the
  9039. // actual scrolling happens, reducing flickering.
  9040. var wheelSamples = 0;
  9041. var wheelPixelsPerUnit = null;
  9042. // Fill in a browser-detected starting value on browsers where we
  9043. // know one. These don't have to be accurate -- the result of them
  9044. // being wrong would just be a slight flicker on the first wheel
  9045. // scroll (if it is large enough).
  9046. if (ie) { wheelPixelsPerUnit = -.53; }
  9047. else if (gecko) { wheelPixelsPerUnit = 15; }
  9048. else if (chrome) { wheelPixelsPerUnit = -.7; }
  9049. else if (safari) { wheelPixelsPerUnit = -1/3; }
  9050. function wheelEventDelta(e) {
  9051. var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
  9052. if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
  9053. if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
  9054. else if (dy == null) { dy = e.wheelDelta; }
  9055. return {x: dx, y: dy}
  9056. }
  9057. function wheelEventPixels(e) {
  9058. var delta = wheelEventDelta(e);
  9059. delta.x *= wheelPixelsPerUnit;
  9060. delta.y *= wheelPixelsPerUnit;
  9061. return delta
  9062. }
  9063. function onScrollWheel(cm, e) {
  9064. var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
  9065. var display = cm.display, scroll = display.scroller;
  9066. // Quit if there's nothing to scroll here
  9067. var canScrollX = scroll.scrollWidth > scroll.clientWidth;
  9068. var canScrollY = scroll.scrollHeight > scroll.clientHeight;
  9069. if (!(dx && canScrollX || dy && canScrollY)) { return }
  9070. // Webkit browsers on OS X abort momentum scrolls when the target
  9071. // of the scroll event is removed from the scrollable element.
  9072. // This hack (see related code in patchDisplay) makes sure the
  9073. // element is kept around.
  9074. if (dy && mac && webkit) {
  9075. outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
  9076. for (var i = 0; i < view.length; i++) {
  9077. if (view[i].node == cur) {
  9078. cm.display.currentWheelTarget = cur;
  9079. break outer
  9080. }
  9081. }
  9082. }
  9083. }
  9084. // On some browsers, horizontal scrolling will cause redraws to
  9085. // happen before the gutter has been realigned, causing it to
  9086. // wriggle around in a most unseemly way. When we have an
  9087. // estimated pixels/delta value, we just handle horizontal
  9088. // scrolling entirely here. It'll be slightly off from native, but
  9089. // better than glitching out.
  9090. if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
  9091. if (dy && canScrollY)
  9092. { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); }
  9093. setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
  9094. // Only prevent default scrolling if vertical scrolling is
  9095. // actually possible. Otherwise, it causes vertical scroll
  9096. // jitter on OSX trackpads when deltaX is small and deltaY
  9097. // is large (issue #3579)
  9098. if (!dy || (dy && canScrollY))
  9099. { e_preventDefault(e); }
  9100. display.wheelStartX = null; // Abort measurement, if in progress
  9101. return
  9102. }
  9103. // 'Project' the visible viewport to cover the area that is being
  9104. // scrolled into view (if we know enough to estimate it).
  9105. if (dy && wheelPixelsPerUnit != null) {
  9106. var pixels = dy * wheelPixelsPerUnit;
  9107. var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
  9108. if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
  9109. else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
  9110. updateDisplaySimple(cm, {top: top, bottom: bot});
  9111. }
  9112. if (wheelSamples < 20) {
  9113. if (display.wheelStartX == null) {
  9114. display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
  9115. display.wheelDX = dx; display.wheelDY = dy;
  9116. setTimeout(function () {
  9117. if (display.wheelStartX == null) { return }
  9118. var movedX = scroll.scrollLeft - display.wheelStartX;
  9119. var movedY = scroll.scrollTop - display.wheelStartY;
  9120. var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
  9121. (movedX && display.wheelDX && movedX / display.wheelDX);
  9122. display.wheelStartX = display.wheelStartY = null;
  9123. if (!sample) { return }
  9124. wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
  9125. ++wheelSamples;
  9126. }, 200);
  9127. } else {
  9128. display.wheelDX += dx; display.wheelDY += dy;
  9129. }
  9130. }
  9131. }
  9132. // SCROLLBARS
  9133. // Prepare DOM reads needed to update the scrollbars. Done in one
  9134. // shot to minimize update/measure roundtrips.
  9135. function measureForScrollbars(cm) {
  9136. var d = cm.display, gutterW = d.gutters.offsetWidth;
  9137. var docH = Math.round(cm.doc.height + paddingVert(cm.display));
  9138. return {
  9139. clientHeight: d.scroller.clientHeight,
  9140. viewHeight: d.wrapper.clientHeight,
  9141. scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
  9142. viewWidth: d.wrapper.clientWidth,
  9143. barLeft: cm.options.fixedGutter ? gutterW : 0,
  9144. docHeight: docH,
  9145. scrollHeight: docH + scrollGap(cm) + d.barHeight,
  9146. nativeBarWidth: d.nativeBarWidth,
  9147. gutterWidth: gutterW
  9148. }
  9149. }
  9150. var NativeScrollbars = function(place, scroll, cm) {
  9151. this.cm = cm;
  9152. var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
  9153. var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
  9154. place(vert); place(horiz);
  9155. on(vert, "scroll", function () {
  9156. if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
  9157. });
  9158. on(horiz, "scroll", function () {
  9159. if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
  9160. });
  9161. this.checkedZeroWidth = false;
  9162. // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
  9163. if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
  9164. };
  9165. NativeScrollbars.prototype.update = function (measure) {
  9166. var needsH = measure.scrollWidth > measure.clientWidth + 1;
  9167. var needsV = measure.scrollHeight > measure.clientHeight + 1;
  9168. var sWidth = measure.nativeBarWidth;
  9169. if (needsV) {
  9170. this.vert.style.display = "block";
  9171. this.vert.style.bottom = needsH ? sWidth + "px" : "0";
  9172. var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
  9173. // A bug in IE8 can cause this value to be negative, so guard it.
  9174. this.vert.firstChild.style.height =
  9175. Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
  9176. } else {
  9177. this.vert.style.display = "";
  9178. this.vert.firstChild.style.height = "0";
  9179. }
  9180. if (needsH) {
  9181. this.horiz.style.display = "block";
  9182. this.horiz.style.right = needsV ? sWidth + "px" : "0";
  9183. this.horiz.style.left = measure.barLeft + "px";
  9184. var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
  9185. this.horiz.firstChild.style.width =
  9186. Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
  9187. } else {
  9188. this.horiz.style.display = "";
  9189. this.horiz.firstChild.style.width = "0";
  9190. }
  9191. if (!this.checkedZeroWidth && measure.clientHeight > 0) {
  9192. if (sWidth == 0) { this.zeroWidthHack(); }
  9193. this.checkedZeroWidth = true;
  9194. }
  9195. return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
  9196. };
  9197. NativeScrollbars.prototype.setScrollLeft = function (pos) {
  9198. if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
  9199. if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz); }
  9200. };
  9201. NativeScrollbars.prototype.setScrollTop = function (pos) {
  9202. if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
  9203. if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert); }
  9204. };
  9205. NativeScrollbars.prototype.zeroWidthHack = function () {
  9206. var w = mac && !mac_geMountainLion ? "12px" : "18px";
  9207. this.horiz.style.height = this.vert.style.width = w;
  9208. this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
  9209. this.disableHoriz = new Delayed;
  9210. this.disableVert = new Delayed;
  9211. };
  9212. NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay) {
  9213. bar.style.pointerEvents = "auto";
  9214. function maybeDisable() {
  9215. // To find out whether the scrollbar is still visible, we
  9216. // check whether the element under the pixel in the bottom
  9217. // left corner of the scrollbar box is the scrollbar box
  9218. // itself (when the bar is still visible) or its filler child
  9219. // (when the bar is hidden). If it is still visible, we keep
  9220. // it enabled, if it's hidden, we disable pointer events.
  9221. var box = bar.getBoundingClientRect();
  9222. var elt$$1 = document.elementFromPoint(box.left + 1, box.bottom - 1);
  9223. if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
  9224. else { delay.set(1000, maybeDisable); }
  9225. }
  9226. delay.set(1000, maybeDisable);
  9227. };
  9228. NativeScrollbars.prototype.clear = function () {
  9229. var parent = this.horiz.parentNode;
  9230. parent.removeChild(this.horiz);
  9231. parent.removeChild(this.vert);
  9232. };
  9233. var NullScrollbars = function () {};
  9234. NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
  9235. NullScrollbars.prototype.setScrollLeft = function () {};
  9236. NullScrollbars.prototype.setScrollTop = function () {};
  9237. NullScrollbars.prototype.clear = function () {};
  9238. function updateScrollbars(cm, measure) {
  9239. if (!measure) { measure = measureForScrollbars(cm); }
  9240. var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
  9241. updateScrollbarsInner(cm, measure);
  9242. for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
  9243. if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
  9244. { updateHeightsInViewport(cm); }
  9245. updateScrollbarsInner(cm, measureForScrollbars(cm));
  9246. startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
  9247. }
  9248. }
  9249. // Re-synchronize the fake scrollbars with the actual size of the
  9250. // content.
  9251. function updateScrollbarsInner(cm, measure) {
  9252. var d = cm.display;
  9253. var sizes = d.scrollbars.update(measure);
  9254. d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
  9255. d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
  9256. d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
  9257. if (sizes.right && sizes.bottom) {
  9258. d.scrollbarFiller.style.display = "block";
  9259. d.scrollbarFiller.style.height = sizes.bottom + "px";
  9260. d.scrollbarFiller.style.width = sizes.right + "px";
  9261. } else { d.scrollbarFiller.style.display = ""; }
  9262. if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
  9263. d.gutterFiller.style.display = "block";
  9264. d.gutterFiller.style.height = sizes.bottom + "px";
  9265. d.gutterFiller.style.width = measure.gutterWidth + "px";
  9266. } else { d.gutterFiller.style.display = ""; }
  9267. }
  9268. var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
  9269. function initScrollbars(cm) {
  9270. if (cm.display.scrollbars) {
  9271. cm.display.scrollbars.clear();
  9272. if (cm.display.scrollbars.addClass)
  9273. { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  9274. }
  9275. cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
  9276. cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
  9277. // Prevent clicks in the scrollbars from killing focus
  9278. on(node, "mousedown", function () {
  9279. if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
  9280. });
  9281. node.setAttribute("cm-not-content", "true");
  9282. }, function (pos, axis) {
  9283. if (axis == "horizontal") { setScrollLeft(cm, pos); }
  9284. else { setScrollTop(cm, pos); }
  9285. }, cm);
  9286. if (cm.display.scrollbars.addClass)
  9287. { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  9288. }
  9289. // SCROLLING THINGS INTO VIEW
  9290. // If an editor sits on the top or bottom of the window, partially
  9291. // scrolled out of view, this ensures that the cursor is visible.
  9292. function maybeScrollWindow(cm, rect) {
  9293. if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
  9294. var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
  9295. if (rect.top + box.top < 0) { doScroll = true; }
  9296. else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
  9297. if (doScroll != null && !phantom) {
  9298. var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
  9299. cm.display.lineSpace.appendChild(scrollNode);
  9300. scrollNode.scrollIntoView(doScroll);
  9301. cm.display.lineSpace.removeChild(scrollNode);
  9302. }
  9303. }
  9304. // Scroll a given position into view (immediately), verifying that
  9305. // it actually became visible (as line heights are accurately
  9306. // measured, the position of something may 'drift' during drawing).
  9307. function scrollPosIntoView(cm, pos, end, margin) {
  9308. if (margin == null) { margin = 0; }
  9309. var rect;
  9310. for (var limit = 0; limit < 5; limit++) {
  9311. var changed = false;
  9312. var coords = cursorCoords(cm, pos);
  9313. var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
  9314. rect = {left: Math.min(coords.left, endCoords.left),
  9315. top: Math.min(coords.top, endCoords.top) - margin,
  9316. right: Math.max(coords.left, endCoords.left),
  9317. bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
  9318. var scrollPos = calculateScrollPos(cm, rect);
  9319. var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
  9320. if (scrollPos.scrollTop != null) {
  9321. setScrollTop(cm, scrollPos.scrollTop);
  9322. if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
  9323. }
  9324. if (scrollPos.scrollLeft != null) {
  9325. setScrollLeft(cm, scrollPos.scrollLeft);
  9326. if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
  9327. }
  9328. if (!changed) { break }
  9329. }
  9330. return rect
  9331. }
  9332. // Scroll a given set of coordinates into view (immediately).
  9333. function scrollIntoView(cm, rect) {
  9334. var scrollPos = calculateScrollPos(cm, rect);
  9335. if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop); }
  9336. if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
  9337. }
  9338. // Calculate a new scroll position needed to scroll the given
  9339. // rectangle into view. Returns an object with scrollTop and
  9340. // scrollLeft properties. When these are undefined, the
  9341. // vertical/horizontal position does not need to be adjusted.
  9342. function calculateScrollPos(cm, rect) {
  9343. var display = cm.display, snapMargin = textHeight(cm.display);
  9344. if (rect.top < 0) { rect.top = 0; }
  9345. var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
  9346. var screen = displayHeight(cm), result = {};
  9347. if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
  9348. var docBottom = cm.doc.height + paddingVert(display);
  9349. var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
  9350. if (rect.top < screentop) {
  9351. result.scrollTop = atTop ? 0 : rect.top;
  9352. } else if (rect.bottom > screentop + screen) {
  9353. var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
  9354. if (newTop != screentop) { result.scrollTop = newTop; }
  9355. }
  9356. var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
  9357. var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
  9358. var tooWide = rect.right - rect.left > screenw;
  9359. if (tooWide) { rect.right = rect.left + screenw; }
  9360. if (rect.left < 10)
  9361. { result.scrollLeft = 0; }
  9362. else if (rect.left < screenleft)
  9363. { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
  9364. else if (rect.right > screenw + screenleft - 3)
  9365. { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
  9366. return result
  9367. }
  9368. // Store a relative adjustment to the scroll position in the current
  9369. // operation (to be applied when the operation finishes).
  9370. function addToScrollPos(cm, left, top) {
  9371. if (left != null || top != null) { resolveScrollToPos(cm); }
  9372. if (left != null)
  9373. { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; }
  9374. if (top != null)
  9375. { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
  9376. }
  9377. // Make sure that at the end of the operation the current cursor is
  9378. // shown.
  9379. function ensureCursorVisible(cm) {
  9380. resolveScrollToPos(cm);
  9381. var cur = cm.getCursor(), from = cur, to = cur;
  9382. if (!cm.options.lineWrapping) {
  9383. from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
  9384. to = Pos(cur.line, cur.ch + 1);
  9385. }
  9386. cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin};
  9387. }
  9388. // When an operation has its scrollToPos property set, and another
  9389. // scroll action is applied before the end of the operation, this
  9390. // 'simulates' scrolling that position into view in a cheap way, so
  9391. // that the effect of intermediate scroll commands is not ignored.
  9392. function resolveScrollToPos(cm) {
  9393. var range$$1 = cm.curOp.scrollToPos;
  9394. if (range$$1) {
  9395. cm.curOp.scrollToPos = null;
  9396. var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
  9397. var sPos = calculateScrollPos(cm, {
  9398. left: Math.min(from.left, to.left),
  9399. top: Math.min(from.top, to.top) - range$$1.margin,
  9400. right: Math.max(from.right, to.right),
  9401. bottom: Math.max(from.bottom, to.bottom) + range$$1.margin
  9402. });
  9403. cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  9404. }
  9405. }
  9406. // Operations are used to wrap a series of changes to the editor
  9407. // state in such a way that each change won't have to update the
  9408. // cursor and display (which would be awkward, slow, and
  9409. // error-prone). Instead, display updates are batched and then all
  9410. // combined and executed at once.
  9411. var nextOpId = 0;
  9412. // Start a new operation.
  9413. function startOperation(cm) {
  9414. cm.curOp = {
  9415. cm: cm,
  9416. viewChanged: false, // Flag that indicates that lines might need to be redrawn
  9417. startHeight: cm.doc.height, // Used to detect need to update scrollbar
  9418. forceUpdate: false, // Used to force a redraw
  9419. updateInput: null, // Whether to reset the input textarea
  9420. typing: false, // Whether this reset should be careful to leave existing text (for compositing)
  9421. changeObjs: null, // Accumulated changes, for firing change events
  9422. cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
  9423. cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
  9424. selectionChanged: false, // Whether the selection needs to be redrawn
  9425. updateMaxLine: false, // Set when the widest line needs to be determined anew
  9426. scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
  9427. scrollToPos: null, // Used to scroll to a specific position
  9428. focus: false,
  9429. id: ++nextOpId // Unique ID
  9430. };
  9431. pushOperation(cm.curOp);
  9432. }
  9433. // Finish an operation, updating the display and signalling delayed events
  9434. function endOperation(cm) {
  9435. var op = cm.curOp;
  9436. finishOperation(op, function (group) {
  9437. for (var i = 0; i < group.ops.length; i++)
  9438. { group.ops[i].cm.curOp = null; }
  9439. endOperations(group);
  9440. });
  9441. }
  9442. // The DOM updates done when an operation finishes are batched so
  9443. // that the minimum number of relayouts are required.
  9444. function endOperations(group) {
  9445. var ops = group.ops;
  9446. for (var i = 0; i < ops.length; i++) // Read DOM
  9447. { endOperation_R1(ops[i]); }
  9448. for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
  9449. { endOperation_W1(ops[i$1]); }
  9450. for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
  9451. { endOperation_R2(ops[i$2]); }
  9452. for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
  9453. { endOperation_W2(ops[i$3]); }
  9454. for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
  9455. { endOperation_finish(ops[i$4]); }
  9456. }
  9457. function endOperation_R1(op) {
  9458. var cm = op.cm, display = cm.display;
  9459. maybeClipScrollbars(cm);
  9460. if (op.updateMaxLine) { findMaxLine(cm); }
  9461. op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
  9462. op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
  9463. op.scrollToPos.to.line >= display.viewTo) ||
  9464. display.maxLineChanged && cm.options.lineWrapping;
  9465. op.update = op.mustUpdate &&
  9466. new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
  9467. }
  9468. function endOperation_W1(op) {
  9469. op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
  9470. }
  9471. function endOperation_R2(op) {
  9472. var cm = op.cm, display = cm.display;
  9473. if (op.updatedDisplay) { updateHeightsInViewport(cm); }
  9474. op.barMeasure = measureForScrollbars(cm);
  9475. // If the max line changed since it was last measured, measure it,
  9476. // and ensure the document's width matches it.
  9477. // updateDisplay_W2 will use these properties to do the actual resizing
  9478. if (display.maxLineChanged && !cm.options.lineWrapping) {
  9479. op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
  9480. cm.display.sizerWidth = op.adjustWidthTo;
  9481. op.barMeasure.scrollWidth =
  9482. Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
  9483. op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
  9484. }
  9485. if (op.updatedDisplay || op.selectionChanged)
  9486. { op.preparedSelection = display.input.prepareSelection(op.focus); }
  9487. }
  9488. function endOperation_W2(op) {
  9489. var cm = op.cm;
  9490. if (op.adjustWidthTo != null) {
  9491. cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
  9492. if (op.maxScrollLeft < cm.doc.scrollLeft)
  9493. { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
  9494. cm.display.maxLineChanged = false;
  9495. }
  9496. var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus());
  9497. if (op.preparedSelection)
  9498. { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
  9499. if (op.updatedDisplay || op.startHeight != cm.doc.height)
  9500. { updateScrollbars(cm, op.barMeasure); }
  9501. if (op.updatedDisplay)
  9502. { setDocumentHeight(cm, op.barMeasure); }
  9503. if (op.selectionChanged) { restartBlink(cm); }
  9504. if (cm.state.focused && op.updateInput)
  9505. { cm.display.input.reset(op.typing); }
  9506. if (takeFocus) { ensureFocus(op.cm); }
  9507. }
  9508. function endOperation_finish(op) {
  9509. var cm = op.cm, display = cm.display, doc = cm.doc;
  9510. if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
  9511. // Abort mouse wheel delta measurement, when scrolling explicitly
  9512. if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
  9513. { display.wheelStartX = display.wheelStartY = null; }
  9514. // Propagate the scroll position to the actual DOM scroller
  9515. if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
  9516. doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
  9517. display.scrollbars.setScrollTop(doc.scrollTop);
  9518. display.scroller.scrollTop = doc.scrollTop;
  9519. }
  9520. if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
  9521. doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
  9522. display.scrollbars.setScrollLeft(doc.scrollLeft);
  9523. display.scroller.scrollLeft = doc.scrollLeft;
  9524. alignHorizontally(cm);
  9525. }
  9526. // If we need to scroll a specific position into view, do so.
  9527. if (op.scrollToPos) {
  9528. var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
  9529. clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
  9530. maybeScrollWindow(cm, rect);
  9531. }
  9532. // Fire events for markers that are hidden/unidden by editing or
  9533. // undoing
  9534. var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
  9535. if (hidden) { for (var i = 0; i < hidden.length; ++i)
  9536. { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
  9537. if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
  9538. { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
  9539. if (display.wrapper.offsetHeight)
  9540. { doc.scrollTop = cm.display.scroller.scrollTop; }
  9541. // Fire change events, and delayed event handlers
  9542. if (op.changeObjs)
  9543. { signal(cm, "changes", cm, op.changeObjs); }
  9544. if (op.update)
  9545. { op.update.finish(); }
  9546. }
  9547. // Run the given function in an operation
  9548. function runInOp(cm, f) {
  9549. if (cm.curOp) { return f() }
  9550. startOperation(cm);
  9551. try { return f() }
  9552. finally { endOperation(cm); }
  9553. }
  9554. // Wraps a function in an operation. Returns the wrapped function.
  9555. function operation(cm, f) {
  9556. return function() {
  9557. if (cm.curOp) { return f.apply(cm, arguments) }
  9558. startOperation(cm);
  9559. try { return f.apply(cm, arguments) }
  9560. finally { endOperation(cm); }
  9561. }
  9562. }
  9563. // Used to add methods to editor and doc instances, wrapping them in
  9564. // operations.
  9565. function methodOp(f) {
  9566. return function() {
  9567. if (this.curOp) { return f.apply(this, arguments) }
  9568. startOperation(this);
  9569. try { return f.apply(this, arguments) }
  9570. finally { endOperation(this); }
  9571. }
  9572. }
  9573. function docMethodOp(f) {
  9574. return function() {
  9575. var cm = this.cm;
  9576. if (!cm || cm.curOp) { return f.apply(this, arguments) }
  9577. startOperation(cm);
  9578. try { return f.apply(this, arguments) }
  9579. finally { endOperation(cm); }
  9580. }
  9581. }
  9582. // Updates the display.view data structure for a given change to the
  9583. // document. From and to are in pre-change coordinates. Lendiff is
  9584. // the amount of lines added or subtracted by the change. This is
  9585. // used for changes that span multiple lines, or change the way
  9586. // lines are divided into visual lines. regLineChange (below)
  9587. // registers single-line changes.
  9588. function regChange(cm, from, to, lendiff) {
  9589. if (from == null) { from = cm.doc.first; }
  9590. if (to == null) { to = cm.doc.first + cm.doc.size; }
  9591. if (!lendiff) { lendiff = 0; }
  9592. var display = cm.display;
  9593. if (lendiff && to < display.viewTo &&
  9594. (display.updateLineNumbers == null || display.updateLineNumbers > from))
  9595. { display.updateLineNumbers = from; }
  9596. cm.curOp.viewChanged = true;
  9597. if (from >= display.viewTo) { // Change after
  9598. if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
  9599. { resetView(cm); }
  9600. } else if (to <= display.viewFrom) { // Change before
  9601. if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
  9602. resetView(cm);
  9603. } else {
  9604. display.viewFrom += lendiff;
  9605. display.viewTo += lendiff;
  9606. }
  9607. } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
  9608. resetView(cm);
  9609. } else if (from <= display.viewFrom) { // Top overlap
  9610. var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
  9611. if (cut) {
  9612. display.view = display.view.slice(cut.index);
  9613. display.viewFrom = cut.lineN;
  9614. display.viewTo += lendiff;
  9615. } else {
  9616. resetView(cm);
  9617. }
  9618. } else if (to >= display.viewTo) { // Bottom overlap
  9619. var cut$1 = viewCuttingPoint(cm, from, from, -1);
  9620. if (cut$1) {
  9621. display.view = display.view.slice(0, cut$1.index);
  9622. display.viewTo = cut$1.lineN;
  9623. } else {
  9624. resetView(cm);
  9625. }
  9626. } else { // Gap in the middle
  9627. var cutTop = viewCuttingPoint(cm, from, from, -1);
  9628. var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
  9629. if (cutTop && cutBot) {
  9630. display.view = display.view.slice(0, cutTop.index)
  9631. .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
  9632. .concat(display.view.slice(cutBot.index));
  9633. display.viewTo += lendiff;
  9634. } else {
  9635. resetView(cm);
  9636. }
  9637. }
  9638. var ext = display.externalMeasured;
  9639. if (ext) {
  9640. if (to < ext.lineN)
  9641. { ext.lineN += lendiff; }
  9642. else if (from < ext.lineN + ext.size)
  9643. { display.externalMeasured = null; }
  9644. }
  9645. }
  9646. // Register a change to a single line. Type must be one of "text",
  9647. // "gutter", "class", "widget"
  9648. function regLineChange(cm, line, type) {
  9649. cm.curOp.viewChanged = true;
  9650. var display = cm.display, ext = cm.display.externalMeasured;
  9651. if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
  9652. { display.externalMeasured = null; }
  9653. if (line < display.viewFrom || line >= display.viewTo) { return }
  9654. var lineView = display.view[findViewIndex(cm, line)];
  9655. if (lineView.node == null) { return }
  9656. var arr = lineView.changes || (lineView.changes = []);
  9657. if (indexOf(arr, type) == -1) { arr.push(type); }
  9658. }
  9659. // Clear the view.
  9660. function resetView(cm) {
  9661. cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
  9662. cm.display.view = [];
  9663. cm.display.viewOffset = 0;
  9664. }
  9665. function viewCuttingPoint(cm, oldN, newN, dir) {
  9666. var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
  9667. if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
  9668. { return {index: index, lineN: newN} }
  9669. var n = cm.display.viewFrom;
  9670. for (var i = 0; i < index; i++)
  9671. { n += view[i].size; }
  9672. if (n != oldN) {
  9673. if (dir > 0) {
  9674. if (index == view.length - 1) { return null }
  9675. diff = (n + view[index].size) - oldN;
  9676. index++;
  9677. } else {
  9678. diff = n - oldN;
  9679. }
  9680. oldN += diff; newN += diff;
  9681. }
  9682. while (visualLineNo(cm.doc, newN) != newN) {
  9683. if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
  9684. newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
  9685. index += dir;
  9686. }
  9687. return {index: index, lineN: newN}
  9688. }
  9689. // Force the view to cover a given range, adding empty view element
  9690. // or clipping off existing ones as needed.
  9691. function adjustView(cm, from, to) {
  9692. var display = cm.display, view = display.view;
  9693. if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
  9694. display.view = buildViewArray(cm, from, to);
  9695. display.viewFrom = from;
  9696. } else {
  9697. if (display.viewFrom > from)
  9698. { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
  9699. else if (display.viewFrom < from)
  9700. { display.view = display.view.slice(findViewIndex(cm, from)); }
  9701. display.viewFrom = from;
  9702. if (display.viewTo < to)
  9703. { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
  9704. else if (display.viewTo > to)
  9705. { display.view = display.view.slice(0, findViewIndex(cm, to)); }
  9706. }
  9707. display.viewTo = to;
  9708. }
  9709. // Count the number of lines in the view whose DOM representation is
  9710. // out of date (or nonexistent).
  9711. function countDirtyView(cm) {
  9712. var view = cm.display.view, dirty = 0;
  9713. for (var i = 0; i < view.length; i++) {
  9714. var lineView = view[i];
  9715. if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
  9716. }
  9717. return dirty
  9718. }
  9719. // HIGHLIGHT WORKER
  9720. function startWorker(cm, time) {
  9721. if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
  9722. { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
  9723. }
  9724. function highlightWorker(cm) {
  9725. var doc = cm.doc;
  9726. if (doc.frontier < doc.first) { doc.frontier = doc.first; }
  9727. if (doc.frontier >= cm.display.viewTo) { return }
  9728. var end = +new Date + cm.options.workTime;
  9729. var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
  9730. var changedLines = [];
  9731. doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
  9732. if (doc.frontier >= cm.display.viewFrom) { // Visible
  9733. var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
  9734. var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
  9735. line.styles = highlighted.styles;
  9736. var oldCls = line.styleClasses, newCls = highlighted.classes;
  9737. if (newCls) { line.styleClasses = newCls; }
  9738. else if (oldCls) { line.styleClasses = null; }
  9739. var ischange = !oldStyles || oldStyles.length != line.styles.length ||
  9740. oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
  9741. for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
  9742. if (ischange) { changedLines.push(doc.frontier); }
  9743. line.stateAfter = tooLong ? state : copyState(doc.mode, state);
  9744. } else {
  9745. if (line.text.length <= cm.options.maxHighlightLength)
  9746. { processLine(cm, line.text, state); }
  9747. line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
  9748. }
  9749. ++doc.frontier;
  9750. if (+new Date > end) {
  9751. startWorker(cm, cm.options.workDelay);
  9752. return true
  9753. }
  9754. });
  9755. if (changedLines.length) { runInOp(cm, function () {
  9756. for (var i = 0; i < changedLines.length; i++)
  9757. { regLineChange(cm, changedLines[i], "text"); }
  9758. }); }
  9759. }
  9760. // DISPLAY DRAWING
  9761. var DisplayUpdate = function(cm, viewport, force) {
  9762. var display = cm.display;
  9763. this.viewport = viewport;
  9764. // Store some values that we'll need later (but don't want to force a relayout for)
  9765. this.visible = visibleLines(display, cm.doc, viewport);
  9766. this.editorIsHidden = !display.wrapper.offsetWidth;
  9767. this.wrapperHeight = display.wrapper.clientHeight;
  9768. this.wrapperWidth = display.wrapper.clientWidth;
  9769. this.oldDisplayWidth = displayWidth(cm);
  9770. this.force = force;
  9771. this.dims = getDimensions(cm);
  9772. this.events = [];
  9773. };
  9774. DisplayUpdate.prototype.signal = function (emitter, type) {
  9775. if (hasHandler(emitter, type))
  9776. { this.events.push(arguments); }
  9777. };
  9778. DisplayUpdate.prototype.finish = function () {
  9779. var this$1 = this;
  9780. for (var i = 0; i < this.events.length; i++)
  9781. { signal.apply(null, this$1.events[i]); }
  9782. };
  9783. function maybeClipScrollbars(cm) {
  9784. var display = cm.display;
  9785. if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
  9786. display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
  9787. display.heightForcer.style.height = scrollGap(cm) + "px";
  9788. display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
  9789. display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
  9790. display.scrollbarsClipped = true;
  9791. }
  9792. }
  9793. // Does the actual updating of the line display. Bails out
  9794. // (returning false) when there is nothing to be done and forced is
  9795. // false.
  9796. function updateDisplayIfNeeded(cm, update) {
  9797. var display = cm.display, doc = cm.doc;
  9798. if (update.editorIsHidden) {
  9799. resetView(cm);
  9800. return false
  9801. }
  9802. // Bail out if the visible area is already rendered and nothing changed.
  9803. if (!update.force &&
  9804. update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
  9805. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
  9806. display.renderedView == display.view && countDirtyView(cm) == 0)
  9807. { return false }
  9808. if (maybeUpdateLineNumberWidth(cm)) {
  9809. resetView(cm);
  9810. update.dims = getDimensions(cm);
  9811. }
  9812. // Compute a suitable new viewport (from & to)
  9813. var end = doc.first + doc.size;
  9814. var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
  9815. var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
  9816. if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
  9817. if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
  9818. if (sawCollapsedSpans) {
  9819. from = visualLineNo(cm.doc, from);
  9820. to = visualLineEndNo(cm.doc, to);
  9821. }
  9822. var different = from != display.viewFrom || to != display.viewTo ||
  9823. display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
  9824. adjustView(cm, from, to);
  9825. display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
  9826. // Position the mover div to align with the current scroll position
  9827. cm.display.mover.style.top = display.viewOffset + "px";
  9828. var toUpdate = countDirtyView(cm);
  9829. if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
  9830. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
  9831. { return false }
  9832. // For big changes, we hide the enclosing element during the
  9833. // update, since that speeds up the operations on most browsers.
  9834. var focused = activeElt();
  9835. if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
  9836. patchDisplay(cm, display.updateLineNumbers, update.dims);
  9837. if (toUpdate > 4) { display.lineDiv.style.display = ""; }
  9838. display.renderedView = display.view;
  9839. // There might have been a widget with a focused element that got
  9840. // hidden or updated, if so re-focus it.
  9841. if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus(); }
  9842. // Prevent selection and cursors from interfering with the scroll
  9843. // width and height.
  9844. removeChildren(display.cursorDiv);
  9845. removeChildren(display.selectionDiv);
  9846. display.gutters.style.height = display.sizer.style.minHeight = 0;
  9847. if (different) {
  9848. display.lastWrapHeight = update.wrapperHeight;
  9849. display.lastWrapWidth = update.wrapperWidth;
  9850. startWorker(cm, 400);
  9851. }
  9852. display.updateLineNumbers = null;
  9853. return true
  9854. }
  9855. function postUpdateDisplay(cm, update) {
  9856. var viewport = update.viewport;
  9857. for (var first = true;; first = false) {
  9858. if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
  9859. // Clip forced viewport to actual scrollable area.
  9860. if (viewport && viewport.top != null)
  9861. { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
  9862. // Updated line heights might result in the drawn area not
  9863. // actually covering the viewport. Keep looping until it does.
  9864. update.visible = visibleLines(cm.display, cm.doc, viewport);
  9865. if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
  9866. { break }
  9867. }
  9868. if (!updateDisplayIfNeeded(cm, update)) { break }
  9869. updateHeightsInViewport(cm);
  9870. var barMeasure = measureForScrollbars(cm);
  9871. updateSelection(cm);
  9872. updateScrollbars(cm, barMeasure);
  9873. setDocumentHeight(cm, barMeasure);
  9874. }
  9875. update.signal(cm, "update", cm);
  9876. if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
  9877. update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
  9878. cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
  9879. }
  9880. }
  9881. function updateDisplaySimple(cm, viewport) {
  9882. var update = new DisplayUpdate(cm, viewport);
  9883. if (updateDisplayIfNeeded(cm, update)) {
  9884. updateHeightsInViewport(cm);
  9885. postUpdateDisplay(cm, update);
  9886. var barMeasure = measureForScrollbars(cm);
  9887. updateSelection(cm);
  9888. updateScrollbars(cm, barMeasure);
  9889. setDocumentHeight(cm, barMeasure);
  9890. update.finish();
  9891. }
  9892. }
  9893. // Sync the actual display DOM structure with display.view, removing
  9894. // nodes for lines that are no longer in view, and creating the ones
  9895. // that are not there yet, and updating the ones that are out of
  9896. // date.
  9897. function patchDisplay(cm, updateNumbersFrom, dims) {
  9898. var display = cm.display, lineNumbers = cm.options.lineNumbers;
  9899. var container = display.lineDiv, cur = container.firstChild;
  9900. function rm(node) {
  9901. var next = node.nextSibling;
  9902. // Works around a throw-scroll bug in OS X Webkit
  9903. if (webkit && mac && cm.display.currentWheelTarget == node)
  9904. { node.style.display = "none"; }
  9905. else
  9906. { node.parentNode.removeChild(node); }
  9907. return next
  9908. }
  9909. var view = display.view, lineN = display.viewFrom;
  9910. // Loop over the elements in the view, syncing cur (the DOM nodes
  9911. // in display.lineDiv) with the view as we go.
  9912. for (var i = 0; i < view.length; i++) {
  9913. var lineView = view[i];
  9914. if (lineView.hidden) {
  9915. } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
  9916. var node = buildLineElement(cm, lineView, lineN, dims);
  9917. container.insertBefore(node, cur);
  9918. } else { // Already drawn
  9919. while (cur != lineView.node) { cur = rm(cur); }
  9920. var updateNumber = lineNumbers && updateNumbersFrom != null &&
  9921. updateNumbersFrom <= lineN && lineView.lineNumber;
  9922. if (lineView.changes) {
  9923. if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
  9924. updateLineForChanges(cm, lineView, lineN, dims);
  9925. }
  9926. if (updateNumber) {
  9927. removeChildren(lineView.lineNumber);
  9928. lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
  9929. }
  9930. cur = lineView.node.nextSibling;
  9931. }
  9932. lineN += lineView.size;
  9933. }
  9934. while (cur) { cur = rm(cur); }
  9935. }
  9936. function updateGutterSpace(cm) {
  9937. var width = cm.display.gutters.offsetWidth;
  9938. cm.display.sizer.style.marginLeft = width + "px";
  9939. }
  9940. function setDocumentHeight(cm, measure) {
  9941. cm.display.sizer.style.minHeight = measure.docHeight + "px";
  9942. cm.display.heightForcer.style.top = measure.docHeight + "px";
  9943. cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
  9944. }
  9945. // Rebuild the gutter elements, ensure the margin to the left of the
  9946. // code matches their width.
  9947. function updateGutters(cm) {
  9948. var gutters = cm.display.gutters, specs = cm.options.gutters;
  9949. removeChildren(gutters);
  9950. var i = 0;
  9951. for (; i < specs.length; ++i) {
  9952. var gutterClass = specs[i];
  9953. var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
  9954. if (gutterClass == "CodeMirror-linenumbers") {
  9955. cm.display.lineGutter = gElt;
  9956. gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
  9957. }
  9958. }
  9959. gutters.style.display = i ? "" : "none";
  9960. updateGutterSpace(cm);
  9961. }
  9962. // Make sure the gutters options contains the element
  9963. // "CodeMirror-linenumbers" when the lineNumbers option is true.
  9964. function setGuttersForLineNumbers(options) {
  9965. var found = indexOf(options.gutters, "CodeMirror-linenumbers");
  9966. if (found == -1 && options.lineNumbers) {
  9967. options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
  9968. } else if (found > -1 && !options.lineNumbers) {
  9969. options.gutters = options.gutters.slice(0);
  9970. options.gutters.splice(found, 1);
  9971. }
  9972. }
  9973. // Selection objects are immutable. A new one is created every time
  9974. // the selection changes. A selection is one or more non-overlapping
  9975. // (and non-touching) ranges, sorted, and an integer that indicates
  9976. // which one is the primary selection (the one that's scrolled into
  9977. // view, that getCursor returns, etc).
  9978. var Selection = function(ranges, primIndex) {
  9979. this.ranges = ranges;
  9980. this.primIndex = primIndex;
  9981. };
  9982. Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
  9983. Selection.prototype.equals = function (other) {
  9984. var this$1 = this;
  9985. if (other == this) { return true }
  9986. if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
  9987. for (var i = 0; i < this.ranges.length; i++) {
  9988. var here = this$1.ranges[i], there = other.ranges[i];
  9989. if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
  9990. }
  9991. return true
  9992. };
  9993. Selection.prototype.deepCopy = function () {
  9994. var this$1 = this;
  9995. var out = [];
  9996. for (var i = 0; i < this.ranges.length; i++)
  9997. { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
  9998. return new Selection(out, this.primIndex)
  9999. };
  10000. Selection.prototype.somethingSelected = function () {
  10001. var this$1 = this;
  10002. for (var i = 0; i < this.ranges.length; i++)
  10003. { if (!this$1.ranges[i].empty()) { return true } }
  10004. return false
  10005. };
  10006. Selection.prototype.contains = function (pos, end) {
  10007. var this$1 = this;
  10008. if (!end) { end = pos; }
  10009. for (var i = 0; i < this.ranges.length; i++) {
  10010. var range = this$1.ranges[i];
  10011. if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
  10012. { return i }
  10013. }
  10014. return -1
  10015. };
  10016. var Range = function(anchor, head) {
  10017. this.anchor = anchor; this.head = head;
  10018. };
  10019. Range.prototype.from = function () { return minPos(this.anchor, this.head) };
  10020. Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
  10021. Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
  10022. // Take an unsorted, potentially overlapping set of ranges, and
  10023. // build a selection out of it. 'Consumes' ranges array (modifying
  10024. // it).
  10025. function normalizeSelection(ranges, primIndex) {
  10026. var prim = ranges[primIndex];
  10027. ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
  10028. primIndex = indexOf(ranges, prim);
  10029. for (var i = 1; i < ranges.length; i++) {
  10030. var cur = ranges[i], prev = ranges[i - 1];
  10031. if (cmp(prev.to(), cur.from()) >= 0) {
  10032. var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
  10033. var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
  10034. if (i <= primIndex) { --primIndex; }
  10035. ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
  10036. }
  10037. }
  10038. return new Selection(ranges, primIndex)
  10039. }
  10040. function simpleSelection(anchor, head) {
  10041. return new Selection([new Range(anchor, head || anchor)], 0)
  10042. }
  10043. // Compute the position of the end of a change (its 'to' property
  10044. // refers to the pre-change end).
  10045. function changeEnd(change) {
  10046. if (!change.text) { return change.to }
  10047. return Pos(change.from.line + change.text.length - 1,
  10048. lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
  10049. }
  10050. // Adjust a position to refer to the post-change position of the
  10051. // same text, or the end of the change if the change covers it.
  10052. function adjustForChange(pos, change) {
  10053. if (cmp(pos, change.from) < 0) { return pos }
  10054. if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
  10055. var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
  10056. if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
  10057. return Pos(line, ch)
  10058. }
  10059. function computeSelAfterChange(doc, change) {
  10060. var out = [];
  10061. for (var i = 0; i < doc.sel.ranges.length; i++) {
  10062. var range = doc.sel.ranges[i];
  10063. out.push(new Range(adjustForChange(range.anchor, change),
  10064. adjustForChange(range.head, change)));
  10065. }
  10066. return normalizeSelection(out, doc.sel.primIndex)
  10067. }
  10068. function offsetPos(pos, old, nw) {
  10069. if (pos.line == old.line)
  10070. { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
  10071. else
  10072. { return Pos(nw.line + (pos.line - old.line), pos.ch) }
  10073. }
  10074. // Used by replaceSelections to allow moving the selection to the
  10075. // start or around the replaced test. Hint may be "start" or "around".
  10076. function computeReplacedSel(doc, changes, hint) {
  10077. var out = [];
  10078. var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
  10079. for (var i = 0; i < changes.length; i++) {
  10080. var change = changes[i];
  10081. var from = offsetPos(change.from, oldPrev, newPrev);
  10082. var to = offsetPos(changeEnd(change), oldPrev, newPrev);
  10083. oldPrev = change.to;
  10084. newPrev = to;
  10085. if (hint == "around") {
  10086. var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
  10087. out[i] = new Range(inv ? to : from, inv ? from : to);
  10088. } else {
  10089. out[i] = new Range(from, from);
  10090. }
  10091. }
  10092. return new Selection(out, doc.sel.primIndex)
  10093. }
  10094. // Used to get the editor into a consistent state again when options change.
  10095. function loadMode(cm) {
  10096. cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
  10097. resetModeState(cm);
  10098. }
  10099. function resetModeState(cm) {
  10100. cm.doc.iter(function (line) {
  10101. if (line.stateAfter) { line.stateAfter = null; }
  10102. if (line.styles) { line.styles = null; }
  10103. });
  10104. cm.doc.frontier = cm.doc.first;
  10105. startWorker(cm, 100);
  10106. cm.state.modeGen++;
  10107. if (cm.curOp) { regChange(cm); }
  10108. }
  10109. // DOCUMENT DATA STRUCTURE
  10110. // By default, updates that start and end at the beginning of a line
  10111. // are treated specially, in order to make the association of line
  10112. // widgets and marker elements with the text behave more intuitive.
  10113. function isWholeLineUpdate(doc, change) {
  10114. return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
  10115. (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
  10116. }
  10117. // Perform a change on the document data structure.
  10118. function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
  10119. function spansFor(n) {return markedSpans ? markedSpans[n] : null}
  10120. function update(line, text, spans) {
  10121. updateLine(line, text, spans, estimateHeight$$1);
  10122. signalLater(line, "change", line, change);
  10123. }
  10124. function linesFor(start, end) {
  10125. var result = [];
  10126. for (var i = start; i < end; ++i)
  10127. { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
  10128. return result
  10129. }
  10130. var from = change.from, to = change.to, text = change.text;
  10131. var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
  10132. var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
  10133. // Adjust the line structure
  10134. if (change.full) {
  10135. doc.insert(0, linesFor(0, text.length));
  10136. doc.remove(text.length, doc.size - text.length);
  10137. } else if (isWholeLineUpdate(doc, change)) {
  10138. // This is a whole-line replace. Treated specially to make
  10139. // sure line objects move the way they are supposed to.
  10140. var added = linesFor(0, text.length - 1);
  10141. update(lastLine, lastLine.text, lastSpans);
  10142. if (nlines) { doc.remove(from.line, nlines); }
  10143. if (added.length) { doc.insert(from.line, added); }
  10144. } else if (firstLine == lastLine) {
  10145. if (text.length == 1) {
  10146. update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
  10147. } else {
  10148. var added$1 = linesFor(1, text.length - 1);
  10149. added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
  10150. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  10151. doc.insert(from.line + 1, added$1);
  10152. }
  10153. } else if (text.length == 1) {
  10154. update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
  10155. doc.remove(from.line + 1, nlines);
  10156. } else {
  10157. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  10158. update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
  10159. var added$2 = linesFor(1, text.length - 1);
  10160. if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
  10161. doc.insert(from.line + 1, added$2);
  10162. }
  10163. signalLater(doc, "change", doc, change);
  10164. }
  10165. // Call f for all linked documents.
  10166. function linkedDocs(doc, f, sharedHistOnly) {
  10167. function propagate(doc, skip, sharedHist) {
  10168. if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
  10169. var rel = doc.linked[i];
  10170. if (rel.doc == skip) { continue }
  10171. var shared = sharedHist && rel.sharedHist;
  10172. if (sharedHistOnly && !shared) { continue }
  10173. f(rel.doc, shared);
  10174. propagate(rel.doc, doc, shared);
  10175. } }
  10176. }
  10177. propagate(doc, null, true);
  10178. }
  10179. // Attach a document to an editor.
  10180. function attachDoc(cm, doc) {
  10181. if (doc.cm) { throw new Error("This document is already in use.") }
  10182. cm.doc = doc;
  10183. doc.cm = cm;
  10184. estimateLineHeights(cm);
  10185. loadMode(cm);
  10186. setDirectionClass(cm);
  10187. if (!cm.options.lineWrapping) { findMaxLine(cm); }
  10188. cm.options.mode = doc.modeOption;
  10189. regChange(cm);
  10190. }
  10191. function setDirectionClass(cm) {
  10192. (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
  10193. }
  10194. function directionChanged(cm) {
  10195. runInOp(cm, function () {
  10196. setDirectionClass(cm);
  10197. regChange(cm);
  10198. });
  10199. }
  10200. function History(startGen) {
  10201. // Arrays of change events and selections. Doing something adds an
  10202. // event to done and clears undo. Undoing moves events from done
  10203. // to undone, redoing moves them in the other direction.
  10204. this.done = []; this.undone = [];
  10205. this.undoDepth = Infinity;
  10206. // Used to track when changes can be merged into a single undo
  10207. // event
  10208. this.lastModTime = this.lastSelTime = 0;
  10209. this.lastOp = this.lastSelOp = null;
  10210. this.lastOrigin = this.lastSelOrigin = null;
  10211. // Used by the isClean() method
  10212. this.generation = this.maxGeneration = startGen || 1;
  10213. }
  10214. // Create a history change event from an updateDoc-style change
  10215. // object.
  10216. function historyChangeFromChange(doc, change) {
  10217. var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
  10218. attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
  10219. linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
  10220. return histChange
  10221. }
  10222. // Pop all selection events off the end of a history array. Stop at
  10223. // a change event.
  10224. function clearSelectionEvents(array) {
  10225. while (array.length) {
  10226. var last = lst(array);
  10227. if (last.ranges) { array.pop(); }
  10228. else { break }
  10229. }
  10230. }
  10231. // Find the top change event in the history. Pop off selection
  10232. // events that are in the way.
  10233. function lastChangeEvent(hist, force) {
  10234. if (force) {
  10235. clearSelectionEvents(hist.done);
  10236. return lst(hist.done)
  10237. } else if (hist.done.length && !lst(hist.done).ranges) {
  10238. return lst(hist.done)
  10239. } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
  10240. hist.done.pop();
  10241. return lst(hist.done)
  10242. }
  10243. }
  10244. // Register a change in the history. Merges changes that are within
  10245. // a single operation, or are close together with an origin that
  10246. // allows merging (starting with "+") into a single event.
  10247. function addChangeToHistory(doc, change, selAfter, opId) {
  10248. var hist = doc.history;
  10249. hist.undone.length = 0;
  10250. var time = +new Date, cur;
  10251. var last;
  10252. if ((hist.lastOp == opId ||
  10253. hist.lastOrigin == change.origin && change.origin &&
  10254. ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
  10255. change.origin.charAt(0) == "*")) &&
  10256. (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
  10257. // Merge this change into the last event
  10258. last = lst(cur.changes);
  10259. if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
  10260. // Optimized case for simple insertion -- don't want to add
  10261. // new changesets for every character typed
  10262. last.to = changeEnd(change);
  10263. } else {
  10264. // Add new sub-event
  10265. cur.changes.push(historyChangeFromChange(doc, change));
  10266. }
  10267. } else {
  10268. // Can not be merged, start a new event.
  10269. var before = lst(hist.done);
  10270. if (!before || !before.ranges)
  10271. { pushSelectionToHistory(doc.sel, hist.done); }
  10272. cur = {changes: [historyChangeFromChange(doc, change)],
  10273. generation: hist.generation};
  10274. hist.done.push(cur);
  10275. while (hist.done.length > hist.undoDepth) {
  10276. hist.done.shift();
  10277. if (!hist.done[0].ranges) { hist.done.shift(); }
  10278. }
  10279. }
  10280. hist.done.push(selAfter);
  10281. hist.generation = ++hist.maxGeneration;
  10282. hist.lastModTime = hist.lastSelTime = time;
  10283. hist.lastOp = hist.lastSelOp = opId;
  10284. hist.lastOrigin = hist.lastSelOrigin = change.origin;
  10285. if (!last) { signal(doc, "historyAdded"); }
  10286. }
  10287. function selectionEventCanBeMerged(doc, origin, prev, sel) {
  10288. var ch = origin.charAt(0);
  10289. return ch == "*" ||
  10290. ch == "+" &&
  10291. prev.ranges.length == sel.ranges.length &&
  10292. prev.somethingSelected() == sel.somethingSelected() &&
  10293. new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
  10294. }
  10295. // Called whenever the selection changes, sets the new selection as
  10296. // the pending selection in the history, and pushes the old pending
  10297. // selection into the 'done' array when it was significantly
  10298. // different (in number of selected ranges, emptiness, or time).
  10299. function addSelectionToHistory(doc, sel, opId, options) {
  10300. var hist = doc.history, origin = options && options.origin;
  10301. // A new event is started when the previous origin does not match
  10302. // the current, or the origins don't allow matching. Origins
  10303. // starting with * are always merged, those starting with + are
  10304. // merged when similar and close together in time.
  10305. if (opId == hist.lastSelOp ||
  10306. (origin && hist.lastSelOrigin == origin &&
  10307. (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
  10308. selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
  10309. { hist.done[hist.done.length - 1] = sel; }
  10310. else
  10311. { pushSelectionToHistory(sel, hist.done); }
  10312. hist.lastSelTime = +new Date;
  10313. hist.lastSelOrigin = origin;
  10314. hist.lastSelOp = opId;
  10315. if (options && options.clearRedo !== false)
  10316. { clearSelectionEvents(hist.undone); }
  10317. }
  10318. function pushSelectionToHistory(sel, dest) {
  10319. var top = lst(dest);
  10320. if (!(top && top.ranges && top.equals(sel)))
  10321. { dest.push(sel); }
  10322. }
  10323. // Used to store marked span information in the history.
  10324. function attachLocalSpans(doc, change, from, to) {
  10325. var existing = change["spans_" + doc.id], n = 0;
  10326. doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
  10327. if (line.markedSpans)
  10328. { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
  10329. ++n;
  10330. });
  10331. }
  10332. // When un/re-doing restores text containing marked spans, those
  10333. // that have been explicitly cleared should not be restored.
  10334. function removeClearedSpans(spans) {
  10335. if (!spans) { return null }
  10336. var out;
  10337. for (var i = 0; i < spans.length; ++i) {
  10338. if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
  10339. else if (out) { out.push(spans[i]); }
  10340. }
  10341. return !out ? spans : out.length ? out : null
  10342. }
  10343. // Retrieve and filter the old marked spans stored in a change event.
  10344. function getOldSpans(doc, change) {
  10345. var found = change["spans_" + doc.id];
  10346. if (!found) { return null }
  10347. var nw = [];
  10348. for (var i = 0; i < change.text.length; ++i)
  10349. { nw.push(removeClearedSpans(found[i])); }
  10350. return nw
  10351. }
  10352. // Used for un/re-doing changes from the history. Combines the
  10353. // result of computing the existing spans with the set of spans that
  10354. // existed in the history (so that deleting around a span and then
  10355. // undoing brings back the span).
  10356. function mergeOldSpans(doc, change) {
  10357. var old = getOldSpans(doc, change);
  10358. var stretched = stretchSpansOverChange(doc, change);
  10359. if (!old) { return stretched }
  10360. if (!stretched) { return old }
  10361. for (var i = 0; i < old.length; ++i) {
  10362. var oldCur = old[i], stretchCur = stretched[i];
  10363. if (oldCur && stretchCur) {
  10364. spans: for (var j = 0; j < stretchCur.length; ++j) {
  10365. var span = stretchCur[j];
  10366. for (var k = 0; k < oldCur.length; ++k)
  10367. { if (oldCur[k].marker == span.marker) { continue spans } }
  10368. oldCur.push(span);
  10369. }
  10370. } else if (stretchCur) {
  10371. old[i] = stretchCur;
  10372. }
  10373. }
  10374. return old
  10375. }
  10376. // Used both to provide a JSON-safe object in .getHistory, and, when
  10377. // detaching a document, to split the history in two
  10378. function copyHistoryArray(events, newGroup, instantiateSel) {
  10379. var copy = [];
  10380. for (var i = 0; i < events.length; ++i) {
  10381. var event = events[i];
  10382. if (event.ranges) {
  10383. copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
  10384. continue
  10385. }
  10386. var changes = event.changes, newChanges = [];
  10387. copy.push({changes: newChanges});
  10388. for (var j = 0; j < changes.length; ++j) {
  10389. var change = changes[j], m = (void 0);
  10390. newChanges.push({from: change.from, to: change.to, text: change.text});
  10391. if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
  10392. if (indexOf(newGroup, Number(m[1])) > -1) {
  10393. lst(newChanges)[prop] = change[prop];
  10394. delete change[prop];
  10395. }
  10396. } } }
  10397. }
  10398. }
  10399. return copy
  10400. }
  10401. // The 'scroll' parameter given to many of these indicated whether
  10402. // the new cursor position should be scrolled into view after
  10403. // modifying the selection.
  10404. // If shift is held or the extend flag is set, extends a range to
  10405. // include a given position (and optionally a second position).
  10406. // Otherwise, simply returns the range between the given positions.
  10407. // Used for cursor motion and such.
  10408. function extendRange(doc, range, head, other) {
  10409. if (doc.cm && doc.cm.display.shift || doc.extend) {
  10410. var anchor = range.anchor;
  10411. if (other) {
  10412. var posBefore = cmp(head, anchor) < 0;
  10413. if (posBefore != (cmp(other, anchor) < 0)) {
  10414. anchor = head;
  10415. head = other;
  10416. } else if (posBefore != (cmp(head, other) < 0)) {
  10417. head = other;
  10418. }
  10419. }
  10420. return new Range(anchor, head)
  10421. } else {
  10422. return new Range(other || head, head)
  10423. }
  10424. }
  10425. // Extend the primary selection range, discard the rest.
  10426. function extendSelection(doc, head, other, options) {
  10427. setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
  10428. }
  10429. // Extend all selections (pos is an array of selections with length
  10430. // equal the number of selections)
  10431. function extendSelections(doc, heads, options) {
  10432. var out = [];
  10433. for (var i = 0; i < doc.sel.ranges.length; i++)
  10434. { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); }
  10435. var newSel = normalizeSelection(out, doc.sel.primIndex);
  10436. setSelection(doc, newSel, options);
  10437. }
  10438. // Updates a single range in the selection.
  10439. function replaceOneSelection(doc, i, range, options) {
  10440. var ranges = doc.sel.ranges.slice(0);
  10441. ranges[i] = range;
  10442. setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
  10443. }
  10444. // Reset the selection to a single range.
  10445. function setSimpleSelection(doc, anchor, head, options) {
  10446. setSelection(doc, simpleSelection(anchor, head), options);
  10447. }
  10448. // Give beforeSelectionChange handlers a change to influence a
  10449. // selection update.
  10450. function filterSelectionChange(doc, sel, options) {
  10451. var obj = {
  10452. ranges: sel.ranges,
  10453. update: function(ranges) {
  10454. var this$1 = this;
  10455. this.ranges = [];
  10456. for (var i = 0; i < ranges.length; i++)
  10457. { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
  10458. clipPos(doc, ranges[i].head)); }
  10459. },
  10460. origin: options && options.origin
  10461. };
  10462. signal(doc, "beforeSelectionChange", doc, obj);
  10463. if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
  10464. if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
  10465. else { return sel }
  10466. }
  10467. function setSelectionReplaceHistory(doc, sel, options) {
  10468. var done = doc.history.done, last = lst(done);
  10469. if (last && last.ranges) {
  10470. done[done.length - 1] = sel;
  10471. setSelectionNoUndo(doc, sel, options);
  10472. } else {
  10473. setSelection(doc, sel, options);
  10474. }
  10475. }
  10476. // Set a new selection.
  10477. function setSelection(doc, sel, options) {
  10478. setSelectionNoUndo(doc, sel, options);
  10479. addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
  10480. }
  10481. function setSelectionNoUndo(doc, sel, options) {
  10482. if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
  10483. { sel = filterSelectionChange(doc, sel, options); }
  10484. var bias = options && options.bias ||
  10485. (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
  10486. setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
  10487. if (!(options && options.scroll === false) && doc.cm)
  10488. { ensureCursorVisible(doc.cm); }
  10489. }
  10490. function setSelectionInner(doc, sel) {
  10491. if (sel.equals(doc.sel)) { return }
  10492. doc.sel = sel;
  10493. if (doc.cm) {
  10494. doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
  10495. signalCursorActivity(doc.cm);
  10496. }
  10497. signalLater(doc, "cursorActivity", doc);
  10498. }
  10499. // Verify that the selection does not partially select any atomic
  10500. // marked ranges.
  10501. function reCheckSelection(doc) {
  10502. setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
  10503. }
  10504. // Return a selection that does not partially select any atomic
  10505. // ranges.
  10506. function skipAtomicInSelection(doc, sel, bias, mayClear) {
  10507. var out;
  10508. for (var i = 0; i < sel.ranges.length; i++) {
  10509. var range = sel.ranges[i];
  10510. var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
  10511. var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
  10512. var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
  10513. if (out || newAnchor != range.anchor || newHead != range.head) {
  10514. if (!out) { out = sel.ranges.slice(0, i); }
  10515. out[i] = new Range(newAnchor, newHead);
  10516. }
  10517. }
  10518. return out ? normalizeSelection(out, sel.primIndex) : sel
  10519. }
  10520. function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
  10521. var line = getLine(doc, pos.line);
  10522. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  10523. var sp = line.markedSpans[i], m = sp.marker;
  10524. if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
  10525. (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
  10526. if (mayClear) {
  10527. signal(m, "beforeCursorEnter");
  10528. if (m.explicitlyCleared) {
  10529. if (!line.markedSpans) { break }
  10530. else {--i; continue}
  10531. }
  10532. }
  10533. if (!m.atomic) { continue }
  10534. if (oldPos) {
  10535. var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
  10536. if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
  10537. { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
  10538. if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
  10539. { return skipAtomicInner(doc, near, pos, dir, mayClear) }
  10540. }
  10541. var far = m.find(dir < 0 ? -1 : 1);
  10542. if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
  10543. { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
  10544. return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
  10545. }
  10546. } }
  10547. return pos
  10548. }
  10549. // Ensure a given position is not inside an atomic range.
  10550. function skipAtomic(doc, pos, oldPos, bias, mayClear) {
  10551. var dir = bias || 1;
  10552. var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
  10553. (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
  10554. skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
  10555. (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
  10556. if (!found) {
  10557. doc.cantEdit = true;
  10558. return Pos(doc.first, 0)
  10559. }
  10560. return found
  10561. }
  10562. function movePos(doc, pos, dir, line) {
  10563. if (dir < 0 && pos.ch == 0) {
  10564. if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
  10565. else { return null }
  10566. } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
  10567. if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
  10568. else { return null }
  10569. } else {
  10570. return new Pos(pos.line, pos.ch + dir)
  10571. }
  10572. }
  10573. function selectAll(cm) {
  10574. cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
  10575. }
  10576. // UPDATING
  10577. // Allow "beforeChange" event handlers to influence a change
  10578. function filterChange(doc, change, update) {
  10579. var obj = {
  10580. canceled: false,
  10581. from: change.from,
  10582. to: change.to,
  10583. text: change.text,
  10584. origin: change.origin,
  10585. cancel: function () { return obj.canceled = true; }
  10586. };
  10587. if (update) { obj.update = function (from, to, text, origin) {
  10588. if (from) { obj.from = clipPos(doc, from); }
  10589. if (to) { obj.to = clipPos(doc, to); }
  10590. if (text) { obj.text = text; }
  10591. if (origin !== undefined) { obj.origin = origin; }
  10592. }; }
  10593. signal(doc, "beforeChange", doc, obj);
  10594. if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
  10595. if (obj.canceled) { return null }
  10596. return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
  10597. }
  10598. // Apply a change to a document, and add it to the document's
  10599. // history, and propagating it to all linked documents.
  10600. function makeChange(doc, change, ignoreReadOnly) {
  10601. if (doc.cm) {
  10602. if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
  10603. if (doc.cm.state.suppressEdits) { return }
  10604. }
  10605. if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
  10606. change = filterChange(doc, change, true);
  10607. if (!change) { return }
  10608. }
  10609. // Possibly split or suppress the update based on the presence
  10610. // of read-only spans in its range.
  10611. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
  10612. if (split) {
  10613. for (var i = split.length - 1; i >= 0; --i)
  10614. { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); }
  10615. } else {
  10616. makeChangeInner(doc, change);
  10617. }
  10618. }
  10619. function makeChangeInner(doc, change) {
  10620. if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
  10621. var selAfter = computeSelAfterChange(doc, change);
  10622. addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
  10623. makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
  10624. var rebased = [];
  10625. linkedDocs(doc, function (doc, sharedHist) {
  10626. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  10627. rebaseHist(doc.history, change);
  10628. rebased.push(doc.history);
  10629. }
  10630. makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
  10631. });
  10632. }
  10633. // Revert a change stored in a document's history.
  10634. function makeChangeFromHistory(doc, type, allowSelectionOnly) {
  10635. if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
  10636. var hist = doc.history, event, selAfter = doc.sel;
  10637. var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
  10638. // Verify that there is a useable event (so that ctrl-z won't
  10639. // needlessly clear selection events)
  10640. var i = 0;
  10641. for (; i < source.length; i++) {
  10642. event = source[i];
  10643. if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
  10644. { break }
  10645. }
  10646. if (i == source.length) { return }
  10647. hist.lastOrigin = hist.lastSelOrigin = null;
  10648. for (;;) {
  10649. event = source.pop();
  10650. if (event.ranges) {
  10651. pushSelectionToHistory(event, dest);
  10652. if (allowSelectionOnly && !event.equals(doc.sel)) {
  10653. setSelection(doc, event, {clearRedo: false});
  10654. return
  10655. }
  10656. selAfter = event;
  10657. }
  10658. else { break }
  10659. }
  10660. // Build up a reverse change object to add to the opposite history
  10661. // stack (redo when undoing, and vice versa).
  10662. var antiChanges = [];
  10663. pushSelectionToHistory(selAfter, dest);
  10664. dest.push({changes: antiChanges, generation: hist.generation});
  10665. hist.generation = event.generation || ++hist.maxGeneration;
  10666. var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
  10667. var loop = function ( i ) {
  10668. var change = event.changes[i];
  10669. change.origin = type;
  10670. if (filter && !filterChange(doc, change, false)) {
  10671. source.length = 0;
  10672. return {}
  10673. }
  10674. antiChanges.push(historyChangeFromChange(doc, change));
  10675. var after = i ? computeSelAfterChange(doc, change) : lst(source);
  10676. makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
  10677. if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
  10678. var rebased = [];
  10679. // Propagate to the linked documents
  10680. linkedDocs(doc, function (doc, sharedHist) {
  10681. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  10682. rebaseHist(doc.history, change);
  10683. rebased.push(doc.history);
  10684. }
  10685. makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
  10686. });
  10687. };
  10688. for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
  10689. var returned = loop( i$1 );
  10690. if ( returned ) return returned.v;
  10691. }
  10692. }
  10693. // Sub-views need their line numbers shifted when text is added
  10694. // above or below them in the parent document.
  10695. function shiftDoc(doc, distance) {
  10696. if (distance == 0) { return }
  10697. doc.first += distance;
  10698. doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
  10699. Pos(range.anchor.line + distance, range.anchor.ch),
  10700. Pos(range.head.line + distance, range.head.ch)
  10701. ); }), doc.sel.primIndex);
  10702. if (doc.cm) {
  10703. regChange(doc.cm, doc.first, doc.first - distance, distance);
  10704. for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
  10705. { regLineChange(doc.cm, l, "gutter"); }
  10706. }
  10707. }
  10708. // More lower-level change function, handling only a single document
  10709. // (not linked ones).
  10710. function makeChangeSingleDoc(doc, change, selAfter, spans) {
  10711. if (doc.cm && !doc.cm.curOp)
  10712. { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
  10713. if (change.to.line < doc.first) {
  10714. shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
  10715. return
  10716. }
  10717. if (change.from.line > doc.lastLine()) { return }
  10718. // Clip the change to the size of this doc
  10719. if (change.from.line < doc.first) {
  10720. var shift = change.text.length - 1 - (doc.first - change.from.line);
  10721. shiftDoc(doc, shift);
  10722. change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
  10723. text: [lst(change.text)], origin: change.origin};
  10724. }
  10725. var last = doc.lastLine();
  10726. if (change.to.line > last) {
  10727. change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
  10728. text: [change.text[0]], origin: change.origin};
  10729. }
  10730. change.removed = getBetween(doc, change.from, change.to);
  10731. if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
  10732. if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
  10733. else { updateDoc(doc, change, spans); }
  10734. setSelectionNoUndo(doc, selAfter, sel_dontScroll);
  10735. }
  10736. // Handle the interaction of a change to a document with the editor
  10737. // that this document is part of.
  10738. function makeChangeSingleDocInEditor(cm, change, spans) {
  10739. var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
  10740. var recomputeMaxLength = false, checkWidthStart = from.line;
  10741. if (!cm.options.lineWrapping) {
  10742. checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
  10743. doc.iter(checkWidthStart, to.line + 1, function (line) {
  10744. if (line == display.maxLine) {
  10745. recomputeMaxLength = true;
  10746. return true
  10747. }
  10748. });
  10749. }
  10750. if (doc.sel.contains(change.from, change.to) > -1)
  10751. { signalCursorActivity(cm); }
  10752. updateDoc(doc, change, spans, estimateHeight(cm));
  10753. if (!cm.options.lineWrapping) {
  10754. doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
  10755. var len = lineLength(line);
  10756. if (len > display.maxLineLength) {
  10757. display.maxLine = line;
  10758. display.maxLineLength = len;
  10759. display.maxLineChanged = true;
  10760. recomputeMaxLength = false;
  10761. }
  10762. });
  10763. if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
  10764. }
  10765. // Adjust frontier, schedule worker
  10766. doc.frontier = Math.min(doc.frontier, from.line);
  10767. startWorker(cm, 400);
  10768. var lendiff = change.text.length - (to.line - from.line) - 1;
  10769. // Remember that these lines changed, for updating the display
  10770. if (change.full)
  10771. { regChange(cm); }
  10772. else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
  10773. { regLineChange(cm, from.line, "text"); }
  10774. else
  10775. { regChange(cm, from.line, to.line + 1, lendiff); }
  10776. var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
  10777. if (changeHandler || changesHandler) {
  10778. var obj = {
  10779. from: from, to: to,
  10780. text: change.text,
  10781. removed: change.removed,
  10782. origin: change.origin
  10783. };
  10784. if (changeHandler) { signalLater(cm, "change", cm, obj); }
  10785. if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
  10786. }
  10787. cm.display.selForContextMenu = null;
  10788. }
  10789. function replaceRange(doc, code, from, to, origin) {
  10790. if (!to) { to = from; }
  10791. if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
  10792. if (typeof code == "string") { code = doc.splitLines(code); }
  10793. makeChange(doc, {from: from, to: to, text: code, origin: origin});
  10794. }
  10795. // Rebasing/resetting history to deal with externally-sourced changes
  10796. function rebaseHistSelSingle(pos, from, to, diff) {
  10797. if (to < pos.line) {
  10798. pos.line += diff;
  10799. } else if (from < pos.line) {
  10800. pos.line = from;
  10801. pos.ch = 0;
  10802. }
  10803. }
  10804. // Tries to rebase an array of history events given a change in the
  10805. // document. If the change touches the same lines as the event, the
  10806. // event, and everything 'behind' it, is discarded. If the change is
  10807. // before the event, the event's positions are updated. Uses a
  10808. // copy-on-write scheme for the positions, to avoid having to
  10809. // reallocate them all on every rebase, but also avoid problems with
  10810. // shared position objects being unsafely updated.
  10811. function rebaseHistArray(array, from, to, diff) {
  10812. for (var i = 0; i < array.length; ++i) {
  10813. var sub = array[i], ok = true;
  10814. if (sub.ranges) {
  10815. if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
  10816. for (var j = 0; j < sub.ranges.length; j++) {
  10817. rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
  10818. rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
  10819. }
  10820. continue
  10821. }
  10822. for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
  10823. var cur = sub.changes[j$1];
  10824. if (to < cur.from.line) {
  10825. cur.from = Pos(cur.from.line + diff, cur.from.ch);
  10826. cur.to = Pos(cur.to.line + diff, cur.to.ch);
  10827. } else if (from <= cur.to.line) {
  10828. ok = false;
  10829. break
  10830. }
  10831. }
  10832. if (!ok) {
  10833. array.splice(0, i + 1);
  10834. i = 0;
  10835. }
  10836. }
  10837. }
  10838. function rebaseHist(hist, change) {
  10839. var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
  10840. rebaseHistArray(hist.done, from, to, diff);
  10841. rebaseHistArray(hist.undone, from, to, diff);
  10842. }
  10843. // Utility for applying a change to a line by handle or number,
  10844. // returning the number and optionally registering the line as
  10845. // changed.
  10846. function changeLine(doc, handle, changeType, op) {
  10847. var no = handle, line = handle;
  10848. if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
  10849. else { no = lineNo(handle); }
  10850. if (no == null) { return null }
  10851. if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
  10852. return line
  10853. }
  10854. // The document is represented as a BTree consisting of leaves, with
  10855. // chunk of lines in them, and branches, with up to ten leaves or
  10856. // other branch nodes below them. The top node is always a branch
  10857. // node, and is the document object itself (meaning it has
  10858. // additional methods and properties).
  10859. //
  10860. // All nodes have parent links. The tree is used both to go from
  10861. // line numbers to line objects, and to go from objects to numbers.
  10862. // It also indexes by height, and is used to convert between height
  10863. // and line object, and to find the total height of the document.
  10864. //
  10865. // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
  10866. var LeafChunk = function(lines) {
  10867. var this$1 = this;
  10868. this.lines = lines;
  10869. this.parent = null;
  10870. var height = 0;
  10871. for (var i = 0; i < lines.length; ++i) {
  10872. lines[i].parent = this$1;
  10873. height += lines[i].height;
  10874. }
  10875. this.height = height;
  10876. };
  10877. LeafChunk.prototype.chunkSize = function () { return this.lines.length };
  10878. // Remove the n lines at offset 'at'.
  10879. LeafChunk.prototype.removeInner = function (at, n) {
  10880. var this$1 = this;
  10881. for (var i = at, e = at + n; i < e; ++i) {
  10882. var line = this$1.lines[i];
  10883. this$1.height -= line.height;
  10884. cleanUpLine(line);
  10885. signalLater(line, "delete");
  10886. }
  10887. this.lines.splice(at, n);
  10888. };
  10889. // Helper used to collapse a small branch into a single leaf.
  10890. LeafChunk.prototype.collapse = function (lines) {
  10891. lines.push.apply(lines, this.lines);
  10892. };
  10893. // Insert the given array of lines at offset 'at', count them as
  10894. // having the given height.
  10895. LeafChunk.prototype.insertInner = function (at, lines, height) {
  10896. var this$1 = this;
  10897. this.height += height;
  10898. this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
  10899. for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
  10900. };
  10901. // Used to iterate over a part of the tree.
  10902. LeafChunk.prototype.iterN = function (at, n, op) {
  10903. var this$1 = this;
  10904. for (var e = at + n; at < e; ++at)
  10905. { if (op(this$1.lines[at])) { return true } }
  10906. };
  10907. var BranchChunk = function(children) {
  10908. var this$1 = this;
  10909. this.children = children;
  10910. var size = 0, height = 0;
  10911. for (var i = 0; i < children.length; ++i) {
  10912. var ch = children[i];
  10913. size += ch.chunkSize(); height += ch.height;
  10914. ch.parent = this$1;
  10915. }
  10916. this.size = size;
  10917. this.height = height;
  10918. this.parent = null;
  10919. };
  10920. BranchChunk.prototype.chunkSize = function () { return this.size };
  10921. BranchChunk.prototype.removeInner = function (at, n) {
  10922. var this$1 = this;
  10923. this.size -= n;
  10924. for (var i = 0; i < this.children.length; ++i) {
  10925. var child = this$1.children[i], sz = child.chunkSize();
  10926. if (at < sz) {
  10927. var rm = Math.min(n, sz - at), oldHeight = child.height;
  10928. child.removeInner(at, rm);
  10929. this$1.height -= oldHeight - child.height;
  10930. if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
  10931. if ((n -= rm) == 0) { break }
  10932. at = 0;
  10933. } else { at -= sz; }
  10934. }
  10935. // If the result is smaller than 25 lines, ensure that it is a
  10936. // single leaf node.
  10937. if (this.size - n < 25 &&
  10938. (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
  10939. var lines = [];
  10940. this.collapse(lines);
  10941. this.children = [new LeafChunk(lines)];
  10942. this.children[0].parent = this;
  10943. }
  10944. };
  10945. BranchChunk.prototype.collapse = function (lines) {
  10946. var this$1 = this;
  10947. for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
  10948. };
  10949. BranchChunk.prototype.insertInner = function (at, lines, height) {
  10950. var this$1 = this;
  10951. this.size += lines.length;
  10952. this.height += height;
  10953. for (var i = 0; i < this.children.length; ++i) {
  10954. var child = this$1.children[i], sz = child.chunkSize();
  10955. if (at <= sz) {
  10956. child.insertInner(at, lines, height);
  10957. if (child.lines && child.lines.length > 50) {
  10958. // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
  10959. // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
  10960. var remaining = child.lines.length % 25 + 25;
  10961. for (var pos = remaining; pos < child.lines.length;) {
  10962. var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
  10963. child.height -= leaf.height;
  10964. this$1.children.splice(++i, 0, leaf);
  10965. leaf.parent = this$1;
  10966. }
  10967. child.lines = child.lines.slice(0, remaining);
  10968. this$1.maybeSpill();
  10969. }
  10970. break
  10971. }
  10972. at -= sz;
  10973. }
  10974. };
  10975. // When a node has grown, check whether it should be split.
  10976. BranchChunk.prototype.maybeSpill = function () {
  10977. if (this.children.length <= 10) { return }
  10978. var me = this;
  10979. do {
  10980. var spilled = me.children.splice(me.children.length - 5, 5);
  10981. var sibling = new BranchChunk(spilled);
  10982. if (!me.parent) { // Become the parent node
  10983. var copy = new BranchChunk(me.children);
  10984. copy.parent = me;
  10985. me.children = [copy, sibling];
  10986. me = copy;
  10987. } else {
  10988. me.size -= sibling.size;
  10989. me.height -= sibling.height;
  10990. var myIndex = indexOf(me.parent.children, me);
  10991. me.parent.children.splice(myIndex + 1, 0, sibling);
  10992. }
  10993. sibling.parent = me.parent;
  10994. } while (me.children.length > 10)
  10995. me.parent.maybeSpill();
  10996. };
  10997. BranchChunk.prototype.iterN = function (at, n, op) {
  10998. var this$1 = this;
  10999. for (var i = 0; i < this.children.length; ++i) {
  11000. var child = this$1.children[i], sz = child.chunkSize();
  11001. if (at < sz) {
  11002. var used = Math.min(n, sz - at);
  11003. if (child.iterN(at, used, op)) { return true }
  11004. if ((n -= used) == 0) { break }
  11005. at = 0;
  11006. } else { at -= sz; }
  11007. }
  11008. };
  11009. // Line widgets are block elements displayed above or below a line.
  11010. var LineWidget = function(doc, node, options) {
  11011. var this$1 = this;
  11012. if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
  11013. { this$1[opt] = options[opt]; } } }
  11014. this.doc = doc;
  11015. this.node = node;
  11016. };
  11017. LineWidget.prototype.clear = function () {
  11018. var this$1 = this;
  11019. var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
  11020. if (no == null || !ws) { return }
  11021. for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
  11022. if (!ws.length) { line.widgets = null; }
  11023. var height = widgetHeight(this);
  11024. updateLineHeight(line, Math.max(0, line.height - height));
  11025. if (cm) {
  11026. runInOp(cm, function () {
  11027. adjustScrollWhenAboveVisible(cm, line, -height);
  11028. regLineChange(cm, no, "widget");
  11029. });
  11030. signalLater(cm, "lineWidgetCleared", cm, this, no);
  11031. }
  11032. };
  11033. LineWidget.prototype.changed = function () {
  11034. var this$1 = this;
  11035. var oldH = this.height, cm = this.doc.cm, line = this.line;
  11036. this.height = null;
  11037. var diff = widgetHeight(this) - oldH;
  11038. if (!diff) { return }
  11039. updateLineHeight(line, line.height + diff);
  11040. if (cm) {
  11041. runInOp(cm, function () {
  11042. cm.curOp.forceUpdate = true;
  11043. adjustScrollWhenAboveVisible(cm, line, diff);
  11044. signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
  11045. });
  11046. }
  11047. };
  11048. eventMixin(LineWidget);
  11049. function adjustScrollWhenAboveVisible(cm, line, diff) {
  11050. if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
  11051. { addToScrollPos(cm, null, diff); }
  11052. }
  11053. function addLineWidget(doc, handle, node, options) {
  11054. var widget = new LineWidget(doc, node, options);
  11055. var cm = doc.cm;
  11056. if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
  11057. changeLine(doc, handle, "widget", function (line) {
  11058. var widgets = line.widgets || (line.widgets = []);
  11059. if (widget.insertAt == null) { widgets.push(widget); }
  11060. else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
  11061. widget.line = line;
  11062. if (cm && !lineIsHidden(doc, line)) {
  11063. var aboveVisible = heightAtLine(line) < doc.scrollTop;
  11064. updateLineHeight(line, line.height + widgetHeight(widget));
  11065. if (aboveVisible) { addToScrollPos(cm, null, widget.height); }
  11066. cm.curOp.forceUpdate = true;
  11067. }
  11068. return true
  11069. });
  11070. signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle));
  11071. return widget
  11072. }
  11073. // TEXTMARKERS
  11074. // Created with markText and setBookmark methods. A TextMarker is a
  11075. // handle that can be used to clear or find a marked position in the
  11076. // document. Line objects hold arrays (markedSpans) containing
  11077. // {from, to, marker} object pointing to such marker objects, and
  11078. // indicating that such a marker is present on that line. Multiple
  11079. // lines may point to the same marker when it spans across lines.
  11080. // The spans will have null for their from/to properties when the
  11081. // marker continues beyond the start/end of the line. Markers have
  11082. // links back to the lines they currently touch.
  11083. // Collapsed markers have unique ids, in order to be able to order
  11084. // them, which is needed for uniquely determining an outer marker
  11085. // when they overlap (they may nest, but not partially overlap).
  11086. var nextMarkerId = 0;
  11087. var TextMarker = function(doc, type) {
  11088. this.lines = [];
  11089. this.type = type;
  11090. this.doc = doc;
  11091. this.id = ++nextMarkerId;
  11092. };
  11093. // Clear the marker.
  11094. TextMarker.prototype.clear = function () {
  11095. var this$1 = this;
  11096. if (this.explicitlyCleared) { return }
  11097. var cm = this.doc.cm, withOp = cm && !cm.curOp;
  11098. if (withOp) { startOperation(cm); }
  11099. if (hasHandler(this, "clear")) {
  11100. var found = this.find();
  11101. if (found) { signalLater(this, "clear", found.from, found.to); }
  11102. }
  11103. var min = null, max = null;
  11104. for (var i = 0; i < this.lines.length; ++i) {
  11105. var line = this$1.lines[i];
  11106. var span = getMarkedSpanFor(line.markedSpans, this$1);
  11107. if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
  11108. else if (cm) {
  11109. if (span.to != null) { max = lineNo(line); }
  11110. if (span.from != null) { min = lineNo(line); }
  11111. }
  11112. line.markedSpans = removeMarkedSpan(line.markedSpans, span);
  11113. if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
  11114. { updateLineHeight(line, textHeight(cm.display)); }
  11115. }
  11116. if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
  11117. var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
  11118. if (len > cm.display.maxLineLength) {
  11119. cm.display.maxLine = visual;
  11120. cm.display.maxLineLength = len;
  11121. cm.display.maxLineChanged = true;
  11122. }
  11123. } }
  11124. if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
  11125. this.lines.length = 0;
  11126. this.explicitlyCleared = true;
  11127. if (this.atomic && this.doc.cantEdit) {
  11128. this.doc.cantEdit = false;
  11129. if (cm) { reCheckSelection(cm.doc); }
  11130. }
  11131. if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
  11132. if (withOp) { endOperation(cm); }
  11133. if (this.parent) { this.parent.clear(); }
  11134. };
  11135. // Find the position of the marker in the document. Returns a {from,
  11136. // to} object by default. Side can be passed to get a specific side
  11137. // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
  11138. // Pos objects returned contain a line object, rather than a line
  11139. // number (used to prevent looking up the same line twice).
  11140. TextMarker.prototype.find = function (side, lineObj) {
  11141. var this$1 = this;
  11142. if (side == null && this.type == "bookmark") { side = 1; }
  11143. var from, to;
  11144. for (var i = 0; i < this.lines.length; ++i) {
  11145. var line = this$1.lines[i];
  11146. var span = getMarkedSpanFor(line.markedSpans, this$1);
  11147. if (span.from != null) {
  11148. from = Pos(lineObj ? line : lineNo(line), span.from);
  11149. if (side == -1) { return from }
  11150. }
  11151. if (span.to != null) {
  11152. to = Pos(lineObj ? line : lineNo(line), span.to);
  11153. if (side == 1) { return to }
  11154. }
  11155. }
  11156. return from && {from: from, to: to}
  11157. };
  11158. // Signals that the marker's widget changed, and surrounding layout
  11159. // should be recomputed.
  11160. TextMarker.prototype.changed = function () {
  11161. var this$1 = this;
  11162. var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
  11163. if (!pos || !cm) { return }
  11164. runInOp(cm, function () {
  11165. var line = pos.line, lineN = lineNo(pos.line);
  11166. var view = findViewForLine(cm, lineN);
  11167. if (view) {
  11168. clearLineMeasurementCacheFor(view);
  11169. cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
  11170. }
  11171. cm.curOp.updateMaxLine = true;
  11172. if (!lineIsHidden(widget.doc, line) && widget.height != null) {
  11173. var oldHeight = widget.height;
  11174. widget.height = null;
  11175. var dHeight = widgetHeight(widget) - oldHeight;
  11176. if (dHeight)
  11177. { updateLineHeight(line, line.height + dHeight); }
  11178. }
  11179. signalLater(cm, "markerChanged", cm, this$1);
  11180. });
  11181. };
  11182. TextMarker.prototype.attachLine = function (line) {
  11183. if (!this.lines.length && this.doc.cm) {
  11184. var op = this.doc.cm.curOp;
  11185. if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
  11186. { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
  11187. }
  11188. this.lines.push(line);
  11189. };
  11190. TextMarker.prototype.detachLine = function (line) {
  11191. this.lines.splice(indexOf(this.lines, line), 1);
  11192. if (!this.lines.length && this.doc.cm) {
  11193. var op = this.doc.cm.curOp;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
  11194. }
  11195. };
  11196. eventMixin(TextMarker);
  11197. // Create a marker, wire it up to the right lines, and
  11198. function markText(doc, from, to, options, type) {
  11199. // Shared markers (across linked documents) are handled separately
  11200. // (markTextShared will call out to this again, once per
  11201. // document).
  11202. if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
  11203. // Ensure we are in an operation.
  11204. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
  11205. var marker = new TextMarker(doc, type), diff = cmp(from, to);
  11206. if (options) { copyObj(options, marker, false); }
  11207. // Don't connect empty markers unless clearWhenEmpty is false
  11208. if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
  11209. { return marker }
  11210. if (marker.replacedWith) {
  11211. // Showing up as a widget implies collapsed (widget replaces text)
  11212. marker.collapsed = true;
  11213. marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
  11214. if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
  11215. if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
  11216. }
  11217. if (marker.collapsed) {
  11218. if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
  11219. from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
  11220. { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
  11221. seeCollapsedSpans();
  11222. }
  11223. if (marker.addToHistory)
  11224. { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
  11225. var curLine = from.line, cm = doc.cm, updateMaxLine;
  11226. doc.iter(curLine, to.line + 1, function (line) {
  11227. if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
  11228. { updateMaxLine = true; }
  11229. if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
  11230. addMarkedSpan(line, new MarkedSpan(marker,
  11231. curLine == from.line ? from.ch : null,
  11232. curLine == to.line ? to.ch : null));
  11233. ++curLine;
  11234. });
  11235. // lineIsHidden depends on the presence of the spans, so needs a second pass
  11236. if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
  11237. if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
  11238. }); }
  11239. if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
  11240. if (marker.readOnly) {
  11241. seeReadOnlySpans();
  11242. if (doc.history.done.length || doc.history.undone.length)
  11243. { doc.clearHistory(); }
  11244. }
  11245. if (marker.collapsed) {
  11246. marker.id = ++nextMarkerId;
  11247. marker.atomic = true;
  11248. }
  11249. if (cm) {
  11250. // Sync editor state
  11251. if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
  11252. if (marker.collapsed)
  11253. { regChange(cm, from.line, to.line + 1); }
  11254. else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
  11255. { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
  11256. if (marker.atomic) { reCheckSelection(cm.doc); }
  11257. signalLater(cm, "markerAdded", cm, marker);
  11258. }
  11259. return marker
  11260. }
  11261. // SHARED TEXTMARKERS
  11262. // A shared marker spans multiple linked documents. It is
  11263. // implemented as a meta-marker-object controlling multiple normal
  11264. // markers.
  11265. var SharedTextMarker = function(markers, primary) {
  11266. var this$1 = this;
  11267. this.markers = markers;
  11268. this.primary = primary;
  11269. for (var i = 0; i < markers.length; ++i)
  11270. { markers[i].parent = this$1; }
  11271. };
  11272. SharedTextMarker.prototype.clear = function () {
  11273. var this$1 = this;
  11274. if (this.explicitlyCleared) { return }
  11275. this.explicitlyCleared = true;
  11276. for (var i = 0; i < this.markers.length; ++i)
  11277. { this$1.markers[i].clear(); }
  11278. signalLater(this, "clear");
  11279. };
  11280. SharedTextMarker.prototype.find = function (side, lineObj) {
  11281. return this.primary.find(side, lineObj)
  11282. };
  11283. eventMixin(SharedTextMarker);
  11284. function markTextShared(doc, from, to, options, type) {
  11285. options = copyObj(options);
  11286. options.shared = false;
  11287. var markers = [markText(doc, from, to, options, type)], primary = markers[0];
  11288. var widget = options.widgetNode;
  11289. linkedDocs(doc, function (doc) {
  11290. if (widget) { options.widgetNode = widget.cloneNode(true); }
  11291. markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
  11292. for (var i = 0; i < doc.linked.length; ++i)
  11293. { if (doc.linked[i].isParent) { return } }
  11294. primary = lst(markers);
  11295. });
  11296. return new SharedTextMarker(markers, primary)
  11297. }
  11298. function findSharedMarkers(doc) {
  11299. return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
  11300. }
  11301. function copySharedMarkers(doc, markers) {
  11302. for (var i = 0; i < markers.length; i++) {
  11303. var marker = markers[i], pos = marker.find();
  11304. var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
  11305. if (cmp(mFrom, mTo)) {
  11306. var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
  11307. marker.markers.push(subMark);
  11308. subMark.parent = marker;
  11309. }
  11310. }
  11311. }
  11312. function detachSharedMarkers(markers) {
  11313. var loop = function ( i ) {
  11314. var marker = markers[i], linked = [marker.primary.doc];
  11315. linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
  11316. for (var j = 0; j < marker.markers.length; j++) {
  11317. var subMarker = marker.markers[j];
  11318. if (indexOf(linked, subMarker.doc) == -1) {
  11319. subMarker.parent = null;
  11320. marker.markers.splice(j--, 1);
  11321. }
  11322. }
  11323. };
  11324. for (var i = 0; i < markers.length; i++) loop( i );
  11325. }
  11326. var nextDocId = 0;
  11327. var Doc = function(text, mode, firstLine, lineSep, direction) {
  11328. if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
  11329. if (firstLine == null) { firstLine = 0; }
  11330. BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
  11331. this.first = firstLine;
  11332. this.scrollTop = this.scrollLeft = 0;
  11333. this.cantEdit = false;
  11334. this.cleanGeneration = 1;
  11335. this.frontier = firstLine;
  11336. var start = Pos(firstLine, 0);
  11337. this.sel = simpleSelection(start);
  11338. this.history = new History(null);
  11339. this.id = ++nextDocId;
  11340. this.modeOption = mode;
  11341. this.lineSep = lineSep;
  11342. this.direction = (direction == "rtl") ? "rtl" : "ltr";
  11343. this.extend = false;
  11344. if (typeof text == "string") { text = this.splitLines(text); }
  11345. updateDoc(this, {from: start, to: start, text: text});
  11346. setSelection(this, simpleSelection(start), sel_dontScroll);
  11347. };
  11348. Doc.prototype = createObj(BranchChunk.prototype, {
  11349. constructor: Doc,
  11350. // Iterate over the document. Supports two forms -- with only one
  11351. // argument, it calls that for each line in the document. With
  11352. // three, it iterates over the range given by the first two (with
  11353. // the second being non-inclusive).
  11354. iter: function(from, to, op) {
  11355. if (op) { this.iterN(from - this.first, to - from, op); }
  11356. else { this.iterN(this.first, this.first + this.size, from); }
  11357. },
  11358. // Non-public interface for adding and removing lines.
  11359. insert: function(at, lines) {
  11360. var height = 0;
  11361. for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
  11362. this.insertInner(at - this.first, lines, height);
  11363. },
  11364. remove: function(at, n) { this.removeInner(at - this.first, n); },
  11365. // From here, the methods are part of the public interface. Most
  11366. // are also available from CodeMirror (editor) instances.
  11367. getValue: function(lineSep) {
  11368. var lines = getLines(this, this.first, this.first + this.size);
  11369. if (lineSep === false) { return lines }
  11370. return lines.join(lineSep || this.lineSeparator())
  11371. },
  11372. setValue: docMethodOp(function(code) {
  11373. var top = Pos(this.first, 0), last = this.first + this.size - 1;
  11374. makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
  11375. text: this.splitLines(code), origin: "setValue", full: true}, true);
  11376. setSelection(this, simpleSelection(top));
  11377. }),
  11378. replaceRange: function(code, from, to, origin) {
  11379. from = clipPos(this, from);
  11380. to = to ? clipPos(this, to) : from;
  11381. replaceRange(this, code, from, to, origin);
  11382. },
  11383. getRange: function(from, to, lineSep) {
  11384. var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
  11385. if (lineSep === false) { return lines }
  11386. return lines.join(lineSep || this.lineSeparator())
  11387. },
  11388. getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
  11389. getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
  11390. getLineNumber: function(line) {return lineNo(line)},
  11391. getLineHandleVisualStart: function(line) {
  11392. if (typeof line == "number") { line = getLine(this, line); }
  11393. return visualLine(line)
  11394. },
  11395. lineCount: function() {return this.size},
  11396. firstLine: function() {return this.first},
  11397. lastLine: function() {return this.first + this.size - 1},
  11398. clipPos: function(pos) {return clipPos(this, pos)},
  11399. getCursor: function(start) {
  11400. var range$$1 = this.sel.primary(), pos;
  11401. if (start == null || start == "head") { pos = range$$1.head; }
  11402. else if (start == "anchor") { pos = range$$1.anchor; }
  11403. else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
  11404. else { pos = range$$1.from(); }
  11405. return pos
  11406. },
  11407. listSelections: function() { return this.sel.ranges },
  11408. somethingSelected: function() {return this.sel.somethingSelected()},
  11409. setCursor: docMethodOp(function(line, ch, options) {
  11410. setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
  11411. }),
  11412. setSelection: docMethodOp(function(anchor, head, options) {
  11413. setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
  11414. }),
  11415. extendSelection: docMethodOp(function(head, other, options) {
  11416. extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
  11417. }),
  11418. extendSelections: docMethodOp(function(heads, options) {
  11419. extendSelections(this, clipPosArray(this, heads), options);
  11420. }),
  11421. extendSelectionsBy: docMethodOp(function(f, options) {
  11422. var heads = map(this.sel.ranges, f);
  11423. extendSelections(this, clipPosArray(this, heads), options);
  11424. }),
  11425. setSelections: docMethodOp(function(ranges, primary, options) {
  11426. var this$1 = this;
  11427. if (!ranges.length) { return }
  11428. var out = [];
  11429. for (var i = 0; i < ranges.length; i++)
  11430. { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
  11431. clipPos(this$1, ranges[i].head)); }
  11432. if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
  11433. setSelection(this, normalizeSelection(out, primary), options);
  11434. }),
  11435. addSelection: docMethodOp(function(anchor, head, options) {
  11436. var ranges = this.sel.ranges.slice(0);
  11437. ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
  11438. setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);
  11439. }),
  11440. getSelection: function(lineSep) {
  11441. var this$1 = this;
  11442. var ranges = this.sel.ranges, lines;
  11443. for (var i = 0; i < ranges.length; i++) {
  11444. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  11445. lines = lines ? lines.concat(sel) : sel;
  11446. }
  11447. if (lineSep === false) { return lines }
  11448. else { return lines.join(lineSep || this.lineSeparator()) }
  11449. },
  11450. getSelections: function(lineSep) {
  11451. var this$1 = this;
  11452. var parts = [], ranges = this.sel.ranges;
  11453. for (var i = 0; i < ranges.length; i++) {
  11454. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  11455. if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
  11456. parts[i] = sel;
  11457. }
  11458. return parts
  11459. },
  11460. replaceSelection: function(code, collapse, origin) {
  11461. var dup = [];
  11462. for (var i = 0; i < this.sel.ranges.length; i++)
  11463. { dup[i] = code; }
  11464. this.replaceSelections(dup, collapse, origin || "+input");
  11465. },
  11466. replaceSelections: docMethodOp(function(code, collapse, origin) {
  11467. var this$1 = this;
  11468. var changes = [], sel = this.sel;
  11469. for (var i = 0; i < sel.ranges.length; i++) {
  11470. var range$$1 = sel.ranges[i];
  11471. changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
  11472. }
  11473. var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
  11474. for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
  11475. { makeChange(this$1, changes[i$1]); }
  11476. if (newSel) { setSelectionReplaceHistory(this, newSel); }
  11477. else if (this.cm) { ensureCursorVisible(this.cm); }
  11478. }),
  11479. undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
  11480. redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
  11481. undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
  11482. redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
  11483. setExtending: function(val) {this.extend = val;},
  11484. getExtending: function() {return this.extend},
  11485. historySize: function() {
  11486. var hist = this.history, done = 0, undone = 0;
  11487. for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
  11488. for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
  11489. return {undo: done, redo: undone}
  11490. },
  11491. clearHistory: function() {this.history = new History(this.history.maxGeneration);},
  11492. markClean: function() {
  11493. this.cleanGeneration = this.changeGeneration(true);
  11494. },
  11495. changeGeneration: function(forceSplit) {
  11496. if (forceSplit)
  11497. { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
  11498. return this.history.generation
  11499. },
  11500. isClean: function (gen) {
  11501. return this.history.generation == (gen || this.cleanGeneration)
  11502. },
  11503. getHistory: function() {
  11504. return {done: copyHistoryArray(this.history.done),
  11505. undone: copyHistoryArray(this.history.undone)}
  11506. },
  11507. setHistory: function(histData) {
  11508. var hist = this.history = new History(this.history.maxGeneration);
  11509. hist.done = copyHistoryArray(histData.done.slice(0), null, true);
  11510. hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
  11511. },
  11512. setGutterMarker: docMethodOp(function(line, gutterID, value) {
  11513. return changeLine(this, line, "gutter", function (line) {
  11514. var markers = line.gutterMarkers || (line.gutterMarkers = {});
  11515. markers[gutterID] = value;
  11516. if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
  11517. return true
  11518. })
  11519. }),
  11520. clearGutter: docMethodOp(function(gutterID) {
  11521. var this$1 = this;
  11522. this.iter(function (line) {
  11523. if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
  11524. changeLine(this$1, line, "gutter", function () {
  11525. line.gutterMarkers[gutterID] = null;
  11526. if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
  11527. return true
  11528. });
  11529. }
  11530. });
  11531. }),
  11532. lineInfo: function(line) {
  11533. var n;
  11534. if (typeof line == "number") {
  11535. if (!isLine(this, line)) { return null }
  11536. n = line;
  11537. line = getLine(this, line);
  11538. if (!line) { return null }
  11539. } else {
  11540. n = lineNo(line);
  11541. if (n == null) { return null }
  11542. }
  11543. return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
  11544. textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
  11545. widgets: line.widgets}
  11546. },
  11547. addLineClass: docMethodOp(function(handle, where, cls) {
  11548. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  11549. var prop = where == "text" ? "textClass"
  11550. : where == "background" ? "bgClass"
  11551. : where == "gutter" ? "gutterClass" : "wrapClass";
  11552. if (!line[prop]) { line[prop] = cls; }
  11553. else if (classTest(cls).test(line[prop])) { return false }
  11554. else { line[prop] += " " + cls; }
  11555. return true
  11556. })
  11557. }),
  11558. removeLineClass: docMethodOp(function(handle, where, cls) {
  11559. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  11560. var prop = where == "text" ? "textClass"
  11561. : where == "background" ? "bgClass"
  11562. : where == "gutter" ? "gutterClass" : "wrapClass";
  11563. var cur = line[prop];
  11564. if (!cur) { return false }
  11565. else if (cls == null) { line[prop] = null; }
  11566. else {
  11567. var found = cur.match(classTest(cls));
  11568. if (!found) { return false }
  11569. var end = found.index + found[0].length;
  11570. line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
  11571. }
  11572. return true
  11573. })
  11574. }),
  11575. addLineWidget: docMethodOp(function(handle, node, options) {
  11576. return addLineWidget(this, handle, node, options)
  11577. }),
  11578. removeLineWidget: function(widget) { widget.clear(); },
  11579. markText: function(from, to, options) {
  11580. return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
  11581. },
  11582. setBookmark: function(pos, options) {
  11583. var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
  11584. insertLeft: options && options.insertLeft,
  11585. clearWhenEmpty: false, shared: options && options.shared,
  11586. handleMouseEvents: options && options.handleMouseEvents};
  11587. pos = clipPos(this, pos);
  11588. return markText(this, pos, pos, realOpts, "bookmark")
  11589. },
  11590. findMarksAt: function(pos) {
  11591. pos = clipPos(this, pos);
  11592. var markers = [], spans = getLine(this, pos.line).markedSpans;
  11593. if (spans) { for (var i = 0; i < spans.length; ++i) {
  11594. var span = spans[i];
  11595. if ((span.from == null || span.from <= pos.ch) &&
  11596. (span.to == null || span.to >= pos.ch))
  11597. { markers.push(span.marker.parent || span.marker); }
  11598. } }
  11599. return markers
  11600. },
  11601. findMarks: function(from, to, filter) {
  11602. from = clipPos(this, from); to = clipPos(this, to);
  11603. var found = [], lineNo$$1 = from.line;
  11604. this.iter(from.line, to.line + 1, function (line) {
  11605. var spans = line.markedSpans;
  11606. if (spans) { for (var i = 0; i < spans.length; i++) {
  11607. var span = spans[i];
  11608. if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
  11609. span.from == null && lineNo$$1 != from.line ||
  11610. span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
  11611. (!filter || filter(span.marker)))
  11612. { found.push(span.marker.parent || span.marker); }
  11613. } }
  11614. ++lineNo$$1;
  11615. });
  11616. return found
  11617. },
  11618. getAllMarks: function() {
  11619. var markers = [];
  11620. this.iter(function (line) {
  11621. var sps = line.markedSpans;
  11622. if (sps) { for (var i = 0; i < sps.length; ++i)
  11623. { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
  11624. });
  11625. return markers
  11626. },
  11627. posFromIndex: function(off) {
  11628. var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
  11629. this.iter(function (line) {
  11630. var sz = line.text.length + sepSize;
  11631. if (sz > off) { ch = off; return true }
  11632. off -= sz;
  11633. ++lineNo$$1;
  11634. });
  11635. return clipPos(this, Pos(lineNo$$1, ch))
  11636. },
  11637. indexFromPos: function (coords) {
  11638. coords = clipPos(this, coords);
  11639. var index = coords.ch;
  11640. if (coords.line < this.first || coords.ch < 0) { return 0 }
  11641. var sepSize = this.lineSeparator().length;
  11642. this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
  11643. index += line.text.length + sepSize;
  11644. });
  11645. return index
  11646. },
  11647. copy: function(copyHistory) {
  11648. var doc = new Doc(getLines(this, this.first, this.first + this.size),
  11649. this.modeOption, this.first, this.lineSep, this.direction);
  11650. doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
  11651. doc.sel = this.sel;
  11652. doc.extend = false;
  11653. if (copyHistory) {
  11654. doc.history.undoDepth = this.history.undoDepth;
  11655. doc.setHistory(this.getHistory());
  11656. }
  11657. return doc
  11658. },
  11659. linkedDoc: function(options) {
  11660. if (!options) { options = {}; }
  11661. var from = this.first, to = this.first + this.size;
  11662. if (options.from != null && options.from > from) { from = options.from; }
  11663. if (options.to != null && options.to < to) { to = options.to; }
  11664. var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
  11665. if (options.sharedHist) { copy.history = this.history
  11666. ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
  11667. copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
  11668. copySharedMarkers(copy, findSharedMarkers(this));
  11669. return copy
  11670. },
  11671. unlinkDoc: function(other) {
  11672. var this$1 = this;
  11673. if (other instanceof CodeMirror$1) { other = other.doc; }
  11674. if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
  11675. var link = this$1.linked[i];
  11676. if (link.doc != other) { continue }
  11677. this$1.linked.splice(i, 1);
  11678. other.unlinkDoc(this$1);
  11679. detachSharedMarkers(findSharedMarkers(this$1));
  11680. break
  11681. } }
  11682. // If the histories were shared, split them again
  11683. if (other.history == this.history) {
  11684. var splitIds = [other.id];
  11685. linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
  11686. other.history = new History(null);
  11687. other.history.done = copyHistoryArray(this.history.done, splitIds);
  11688. other.history.undone = copyHistoryArray(this.history.undone, splitIds);
  11689. }
  11690. },
  11691. iterLinkedDocs: function(f) {linkedDocs(this, f);},
  11692. getMode: function() {return this.mode},
  11693. getEditor: function() {return this.cm},
  11694. splitLines: function(str) {
  11695. if (this.lineSep) { return str.split(this.lineSep) }
  11696. return splitLinesAuto(str)
  11697. },
  11698. lineSeparator: function() { return this.lineSep || "\n" },
  11699. setDirection: docMethodOp(function (dir) {
  11700. if (dir != "rtl") { dir = "ltr"; }
  11701. if (dir == this.direction) { return }
  11702. this.direction = dir;
  11703. this.iter(function (line) { return line.order = null; });
  11704. if (this.cm) { directionChanged(this.cm); }
  11705. })
  11706. });
  11707. // Public alias.
  11708. Doc.prototype.eachLine = Doc.prototype.iter;
  11709. // Kludge to work around strange IE behavior where it'll sometimes
  11710. // re-fire a series of drag-related events right after the drop (#1551)
  11711. var lastDrop = 0;
  11712. function onDrop(e) {
  11713. var cm = this;
  11714. clearDragCursor(cm);
  11715. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
  11716. { return }
  11717. e_preventDefault(e);
  11718. if (ie) { lastDrop = +new Date; }
  11719. var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
  11720. if (!pos || cm.isReadOnly()) { return }
  11721. // Might be a file drop, in which case we simply extract the text
  11722. // and insert it.
  11723. if (files && files.length && window.FileReader && window.File) {
  11724. var n = files.length, text = Array(n), read = 0;
  11725. var loadFile = function (file, i) {
  11726. if (cm.options.allowDropFileTypes &&
  11727. indexOf(cm.options.allowDropFileTypes, file.type) == -1)
  11728. { return }
  11729. var reader = new FileReader;
  11730. reader.onload = operation(cm, function () {
  11731. var content = reader.result;
  11732. if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
  11733. text[i] = content;
  11734. if (++read == n) {
  11735. pos = clipPos(cm.doc, pos);
  11736. var change = {from: pos, to: pos,
  11737. text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
  11738. origin: "paste"};
  11739. makeChange(cm.doc, change);
  11740. setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
  11741. }
  11742. });
  11743. reader.readAsText(file);
  11744. };
  11745. for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
  11746. } else { // Normal drop
  11747. // Don't do a replace if the drop happened inside of the selected text.
  11748. if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
  11749. cm.state.draggingText(e);
  11750. // Ensure the editor is re-focused
  11751. setTimeout(function () { return cm.display.input.focus(); }, 20);
  11752. return
  11753. }
  11754. try {
  11755. var text$1 = e.dataTransfer.getData("Text");
  11756. if (text$1) {
  11757. var selected;
  11758. if (cm.state.draggingText && !cm.state.draggingText.copy)
  11759. { selected = cm.listSelections(); }
  11760. setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
  11761. if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
  11762. { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
  11763. cm.replaceSelection(text$1, "around", "paste");
  11764. cm.display.input.focus();
  11765. }
  11766. }
  11767. catch(e){}
  11768. }
  11769. }
  11770. function onDragStart(cm, e) {
  11771. if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
  11772. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
  11773. e.dataTransfer.setData("Text", cm.getSelection());
  11774. e.dataTransfer.effectAllowed = "copyMove";
  11775. // Use dummy image instead of default browsers image.
  11776. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
  11777. if (e.dataTransfer.setDragImage && !safari) {
  11778. var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
  11779. img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
  11780. if (presto) {
  11781. img.width = img.height = 1;
  11782. cm.display.wrapper.appendChild(img);
  11783. // Force a relayout, or Opera won't use our image for some obscure reason
  11784. img._top = img.offsetTop;
  11785. }
  11786. e.dataTransfer.setDragImage(img, 0, 0);
  11787. if (presto) { img.parentNode.removeChild(img); }
  11788. }
  11789. }
  11790. function onDragOver(cm, e) {
  11791. var pos = posFromMouse(cm, e);
  11792. if (!pos) { return }
  11793. var frag = document.createDocumentFragment();
  11794. drawSelectionCursor(cm, pos, frag);
  11795. if (!cm.display.dragCursor) {
  11796. cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
  11797. cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
  11798. }
  11799. removeChildrenAndAdd(cm.display.dragCursor, frag);
  11800. }
  11801. function clearDragCursor(cm) {
  11802. if (cm.display.dragCursor) {
  11803. cm.display.lineSpace.removeChild(cm.display.dragCursor);
  11804. cm.display.dragCursor = null;
  11805. }
  11806. }
  11807. // These must be handled carefully, because naively registering a
  11808. // handler for each editor will cause the editors to never be
  11809. // garbage collected.
  11810. function forEachCodeMirror(f) {
  11811. if (!document.body.getElementsByClassName) { return }
  11812. var byClass = document.body.getElementsByClassName("CodeMirror");
  11813. for (var i = 0; i < byClass.length; i++) {
  11814. var cm = byClass[i].CodeMirror;
  11815. if (cm) { f(cm); }
  11816. }
  11817. }
  11818. var globalsRegistered = false;
  11819. function ensureGlobalHandlers() {
  11820. if (globalsRegistered) { return }
  11821. registerGlobalHandlers();
  11822. globalsRegistered = true;
  11823. }
  11824. function registerGlobalHandlers() {
  11825. // When the window resizes, we need to refresh active editors.
  11826. var resizeTimer;
  11827. on(window, "resize", function () {
  11828. if (resizeTimer == null) { resizeTimer = setTimeout(function () {
  11829. resizeTimer = null;
  11830. forEachCodeMirror(onResize);
  11831. }, 100); }
  11832. });
  11833. // When the window loses focus, we want to show the editor as blurred
  11834. on(window, "blur", function () { return forEachCodeMirror(onBlur); });
  11835. }
  11836. // Called when the window resizes
  11837. function onResize(cm) {
  11838. var d = cm.display;
  11839. if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
  11840. { return }
  11841. // Might be a text scaling operation, clear size caches.
  11842. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  11843. d.scrollbarsClipped = false;
  11844. cm.setSize();
  11845. }
  11846. var keyNames = {
  11847. 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
  11848. 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
  11849. 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
  11850. 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
  11851. 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
  11852. 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
  11853. 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
  11854. 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
  11855. };
  11856. // Number keys
  11857. for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
  11858. // Alphabetic keys
  11859. for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
  11860. // Function keys
  11861. for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
  11862. var keyMap = {};
  11863. keyMap.basic = {
  11864. "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
  11865. "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
  11866. "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
  11867. "Tab": "defaultTab", "Shift-Tab": "indentAuto",
  11868. "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
  11869. "Esc": "singleSelection"
  11870. };
  11871. // Note that the save and find-related commands aren't defined by
  11872. // default. User code or addons can define them. Unknown commands
  11873. // are simply ignored.
  11874. keyMap.pcDefault = {
  11875. "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
  11876. "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
  11877. "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
  11878. "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
  11879. "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
  11880. "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
  11881. "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
  11882. fallthrough: "basic"
  11883. };
  11884. // Very basic readline/emacs-style bindings, which are standard on Mac.
  11885. keyMap.emacsy = {
  11886. "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
  11887. "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
  11888. "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
  11889. "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
  11890. "Ctrl-O": "openLine"
  11891. };
  11892. keyMap.macDefault = {
  11893. "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
  11894. "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
  11895. "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
  11896. "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
  11897. "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
  11898. "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
  11899. "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
  11900. fallthrough: ["basic", "emacsy"]
  11901. };
  11902. keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
  11903. // KEYMAP DISPATCH
  11904. function normalizeKeyName(name) {
  11905. var parts = name.split(/-(?!$)/);
  11906. name = parts[parts.length - 1];
  11907. var alt, ctrl, shift, cmd;
  11908. for (var i = 0; i < parts.length - 1; i++) {
  11909. var mod = parts[i];
  11910. if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
  11911. else if (/^a(lt)?$/i.test(mod)) { alt = true; }
  11912. else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
  11913. else if (/^s(hift)?$/i.test(mod)) { shift = true; }
  11914. else { throw new Error("Unrecognized modifier name: " + mod) }
  11915. }
  11916. if (alt) { name = "Alt-" + name; }
  11917. if (ctrl) { name = "Ctrl-" + name; }
  11918. if (cmd) { name = "Cmd-" + name; }
  11919. if (shift) { name = "Shift-" + name; }
  11920. return name
  11921. }
  11922. // This is a kludge to keep keymaps mostly working as raw objects
  11923. // (backwards compatibility) while at the same time support features
  11924. // like normalization and multi-stroke key bindings. It compiles a
  11925. // new normalized keymap, and then updates the old object to reflect
  11926. // this.
  11927. function normalizeKeyMap(keymap) {
  11928. var copy = {};
  11929. for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
  11930. var value = keymap[keyname];
  11931. if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
  11932. if (value == "...") { delete keymap[keyname]; continue }
  11933. var keys = map(keyname.split(" "), normalizeKeyName);
  11934. for (var i = 0; i < keys.length; i++) {
  11935. var val = (void 0), name = (void 0);
  11936. if (i == keys.length - 1) {
  11937. name = keys.join(" ");
  11938. val = value;
  11939. } else {
  11940. name = keys.slice(0, i + 1).join(" ");
  11941. val = "...";
  11942. }
  11943. var prev = copy[name];
  11944. if (!prev) { copy[name] = val; }
  11945. else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
  11946. }
  11947. delete keymap[keyname];
  11948. } }
  11949. for (var prop in copy) { keymap[prop] = copy[prop]; }
  11950. return keymap
  11951. }
  11952. function lookupKey(key, map$$1, handle, context) {
  11953. map$$1 = getKeyMap(map$$1);
  11954. var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
  11955. if (found === false) { return "nothing" }
  11956. if (found === "...") { return "multi" }
  11957. if (found != null && handle(found)) { return "handled" }
  11958. if (map$$1.fallthrough) {
  11959. if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
  11960. { return lookupKey(key, map$$1.fallthrough, handle, context) }
  11961. for (var i = 0; i < map$$1.fallthrough.length; i++) {
  11962. var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
  11963. if (result) { return result }
  11964. }
  11965. }
  11966. }
  11967. // Modifier key presses don't count as 'real' key presses for the
  11968. // purpose of keymap fallthrough.
  11969. function isModifierKey(value) {
  11970. var name = typeof value == "string" ? value : keyNames[value.keyCode];
  11971. return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
  11972. }
  11973. // Look up the name of a key as indicated by an event object.
  11974. function keyName(event, noShift) {
  11975. if (presto && event.keyCode == 34 && event["char"]) { return false }
  11976. var base = keyNames[event.keyCode], name = base;
  11977. if (name == null || event.altGraphKey) { return false }
  11978. if (event.altKey && base != "Alt") { name = "Alt-" + name; }
  11979. if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
  11980. if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
  11981. if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
  11982. return name
  11983. }
  11984. function getKeyMap(val) {
  11985. return typeof val == "string" ? keyMap[val] : val
  11986. }
  11987. // Helper for deleting text near the selection(s), used to implement
  11988. // backspace, delete, and similar functionality.
  11989. function deleteNearSelection(cm, compute) {
  11990. var ranges = cm.doc.sel.ranges, kill = [];
  11991. // Build up a set of ranges to kill first, merging overlapping
  11992. // ranges.
  11993. for (var i = 0; i < ranges.length; i++) {
  11994. var toKill = compute(ranges[i]);
  11995. while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
  11996. var replaced = kill.pop();
  11997. if (cmp(replaced.from, toKill.from) < 0) {
  11998. toKill.from = replaced.from;
  11999. break
  12000. }
  12001. }
  12002. kill.push(toKill);
  12003. }
  12004. // Next, remove those actual ranges.
  12005. runInOp(cm, function () {
  12006. for (var i = kill.length - 1; i >= 0; i--)
  12007. { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
  12008. ensureCursorVisible(cm);
  12009. });
  12010. }
  12011. // Commands are parameter-less actions that can be performed on an
  12012. // editor, mostly used for keybindings.
  12013. var commands = {
  12014. selectAll: selectAll,
  12015. singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
  12016. killLine: function (cm) { return deleteNearSelection(cm, function (range) {
  12017. if (range.empty()) {
  12018. var len = getLine(cm.doc, range.head.line).text.length;
  12019. if (range.head.ch == len && range.head.line < cm.lastLine())
  12020. { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
  12021. else
  12022. { return {from: range.head, to: Pos(range.head.line, len)} }
  12023. } else {
  12024. return {from: range.from(), to: range.to()}
  12025. }
  12026. }); },
  12027. deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  12028. from: Pos(range.from().line, 0),
  12029. to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
  12030. }); }); },
  12031. delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  12032. from: Pos(range.from().line, 0), to: range.from()
  12033. }); }); },
  12034. delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
  12035. var top = cm.charCoords(range.head, "div").top + 5;
  12036. var leftPos = cm.coordsChar({left: 0, top: top}, "div");
  12037. return {from: leftPos, to: range.from()}
  12038. }); },
  12039. delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
  12040. var top = cm.charCoords(range.head, "div").top + 5;
  12041. var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
  12042. return {from: range.from(), to: rightPos }
  12043. }); },
  12044. undo: function (cm) { return cm.undo(); },
  12045. redo: function (cm) { return cm.redo(); },
  12046. undoSelection: function (cm) { return cm.undoSelection(); },
  12047. redoSelection: function (cm) { return cm.redoSelection(); },
  12048. goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
  12049. goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
  12050. goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
  12051. {origin: "+move", bias: 1}
  12052. ); },
  12053. goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
  12054. {origin: "+move", bias: 1}
  12055. ); },
  12056. goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
  12057. {origin: "+move", bias: -1}
  12058. ); },
  12059. goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
  12060. var top = cm.charCoords(range.head, "div").top + 5;
  12061. return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
  12062. }, sel_move); },
  12063. goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
  12064. var top = cm.charCoords(range.head, "div").top + 5;
  12065. return cm.coordsChar({left: 0, top: top}, "div")
  12066. }, sel_move); },
  12067. goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
  12068. var top = cm.charCoords(range.head, "div").top + 5;
  12069. var pos = cm.coordsChar({left: 0, top: top}, "div");
  12070. if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
  12071. return pos
  12072. }, sel_move); },
  12073. goLineUp: function (cm) { return cm.moveV(-1, "line"); },
  12074. goLineDown: function (cm) { return cm.moveV(1, "line"); },
  12075. goPageUp: function (cm) { return cm.moveV(-1, "page"); },
  12076. goPageDown: function (cm) { return cm.moveV(1, "page"); },
  12077. goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
  12078. goCharRight: function (cm) { return cm.moveH(1, "char"); },
  12079. goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
  12080. goColumnRight: function (cm) { return cm.moveH(1, "column"); },
  12081. goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
  12082. goGroupRight: function (cm) { return cm.moveH(1, "group"); },
  12083. goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
  12084. goWordRight: function (cm) { return cm.moveH(1, "word"); },
  12085. delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
  12086. delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
  12087. delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
  12088. delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
  12089. delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
  12090. delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
  12091. indentAuto: function (cm) { return cm.indentSelection("smart"); },
  12092. indentMore: function (cm) { return cm.indentSelection("add"); },
  12093. indentLess: function (cm) { return cm.indentSelection("subtract"); },
  12094. insertTab: function (cm) { return cm.replaceSelection("\t"); },
  12095. insertSoftTab: function (cm) {
  12096. var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
  12097. for (var i = 0; i < ranges.length; i++) {
  12098. var pos = ranges[i].from();
  12099. var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
  12100. spaces.push(spaceStr(tabSize - col % tabSize));
  12101. }
  12102. cm.replaceSelections(spaces);
  12103. },
  12104. defaultTab: function (cm) {
  12105. if (cm.somethingSelected()) { cm.indentSelection("add"); }
  12106. else { cm.execCommand("insertTab"); }
  12107. },
  12108. // Swap the two chars left and right of each selection's head.
  12109. // Move cursor behind the two swapped characters afterwards.
  12110. //
  12111. // Doesn't consider line feeds a character.
  12112. // Doesn't scan more than one line above to find a character.
  12113. // Doesn't do anything on an empty line.
  12114. // Doesn't do anything with non-empty selections.
  12115. transposeChars: function (cm) { return runInOp(cm, function () {
  12116. var ranges = cm.listSelections(), newSel = [];
  12117. for (var i = 0; i < ranges.length; i++) {
  12118. if (!ranges[i].empty()) { continue }
  12119. var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
  12120. if (line) {
  12121. if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
  12122. if (cur.ch > 0) {
  12123. cur = new Pos(cur.line, cur.ch + 1);
  12124. cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
  12125. Pos(cur.line, cur.ch - 2), cur, "+transpose");
  12126. } else if (cur.line > cm.doc.first) {
  12127. var prev = getLine(cm.doc, cur.line - 1).text;
  12128. if (prev) {
  12129. cur = new Pos(cur.line, 1);
  12130. cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
  12131. prev.charAt(prev.length - 1),
  12132. Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
  12133. }
  12134. }
  12135. }
  12136. newSel.push(new Range(cur, cur));
  12137. }
  12138. cm.setSelections(newSel);
  12139. }); },
  12140. newlineAndIndent: function (cm) { return runInOp(cm, function () {
  12141. var sels = cm.listSelections();
  12142. for (var i = sels.length - 1; i >= 0; i--)
  12143. { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
  12144. sels = cm.listSelections();
  12145. for (var i$1 = 0; i$1 < sels.length; i$1++)
  12146. { cm.indentLine(sels[i$1].from().line, null, true); }
  12147. ensureCursorVisible(cm);
  12148. }); },
  12149. openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
  12150. toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
  12151. };
  12152. function lineStart(cm, lineN) {
  12153. var line = getLine(cm.doc, lineN);
  12154. var visual = visualLine(line);
  12155. if (visual != line) { lineN = lineNo(visual); }
  12156. return endOfLine(true, cm, visual, lineN, 1)
  12157. }
  12158. function lineEnd(cm, lineN) {
  12159. var line = getLine(cm.doc, lineN);
  12160. var visual = visualLineEnd(line);
  12161. if (visual != line) { lineN = lineNo(visual); }
  12162. return endOfLine(true, cm, line, lineN, -1)
  12163. }
  12164. function lineStartSmart(cm, pos) {
  12165. var start = lineStart(cm, pos.line);
  12166. var line = getLine(cm.doc, start.line);
  12167. var order = getOrder(line, cm.doc.direction);
  12168. if (!order || order[0].level == 0) {
  12169. var firstNonWS = Math.max(0, line.text.search(/\S/));
  12170. var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
  12171. return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
  12172. }
  12173. return start
  12174. }
  12175. // Run a handler that was bound to a key.
  12176. function doHandleBinding(cm, bound, dropShift) {
  12177. if (typeof bound == "string") {
  12178. bound = commands[bound];
  12179. if (!bound) { return false }
  12180. }
  12181. // Ensure previous input has been read, so that the handler sees a
  12182. // consistent view of the document
  12183. cm.display.input.ensurePolled();
  12184. var prevShift = cm.display.shift, done = false;
  12185. try {
  12186. if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
  12187. if (dropShift) { cm.display.shift = false; }
  12188. done = bound(cm) != Pass;
  12189. } finally {
  12190. cm.display.shift = prevShift;
  12191. cm.state.suppressEdits = false;
  12192. }
  12193. return done
  12194. }
  12195. function lookupKeyForEditor(cm, name, handle) {
  12196. for (var i = 0; i < cm.state.keyMaps.length; i++) {
  12197. var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
  12198. if (result) { return result }
  12199. }
  12200. return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
  12201. || lookupKey(name, cm.options.keyMap, handle, cm)
  12202. }
  12203. var stopSeq = new Delayed;
  12204. function dispatchKey(cm, name, e, handle) {
  12205. var seq = cm.state.keySeq;
  12206. if (seq) {
  12207. if (isModifierKey(name)) { return "handled" }
  12208. stopSeq.set(50, function () {
  12209. if (cm.state.keySeq == seq) {
  12210. cm.state.keySeq = null;
  12211. cm.display.input.reset();
  12212. }
  12213. });
  12214. name = seq + " " + name;
  12215. }
  12216. var result = lookupKeyForEditor(cm, name, handle);
  12217. if (result == "multi")
  12218. { cm.state.keySeq = name; }
  12219. if (result == "handled")
  12220. { signalLater(cm, "keyHandled", cm, name, e); }
  12221. if (result == "handled" || result == "multi") {
  12222. e_preventDefault(e);
  12223. restartBlink(cm);
  12224. }
  12225. if (seq && !result && /\'$/.test(name)) {
  12226. e_preventDefault(e);
  12227. return true
  12228. }
  12229. return !!result
  12230. }
  12231. // Handle a key from the keydown event.
  12232. function handleKeyBinding(cm, e) {
  12233. var name = keyName(e, true);
  12234. if (!name) { return false }
  12235. if (e.shiftKey && !cm.state.keySeq) {
  12236. // First try to resolve full name (including 'Shift-'). Failing
  12237. // that, see if there is a cursor-motion command (starting with
  12238. // 'go') bound to the keyname without 'Shift-'.
  12239. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
  12240. || dispatchKey(cm, name, e, function (b) {
  12241. if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
  12242. { return doHandleBinding(cm, b) }
  12243. })
  12244. } else {
  12245. return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
  12246. }
  12247. }
  12248. // Handle a key from the keypress event
  12249. function handleCharBinding(cm, e, ch) {
  12250. return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
  12251. }
  12252. var lastStoppedKey = null;
  12253. function onKeyDown(e) {
  12254. var cm = this;
  12255. cm.curOp.focus = activeElt();
  12256. if (signalDOMEvent(cm, e)) { return }
  12257. // IE does strange things with escape.
  12258. if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
  12259. var code = e.keyCode;
  12260. cm.display.shift = code == 16 || e.shiftKey;
  12261. var handled = handleKeyBinding(cm, e);
  12262. if (presto) {
  12263. lastStoppedKey = handled ? code : null;
  12264. // Opera has no cut event... we try to at least catch the key combo
  12265. if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
  12266. { cm.replaceSelection("", null, "cut"); }
  12267. }
  12268. // Turn mouse into crosshair when Alt is held on Mac.
  12269. if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
  12270. { showCrossHair(cm); }
  12271. }
  12272. function showCrossHair(cm) {
  12273. var lineDiv = cm.display.lineDiv;
  12274. addClass(lineDiv, "CodeMirror-crosshair");
  12275. function up(e) {
  12276. if (e.keyCode == 18 || !e.altKey) {
  12277. rmClass(lineDiv, "CodeMirror-crosshair");
  12278. off(document, "keyup", up);
  12279. off(document, "mouseover", up);
  12280. }
  12281. }
  12282. on(document, "keyup", up);
  12283. on(document, "mouseover", up);
  12284. }
  12285. function onKeyUp(e) {
  12286. if (e.keyCode == 16) { this.doc.sel.shift = false; }
  12287. signalDOMEvent(this, e);
  12288. }
  12289. function onKeyPress(e) {
  12290. var cm = this;
  12291. if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
  12292. var keyCode = e.keyCode, charCode = e.charCode;
  12293. if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
  12294. if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
  12295. var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
  12296. // Some browsers fire keypress events for backspace
  12297. if (ch == "\x08") { return }
  12298. if (handleCharBinding(cm, e, ch)) { return }
  12299. cm.display.input.onKeyPress(e);
  12300. }
  12301. // A mouse down can be a single click, double click, triple click,
  12302. // start of selection drag, start of text drag, new cursor
  12303. // (ctrl-click), rectangle drag (alt-drag), or xwin
  12304. // middle-click-paste. Or it might be a click on something we should
  12305. // not interfere with, such as a scrollbar or widget.
  12306. function onMouseDown(e) {
  12307. var cm = this, display = cm.display;
  12308. if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
  12309. display.input.ensurePolled();
  12310. display.shift = e.shiftKey;
  12311. if (eventInWidget(display, e)) {
  12312. if (!webkit) {
  12313. // Briefly turn off draggability, to allow widgets to do
  12314. // normal dragging things.
  12315. display.scroller.draggable = false;
  12316. setTimeout(function () { return display.scroller.draggable = true; }, 100);
  12317. }
  12318. return
  12319. }
  12320. if (clickInGutter(cm, e)) { return }
  12321. var start = posFromMouse(cm, e);
  12322. window.focus();
  12323. switch (e_button(e)) {
  12324. case 1:
  12325. // #3261: make sure, that we're not starting a second selection
  12326. if (cm.state.selectingText)
  12327. { cm.state.selectingText(e); }
  12328. else if (start)
  12329. { leftButtonDown(cm, e, start); }
  12330. else if (e_target(e) == display.scroller)
  12331. { e_preventDefault(e); }
  12332. break
  12333. case 2:
  12334. if (webkit) { cm.state.lastMiddleDown = +new Date; }
  12335. if (start) { extendSelection(cm.doc, start); }
  12336. setTimeout(function () { return display.input.focus(); }, 20);
  12337. e_preventDefault(e);
  12338. break
  12339. case 3:
  12340. if (captureRightClick) { onContextMenu(cm, e); }
  12341. else { delayBlurEvent(cm); }
  12342. break
  12343. }
  12344. }
  12345. var lastClick;
  12346. var lastDoubleClick;
  12347. function leftButtonDown(cm, e, start) {
  12348. if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
  12349. else { cm.curOp.focus = activeElt(); }
  12350. var now = +new Date, type;
  12351. if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
  12352. type = "triple";
  12353. } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
  12354. type = "double";
  12355. lastDoubleClick = {time: now, pos: start};
  12356. } else {
  12357. type = "single";
  12358. lastClick = {time: now, pos: start};
  12359. }
  12360. var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
  12361. if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
  12362. type == "single" && (contained = sel.contains(start)) > -1 &&
  12363. (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
  12364. (cmp(contained.to(), start) > 0 || start.xRel < 0))
  12365. { leftButtonStartDrag(cm, e, start, modifier); }
  12366. else
  12367. { leftButtonSelect(cm, e, start, type, modifier); }
  12368. }
  12369. // Start a text drag. When it ends, see if any dragging actually
  12370. // happen, and treat as a click if it didn't.
  12371. function leftButtonStartDrag(cm, e, start, modifier) {
  12372. var display = cm.display, startTime = +new Date;
  12373. var dragEnd = operation(cm, function (e2) {
  12374. if (webkit) { display.scroller.draggable = false; }
  12375. cm.state.draggingText = false;
  12376. off(document, "mouseup", dragEnd);
  12377. off(display.scroller, "drop", dragEnd);
  12378. if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
  12379. e_preventDefault(e2);
  12380. if (!modifier && +new Date - 200 < startTime)
  12381. { extendSelection(cm.doc, start); }
  12382. // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
  12383. if (webkit || ie && ie_version == 9)
  12384. { setTimeout(function () {document.body.focus(); display.input.focus();}, 20); }
  12385. else
  12386. { display.input.focus(); }
  12387. }
  12388. });
  12389. // Let the drag handler handle this.
  12390. if (webkit) { display.scroller.draggable = true; }
  12391. cm.state.draggingText = dragEnd;
  12392. dragEnd.copy = mac ? e.altKey : e.ctrlKey;
  12393. // IE's approach to draggable
  12394. if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
  12395. on(document, "mouseup", dragEnd);
  12396. on(display.scroller, "drop", dragEnd);
  12397. }
  12398. // Normal selection, as opposed to text dragging.
  12399. function leftButtonSelect(cm, e, start, type, addNew) {
  12400. var display = cm.display, doc = cm.doc;
  12401. e_preventDefault(e);
  12402. var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
  12403. if (addNew && !e.shiftKey) {
  12404. ourIndex = doc.sel.contains(start);
  12405. if (ourIndex > -1)
  12406. { ourRange = ranges[ourIndex]; }
  12407. else
  12408. { ourRange = new Range(start, start); }
  12409. } else {
  12410. ourRange = doc.sel.primary();
  12411. ourIndex = doc.sel.primIndex;
  12412. }
  12413. if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
  12414. type = "rect";
  12415. if (!addNew) { ourRange = new Range(start, start); }
  12416. start = posFromMouse(cm, e, true, true);
  12417. ourIndex = -1;
  12418. } else if (type == "double") {
  12419. var word = cm.findWordAt(start);
  12420. if (cm.display.shift || doc.extend)
  12421. { ourRange = extendRange(doc, ourRange, word.anchor, word.head); }
  12422. else
  12423. { ourRange = word; }
  12424. } else if (type == "triple") {
  12425. var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
  12426. if (cm.display.shift || doc.extend)
  12427. { ourRange = extendRange(doc, ourRange, line.anchor, line.head); }
  12428. else
  12429. { ourRange = line; }
  12430. } else {
  12431. ourRange = extendRange(doc, ourRange, start);
  12432. }
  12433. if (!addNew) {
  12434. ourIndex = 0;
  12435. setSelection(doc, new Selection([ourRange], 0), sel_mouse);
  12436. startSel = doc.sel;
  12437. } else if (ourIndex == -1) {
  12438. ourIndex = ranges.length;
  12439. setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
  12440. {scroll: false, origin: "*mouse"});
  12441. } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
  12442. setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
  12443. {scroll: false, origin: "*mouse"});
  12444. startSel = doc.sel;
  12445. } else {
  12446. replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
  12447. }
  12448. var lastPos = start;
  12449. function extendTo(pos) {
  12450. if (cmp(lastPos, pos) == 0) { return }
  12451. lastPos = pos;
  12452. if (type == "rect") {
  12453. var ranges = [], tabSize = cm.options.tabSize;
  12454. var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
  12455. var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
  12456. var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
  12457. for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
  12458. line <= end; line++) {
  12459. var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
  12460. if (left == right)
  12461. { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
  12462. else if (text.length > leftPos)
  12463. { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
  12464. }
  12465. if (!ranges.length) { ranges.push(new Range(start, start)); }
  12466. setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
  12467. {origin: "*mouse", scroll: false});
  12468. cm.scrollIntoView(pos);
  12469. } else {
  12470. var oldRange = ourRange;
  12471. var anchor = oldRange.anchor, head = pos;
  12472. if (type != "single") {
  12473. var range$$1;
  12474. if (type == "double")
  12475. { range$$1 = cm.findWordAt(pos); }
  12476. else
  12477. { range$$1 = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); }
  12478. if (cmp(range$$1.anchor, anchor) > 0) {
  12479. head = range$$1.head;
  12480. anchor = minPos(oldRange.from(), range$$1.anchor);
  12481. } else {
  12482. head = range$$1.anchor;
  12483. anchor = maxPos(oldRange.to(), range$$1.head);
  12484. }
  12485. }
  12486. var ranges$1 = startSel.ranges.slice(0);
  12487. ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);
  12488. setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);
  12489. }
  12490. }
  12491. var editorSize = display.wrapper.getBoundingClientRect();
  12492. // Used to ensure timeout re-tries don't fire when another extend
  12493. // happened in the meantime (clearTimeout isn't reliable -- at
  12494. // least on Chrome, the timeouts still happen even when cleared,
  12495. // if the clear happens after their scheduled firing time).
  12496. var counter = 0;
  12497. function extend(e) {
  12498. var curCount = ++counter;
  12499. var cur = posFromMouse(cm, e, true, type == "rect");
  12500. if (!cur) { return }
  12501. if (cmp(cur, lastPos) != 0) {
  12502. cm.curOp.focus = activeElt();
  12503. extendTo(cur);
  12504. var visible = visibleLines(display, doc);
  12505. if (cur.line >= visible.to || cur.line < visible.from)
  12506. { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
  12507. } else {
  12508. var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
  12509. if (outside) { setTimeout(operation(cm, function () {
  12510. if (counter != curCount) { return }
  12511. display.scroller.scrollTop += outside;
  12512. extend(e);
  12513. }), 50); }
  12514. }
  12515. }
  12516. function done(e) {
  12517. cm.state.selectingText = false;
  12518. counter = Infinity;
  12519. e_preventDefault(e);
  12520. display.input.focus();
  12521. off(document, "mousemove", move);
  12522. off(document, "mouseup", up);
  12523. doc.history.lastSelOrigin = null;
  12524. }
  12525. var move = operation(cm, function (e) {
  12526. if (!e_button(e)) { done(e); }
  12527. else { extend(e); }
  12528. });
  12529. var up = operation(cm, done);
  12530. cm.state.selectingText = up;
  12531. on(document, "mousemove", move);
  12532. on(document, "mouseup", up);
  12533. }
  12534. // Determines whether an event happened in the gutter, and fires the
  12535. // handlers for the corresponding event.
  12536. function gutterEvent(cm, e, type, prevent) {
  12537. var mX, mY;
  12538. try { mX = e.clientX; mY = e.clientY; }
  12539. catch(e) { return false }
  12540. if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
  12541. if (prevent) { e_preventDefault(e); }
  12542. var display = cm.display;
  12543. var lineBox = display.lineDiv.getBoundingClientRect();
  12544. if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
  12545. mY -= lineBox.top - display.viewOffset;
  12546. for (var i = 0; i < cm.options.gutters.length; ++i) {
  12547. var g = display.gutters.childNodes[i];
  12548. if (g && g.getBoundingClientRect().right >= mX) {
  12549. var line = lineAtHeight(cm.doc, mY);
  12550. var gutter = cm.options.gutters[i];
  12551. signal(cm, type, cm, line, gutter, e);
  12552. return e_defaultPrevented(e)
  12553. }
  12554. }
  12555. }
  12556. function clickInGutter(cm, e) {
  12557. return gutterEvent(cm, e, "gutterClick", true)
  12558. }
  12559. // CONTEXT MENU HANDLING
  12560. // To make the context menu work, we need to briefly unhide the
  12561. // textarea (making it as unobtrusive as possible) to let the
  12562. // right-click take effect on it.
  12563. function onContextMenu(cm, e) {
  12564. if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
  12565. if (signalDOMEvent(cm, e, "contextmenu")) { return }
  12566. cm.display.input.onContextMenu(e);
  12567. }
  12568. function contextMenuInGutter(cm, e) {
  12569. if (!hasHandler(cm, "gutterContextMenu")) { return false }
  12570. return gutterEvent(cm, e, "gutterContextMenu", false)
  12571. }
  12572. function themeChanged(cm) {
  12573. cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
  12574. cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
  12575. clearCaches(cm);
  12576. }
  12577. var Init = {toString: function(){return "CodeMirror.Init"}};
  12578. var defaults = {};
  12579. var optionHandlers = {};
  12580. function defineOptions(CodeMirror) {
  12581. var optionHandlers = CodeMirror.optionHandlers;
  12582. function option(name, deflt, handle, notOnInit) {
  12583. CodeMirror.defaults[name] = deflt;
  12584. if (handle) { optionHandlers[name] =
  12585. notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
  12586. }
  12587. CodeMirror.defineOption = option;
  12588. // Passed to option handlers when there is no old value.
  12589. CodeMirror.Init = Init;
  12590. // These two are, on init, called from the constructor because they
  12591. // have to be initialized before the editor can start at all.
  12592. option("value", "", function (cm, val) { return cm.setValue(val); }, true);
  12593. option("mode", null, function (cm, val) {
  12594. cm.doc.modeOption = val;
  12595. loadMode(cm);
  12596. }, true);
  12597. option("indentUnit", 2, loadMode, true);
  12598. option("indentWithTabs", false);
  12599. option("smartIndent", true);
  12600. option("tabSize", 4, function (cm) {
  12601. resetModeState(cm);
  12602. clearCaches(cm);
  12603. regChange(cm);
  12604. }, true);
  12605. option("lineSeparator", null, function (cm, val) {
  12606. cm.doc.lineSep = val;
  12607. if (!val) { return }
  12608. var newBreaks = [], lineNo = cm.doc.first;
  12609. cm.doc.iter(function (line) {
  12610. for (var pos = 0;;) {
  12611. var found = line.text.indexOf(val, pos);
  12612. if (found == -1) { break }
  12613. pos = found + val.length;
  12614. newBreaks.push(Pos(lineNo, found));
  12615. }
  12616. lineNo++;
  12617. });
  12618. for (var i = newBreaks.length - 1; i >= 0; i--)
  12619. { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
  12620. });
  12621. option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
  12622. cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
  12623. if (old != Init) { cm.refresh(); }
  12624. });
  12625. option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
  12626. option("electricChars", true);
  12627. option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
  12628. throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
  12629. }, true);
  12630. option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
  12631. option("rtlMoveVisually", !windows);
  12632. option("wholeLineUpdateBefore", true);
  12633. option("theme", "default", function (cm) {
  12634. themeChanged(cm);
  12635. guttersChanged(cm);
  12636. }, true);
  12637. option("keyMap", "default", function (cm, val, old) {
  12638. var next = getKeyMap(val);
  12639. var prev = old != Init && getKeyMap(old);
  12640. if (prev && prev.detach) { prev.detach(cm, next); }
  12641. if (next.attach) { next.attach(cm, prev || null); }
  12642. });
  12643. option("extraKeys", null);
  12644. option("lineWrapping", false, wrappingChanged, true);
  12645. option("gutters", [], function (cm) {
  12646. setGuttersForLineNumbers(cm.options);
  12647. guttersChanged(cm);
  12648. }, true);
  12649. option("fixedGutter", true, function (cm, val) {
  12650. cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
  12651. cm.refresh();
  12652. }, true);
  12653. option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
  12654. option("scrollbarStyle", "native", function (cm) {
  12655. initScrollbars(cm);
  12656. updateScrollbars(cm);
  12657. cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
  12658. cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
  12659. }, true);
  12660. option("lineNumbers", false, function (cm) {
  12661. setGuttersForLineNumbers(cm.options);
  12662. guttersChanged(cm);
  12663. }, true);
  12664. option("firstLineNumber", 1, guttersChanged, true);
  12665. option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true);
  12666. option("showCursorWhenSelecting", false, updateSelection, true);
  12667. option("resetSelectionOnContextMenu", true);
  12668. option("lineWiseCopyCut", true);
  12669. option("readOnly", false, function (cm, val) {
  12670. if (val == "nocursor") {
  12671. onBlur(cm);
  12672. cm.display.input.blur();
  12673. cm.display.disabled = true;
  12674. } else {
  12675. cm.display.disabled = false;
  12676. }
  12677. cm.display.input.readOnlyChanged(val);
  12678. });
  12679. option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
  12680. option("dragDrop", true, dragDropChanged);
  12681. option("allowDropFileTypes", null);
  12682. option("cursorBlinkRate", 530);
  12683. option("cursorScrollMargin", 0);
  12684. option("cursorHeight", 1, updateSelection, true);
  12685. option("singleCursorHeightPerLine", true, updateSelection, true);
  12686. option("workTime", 100);
  12687. option("workDelay", 100);
  12688. option("flattenSpans", true, resetModeState, true);
  12689. option("addModeClass", false, resetModeState, true);
  12690. option("pollInterval", 100);
  12691. option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
  12692. option("historyEventDelay", 1250);
  12693. option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
  12694. option("maxHighlightLength", 10000, resetModeState, true);
  12695. option("moveInputWithCursor", true, function (cm, val) {
  12696. if (!val) { cm.display.input.resetPosition(); }
  12697. });
  12698. option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
  12699. option("autofocus", null);
  12700. option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
  12701. }
  12702. function guttersChanged(cm) {
  12703. updateGutters(cm);
  12704. regChange(cm);
  12705. alignHorizontally(cm);
  12706. }
  12707. function dragDropChanged(cm, value, old) {
  12708. var wasOn = old && old != Init;
  12709. if (!value != !wasOn) {
  12710. var funcs = cm.display.dragFunctions;
  12711. var toggle = value ? on : off;
  12712. toggle(cm.display.scroller, "dragstart", funcs.start);
  12713. toggle(cm.display.scroller, "dragenter", funcs.enter);
  12714. toggle(cm.display.scroller, "dragover", funcs.over);
  12715. toggle(cm.display.scroller, "dragleave", funcs.leave);
  12716. toggle(cm.display.scroller, "drop", funcs.drop);
  12717. }
  12718. }
  12719. function wrappingChanged(cm) {
  12720. if (cm.options.lineWrapping) {
  12721. addClass(cm.display.wrapper, "CodeMirror-wrap");
  12722. cm.display.sizer.style.minWidth = "";
  12723. cm.display.sizerWidth = null;
  12724. } else {
  12725. rmClass(cm.display.wrapper, "CodeMirror-wrap");
  12726. findMaxLine(cm);
  12727. }
  12728. estimateLineHeights(cm);
  12729. regChange(cm);
  12730. clearCaches(cm);
  12731. setTimeout(function () { return updateScrollbars(cm); }, 100);
  12732. }
  12733. // A CodeMirror instance represents an editor. This is the object
  12734. // that user code is usually dealing with.
  12735. function CodeMirror$1(place, options) {
  12736. var this$1 = this;
  12737. if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }
  12738. this.options = options = options ? copyObj(options) : {};
  12739. // Determine effective options based on given values and defaults.
  12740. copyObj(defaults, options, false);
  12741. setGuttersForLineNumbers(options);
  12742. var doc = options.value;
  12743. if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
  12744. this.doc = doc;
  12745. var input = new CodeMirror$1.inputStyles[options.inputStyle](this);
  12746. var display = this.display = new Display(place, doc, input);
  12747. display.wrapper.CodeMirror = this;
  12748. updateGutters(this);
  12749. themeChanged(this);
  12750. if (options.lineWrapping)
  12751. { this.display.wrapper.className += " CodeMirror-wrap"; }
  12752. initScrollbars(this);
  12753. this.state = {
  12754. keyMaps: [], // stores maps added by addKeyMap
  12755. overlays: [], // highlighting overlays, as added by addOverlay
  12756. modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
  12757. overwrite: false,
  12758. delayingBlurEvent: false,
  12759. focused: false,
  12760. suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
  12761. pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
  12762. selectingText: false,
  12763. draggingText: false,
  12764. highlight: new Delayed(), // stores highlight worker timeout
  12765. keySeq: null, // Unfinished key sequence
  12766. specialChars: null
  12767. };
  12768. if (options.autofocus && !mobile) { display.input.focus(); }
  12769. // Override magic textarea content restore that IE sometimes does
  12770. // on our hidden textarea on reload
  12771. if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
  12772. registerEventHandlers(this);
  12773. ensureGlobalHandlers();
  12774. startOperation(this);
  12775. this.curOp.forceUpdate = true;
  12776. attachDoc(this, doc);
  12777. if ((options.autofocus && !mobile) || this.hasFocus())
  12778. { setTimeout(bind(onFocus, this), 20); }
  12779. else
  12780. { onBlur(this); }
  12781. for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
  12782. { optionHandlers[opt](this$1, options[opt], Init); } }
  12783. maybeUpdateLineNumberWidth(this);
  12784. if (options.finishInit) { options.finishInit(this); }
  12785. for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
  12786. endOperation(this);
  12787. // Suppress optimizelegibility in Webkit, since it breaks text
  12788. // measuring on line wrapping boundaries.
  12789. if (webkit && options.lineWrapping &&
  12790. getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
  12791. { display.lineDiv.style.textRendering = "auto"; }
  12792. }
  12793. // The default configuration options.
  12794. CodeMirror$1.defaults = defaults;
  12795. // Functions to run when options are changed.
  12796. CodeMirror$1.optionHandlers = optionHandlers;
  12797. // Attach the necessary event handlers when initializing the editor
  12798. function registerEventHandlers(cm) {
  12799. var d = cm.display;
  12800. on(d.scroller, "mousedown", operation(cm, onMouseDown));
  12801. // Older IE's will not fire a second mousedown for a double click
  12802. if (ie && ie_version < 11)
  12803. { on(d.scroller, "dblclick", operation(cm, function (e) {
  12804. if (signalDOMEvent(cm, e)) { return }
  12805. var pos = posFromMouse(cm, e);
  12806. if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
  12807. e_preventDefault(e);
  12808. var word = cm.findWordAt(pos);
  12809. extendSelection(cm.doc, word.anchor, word.head);
  12810. })); }
  12811. else
  12812. { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
  12813. // Some browsers fire contextmenu *after* opening the menu, at
  12814. // which point we can't mess with it anymore. Context menu is
  12815. // handled in onMouseDown for these browsers.
  12816. if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); }
  12817. // Used to suppress mouse event handling when a touch happens
  12818. var touchFinished, prevTouch = {end: 0};
  12819. function finishTouch() {
  12820. if (d.activeTouch) {
  12821. touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
  12822. prevTouch = d.activeTouch;
  12823. prevTouch.end = +new Date;
  12824. }
  12825. }
  12826. function isMouseLikeTouchEvent(e) {
  12827. if (e.touches.length != 1) { return false }
  12828. var touch = e.touches[0];
  12829. return touch.radiusX <= 1 && touch.radiusY <= 1
  12830. }
  12831. function farAway(touch, other) {
  12832. if (other.left == null) { return true }
  12833. var dx = other.left - touch.left, dy = other.top - touch.top;
  12834. return dx * dx + dy * dy > 20 * 20
  12835. }
  12836. on(d.scroller, "touchstart", function (e) {
  12837. if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
  12838. d.input.ensurePolled();
  12839. clearTimeout(touchFinished);
  12840. var now = +new Date;
  12841. d.activeTouch = {start: now, moved: false,
  12842. prev: now - prevTouch.end <= 300 ? prevTouch : null};
  12843. if (e.touches.length == 1) {
  12844. d.activeTouch.left = e.touches[0].pageX;
  12845. d.activeTouch.top = e.touches[0].pageY;
  12846. }
  12847. }
  12848. });
  12849. on(d.scroller, "touchmove", function () {
  12850. if (d.activeTouch) { d.activeTouch.moved = true; }
  12851. });
  12852. on(d.scroller, "touchend", function (e) {
  12853. var touch = d.activeTouch;
  12854. if (touch && !eventInWidget(d, e) && touch.left != null &&
  12855. !touch.moved && new Date - touch.start < 300) {
  12856. var pos = cm.coordsChar(d.activeTouch, "page"), range;
  12857. if (!touch.prev || farAway(touch, touch.prev)) // Single tap
  12858. { range = new Range(pos, pos); }
  12859. else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
  12860. { range = cm.findWordAt(pos); }
  12861. else // Triple tap
  12862. { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
  12863. cm.setSelection(range.anchor, range.head);
  12864. cm.focus();
  12865. e_preventDefault(e);
  12866. }
  12867. finishTouch();
  12868. });
  12869. on(d.scroller, "touchcancel", finishTouch);
  12870. // Sync scrolling between fake scrollbars and real scrollable
  12871. // area, ensure viewport is updated when scrolling.
  12872. on(d.scroller, "scroll", function () {
  12873. if (d.scroller.clientHeight) {
  12874. setScrollTop(cm, d.scroller.scrollTop);
  12875. setScrollLeft(cm, d.scroller.scrollLeft, true);
  12876. signal(cm, "scroll", cm);
  12877. }
  12878. });
  12879. // Listen to wheel events in order to try and update the viewport on time.
  12880. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
  12881. on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
  12882. // Prevent wrapper from ever scrolling
  12883. on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
  12884. d.dragFunctions = {
  12885. enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
  12886. over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
  12887. start: function (e) { return onDragStart(cm, e); },
  12888. drop: operation(cm, onDrop),
  12889. leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
  12890. };
  12891. var inp = d.input.getField();
  12892. on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
  12893. on(inp, "keydown", operation(cm, onKeyDown));
  12894. on(inp, "keypress", operation(cm, onKeyPress));
  12895. on(inp, "focus", function (e) { return onFocus(cm, e); });
  12896. on(inp, "blur", function (e) { return onBlur(cm, e); });
  12897. }
  12898. var initHooks = [];
  12899. CodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); };
  12900. // Indent the given line. The how parameter can be "smart",
  12901. // "add"/null, "subtract", or "prev". When aggressive is false
  12902. // (typically set to true for forced single-line indents), empty
  12903. // lines are not indented, and places where the mode returns Pass
  12904. // are left alone.
  12905. function indentLine(cm, n, how, aggressive) {
  12906. var doc = cm.doc, state;
  12907. if (how == null) { how = "add"; }
  12908. if (how == "smart") {
  12909. // Fall back to "prev" when the mode doesn't have an indentation
  12910. // method.
  12911. if (!doc.mode.indent) { how = "prev"; }
  12912. else { state = getStateBefore(cm, n); }
  12913. }
  12914. var tabSize = cm.options.tabSize;
  12915. var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
  12916. if (line.stateAfter) { line.stateAfter = null; }
  12917. var curSpaceString = line.text.match(/^\s*/)[0], indentation;
  12918. if (!aggressive && !/\S/.test(line.text)) {
  12919. indentation = 0;
  12920. how = "not";
  12921. } else if (how == "smart") {
  12922. indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
  12923. if (indentation == Pass || indentation > 150) {
  12924. if (!aggressive) { return }
  12925. how = "prev";
  12926. }
  12927. }
  12928. if (how == "prev") {
  12929. if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
  12930. else { indentation = 0; }
  12931. } else if (how == "add") {
  12932. indentation = curSpace + cm.options.indentUnit;
  12933. } else if (how == "subtract") {
  12934. indentation = curSpace - cm.options.indentUnit;
  12935. } else if (typeof how == "number") {
  12936. indentation = curSpace + how;
  12937. }
  12938. indentation = Math.max(0, indentation);
  12939. var indentString = "", pos = 0;
  12940. if (cm.options.indentWithTabs)
  12941. { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
  12942. if (pos < indentation) { indentString += spaceStr(indentation - pos); }
  12943. if (indentString != curSpaceString) {
  12944. replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
  12945. line.stateAfter = null;
  12946. return true
  12947. } else {
  12948. // Ensure that, if the cursor was in the whitespace at the start
  12949. // of the line, it is moved to the end of that space.
  12950. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
  12951. var range = doc.sel.ranges[i$1];
  12952. if (range.head.line == n && range.head.ch < curSpaceString.length) {
  12953. var pos$1 = Pos(n, curSpaceString.length);
  12954. replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
  12955. break
  12956. }
  12957. }
  12958. }
  12959. }
  12960. // This will be set to a {lineWise: bool, text: [string]} object, so
  12961. // that, when pasting, we know what kind of selections the copied
  12962. // text was made out of.
  12963. var lastCopied = null;
  12964. function setLastCopied(newLastCopied) {
  12965. lastCopied = newLastCopied;
  12966. }
  12967. function applyTextInput(cm, inserted, deleted, sel, origin) {
  12968. var doc = cm.doc;
  12969. cm.display.shift = false;
  12970. if (!sel) { sel = doc.sel; }
  12971. var paste = cm.state.pasteIncoming || origin == "paste";
  12972. var textLines = splitLinesAuto(inserted), multiPaste = null;
  12973. // When pasing N lines into N selections, insert one line per selection
  12974. if (paste && sel.ranges.length > 1) {
  12975. if (lastCopied && lastCopied.text.join("\n") == inserted) {
  12976. if (sel.ranges.length % lastCopied.text.length == 0) {
  12977. multiPaste = [];
  12978. for (var i = 0; i < lastCopied.text.length; i++)
  12979. { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
  12980. }
  12981. } else if (textLines.length == sel.ranges.length) {
  12982. multiPaste = map(textLines, function (l) { return [l]; });
  12983. }
  12984. }
  12985. var updateInput;
  12986. // Normal behavior is to insert the new text into every selection
  12987. for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
  12988. var range$$1 = sel.ranges[i$1];
  12989. var from = range$$1.from(), to = range$$1.to();
  12990. if (range$$1.empty()) {
  12991. if (deleted && deleted > 0) // Handle deletion
  12992. { from = Pos(from.line, from.ch - deleted); }
  12993. else if (cm.state.overwrite && !paste) // Handle overwrite
  12994. { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
  12995. else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
  12996. { from = to = Pos(from.line, 0); }
  12997. }
  12998. updateInput = cm.curOp.updateInput;
  12999. var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
  13000. origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
  13001. makeChange(cm.doc, changeEvent);
  13002. signalLater(cm, "inputRead", cm, changeEvent);
  13003. }
  13004. if (inserted && !paste)
  13005. { triggerElectric(cm, inserted); }
  13006. ensureCursorVisible(cm);
  13007. cm.curOp.updateInput = updateInput;
  13008. cm.curOp.typing = true;
  13009. cm.state.pasteIncoming = cm.state.cutIncoming = false;
  13010. }
  13011. function handlePaste(e, cm) {
  13012. var pasted = e.clipboardData && e.clipboardData.getData("Text");
  13013. if (pasted) {
  13014. e.preventDefault();
  13015. if (!cm.isReadOnly() && !cm.options.disableInput)
  13016. { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
  13017. return true
  13018. }
  13019. }
  13020. function triggerElectric(cm, inserted) {
  13021. // When an 'electric' character is inserted, immediately trigger a reindent
  13022. if (!cm.options.electricChars || !cm.options.smartIndent) { return }
  13023. var sel = cm.doc.sel;
  13024. for (var i = sel.ranges.length - 1; i >= 0; i--) {
  13025. var range$$1 = sel.ranges[i];
  13026. if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
  13027. var mode = cm.getModeAt(range$$1.head);
  13028. var indented = false;
  13029. if (mode.electricChars) {
  13030. for (var j = 0; j < mode.electricChars.length; j++)
  13031. { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
  13032. indented = indentLine(cm, range$$1.head.line, "smart");
  13033. break
  13034. } }
  13035. } else if (mode.electricInput) {
  13036. if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
  13037. { indented = indentLine(cm, range$$1.head.line, "smart"); }
  13038. }
  13039. if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
  13040. }
  13041. }
  13042. function copyableRanges(cm) {
  13043. var text = [], ranges = [];
  13044. for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
  13045. var line = cm.doc.sel.ranges[i].head.line;
  13046. var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
  13047. ranges.push(lineRange);
  13048. text.push(cm.getRange(lineRange.anchor, lineRange.head));
  13049. }
  13050. return {text: text, ranges: ranges}
  13051. }
  13052. function disableBrowserMagic(field, spellcheck) {
  13053. field.setAttribute("autocorrect", "off");
  13054. field.setAttribute("autocapitalize", "off");
  13055. field.setAttribute("spellcheck", !!spellcheck);
  13056. }
  13057. function hiddenTextarea() {
  13058. var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
  13059. var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
  13060. // The textarea is kept positioned near the cursor to prevent the
  13061. // fact that it'll be scrolled into view on input from scrolling
  13062. // our fake cursor out of view. On webkit, when wrap=off, paste is
  13063. // very slow. So make the area wide instead.
  13064. if (webkit) { te.style.width = "1000px"; }
  13065. else { te.setAttribute("wrap", "off"); }
  13066. // If border: 0; -- iOS fails to open keyboard (issue #1287)
  13067. if (ios) { te.style.border = "1px solid black"; }
  13068. disableBrowserMagic(te);
  13069. return div
  13070. }
  13071. // The publicly visible API. Note that methodOp(f) means
  13072. // 'wrap f in an operation, performed on its `this` parameter'.
  13073. // This is not the complete set of editor methods. Most of the
  13074. // methods defined on the Doc type are also injected into
  13075. // CodeMirror.prototype, for backwards compatibility and
  13076. // convenience.
  13077. var addEditorMethods = function(CodeMirror) {
  13078. var optionHandlers = CodeMirror.optionHandlers;
  13079. var helpers = CodeMirror.helpers = {};
  13080. CodeMirror.prototype = {
  13081. constructor: CodeMirror,
  13082. focus: function(){window.focus(); this.display.input.focus();},
  13083. setOption: function(option, value) {
  13084. var options = this.options, old = options[option];
  13085. if (options[option] == value && option != "mode") { return }
  13086. options[option] = value;
  13087. if (optionHandlers.hasOwnProperty(option))
  13088. { operation(this, optionHandlers[option])(this, value, old); }
  13089. signal(this, "optionChange", this, option);
  13090. },
  13091. getOption: function(option) {return this.options[option]},
  13092. getDoc: function() {return this.doc},
  13093. addKeyMap: function(map$$1, bottom) {
  13094. this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
  13095. },
  13096. removeKeyMap: function(map$$1) {
  13097. var maps = this.state.keyMaps;
  13098. for (var i = 0; i < maps.length; ++i)
  13099. { if (maps[i] == map$$1 || maps[i].name == map$$1) {
  13100. maps.splice(i, 1);
  13101. return true
  13102. } }
  13103. },
  13104. addOverlay: methodOp(function(spec, options) {
  13105. var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
  13106. if (mode.startState) { throw new Error("Overlays may not be stateful.") }
  13107. insertSorted(this.state.overlays,
  13108. {mode: mode, modeSpec: spec, opaque: options && options.opaque,
  13109. priority: (options && options.priority) || 0},
  13110. function (overlay) { return overlay.priority; });
  13111. this.state.modeGen++;
  13112. regChange(this);
  13113. }),
  13114. removeOverlay: methodOp(function(spec) {
  13115. var this$1 = this;
  13116. var overlays = this.state.overlays;
  13117. for (var i = 0; i < overlays.length; ++i) {
  13118. var cur = overlays[i].modeSpec;
  13119. if (cur == spec || typeof spec == "string" && cur.name == spec) {
  13120. overlays.splice(i, 1);
  13121. this$1.state.modeGen++;
  13122. regChange(this$1);
  13123. return
  13124. }
  13125. }
  13126. }),
  13127. indentLine: methodOp(function(n, dir, aggressive) {
  13128. if (typeof dir != "string" && typeof dir != "number") {
  13129. if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
  13130. else { dir = dir ? "add" : "subtract"; }
  13131. }
  13132. if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
  13133. }),
  13134. indentSelection: methodOp(function(how) {
  13135. var this$1 = this;
  13136. var ranges = this.doc.sel.ranges, end = -1;
  13137. for (var i = 0; i < ranges.length; i++) {
  13138. var range$$1 = ranges[i];
  13139. if (!range$$1.empty()) {
  13140. var from = range$$1.from(), to = range$$1.to();
  13141. var start = Math.max(end, from.line);
  13142. end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
  13143. for (var j = start; j < end; ++j)
  13144. { indentLine(this$1, j, how); }
  13145. var newRanges = this$1.doc.sel.ranges;
  13146. if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
  13147. { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
  13148. } else if (range$$1.head.line > end) {
  13149. indentLine(this$1, range$$1.head.line, how, true);
  13150. end = range$$1.head.line;
  13151. if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
  13152. }
  13153. }
  13154. }),
  13155. // Fetch the parser token for a given character. Useful for hacks
  13156. // that want to inspect the mode state (say, for completion).
  13157. getTokenAt: function(pos, precise) {
  13158. return takeToken(this, pos, precise)
  13159. },
  13160. getLineTokens: function(line, precise) {
  13161. return takeToken(this, Pos(line), precise, true)
  13162. },
  13163. getTokenTypeAt: function(pos) {
  13164. pos = clipPos(this.doc, pos);
  13165. var styles = getLineStyles(this, getLine(this.doc, pos.line));
  13166. var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
  13167. var type;
  13168. if (ch == 0) { type = styles[2]; }
  13169. else { for (;;) {
  13170. var mid = (before + after) >> 1;
  13171. if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
  13172. else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
  13173. else { type = styles[mid * 2 + 2]; break }
  13174. } }
  13175. var cut = type ? type.indexOf("overlay ") : -1;
  13176. return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
  13177. },
  13178. getModeAt: function(pos) {
  13179. var mode = this.doc.mode;
  13180. if (!mode.innerMode) { return mode }
  13181. return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
  13182. },
  13183. getHelper: function(pos, type) {
  13184. return this.getHelpers(pos, type)[0]
  13185. },
  13186. getHelpers: function(pos, type) {
  13187. var this$1 = this;
  13188. var found = [];
  13189. if (!helpers.hasOwnProperty(type)) { return found }
  13190. var help = helpers[type], mode = this.getModeAt(pos);
  13191. if (typeof mode[type] == "string") {
  13192. if (help[mode[type]]) { found.push(help[mode[type]]); }
  13193. } else if (mode[type]) {
  13194. for (var i = 0; i < mode[type].length; i++) {
  13195. var val = help[mode[type][i]];
  13196. if (val) { found.push(val); }
  13197. }
  13198. } else if (mode.helperType && help[mode.helperType]) {
  13199. found.push(help[mode.helperType]);
  13200. } else if (help[mode.name]) {
  13201. found.push(help[mode.name]);
  13202. }
  13203. for (var i$1 = 0; i$1 < help._global.length; i$1++) {
  13204. var cur = help._global[i$1];
  13205. if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
  13206. { found.push(cur.val); }
  13207. }
  13208. return found
  13209. },
  13210. getStateAfter: function(line, precise) {
  13211. var doc = this.doc;
  13212. line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
  13213. return getStateBefore(this, line + 1, precise)
  13214. },
  13215. cursorCoords: function(start, mode) {
  13216. var pos, range$$1 = this.doc.sel.primary();
  13217. if (start == null) { pos = range$$1.head; }
  13218. else if (typeof start == "object") { pos = clipPos(this.doc, start); }
  13219. else { pos = start ? range$$1.from() : range$$1.to(); }
  13220. return cursorCoords(this, pos, mode || "page")
  13221. },
  13222. charCoords: function(pos, mode) {
  13223. return charCoords(this, clipPos(this.doc, pos), mode || "page")
  13224. },
  13225. coordsChar: function(coords, mode) {
  13226. coords = fromCoordSystem(this, coords, mode || "page");
  13227. return coordsChar(this, coords.left, coords.top)
  13228. },
  13229. lineAtHeight: function(height, mode) {
  13230. height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
  13231. return lineAtHeight(this.doc, height + this.display.viewOffset)
  13232. },
  13233. heightAtLine: function(line, mode, includeWidgets) {
  13234. var end = false, lineObj;
  13235. if (typeof line == "number") {
  13236. var last = this.doc.first + this.doc.size - 1;
  13237. if (line < this.doc.first) { line = this.doc.first; }
  13238. else if (line > last) { line = last; end = true; }
  13239. lineObj = getLine(this.doc, line);
  13240. } else {
  13241. lineObj = line;
  13242. }
  13243. return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
  13244. (end ? this.doc.height - heightAtLine(lineObj) : 0)
  13245. },
  13246. defaultTextHeight: function() { return textHeight(this.display) },
  13247. defaultCharWidth: function() { return charWidth(this.display) },
  13248. getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
  13249. addWidget: function(pos, node, scroll, vert, horiz) {
  13250. var display = this.display;
  13251. pos = cursorCoords(this, clipPos(this.doc, pos));
  13252. var top = pos.bottom, left = pos.left;
  13253. node.style.position = "absolute";
  13254. node.setAttribute("cm-ignore-events", "true");
  13255. this.display.input.setUneditable(node);
  13256. display.sizer.appendChild(node);
  13257. if (vert == "over") {
  13258. top = pos.top;
  13259. } else if (vert == "above" || vert == "near") {
  13260. var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
  13261. hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
  13262. // Default to positioning above (if specified and possible); otherwise default to positioning below
  13263. if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
  13264. { top = pos.top - node.offsetHeight; }
  13265. else if (pos.bottom + node.offsetHeight <= vspace)
  13266. { top = pos.bottom; }
  13267. if (left + node.offsetWidth > hspace)
  13268. { left = hspace - node.offsetWidth; }
  13269. }
  13270. node.style.top = top + "px";
  13271. node.style.left = node.style.right = "";
  13272. if (horiz == "right") {
  13273. left = display.sizer.clientWidth - node.offsetWidth;
  13274. node.style.right = "0px";
  13275. } else {
  13276. if (horiz == "left") { left = 0; }
  13277. else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
  13278. node.style.left = left + "px";
  13279. }
  13280. if (scroll)
  13281. { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
  13282. },
  13283. triggerOnKeyDown: methodOp(onKeyDown),
  13284. triggerOnKeyPress: methodOp(onKeyPress),
  13285. triggerOnKeyUp: onKeyUp,
  13286. execCommand: function(cmd) {
  13287. if (commands.hasOwnProperty(cmd))
  13288. { return commands[cmd].call(null, this) }
  13289. },
  13290. triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
  13291. findPosH: function(from, amount, unit, visually) {
  13292. var this$1 = this;
  13293. var dir = 1;
  13294. if (amount < 0) { dir = -1; amount = -amount; }
  13295. var cur = clipPos(this.doc, from);
  13296. for (var i = 0; i < amount; ++i) {
  13297. cur = findPosH(this$1.doc, cur, dir, unit, visually);
  13298. if (cur.hitSide) { break }
  13299. }
  13300. return cur
  13301. },
  13302. moveH: methodOp(function(dir, unit) {
  13303. var this$1 = this;
  13304. this.extendSelectionsBy(function (range$$1) {
  13305. if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
  13306. { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
  13307. else
  13308. { return dir < 0 ? range$$1.from() : range$$1.to() }
  13309. }, sel_move);
  13310. }),
  13311. deleteH: methodOp(function(dir, unit) {
  13312. var sel = this.doc.sel, doc = this.doc;
  13313. if (sel.somethingSelected())
  13314. { doc.replaceSelection("", null, "+delete"); }
  13315. else
  13316. { deleteNearSelection(this, function (range$$1) {
  13317. var other = findPosH(doc, range$$1.head, dir, unit, false);
  13318. return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
  13319. }); }
  13320. }),
  13321. findPosV: function(from, amount, unit, goalColumn) {
  13322. var this$1 = this;
  13323. var dir = 1, x = goalColumn;
  13324. if (amount < 0) { dir = -1; amount = -amount; }
  13325. var cur = clipPos(this.doc, from);
  13326. for (var i = 0; i < amount; ++i) {
  13327. var coords = cursorCoords(this$1, cur, "div");
  13328. if (x == null) { x = coords.left; }
  13329. else { coords.left = x; }
  13330. cur = findPosV(this$1, coords, dir, unit);
  13331. if (cur.hitSide) { break }
  13332. }
  13333. return cur
  13334. },
  13335. moveV: methodOp(function(dir, unit) {
  13336. var this$1 = this;
  13337. var doc = this.doc, goals = [];
  13338. var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
  13339. doc.extendSelectionsBy(function (range$$1) {
  13340. if (collapse)
  13341. { return dir < 0 ? range$$1.from() : range$$1.to() }
  13342. var headPos = cursorCoords(this$1, range$$1.head, "div");
  13343. if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
  13344. goals.push(headPos.left);
  13345. var pos = findPosV(this$1, headPos, dir, unit);
  13346. if (unit == "page" && range$$1 == doc.sel.primary())
  13347. { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top); }
  13348. return pos
  13349. }, sel_move);
  13350. if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
  13351. { doc.sel.ranges[i].goalColumn = goals[i]; } }
  13352. }),
  13353. // Find the word at the given position (as returned by coordsChar).
  13354. findWordAt: function(pos) {
  13355. var doc = this.doc, line = getLine(doc, pos.line).text;
  13356. var start = pos.ch, end = pos.ch;
  13357. if (line) {
  13358. var helper = this.getHelper(pos, "wordChars");
  13359. if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
  13360. var startChar = line.charAt(start);
  13361. var check = isWordChar(startChar, helper)
  13362. ? function (ch) { return isWordChar(ch, helper); }
  13363. : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
  13364. : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
  13365. while (start > 0 && check(line.charAt(start - 1))) { --start; }
  13366. while (end < line.length && check(line.charAt(end))) { ++end; }
  13367. }
  13368. return new Range(Pos(pos.line, start), Pos(pos.line, end))
  13369. },
  13370. toggleOverwrite: function(value) {
  13371. if (value != null && value == this.state.overwrite) { return }
  13372. if (this.state.overwrite = !this.state.overwrite)
  13373. { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  13374. else
  13375. { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  13376. signal(this, "overwriteToggle", this, this.state.overwrite);
  13377. },
  13378. hasFocus: function() { return this.display.input.getField() == activeElt() },
  13379. isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
  13380. scrollTo: methodOp(function(x, y) {
  13381. if (x != null || y != null) { resolveScrollToPos(this); }
  13382. if (x != null) { this.curOp.scrollLeft = x; }
  13383. if (y != null) { this.curOp.scrollTop = y; }
  13384. }),
  13385. getScrollInfo: function() {
  13386. var scroller = this.display.scroller;
  13387. return {left: scroller.scrollLeft, top: scroller.scrollTop,
  13388. height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
  13389. width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
  13390. clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
  13391. },
  13392. scrollIntoView: methodOp(function(range$$1, margin) {
  13393. if (range$$1 == null) {
  13394. range$$1 = {from: this.doc.sel.primary().head, to: null};
  13395. if (margin == null) { margin = this.options.cursorScrollMargin; }
  13396. } else if (typeof range$$1 == "number") {
  13397. range$$1 = {from: Pos(range$$1, 0), to: null};
  13398. } else if (range$$1.from == null) {
  13399. range$$1 = {from: range$$1, to: null};
  13400. }
  13401. if (!range$$1.to) { range$$1.to = range$$1.from; }
  13402. range$$1.margin = margin || 0;
  13403. if (range$$1.from.line != null) {
  13404. resolveScrollToPos(this);
  13405. this.curOp.scrollToPos = range$$1;
  13406. } else {
  13407. var sPos = calculateScrollPos(this, {
  13408. left: Math.min(range$$1.from.left, range$$1.to.left),
  13409. top: Math.min(range$$1.from.top, range$$1.to.top) - range$$1.margin,
  13410. right: Math.max(range$$1.from.right, range$$1.to.right),
  13411. bottom: Math.max(range$$1.from.bottom, range$$1.to.bottom) + range$$1.margin
  13412. });
  13413. this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  13414. }
  13415. }),
  13416. setSize: methodOp(function(width, height) {
  13417. var this$1 = this;
  13418. var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
  13419. if (width != null) { this.display.wrapper.style.width = interpret(width); }
  13420. if (height != null) { this.display.wrapper.style.height = interpret(height); }
  13421. if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
  13422. var lineNo$$1 = this.display.viewFrom;
  13423. this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
  13424. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
  13425. { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
  13426. ++lineNo$$1;
  13427. });
  13428. this.curOp.forceUpdate = true;
  13429. signal(this, "refresh", this);
  13430. }),
  13431. operation: function(f){return runInOp(this, f)},
  13432. refresh: methodOp(function() {
  13433. var oldHeight = this.display.cachedTextHeight;
  13434. regChange(this);
  13435. this.curOp.forceUpdate = true;
  13436. clearCaches(this);
  13437. this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
  13438. updateGutterSpace(this);
  13439. if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
  13440. { estimateLineHeights(this); }
  13441. signal(this, "refresh", this);
  13442. }),
  13443. swapDoc: methodOp(function(doc) {
  13444. var old = this.doc;
  13445. old.cm = null;
  13446. attachDoc(this, doc);
  13447. clearCaches(this);
  13448. this.display.input.reset();
  13449. this.scrollTo(doc.scrollLeft, doc.scrollTop);
  13450. this.curOp.forceScroll = true;
  13451. signalLater(this, "swapDoc", this, old);
  13452. return old
  13453. }),
  13454. getInputField: function(){return this.display.input.getField()},
  13455. getWrapperElement: function(){return this.display.wrapper},
  13456. getScrollerElement: function(){return this.display.scroller},
  13457. getGutterElement: function(){return this.display.gutters}
  13458. };
  13459. eventMixin(CodeMirror);
  13460. CodeMirror.registerHelper = function(type, name, value) {
  13461. if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
  13462. helpers[type][name] = value;
  13463. };
  13464. CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
  13465. CodeMirror.registerHelper(type, name, value);
  13466. helpers[type]._global.push({pred: predicate, val: value});
  13467. };
  13468. };
  13469. // Used for horizontal relative motion. Dir is -1 or 1 (left or
  13470. // right), unit can be "char", "column" (like char, but doesn't
  13471. // cross line boundaries), "word" (across next word), or "group" (to
  13472. // the start of next group of word or non-word-non-whitespace
  13473. // chars). The visually param controls whether, in right-to-left
  13474. // text, direction 1 means to move towards the next index in the
  13475. // string, or towards the character to the right of the current
  13476. // position. The resulting position will have a hitSide=true
  13477. // property if it reached the end of the document.
  13478. function findPosH(doc, pos, dir, unit, visually) {
  13479. var oldPos = pos;
  13480. var origDir = dir;
  13481. var lineObj = getLine(doc, pos.line);
  13482. function findNextLine() {
  13483. var l = pos.line + dir;
  13484. if (l < doc.first || l >= doc.first + doc.size) { return false }
  13485. pos = new Pos(l, pos.ch, pos.sticky);
  13486. return lineObj = getLine(doc, l)
  13487. }
  13488. function moveOnce(boundToLine) {
  13489. var next;
  13490. if (visually) {
  13491. next = moveVisually(doc.cm, lineObj, pos, dir);
  13492. } else {
  13493. next = moveLogically(lineObj, pos, dir);
  13494. }
  13495. if (next == null) {
  13496. if (!boundToLine && findNextLine())
  13497. { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
  13498. else
  13499. { return false }
  13500. } else {
  13501. pos = next;
  13502. }
  13503. return true
  13504. }
  13505. if (unit == "char") {
  13506. moveOnce();
  13507. } else if (unit == "column") {
  13508. moveOnce(true);
  13509. } else if (unit == "word" || unit == "group") {
  13510. var sawType = null, group = unit == "group";
  13511. var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
  13512. for (var first = true;; first = false) {
  13513. if (dir < 0 && !moveOnce(!first)) { break }
  13514. var cur = lineObj.text.charAt(pos.ch) || "\n";
  13515. var type = isWordChar(cur, helper) ? "w"
  13516. : group && cur == "\n" ? "n"
  13517. : !group || /\s/.test(cur) ? null
  13518. : "p";
  13519. if (group && !first && !type) { type = "s"; }
  13520. if (sawType && sawType != type) {
  13521. if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
  13522. break
  13523. }
  13524. if (type) { sawType = type; }
  13525. if (dir > 0 && !moveOnce(!first)) { break }
  13526. }
  13527. }
  13528. var result = skipAtomic(doc, pos, oldPos, origDir, true);
  13529. if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
  13530. return result
  13531. }
  13532. // For relative vertical movement. Dir may be -1 or 1. Unit can be
  13533. // "page" or "line". The resulting position will have a hitSide=true
  13534. // property if it reached the end of the document.
  13535. function findPosV(cm, pos, dir, unit) {
  13536. var doc = cm.doc, x = pos.left, y;
  13537. if (unit == "page") {
  13538. var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
  13539. var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
  13540. y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
  13541. } else if (unit == "line") {
  13542. y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
  13543. }
  13544. var target;
  13545. for (;;) {
  13546. target = coordsChar(cm, x, y);
  13547. if (!target.outside) { break }
  13548. if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
  13549. y += dir * 5;
  13550. }
  13551. return target
  13552. }
  13553. // CONTENTEDITABLE INPUT STYLE
  13554. var ContentEditableInput = function(cm) {
  13555. this.cm = cm;
  13556. this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
  13557. this.polling = new Delayed();
  13558. this.composing = null;
  13559. this.gracePeriod = false;
  13560. this.readDOMTimeout = null;
  13561. };
  13562. ContentEditableInput.prototype.init = function (display) {
  13563. var this$1 = this;
  13564. var input = this, cm = input.cm;
  13565. var div = input.div = display.lineDiv;
  13566. disableBrowserMagic(div, cm.options.spellcheck);
  13567. on(div, "paste", function (e) {
  13568. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  13569. // IE doesn't fire input events, so we schedule a read for the pasted content in this way
  13570. if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
  13571. });
  13572. on(div, "compositionstart", function (e) {
  13573. this$1.composing = {data: e.data, done: false};
  13574. });
  13575. on(div, "compositionupdate", function (e) {
  13576. if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
  13577. });
  13578. on(div, "compositionend", function (e) {
  13579. if (this$1.composing) {
  13580. if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
  13581. this$1.composing.done = true;
  13582. }
  13583. });
  13584. on(div, "touchstart", function () { return input.forceCompositionEnd(); });
  13585. on(div, "input", function () {
  13586. if (!this$1.composing) { this$1.readFromDOMSoon(); }
  13587. });
  13588. function onCopyCut(e) {
  13589. if (signalDOMEvent(cm, e)) { return }
  13590. if (cm.somethingSelected()) {
  13591. setLastCopied({lineWise: false, text: cm.getSelections()});
  13592. if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
  13593. } else if (!cm.options.lineWiseCopyCut) {
  13594. return
  13595. } else {
  13596. var ranges = copyableRanges(cm);
  13597. setLastCopied({lineWise: true, text: ranges.text});
  13598. if (e.type == "cut") {
  13599. cm.operation(function () {
  13600. cm.setSelections(ranges.ranges, 0, sel_dontScroll);
  13601. cm.replaceSelection("", null, "cut");
  13602. });
  13603. }
  13604. }
  13605. if (e.clipboardData) {
  13606. e.clipboardData.clearData();
  13607. var content = lastCopied.text.join("\n");
  13608. // iOS exposes the clipboard API, but seems to discard content inserted into it
  13609. e.clipboardData.setData("Text", content);
  13610. if (e.clipboardData.getData("Text") == content) {
  13611. e.preventDefault();
  13612. return
  13613. }
  13614. }
  13615. // Old-fashioned briefly-focus-a-textarea hack
  13616. var kludge = hiddenTextarea(), te = kludge.firstChild;
  13617. cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
  13618. te.value = lastCopied.text.join("\n");
  13619. var hadFocus = document.activeElement;
  13620. selectInput(te);
  13621. setTimeout(function () {
  13622. cm.display.lineSpace.removeChild(kludge);
  13623. hadFocus.focus();
  13624. if (hadFocus == div) { input.showPrimarySelection(); }
  13625. }, 50);
  13626. }
  13627. on(div, "copy", onCopyCut);
  13628. on(div, "cut", onCopyCut);
  13629. };
  13630. ContentEditableInput.prototype.prepareSelection = function () {
  13631. var result = prepareSelection(this.cm, false);
  13632. result.focus = this.cm.state.focused;
  13633. return result
  13634. };
  13635. ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
  13636. if (!info || !this.cm.display.view.length) { return }
  13637. if (info.focus || takeFocus) { this.showPrimarySelection(); }
  13638. this.showMultipleSelections(info);
  13639. };
  13640. ContentEditableInput.prototype.showPrimarySelection = function () {
  13641. var sel = window.getSelection(), prim = this.cm.doc.sel.primary();
  13642. var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);
  13643. var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);
  13644. if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
  13645. cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&
  13646. cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)
  13647. { return }
  13648. var start = posToDOM(this.cm, prim.from());
  13649. var end = posToDOM(this.cm, prim.to());
  13650. if (!start && !end) {
  13651. sel.removeAllRanges();
  13652. return
  13653. }
  13654. var view = this.cm.display.view;
  13655. var old = sel.rangeCount && sel.getRangeAt(0);
  13656. if (!start) {
  13657. start = {node: view[0].measure.map[2], offset: 0};
  13658. } else if (!end) { // FIXME dangerously hacky
  13659. var measure = view[view.length - 1].measure;
  13660. var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
  13661. end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};
  13662. }
  13663. var rng;
  13664. try { rng = range(start.node, start.offset, end.offset, end.node); }
  13665. catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
  13666. if (rng) {
  13667. if (!gecko && this.cm.state.focused) {
  13668. sel.collapse(start.node, start.offset);
  13669. if (!rng.collapsed) {
  13670. sel.removeAllRanges();
  13671. sel.addRange(rng);
  13672. }
  13673. } else {
  13674. sel.removeAllRanges();
  13675. sel.addRange(rng);
  13676. }
  13677. if (old && sel.anchorNode == null) { sel.addRange(old); }
  13678. else if (gecko) { this.startGracePeriod(); }
  13679. }
  13680. this.rememberSelection();
  13681. };
  13682. ContentEditableInput.prototype.startGracePeriod = function () {
  13683. var this$1 = this;
  13684. clearTimeout(this.gracePeriod);
  13685. this.gracePeriod = setTimeout(function () {
  13686. this$1.gracePeriod = false;
  13687. if (this$1.selectionChanged())
  13688. { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
  13689. }, 20);
  13690. };
  13691. ContentEditableInput.prototype.showMultipleSelections = function (info) {
  13692. removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
  13693. removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
  13694. };
  13695. ContentEditableInput.prototype.rememberSelection = function () {
  13696. var sel = window.getSelection();
  13697. this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
  13698. this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
  13699. };
  13700. ContentEditableInput.prototype.selectionInEditor = function () {
  13701. var sel = window.getSelection();
  13702. if (!sel.rangeCount) { return false }
  13703. var node = sel.getRangeAt(0).commonAncestorContainer;
  13704. return contains(this.div, node)
  13705. };
  13706. ContentEditableInput.prototype.focus = function () {
  13707. if (this.cm.options.readOnly != "nocursor") {
  13708. if (!this.selectionInEditor())
  13709. { this.showSelection(this.prepareSelection(), true); }
  13710. this.div.focus();
  13711. }
  13712. };
  13713. ContentEditableInput.prototype.blur = function () { this.div.blur(); };
  13714. ContentEditableInput.prototype.getField = function () { return this.div };
  13715. ContentEditableInput.prototype.supportsTouch = function () { return true };
  13716. ContentEditableInput.prototype.receivedFocus = function () {
  13717. var input = this;
  13718. if (this.selectionInEditor())
  13719. { this.pollSelection(); }
  13720. else
  13721. { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
  13722. function poll() {
  13723. if (input.cm.state.focused) {
  13724. input.pollSelection();
  13725. input.polling.set(input.cm.options.pollInterval, poll);
  13726. }
  13727. }
  13728. this.polling.set(this.cm.options.pollInterval, poll);
  13729. };
  13730. ContentEditableInput.prototype.selectionChanged = function () {
  13731. var sel = window.getSelection();
  13732. return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
  13733. sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
  13734. };
  13735. ContentEditableInput.prototype.pollSelection = function () {
  13736. if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
  13737. var sel = window.getSelection(), cm = this.cm;
  13738. // On Android Chrome (version 56, at least), backspacing into an
  13739. // uneditable block element will put the cursor in that element,
  13740. // and then, because it's not editable, hide the virtual keyboard.
  13741. // Because Android doesn't allow us to actually detect backspace
  13742. // presses in a sane way, this code checks for when that happens
  13743. // and simulates a backspace press in this case.
  13744. if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
  13745. this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
  13746. this.blur();
  13747. this.focus();
  13748. return
  13749. }
  13750. if (this.composing) { return }
  13751. this.rememberSelection();
  13752. var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
  13753. var head = domToPos(cm, sel.focusNode, sel.focusOffset);
  13754. if (anchor && head) { runInOp(cm, function () {
  13755. setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
  13756. if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
  13757. }); }
  13758. };
  13759. ContentEditableInput.prototype.pollContent = function () {
  13760. if (this.readDOMTimeout != null) {
  13761. clearTimeout(this.readDOMTimeout);
  13762. this.readDOMTimeout = null;
  13763. }
  13764. var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
  13765. var from = sel.from(), to = sel.to();
  13766. if (from.ch == 0 && from.line > cm.firstLine())
  13767. { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
  13768. if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
  13769. { to = Pos(to.line + 1, 0); }
  13770. if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
  13771. var fromIndex, fromLine, fromNode;
  13772. if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
  13773. fromLine = lineNo(display.view[0].line);
  13774. fromNode = display.view[0].node;
  13775. } else {
  13776. fromLine = lineNo(display.view[fromIndex].line);
  13777. fromNode = display.view[fromIndex - 1].node.nextSibling;
  13778. }
  13779. var toIndex = findViewIndex(cm, to.line);
  13780. var toLine, toNode;
  13781. if (toIndex == display.view.length - 1) {
  13782. toLine = display.viewTo - 1;
  13783. toNode = display.lineDiv.lastChild;
  13784. } else {
  13785. toLine = lineNo(display.view[toIndex + 1].line) - 1;
  13786. toNode = display.view[toIndex + 1].node.previousSibling;
  13787. }
  13788. if (!fromNode) { return false }
  13789. var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
  13790. var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
  13791. while (newText.length > 1 && oldText.length > 1) {
  13792. if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
  13793. else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
  13794. else { break }
  13795. }
  13796. var cutFront = 0, cutEnd = 0;
  13797. var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
  13798. while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
  13799. { ++cutFront; }
  13800. var newBot = lst(newText), oldBot = lst(oldText);
  13801. var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
  13802. oldBot.length - (oldText.length == 1 ? cutFront : 0));
  13803. while (cutEnd < maxCutEnd &&
  13804. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
  13805. { ++cutEnd; }
  13806. // Try to move start of change to start of selection if ambiguous
  13807. if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
  13808. while (cutFront && cutFront > from.ch &&
  13809. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
  13810. cutFront--;
  13811. cutEnd++;
  13812. }
  13813. }
  13814. newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
  13815. newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
  13816. var chFrom = Pos(fromLine, cutFront);
  13817. var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
  13818. if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
  13819. replaceRange(cm.doc, newText, chFrom, chTo, "+input");
  13820. return true
  13821. }
  13822. };
  13823. ContentEditableInput.prototype.ensurePolled = function () {
  13824. this.forceCompositionEnd();
  13825. };
  13826. ContentEditableInput.prototype.reset = function () {
  13827. this.forceCompositionEnd();
  13828. };
  13829. ContentEditableInput.prototype.forceCompositionEnd = function () {
  13830. if (!this.composing) { return }
  13831. clearTimeout(this.readDOMTimeout);
  13832. this.composing = null;
  13833. this.updateFromDOM();
  13834. this.div.blur();
  13835. this.div.focus();
  13836. };
  13837. ContentEditableInput.prototype.readFromDOMSoon = function () {
  13838. var this$1 = this;
  13839. if (this.readDOMTimeout != null) { return }
  13840. this.readDOMTimeout = setTimeout(function () {
  13841. this$1.readDOMTimeout = null;
  13842. if (this$1.composing) {
  13843. if (this$1.composing.done) { this$1.composing = null; }
  13844. else { return }
  13845. }
  13846. this$1.updateFromDOM();
  13847. }, 80);
  13848. };
  13849. ContentEditableInput.prototype.updateFromDOM = function () {
  13850. var this$1 = this;
  13851. if (this.cm.isReadOnly() || !this.pollContent())
  13852. { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
  13853. };
  13854. ContentEditableInput.prototype.setUneditable = function (node) {
  13855. node.contentEditable = "false";
  13856. };
  13857. ContentEditableInput.prototype.onKeyPress = function (e) {
  13858. if (e.charCode == 0) { return }
  13859. e.preventDefault();
  13860. if (!this.cm.isReadOnly())
  13861. { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
  13862. };
  13863. ContentEditableInput.prototype.readOnlyChanged = function (val) {
  13864. this.div.contentEditable = String(val != "nocursor");
  13865. };
  13866. ContentEditableInput.prototype.onContextMenu = function () {};
  13867. ContentEditableInput.prototype.resetPosition = function () {};
  13868. ContentEditableInput.prototype.needsContentAttribute = true;
  13869. function posToDOM(cm, pos) {
  13870. var view = findViewForLine(cm, pos.line);
  13871. if (!view || view.hidden) { return null }
  13872. var line = getLine(cm.doc, pos.line);
  13873. var info = mapFromLineView(view, line, pos.line);
  13874. var order = getOrder(line, cm.doc.direction), side = "left";
  13875. if (order) {
  13876. var partPos = getBidiPartAt(order, pos.ch);
  13877. side = partPos % 2 ? "right" : "left";
  13878. }
  13879. var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
  13880. result.offset = result.collapse == "right" ? result.end : result.start;
  13881. return result
  13882. }
  13883. function isInGutter(node) {
  13884. for (var scan = node; scan; scan = scan.parentNode)
  13885. { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
  13886. return false
  13887. }
  13888. function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
  13889. function domTextBetween(cm, from, to, fromLine, toLine) {
  13890. var text = "", closing = false, lineSep = cm.doc.lineSeparator();
  13891. function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
  13892. function close() {
  13893. if (closing) {
  13894. text += lineSep;
  13895. closing = false;
  13896. }
  13897. }
  13898. function addText(str) {
  13899. if (str) {
  13900. close();
  13901. text += str;
  13902. }
  13903. }
  13904. function walk(node) {
  13905. if (node.nodeType == 1) {
  13906. var cmText = node.getAttribute("cm-text");
  13907. if (cmText != null) {
  13908. addText(cmText || node.textContent.replace(/\u200b/g, ""));
  13909. return
  13910. }
  13911. var markerID = node.getAttribute("cm-marker"), range$$1;
  13912. if (markerID) {
  13913. var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
  13914. if (found.length && (range$$1 = found[0].find()))
  13915. { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
  13916. return
  13917. }
  13918. if (node.getAttribute("contenteditable") == "false") { return }
  13919. var isBlock = /^(pre|div|p)$/i.test(node.nodeName);
  13920. if (isBlock) { close(); }
  13921. for (var i = 0; i < node.childNodes.length; i++)
  13922. { walk(node.childNodes[i]); }
  13923. if (isBlock) { closing = true; }
  13924. } else if (node.nodeType == 3) {
  13925. addText(node.nodeValue);
  13926. }
  13927. }
  13928. for (;;) {
  13929. walk(from);
  13930. if (from == to) { break }
  13931. from = from.nextSibling;
  13932. }
  13933. return text
  13934. }
  13935. function domToPos(cm, node, offset) {
  13936. var lineNode;
  13937. if (node == cm.display.lineDiv) {
  13938. lineNode = cm.display.lineDiv.childNodes[offset];
  13939. if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
  13940. node = null; offset = 0;
  13941. } else {
  13942. for (lineNode = node;; lineNode = lineNode.parentNode) {
  13943. if (!lineNode || lineNode == cm.display.lineDiv) { return null }
  13944. if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
  13945. }
  13946. }
  13947. for (var i = 0; i < cm.display.view.length; i++) {
  13948. var lineView = cm.display.view[i];
  13949. if (lineView.node == lineNode)
  13950. { return locateNodeInLineView(lineView, node, offset) }
  13951. }
  13952. }
  13953. function locateNodeInLineView(lineView, node, offset) {
  13954. var wrapper = lineView.text.firstChild, bad = false;
  13955. if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
  13956. if (node == wrapper) {
  13957. bad = true;
  13958. node = wrapper.childNodes[offset];
  13959. offset = 0;
  13960. if (!node) {
  13961. var line = lineView.rest ? lst(lineView.rest) : lineView.line;
  13962. return badPos(Pos(lineNo(line), line.text.length), bad)
  13963. }
  13964. }
  13965. var textNode = node.nodeType == 3 ? node : null, topNode = node;
  13966. if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
  13967. textNode = node.firstChild;
  13968. if (offset) { offset = textNode.nodeValue.length; }
  13969. }
  13970. while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
  13971. var measure = lineView.measure, maps = measure.maps;
  13972. function find(textNode, topNode, offset) {
  13973. for (var i = -1; i < (maps ? maps.length : 0); i++) {
  13974. var map$$1 = i < 0 ? measure.map : maps[i];
  13975. for (var j = 0; j < map$$1.length; j += 3) {
  13976. var curNode = map$$1[j + 2];
  13977. if (curNode == textNode || curNode == topNode) {
  13978. var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
  13979. var ch = map$$1[j] + offset;
  13980. if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
  13981. return Pos(line, ch)
  13982. }
  13983. }
  13984. }
  13985. }
  13986. var found = find(textNode, topNode, offset);
  13987. if (found) { return badPos(found, bad) }
  13988. // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
  13989. for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
  13990. found = find(after, after.firstChild, 0);
  13991. if (found)
  13992. { return badPos(Pos(found.line, found.ch - dist), bad) }
  13993. else
  13994. { dist += after.textContent.length; }
  13995. }
  13996. for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
  13997. found = find(before, before.firstChild, -1);
  13998. if (found)
  13999. { return badPos(Pos(found.line, found.ch + dist$1), bad) }
  14000. else
  14001. { dist$1 += before.textContent.length; }
  14002. }
  14003. }
  14004. // TEXTAREA INPUT STYLE
  14005. var TextareaInput = function(cm) {
  14006. this.cm = cm;
  14007. // See input.poll and input.reset
  14008. this.prevInput = "";
  14009. // Flag that indicates whether we expect input to appear real soon
  14010. // now (after some event like 'keypress' or 'input') and are
  14011. // polling intensively.
  14012. this.pollingFast = false;
  14013. // Self-resetting timeout for the poller
  14014. this.polling = new Delayed();
  14015. // Tracks when input.reset has punted to just putting a short
  14016. // string into the textarea instead of the full selection.
  14017. this.inaccurateSelection = false;
  14018. // Used to work around IE issue with selection being forgotten when focus moves away from textarea
  14019. this.hasSelection = false;
  14020. this.composing = null;
  14021. };
  14022. TextareaInput.prototype.init = function (display) {
  14023. var this$1 = this;
  14024. var input = this, cm = this.cm;
  14025. // Wraps and hides input textarea
  14026. var div = this.wrapper = hiddenTextarea();
  14027. // The semihidden textarea that is focused when the editor is
  14028. // focused, and receives input.
  14029. var te = this.textarea = div.firstChild;
  14030. display.wrapper.insertBefore(div, display.wrapper.firstChild);
  14031. // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
  14032. if (ios) { te.style.width = "0px"; }
  14033. on(te, "input", function () {
  14034. if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
  14035. input.poll();
  14036. });
  14037. on(te, "paste", function (e) {
  14038. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  14039. cm.state.pasteIncoming = true;
  14040. input.fastPoll();
  14041. });
  14042. function prepareCopyCut(e) {
  14043. if (signalDOMEvent(cm, e)) { return }
  14044. if (cm.somethingSelected()) {
  14045. setLastCopied({lineWise: false, text: cm.getSelections()});
  14046. if (input.inaccurateSelection) {
  14047. input.prevInput = "";
  14048. input.inaccurateSelection = false;
  14049. te.value = lastCopied.text.join("\n");
  14050. selectInput(te);
  14051. }
  14052. } else if (!cm.options.lineWiseCopyCut) {
  14053. return
  14054. } else {
  14055. var ranges = copyableRanges(cm);
  14056. setLastCopied({lineWise: true, text: ranges.text});
  14057. if (e.type == "cut") {
  14058. cm.setSelections(ranges.ranges, null, sel_dontScroll);
  14059. } else {
  14060. input.prevInput = "";
  14061. te.value = ranges.text.join("\n");
  14062. selectInput(te);
  14063. }
  14064. }
  14065. if (e.type == "cut") { cm.state.cutIncoming = true; }
  14066. }
  14067. on(te, "cut", prepareCopyCut);
  14068. on(te, "copy", prepareCopyCut);
  14069. on(display.scroller, "paste", function (e) {
  14070. if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
  14071. cm.state.pasteIncoming = true;
  14072. input.focus();
  14073. });
  14074. // Prevent normal selection in the editor (we handle our own)
  14075. on(display.lineSpace, "selectstart", function (e) {
  14076. if (!eventInWidget(display, e)) { e_preventDefault(e); }
  14077. });
  14078. on(te, "compositionstart", function () {
  14079. var start = cm.getCursor("from");
  14080. if (input.composing) { input.composing.range.clear(); }
  14081. input.composing = {
  14082. start: start,
  14083. range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
  14084. };
  14085. });
  14086. on(te, "compositionend", function () {
  14087. if (input.composing) {
  14088. input.poll();
  14089. input.composing.range.clear();
  14090. input.composing = null;
  14091. }
  14092. });
  14093. };
  14094. TextareaInput.prototype.prepareSelection = function () {
  14095. // Redraw the selection and/or cursor
  14096. var cm = this.cm, display = cm.display, doc = cm.doc;
  14097. var result = prepareSelection(cm);
  14098. // Move the hidden textarea near the cursor to prevent scrolling artifacts
  14099. if (cm.options.moveInputWithCursor) {
  14100. var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
  14101. var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
  14102. result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
  14103. headPos.top + lineOff.top - wrapOff.top));
  14104. result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
  14105. headPos.left + lineOff.left - wrapOff.left));
  14106. }
  14107. return result
  14108. };
  14109. TextareaInput.prototype.showSelection = function (drawn) {
  14110. var cm = this.cm, display = cm.display;
  14111. removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
  14112. removeChildrenAndAdd(display.selectionDiv, drawn.selection);
  14113. if (drawn.teTop != null) {
  14114. this.wrapper.style.top = drawn.teTop + "px";
  14115. this.wrapper.style.left = drawn.teLeft + "px";
  14116. }
  14117. };
  14118. // Reset the input to correspond to the selection (or to be empty,
  14119. // when not typing and nothing is selected)
  14120. TextareaInput.prototype.reset = function (typing) {
  14121. if (this.contextMenuPending) { return }
  14122. var minimal, selected, cm = this.cm, doc = cm.doc;
  14123. if (cm.somethingSelected()) {
  14124. this.prevInput = "";
  14125. var range$$1 = doc.sel.primary();
  14126. minimal = hasCopyEvent &&
  14127. (range$$1.to().line - range$$1.from().line > 100 || (selected = cm.getSelection()).length > 1000);
  14128. var content = minimal ? "-" : selected || cm.getSelection();
  14129. this.textarea.value = content;
  14130. if (cm.state.focused) { selectInput(this.textarea); }
  14131. if (ie && ie_version >= 9) { this.hasSelection = content; }
  14132. } else if (!typing) {
  14133. this.prevInput = this.textarea.value = "";
  14134. if (ie && ie_version >= 9) { this.hasSelection = null; }
  14135. }
  14136. this.inaccurateSelection = minimal;
  14137. };
  14138. TextareaInput.prototype.getField = function () { return this.textarea };
  14139. TextareaInput.prototype.supportsTouch = function () { return false };
  14140. TextareaInput.prototype.focus = function () {
  14141. if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
  14142. try { this.textarea.focus(); }
  14143. catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
  14144. }
  14145. };
  14146. TextareaInput.prototype.blur = function () { this.textarea.blur(); };
  14147. TextareaInput.prototype.resetPosition = function () {
  14148. this.wrapper.style.top = this.wrapper.style.left = 0;
  14149. };
  14150. TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
  14151. // Poll for input changes, using the normal rate of polling. This
  14152. // runs as long as the editor is focused.
  14153. TextareaInput.prototype.slowPoll = function () {
  14154. var this$1 = this;
  14155. if (this.pollingFast) { return }
  14156. this.polling.set(this.cm.options.pollInterval, function () {
  14157. this$1.poll();
  14158. if (this$1.cm.state.focused) { this$1.slowPoll(); }
  14159. });
  14160. };
  14161. // When an event has just come in that is likely to add or change
  14162. // something in the input textarea, we poll faster, to ensure that
  14163. // the change appears on the screen quickly.
  14164. TextareaInput.prototype.fastPoll = function () {
  14165. var missed = false, input = this;
  14166. input.pollingFast = true;
  14167. function p() {
  14168. var changed = input.poll();
  14169. if (!changed && !missed) {missed = true; input.polling.set(60, p);}
  14170. else {input.pollingFast = false; input.slowPoll();}
  14171. }
  14172. input.polling.set(20, p);
  14173. };
  14174. // Read input from the textarea, and update the document to match.
  14175. // When something is selected, it is present in the textarea, and
  14176. // selected (unless it is huge, in which case a placeholder is
  14177. // used). When nothing is selected, the cursor sits after previously
  14178. // seen text (can be empty), which is stored in prevInput (we must
  14179. // not reset the textarea when typing, because that breaks IME).
  14180. TextareaInput.prototype.poll = function () {
  14181. var this$1 = this;
  14182. var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
  14183. // Since this is called a *lot*, try to bail out as cheaply as
  14184. // possible when it is clear that nothing happened. hasSelection
  14185. // will be the case when there is a lot of text in the textarea,
  14186. // in which case reading its value would be expensive.
  14187. if (this.contextMenuPending || !cm.state.focused ||
  14188. (hasSelection(input) && !prevInput && !this.composing) ||
  14189. cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
  14190. { return false }
  14191. var text = input.value;
  14192. // If nothing changed, bail.
  14193. if (text == prevInput && !cm.somethingSelected()) { return false }
  14194. // Work around nonsensical selection resetting in IE9/10, and
  14195. // inexplicable appearance of private area unicode characters on
  14196. // some key combos in Mac (#2689).
  14197. if (ie && ie_version >= 9 && this.hasSelection === text ||
  14198. mac && /[\uf700-\uf7ff]/.test(text)) {
  14199. cm.display.input.reset();
  14200. return false
  14201. }
  14202. if (cm.doc.sel == cm.display.selForContextMenu) {
  14203. var first = text.charCodeAt(0);
  14204. if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
  14205. if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
  14206. }
  14207. // Find the part of the input that is actually new
  14208. var same = 0, l = Math.min(prevInput.length, text.length);
  14209. while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
  14210. runInOp(cm, function () {
  14211. applyTextInput(cm, text.slice(same), prevInput.length - same,
  14212. null, this$1.composing ? "*compose" : null);
  14213. // Don't leave long text in the textarea, since it makes further polling slow
  14214. if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
  14215. else { this$1.prevInput = text; }
  14216. if (this$1.composing) {
  14217. this$1.composing.range.clear();
  14218. this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
  14219. {className: "CodeMirror-composing"});
  14220. }
  14221. });
  14222. return true
  14223. };
  14224. TextareaInput.prototype.ensurePolled = function () {
  14225. if (this.pollingFast && this.poll()) { this.pollingFast = false; }
  14226. };
  14227. TextareaInput.prototype.onKeyPress = function () {
  14228. if (ie && ie_version >= 9) { this.hasSelection = null; }
  14229. this.fastPoll();
  14230. };
  14231. TextareaInput.prototype.onContextMenu = function (e) {
  14232. var input = this, cm = input.cm, display = cm.display, te = input.textarea;
  14233. var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
  14234. if (!pos || presto) { return } // Opera is difficult.
  14235. // Reset the current text selection only if the click is done outside of the selection
  14236. // and 'resetSelectionOnContextMenu' option is true.
  14237. var reset = cm.options.resetSelectionOnContextMenu;
  14238. if (reset && cm.doc.sel.contains(pos) == -1)
  14239. { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
  14240. var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
  14241. input.wrapper.style.cssText = "position: absolute";
  14242. var wrapperBox = input.wrapper.getBoundingClientRect();
  14243. te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
  14244. var oldScrollY;
  14245. if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
  14246. display.input.focus();
  14247. if (webkit) { window.scrollTo(null, oldScrollY); }
  14248. display.input.reset();
  14249. // Adds "Select all" to context menu in FF
  14250. if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
  14251. input.contextMenuPending = true;
  14252. display.selForContextMenu = cm.doc.sel;
  14253. clearTimeout(display.detectingSelectAll);
  14254. // Select-all will be greyed out if there's nothing to select, so
  14255. // this adds a zero-width space so that we can later check whether
  14256. // it got selected.
  14257. function prepareSelectAllHack() {
  14258. if (te.selectionStart != null) {
  14259. var selected = cm.somethingSelected();
  14260. var extval = "\u200b" + (selected ? te.value : "");
  14261. te.value = "\u21da"; // Used to catch context-menu undo
  14262. te.value = extval;
  14263. input.prevInput = selected ? "" : "\u200b";
  14264. te.selectionStart = 1; te.selectionEnd = extval.length;
  14265. // Re-set this, in case some other handler touched the
  14266. // selection in the meantime.
  14267. display.selForContextMenu = cm.doc.sel;
  14268. }
  14269. }
  14270. function rehide() {
  14271. input.contextMenuPending = false;
  14272. input.wrapper.style.cssText = oldWrapperCSS;
  14273. te.style.cssText = oldCSS;
  14274. if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
  14275. // Try to detect the user choosing select-all
  14276. if (te.selectionStart != null) {
  14277. if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
  14278. var i = 0, poll = function () {
  14279. if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
  14280. te.selectionEnd > 0 && input.prevInput == "\u200b") {
  14281. operation(cm, selectAll)(cm);
  14282. } else if (i++ < 10) {
  14283. display.detectingSelectAll = setTimeout(poll, 500);
  14284. } else {
  14285. display.selForContextMenu = null;
  14286. display.input.reset();
  14287. }
  14288. };
  14289. display.detectingSelectAll = setTimeout(poll, 200);
  14290. }
  14291. }
  14292. if (ie && ie_version >= 9) { prepareSelectAllHack(); }
  14293. if (captureRightClick) {
  14294. e_stop(e);
  14295. var mouseup = function () {
  14296. off(window, "mouseup", mouseup);
  14297. setTimeout(rehide, 20);
  14298. };
  14299. on(window, "mouseup", mouseup);
  14300. } else {
  14301. setTimeout(rehide, 50);
  14302. }
  14303. };
  14304. TextareaInput.prototype.readOnlyChanged = function (val) {
  14305. if (!val) { this.reset(); }
  14306. };
  14307. TextareaInput.prototype.setUneditable = function () {};
  14308. TextareaInput.prototype.needsContentAttribute = false;
  14309. function fromTextArea(textarea, options) {
  14310. options = options ? copyObj(options) : {};
  14311. options.value = textarea.value;
  14312. if (!options.tabindex && textarea.tabIndex)
  14313. { options.tabindex = textarea.tabIndex; }
  14314. if (!options.placeholder && textarea.placeholder)
  14315. { options.placeholder = textarea.placeholder; }
  14316. // Set autofocus to true if this textarea is focused, or if it has
  14317. // autofocus and no other element is focused.
  14318. if (options.autofocus == null) {
  14319. var hasFocus = activeElt();
  14320. options.autofocus = hasFocus == textarea ||
  14321. textarea.getAttribute("autofocus") != null && hasFocus == document.body;
  14322. }
  14323. function save() {textarea.value = cm.getValue();}
  14324. var realSubmit;
  14325. if (textarea.form) {
  14326. on(textarea.form, "submit", save);
  14327. // Deplorable hack to make the submit method do the right thing.
  14328. if (!options.leaveSubmitMethodAlone) {
  14329. var form = textarea.form;
  14330. realSubmit = form.submit;
  14331. try {
  14332. var wrappedSubmit = form.submit = function () {
  14333. save();
  14334. form.submit = realSubmit;
  14335. form.submit();
  14336. form.submit = wrappedSubmit;
  14337. };
  14338. } catch(e) {}
  14339. }
  14340. }
  14341. options.finishInit = function (cm) {
  14342. cm.save = save;
  14343. cm.getTextArea = function () { return textarea; };
  14344. cm.toTextArea = function () {
  14345. cm.toTextArea = isNaN; // Prevent this from being ran twice
  14346. save();
  14347. textarea.parentNode.removeChild(cm.getWrapperElement());
  14348. textarea.style.display = "";
  14349. if (textarea.form) {
  14350. off(textarea.form, "submit", save);
  14351. if (typeof textarea.form.submit == "function")
  14352. { textarea.form.submit = realSubmit; }
  14353. }
  14354. };
  14355. };
  14356. textarea.style.display = "none";
  14357. var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
  14358. options);
  14359. return cm
  14360. }
  14361. function addLegacyProps(CodeMirror) {
  14362. CodeMirror.off = off;
  14363. CodeMirror.on = on;
  14364. CodeMirror.wheelEventPixels = wheelEventPixels;
  14365. CodeMirror.Doc = Doc;
  14366. CodeMirror.splitLines = splitLinesAuto;
  14367. CodeMirror.countColumn = countColumn;
  14368. CodeMirror.findColumn = findColumn;
  14369. CodeMirror.isWordChar = isWordCharBasic;
  14370. CodeMirror.Pass = Pass;
  14371. CodeMirror.signal = signal;
  14372. CodeMirror.Line = Line;
  14373. CodeMirror.changeEnd = changeEnd;
  14374. CodeMirror.scrollbarModel = scrollbarModel;
  14375. CodeMirror.Pos = Pos;
  14376. CodeMirror.cmpPos = cmp;
  14377. CodeMirror.modes = modes;
  14378. CodeMirror.mimeModes = mimeModes;
  14379. CodeMirror.resolveMode = resolveMode;
  14380. CodeMirror.getMode = getMode;
  14381. CodeMirror.modeExtensions = modeExtensions;
  14382. CodeMirror.extendMode = extendMode;
  14383. CodeMirror.copyState = copyState;
  14384. CodeMirror.startState = startState;
  14385. CodeMirror.innerMode = innerMode;
  14386. CodeMirror.commands = commands;
  14387. CodeMirror.keyMap = keyMap;
  14388. CodeMirror.keyName = keyName;
  14389. CodeMirror.isModifierKey = isModifierKey;
  14390. CodeMirror.lookupKey = lookupKey;
  14391. CodeMirror.normalizeKeyMap = normalizeKeyMap;
  14392. CodeMirror.StringStream = StringStream;
  14393. CodeMirror.SharedTextMarker = SharedTextMarker;
  14394. CodeMirror.TextMarker = TextMarker;
  14395. CodeMirror.LineWidget = LineWidget;
  14396. CodeMirror.e_preventDefault = e_preventDefault;
  14397. CodeMirror.e_stopPropagation = e_stopPropagation;
  14398. CodeMirror.e_stop = e_stop;
  14399. CodeMirror.addClass = addClass;
  14400. CodeMirror.contains = contains;
  14401. CodeMirror.rmClass = rmClass;
  14402. CodeMirror.keyNames = keyNames;
  14403. }
  14404. // EDITOR CONSTRUCTOR
  14405. defineOptions(CodeMirror$1);
  14406. addEditorMethods(CodeMirror$1);
  14407. // Set up methods on CodeMirror's prototype to redirect to the editor's document.
  14408. var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
  14409. for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
  14410. { CodeMirror$1.prototype[prop] = (function(method) {
  14411. return function() {return method.apply(this.doc, arguments)}
  14412. })(Doc.prototype[prop]); } }
  14413. eventMixin(Doc);
  14414. // INPUT HANDLING
  14415. CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
  14416. // MODE DEFINITION AND QUERYING
  14417. // Extra arguments are stored as the mode's dependencies, which is
  14418. // used by (legacy) mechanisms like loadmode.js to automatically
  14419. // load a mode. (Preferred mechanism is the require/define calls.)
  14420. CodeMirror$1.defineMode = function(name/*, mode, …*/) {
  14421. if (!CodeMirror$1.defaults.mode && name != "null") { CodeMirror$1.defaults.mode = name; }
  14422. defineMode.apply(this, arguments);
  14423. };
  14424. CodeMirror$1.defineMIME = defineMIME;
  14425. // Minimal default mode.
  14426. CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
  14427. CodeMirror$1.defineMIME("text/plain", "null");
  14428. // EXTENSIONS
  14429. CodeMirror$1.defineExtension = function (name, func) {
  14430. CodeMirror$1.prototype[name] = func;
  14431. };
  14432. CodeMirror$1.defineDocExtension = function (name, func) {
  14433. Doc.prototype[name] = func;
  14434. };
  14435. CodeMirror$1.fromTextArea = fromTextArea;
  14436. addLegacyProps(CodeMirror$1);
  14437. CodeMirror$1.version = "5.25.0";
  14438. return CodeMirror$1;
  14439. })));
  14440. /***/ }),
  14441. /* 68 */
  14442. /***/ (function(module, exports) {
  14443. // shim for using process in browser
  14444. var process = module.exports = {};
  14445. // cached from whatever global is present so that test runners that stub it
  14446. // don't break things. But we need to wrap it in a try catch in case it is
  14447. // wrapped in strict mode code which doesn't define any globals. It's inside a
  14448. // function because try/catches deoptimize in certain engines.
  14449. var cachedSetTimeout;
  14450. var cachedClearTimeout;
  14451. function defaultSetTimout() {
  14452. throw new Error('setTimeout has not been defined');
  14453. }
  14454. function defaultClearTimeout () {
  14455. throw new Error('clearTimeout has not been defined');
  14456. }
  14457. (function () {
  14458. try {
  14459. if (typeof setTimeout === 'function') {
  14460. cachedSetTimeout = setTimeout;
  14461. } else {
  14462. cachedSetTimeout = defaultSetTimout;
  14463. }
  14464. } catch (e) {
  14465. cachedSetTimeout = defaultSetTimout;
  14466. }
  14467. try {
  14468. if (typeof clearTimeout === 'function') {
  14469. cachedClearTimeout = clearTimeout;
  14470. } else {
  14471. cachedClearTimeout = defaultClearTimeout;
  14472. }
  14473. } catch (e) {
  14474. cachedClearTimeout = defaultClearTimeout;
  14475. }
  14476. } ())
  14477. function runTimeout(fun) {
  14478. if (cachedSetTimeout === setTimeout) {
  14479. //normal enviroments in sane situations
  14480. return setTimeout(fun, 0);
  14481. }
  14482. // if setTimeout wasn't available but was latter defined
  14483. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  14484. cachedSetTimeout = setTimeout;
  14485. return setTimeout(fun, 0);
  14486. }
  14487. try {
  14488. // when when somebody has screwed with setTimeout but no I.E. maddness
  14489. return cachedSetTimeout(fun, 0);
  14490. } catch(e){
  14491. try {
  14492. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14493. return cachedSetTimeout.call(null, fun, 0);
  14494. } catch(e){
  14495. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  14496. return cachedSetTimeout.call(this, fun, 0);
  14497. }
  14498. }
  14499. }
  14500. function runClearTimeout(marker) {
  14501. if (cachedClearTimeout === clearTimeout) {
  14502. //normal enviroments in sane situations
  14503. return clearTimeout(marker);
  14504. }
  14505. // if clearTimeout wasn't available but was latter defined
  14506. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  14507. cachedClearTimeout = clearTimeout;
  14508. return clearTimeout(marker);
  14509. }
  14510. try {
  14511. // when when somebody has screwed with setTimeout but no I.E. maddness
  14512. return cachedClearTimeout(marker);
  14513. } catch (e){
  14514. try {
  14515. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14516. return cachedClearTimeout.call(null, marker);
  14517. } catch (e){
  14518. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  14519. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  14520. return cachedClearTimeout.call(this, marker);
  14521. }
  14522. }
  14523. }
  14524. var queue = [];
  14525. var draining = false;
  14526. var currentQueue;
  14527. var queueIndex = -1;
  14528. function cleanUpNextTick() {
  14529. if (!draining || !currentQueue) {
  14530. return;
  14531. }
  14532. draining = false;
  14533. if (currentQueue.length) {
  14534. queue = currentQueue.concat(queue);
  14535. } else {
  14536. queueIndex = -1;
  14537. }
  14538. if (queue.length) {
  14539. drainQueue();
  14540. }
  14541. }
  14542. function drainQueue() {
  14543. if (draining) {
  14544. return;
  14545. }
  14546. var timeout = runTimeout(cleanUpNextTick);
  14547. draining = true;
  14548. var len = queue.length;
  14549. while(len) {
  14550. currentQueue = queue;
  14551. queue = [];
  14552. while (++queueIndex < len) {
  14553. if (currentQueue) {
  14554. currentQueue[queueIndex].run();
  14555. }
  14556. }
  14557. queueIndex = -1;
  14558. len = queue.length;
  14559. }
  14560. currentQueue = null;
  14561. draining = false;
  14562. runClearTimeout(timeout);
  14563. }
  14564. process.nextTick = function (fun) {
  14565. var args = new Array(arguments.length - 1);
  14566. if (arguments.length > 1) {
  14567. for (var i = 1; i < arguments.length; i++) {
  14568. args[i - 1] = arguments[i];
  14569. }
  14570. }
  14571. queue.push(new Item(fun, args));
  14572. if (queue.length === 1 && !draining) {
  14573. runTimeout(drainQueue);
  14574. }
  14575. };
  14576. // v8 likes predictible objects
  14577. function Item(fun, array) {
  14578. this.fun = fun;
  14579. this.array = array;
  14580. }
  14581. Item.prototype.run = function () {
  14582. this.fun.apply(null, this.array);
  14583. };
  14584. process.title = 'browser';
  14585. process.browser = true;
  14586. process.env = {};
  14587. process.argv = [];
  14588. process.version = ''; // empty string to avoid regexp issues
  14589. process.versions = {};
  14590. function noop() {}
  14591. process.on = noop;
  14592. process.addListener = noop;
  14593. process.once = noop;
  14594. process.off = noop;
  14595. process.removeListener = noop;
  14596. process.removeAllListeners = noop;
  14597. process.emit = noop;
  14598. process.binding = function (name) {
  14599. throw new Error('process.binding is not supported');
  14600. };
  14601. process.cwd = function () { return '/' };
  14602. process.chdir = function (dir) {
  14603. throw new Error('process.chdir is not supported');
  14604. };
  14605. process.umask = function() { return 0; };
  14606. /***/ }),
  14607. /* 69 */
  14608. /***/ (function(module, exports) {
  14609. module.exports = "data:application/vnd.ms-fontobject;base64,pj8AAIw+AAABAAIAAAAAAAIABgMAAAAAAAABAPQBAAAAAExQAQAAAAAAABAAAAAAAAAAAAEAAAAAAAAAKj2ZxQAAAAAAAAAAAAAAAAAAAAAAABAAaQBjAG8AbgBmAG8AbgB0AAAADABNAGUAZABpAHUAbQAAAIoAVgBlAHIAcwBpAG8AbgAgADEALgAwADsAIAB0AHQAZgBhAHUAdABvAGgAaQBuAHQAIAAoAHYAMAAuADkANAApACAALQBsACAAOAAgAC0AcgAgADUAMAAgAC0ARwAgADIAMAAwACAALQB4ACAAMQA0ACAALQB3ACAAIgBHACIAIAAtAGYAIAAtAHMAAAAQAGkAYwBvAG4AZgBvAG4AdAAAAAAAAAEAAAAQAQAABAAARkZUTXZHMeAAAAEMAAAAHEdERUYAUgAGAAABKAAAACBPUy8yV6halgAAAUgAAABWY21hcL2Ds2kAAAGgAAABqGN2dCANZf5MAAA0OAAAACRmcGdtMPeelQAANFwAAAmWZ2FzcAAAABAAADQwAAAACGdseWZJFyqxAAADSAAALDRoZWFkDijSuQAAL3wAAAA2aGhlYQjeBE8AAC+0AAAAJGhtdHh/CAn8AAAv2AAAAIxsb2Nho5yvDgAAMGQAAABMbWF4cAIkCrwAADCwAAAAIG5hbWUckFeqAAAw0AAAAihwb3N0xwSeMQAAMvgAAAE2cHJlcKW5vmYAAD30AAAAlQAAAAEAAAAAzD2izwAAAADVBMeIAAAAANUEx4gAAQAAAA4AAAAYAAAAAAACAAEAAwAkAAEABAAAAAIAAAABBAYB9AAFAAgCmQLMAAAAjwKZAswAAAHrADMBCQAAAgAGAwAAAAAAAAAAAAEQAAAAAAAAAAAAAABQZkVkAEAAeOd9A4D/gABcA4AA1AAAAAEAAAAAAAAAAAADAAAAAwAAABwAAQAAAAAAogADAAEAAAAcAAQAhgAAAA4ACAACAAYAAAB45hXmH+Y6533//wAAAAAAeOYA5hfmOud9//8AAP+LAAAAABnkGKcAAQAAAAAACgA0AAAAAAAAAAUADwARABIACAAjAB8ABgAHAA4AEwAUABUABAAaABwAHQAgABAACwAMACIACQAWABcAGwAhAA0ACgAYABkAAAEGAAABAAAAAAAAAAECAAAAAgAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUALP/hA7wDGAAWADAAOgBSAF4Bd0uwE1BYQEoCAQANDg0ADmYAAw4BDgNeAAEICAFcEAEJCAoGCV4RAQwGBAYMXgALBAtpDwEIAAYMCAZYAAoHBQIECwoEWRIBDg4NUQANDQoOQhtLsBdQWEBLAgEADQ4NAA5mAAMOAQ4DXgABCAgBXBABCQgKCAkKZhEBDAYEBgxeAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CG0uwGFBYQEwCAQANDg0ADmYAAw4BDgNeAAEICAFcEAEJCAoICQpmEQEMBgQGDARmAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CG0BOAgEADQ4NAA5mAAMOAQ4DAWYAAQgOAQhkEAEJCAoICQpmEQEMBgQGDARmAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CWVlZQChTUzs7MjEXF1NeU15bWDtSO1JLQzc1MToyOhcwFzBRETEYESgVQBMWKwEGKwEiDgIdASE1NCY1NC4CKwEVIQUVFBYUDgIjBiYrASchBysBIiciLgI9ARciBhQWMzI2NCYXBgcOAx4BOwYyNicuAScmJwE1ND4COwEyFh0BARkbGlMSJRwSA5ABChgnHoX+SgKiARUfIw4OHw4gLf5JLB0iFBkZIBMIdwwSEgwNEhKMCAYFCwQCBA8OJUNRUEAkFxYJBQkFBQb+pAUPGhW8HykCHwEMGScaTCkQHAQNIBsSYYg0Fzo6JRcJAQGAgAETGyAOpz8RGhERGhF8GhYTJA4QDQgYGg0jERMUAXfkCxgTDB0m4wAABwAA/ywEAAMsAA8AFwAfAC8ANwA/AE8AzkuwGlBYQDEIBgICAAECAVULBwIFBQBRDgEAAApBCgEEBANRDQkCAwMLQQ8BDAwDUQ0JAgMDCwNCG0uwLlBYQC8OAQALBwIFBAAFWQgGAgIAAQIBVQoBBAQDUQ0JAgMDC0EPAQwMA1ENCQIDAwsDQhtAMQ4BAAsHAgUEAAVZCgEEDAMETQ8BDA0JAgMCDANZCAYCAgEBAk0IBgICAgFRAAECAUVZWUAmQkACAEpHQE9CTz08OTg1NDEwLSolIh0cGRgVFBEQCgcADwIPEA4rASEiBhURFBYzITI2NRE0JgAiJjQ2MhYUAiImNDYyFhQBFAYjISImNRE0NjMhMhYVEiImNDYyFhQCIiY0NjIWFAEjIgYdARQWOwEyNj0BNCYDQP2AUHBwUAKAT3Fx/R4aExMaExMaExMaEwIAJRv/ABslJhoBABslrRoTExoTExoTExoT/sCAGiYlG4AbJSUDLHBQ/YBPcXFPAoBQcPyAExoTExoCrRMaExMa/W0bJSUbAoAaJiUb/UATGhMTGgKtExoTExr+rSYawBslJRvAGyUAAAAAAQA6/7gDlgLqAAkABrMEAAEmKwETBQcTJQUTJyUB6IQBKdcz/vf+9jPXASkC6f7zK9H+2IyMASjRKwAAAwBL/+ADtQMfAAwAGAAgAChAJQADAAUEAwVZAAICAFEAAAAKQQAEBAFRAAEBCwFCExMVFDUSBhQrJQEmIgcBBhcWMyEyNgE0NjIWFREUBiImNRYiJjQ2MhYUA6/+qyNvI/6sIhwdRwKiRzn+DxMaExMaEzQoHBwoHH8CYT8//Z8+MTBhAf8NExMN/uANExMN4BwoHBwoAAAFAEv/3wO1Ax8ACwAXACMAJAAsAEVAQiQBBwYBQAAFAAQGBQRZAAYABwMGB1kAAgIBUQABAQpBAAMDAFEIAQAACwBCAgAsKygnHx4ZGBQRDQwHBgALAgsJDisFISImNwE2MhcBFgYAIgcBBhYzITI2JwECIiY1ETQ2MhYVERQHBjQ2MhYUBiIDUf1eRzkiAVQjbyMBVSI5/nokEf6sERQjAqIjFBH+qxUaExMaEyAwHCgcHCghYj4CYT8//Z8/YQMAHv2eHiIiHgJi/j8TDQEgDRMTDf7gDYMUKBwcKBwAAAIAZv+SA5oCxgALACoAOEA1DAECBQFAAAMABQADBWYABQIABQJkAAAAAgQAAlkABAEBBE0ABAQBUQABBAFFFxkUKRUQBhQrACIOARQeATI+ATQmARQeAjMyPwE2NzIfAR4BBwMxBw4BLwEuAT8BPgEXAm/evW1tvd69bW3+TAoIDAQQXYoHCA0ILQcBB/o1BxYHlwgBCCMHFggCxW293r1tbb3evf6lAQoIB2ieCAEHLAgVCP74OQcBB44HFgglCAEIAAACAH8AIQOBAyMACwAXAGZLsDJQWEAkBwEFAAYABQZmBAECAwEDAgFmAAMAAQMBVQAGBgBSAAAACgZCG0AqBwEFAAYABQZmBAECAwEDAgFmAAAABgMABlcAAwIBA0sAAwMBUQABAwFFWUAKEREREREVFRAIFisAIg4BFB4BMj4BNCYDIzUjFSMRMxUzNTMCaNCxZ2ex0LFnZ4UyxDIyxDIDImex0bFnZ7HRsf4br68Bi7OzAAADAFX/LAOrAywAEgAaADMAcUAOMxsCAwIREAkHBAEAAkBLsBpQWEAdBgQIAwMAAAEDAFkAAQAFAQVWAAICB1EABwcKAkIbQCMABwACAwcCWQYECAMDAAABAwBZAAEFBQFNAAEBBVIABQEFRllAExMTMTAtKyYjHhwTGhMaGDgSCRErJTQ2MhYVFAcWFxQGKwEiJjU3JgM1NDYyFh0BJRUjIgYVERQWMyEyNjURNCYrATU0JiIGFQGrMkYyJwkJEw1ADRMSJ1ZkjmT+QEAkMjIkAqokMjIkQKLmopcjMjIjLxkyPA0TEw1uGQEZlkZkZEaWlpYyI/5VIzIyIwGrIzKWc6KicwAAAAADAA8AWQPxAqcADwAfACcANkAzAAEAAgUBAlkABQAEAwUEWQADAAADTQADAwBRBgEAAwBFAgAlJCEgHRoVEgoHAA8CDwcOKyUhIiY9ATQ2MyEyFh0BFAYTNCYjISIGHQEUFjMhMjY1BCImNDYyFhQC2f5OdKOjdAGydKOjZX9a/k5af39aAbJaf/3UiGBgiGBao3Mgc6OjcyBzowE2Wn5+WiBaf39akWGIYGCIAAAAAAMADwBZA/ECpwAPACAAKAA9QDogEAIEBQFAAAEAAgUBAlkABQAEAwUEWQADAAADTQADAwBRBgEAAwBFAgAmJSIhHRoVEgoHAA8CDwcOKyUhIiY9ATQ2MyEyFh0BFAYTNCYjISIGHQEUFjMhMjY9AQYiJjQ2MhYUAtn+TnSjo3QBsnSjo2Z/Wv5MWX9/WQG0Wn+xiGBgiGFao3Mgc6OjcyBzowE1Wn9/Wh9af39aH7BhiGBgiAAAAAACAAD/XwQAAwQAIQA1AFW1AwEDBAFAS7AaUFhAGgACAwEDAgFmAAMAAQMBVQAEBABRAAAACgRCG0AgAAIDAQMCAWYAAAAEAwAEWQADAgEDTQADAwFRAAEDAUVZtigsETgpBRMrLQEmJzY1NCYnJiMiBgcGFRQWFxY7ATI3MhYxBRY2PwE2JiUOASMmJy4BNTQ3PgEzMhceARUUA+P+8AIEJUVBaYpSmDdYRUJpiAF5ZAECARAbSBcGGAT+TChtO2JMLzJAJ207Y0svMgPjAgJPUVKYN1lGQWmKUpk3WEgD4xcJHQccSe4vMgE/J247Y0swMT8obTtjAAMAdP+gA4wCuAAPABkAHAAmQCMZAQACGxgCAQACQBwaAgE9AAIAAmgAAAEAaAABAV8SFxYDESslJyY0NwE2Mh8BFhQHAQYiATYyHwEWFA8BJwE3FwGAqQYGAXwGEAapBgb+hAYRATASMRJwEhI4xf33OMYDqQURBgF8BgapBhAG/oQGAqkSEnASMRI4xf0y/sYAAAADAGv/6wOVAxUACwAbACsATEuwLlBYQB0AAwAEBQMEWQACAgFRAAEBCkEABQUAUQAAAAsAQhtAGgADAAQFAwRZAAUAAAUAVQACAgFRAAEBCgJCWbc1NTU3FRAGFCsEIi4BND4BMh4BFAYDNCYrASIGHQEUFjsBMjY1FTQmKwEiBh0BFBY7ATI2NQJu3LpsbLrcumxs8QsHSgcLCwdKBwsLB0oHCwsHSgcLFGy63LpsbLrcugIFBwsLB0oICgoIgQgLCwjvBwsLBwAAAAABATIArgLWAlIAHAAnQCQABAMBBE0FAQMGAgIAAQMAWQAEBAFRAAEEAUUTIxMjIxMQBxUrASMVFAYiJj0BIyImNDY7ATU0NjIWHQEzMhYUBiMCu50PFhCdCw8PC50QFg+dCw8PCwFmngoQEAqeDxYPnQsPDwudDxYPAAAAAwBJASsDtQH2AAcADwAXACFAHgQCAgABAQBNBAICAAABUQUDAgEAAUUTExMTExAGFCsSIgYUFjI2NCQiBhQWMjY0JCIGFBYyNjTYUzs7UzwBFVQ7O1Q7ARZUOztUOwH1O1Q7O1Q7O1Q7O1Q7O1Q7O1QAAAAJAED/vgO/Az4ADwAfAC8APwBPAF8AbwB/AI8Ah0CEFAQTAhIFAAUDAgEGAAFZFwoWCBUFBgsJAgcMBgdZGhAZDhgFDA0NDE0aEBkOGAUMDA1REQ8CDQwNRYKAcnBiYFJQQkAyMCIgEhACAIqHgI+Cj3p3cH9yf2pnYG9ib1pXUF9SX0pHQE9CTzo3MD8yPyonIC8iLxoXEB8SHwoHAA8CDxsOKwEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgJZswwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgE8swwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgE8swwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgM+EgyzDBISDLMMEhIMswwSEgyzDBISDLMMEhIMswwS/rgSDLMNERENswwSEgyzDRERDbMMEhIMsw0REQ2zDBL+uBIMsw0REQ2zDBISDLMNERENswwSEgyzDRERDbMMEgALAED/awOgAmwABgAKAA4AEgAWABoAHgAiACYAKgAuAU20BQEPAT9LsApQWEBRAAAEAwQAA2YLCQIHBgEGB14SEAIODw5pAAUYAQQABQRXAAMABgcDBlcKCBcCBAEAEwwBE1cADAAVFAwVVwAWEQEPDhYPVwAUFA1PAA0NCw1CG0uwGFBYQFIAAAQDBAADZgsJAgcGAQYHAWYSEAIODw5pAAUYAQQABQRXAAMABgcDBlcKCBcCBAEAEwwBE1cADAAVFAwVVwAWEQEPDhYPVwAUFA1PAA0NCw1CG0BXAAAEAwQAA2YLCQIHBgEGBwFmEhACDg8OaQAFGAEEAAUEVwADAAYHAwZXCggXAgQBABMMARNXAAwAFRQMFVcAFAANFhQNVwAWDw8WSwAWFg9PEQEPFg9DWVlANgcHAAAuLSwrKikoJyYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsHCgcKCQgABgAGEREZECslESMRIxc3ARUjNSUhESEFMxUjNzMVIzczFSMFMxUjNzMVIzczFSMnMxUjJTMVIwMAQKDAwP2gwAEA/sABQP7AYGCAYGCAQED/AEBAYGBggGBg4EBAAQBAQGwBgP6AwMABwMDAQP7AgEBAQEBggGBAQEBA4GBAYAAAAAsAQP9sA6ECbAAGAAoADgASABYAGgAeACIAJgAqAC4BA7QFAREBP0uwClBYQFwHBQIDBANoFwICAQsKCwEKZg4MAgoVFQpcAAAUExQAE2YGAQQADwgED1cACAAREAgRVwAQAAkSEAlXABINAQsBEgtXABUYARQAFRRYABMWFhNLABMTFlAAFhMWRBtAXQcFAgMEA2gXAgIBCwoLAQpmDgwCChULChVkAAAUExQAE2YGAQQADwgED1cACAAREAgRVwAQAAkSEAlXABINAQsBEgtXABUYARQAFRRYABMWFhNLABMTFlAAFhMWRFlANicnAAAuLSwrJyonKikoJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcABgAGEREZECsBETMRMycHATMVIzczFSM3MxUjBTMVIzczFSM3MxUjJzMVIyUzFSMRFSM1JSERIQLAQKDAwP4gYGCAYGCAQED/AEBAYGBggGBg4EBAAQBAQMABAP7AAUABLP6AAYDAwAFAQEBAQGCAYEBAQEDgYEBg/uDAwED+wAACAFf/1wOpAykACwAXAJRLsB1QWEAmBAECAwUDAgVmBwEFBgMFBmQAAwMBUQABAQpBAAYGAFIAAAALAEIbS7AyUFhAJAQBAgMFAwIFZgcBBQYDBQZkAAEAAwIBA1cABgYAUgAAAAsAQhtAKQQBAgMFAwIFZgcBBQYDBQZkAAEAAwIBA1cABgAABksABgYAUgAABgBGWVlAChERERERFRUQCBYrBCIuATQ+ATIeARQGAyM1IxUjFTMVMzUzAnPmxHJyxObEcnJjqlSqqlSqKXLE5sRycsTmxAFhqqpUqqoAAAMAQAAAA8EC4AAjAEAATABLQEgJAQcALCscGwQFBgJABwEAPgkCAQMACggCBwMAB1kAAwAGBQMGWQAFBAQFTQAFBQRRAAQFBEVDQUlGQUxDTCZlNTVnFREiCxYrATQmKwEwIjEGBwYwIwYHBgcGBwYjKgEjISIGFRMUFjMhMjY1JxQGIyEiJjUDNDYzIToBMzI2NzY3NjczMhYdAiUhMjY0JiMhIgYUFgPBOSe6AgYEAQEFAxIRAwEEFwENAf5gKDggOCgCgCg4QBMN/YANEyATDQGgAQ0BIy8HAgIIBagNE/z/AaANExMN/mANExMCgCg4AQEBAwMRRwwCETkp/mIoODgmAg0TFA4Bng0TIh8ECyIOEw0CASMTGhMTGhMAAAQAX//BA7MDSQAFAAkADQATAA1AChMRDAoJBwUDBCYrLQEHCQEnNwkCEQ0BJQElBwkBJwIJ/ogyAaoBqjMz/lb+VgGqAS7+0v7SAS7+iDIBqgGqM8L3NP7dASM1bAEj/t3+3QHxzs/P/fv4NP7dASM1AAAABAC//8ADQANAABkAIwAzAEMAV0BUISAbGgkIAgEIAQQ7NAIJCAJAAAAABAEABFkFCgMDAQAHCAEHWQAIAAkGCAlZAAYCAgZNAAYGAlIAAgYCRgAAQD84NzEuKSYjIh4dABkAGTUkJAsRKwE1MS4BIyIGBzEVIyIGFREUFjMhMjY1ETQmJTE+ATIWFzEVIQEUBiMhIiY1ETQ2MyEyFhUHNTQmIgYdAQYVFBYyNjU0AwEDlWholQMBGyUlGwIAGyUl/iYCcJxwAv6AAb8TDf5ADRMTDQHADRPgExoTHCMyIwHAh2iRkWeIJRv+gBslJRsBgBomhU5tbU6F/mANExMNAUANExMNkjQNExMNNBIhGSMjGSEABgCJ/6oDswNIAAsAFwAuAEAAUgBZAIFAflcBBQ0uAQ4PAkAABAANBQQNWQAFAAkPBQlZEgEPAA4ADw5ZEAEAAAECAAFZEQECAAMMAgNZAAwKAQcIDAdZCwEIBgYITQsBCAgGUQAGCAZFVFMODAIAU1lUWVJQTUtGQ0A/PTs4NjEvKigmIx4cGhgUEQwXDhcIBQALAgsTDisBISIGFBYzITI2NCYHISIGFBYzITI2NCYDISIGFSMiBhURFBYzITI2NTMyNjURNQEhIiY1ETQ2MzcRFBYzIRQGIzcUBiMhIiY1ETQ2MyEVFBY7ASciJj0BMRcC6P78DBERDAEEDBERDP78DBERDAEEDBERDP6lLUYiLUJGLgGxLkYdLkb++/5PFyMhFiBGLQFbIxfLIxf+ThYjIxYBIUYuV1cVJZEBshEYEREYEZARGBERGBECJUctRi39vi1HRy1HLAGVOf2FJBYCQhYjAf33LEcWJK0WIyMWAkIXI3QtRjo9GVasAAAAAgAA/3UDbgLjACsANwAvQCwkGQ4DBAIAAUAABQEBAAIFAFkDAQIEBAJNAwECAgRRAAQCBEUVFyQuJCoGFCslNC8BNzY1NC8BJiMiDwEnJiMiDwEGFRQfAQcGFRQfARYzMj8BFxYzMj8BNhIUDgEiLgE0PgEyFgKRC2hoCws0Cw8PC2doCg8QCzMLC2dnCwszCxAPCmhnCw8PCzQL3XbK78l2dsnvyqsPC2dnCw8QCjQLC2hoCws0ChAPC2dnCw8QCjQLC2hoCws0CgEI7sp2dsruynZ2AAAABf///ywEAAMsAA8AHABcAGwAwwGuQBuEAQYLGwEHBrpVEAMDB7F+cnBsZ2FdCAIOBEBLsAtQWEBBAA0ABgcNBlkMAQsIAQcDCwdZAAMAEA4DEFkFAQQPAQ4CBA5ZEgEJAAEJAVUACgoAUQAAAApBAAICEVEAERELEUIbS7AMUFhAOwANAAYHDQZZDAELCAEHAwsHWQUEAgMQDwIOAgMOWRIBCQABCQFVAAoKAFEAAAAKQQACAhFRABERCxFCG0uwGlBYQEEADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkSAQkAAQkBVQAKCgBRAAAACkEAAgIRUQAREQsRQhtLsCZQWEA/AAAACg0AClkADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkSAQkAAQkBVQACAhFRABERCxFCG0BGAAAACg0AClkADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkAAgARCQIRWRIBCQEBCU0SAQkJAVEAAQkBRVlZWVlAJsPCqKacmpiXlpWPjYuJiIWDgW5tSkdGREJAODc2NTMxKCcXEhMQKwAuASIOAhQeAjI+AjQnLgEnLgInLgInFgMeAQYHBgcOAyMmJyYnJicmJyYjIgcGIzEiLgEnJj4BNzYzMhcWMzI3MjMyFx4BFx4DFxYXBgcGBw4BFyUWFxYXBgcGFxYHJjU8ATUBIiYnNic0Nz4DJicmJyYnPgIzMhcmIyIjBiMiJyYjIgcGBwYXFjMxMjc2MzIXFhcWFxYXFhcWMzI3Njc2Nz4BJicmNjc2NzY3Nic0MRYVFA4CIwOzkrrOupJNTZK6zrqSTVIHHh8QGQwJCAsXDoJYAgESFAwOCAsWIhgHBQQGCA0ZOxodDhkRBwgKEAgLAiciNyIbKicqCA4KBhINDRELCAsWIBUWCQkbFQkVCQX9FQgKIg4DCRwGBQsaAc2B2jsoDQ4GBggDAQQMRA0SDoDIdHdoExgICw0GHRw1KDFEQBgXHB47ChQWCxQSIhEMCAYHBgsQGUQoFRQLBRsZAwEDAwgNESAJFgQbSXyrXQJNkk1NkrrOupJNTZK6zj8MDwsFHhscGBokC1L+wRMhLBcNJRYXHQ0IHRhCbzFcFAkDAgMSER5DRxYlFxQBCQkiHxgbJxkHCAMJGRIJEzYUDgECCAcGDCkYFiJKTwECAf4vhW5MOAUTCAkRDBEHGg8DA3G6azoIAQ8cLSpLST9FAgMGC0Isa1AeGg8YLBg1HAYePywWFRUICw8dChgUAUtRXqp8SQAAAAEAAv8sA/4DLABLAKRADBoJAgIDQC8CCgkCQEuwGlBYQDcEAQIDAAMCAGYGAQABAwABZA0BBwgJCAcJZgsBCQoICQpkBQEBDAEIBwEIWAAKCgNRAAMDCgpCG0A8BAECAwADAgBmBgEAAQMAAWQNAQcICQgHCWYLAQkKCAkKZAADAgoDTQUBAQwBCAcBCFgAAwMKUQAKAwpFWUAVR0ZCQT49ODcyMRQXFBMVFRMUEg4XKwEnJiIGFB8BIREXFjI2NC8BJiIPAQYUFjI/AREhNzY0JiIPAQYUHwEWMjY0LwEhEScmIgYUHwEWMj8BNjQmIg8BESEHBhQWMj8BNjQD8JwOJxsOTP7RTA4nGw6bDicNnA4bJw5M/tBMDhsnDpwNDZwOJxsOTAEwTA4nGw6bDicOmw4bJw5MAS9MDhsnDpwNAUqbDhsnDkwBNUsOGycOmw4Omw4nGw1M/stMDicbDpsOJw2cDhwmDkz+0UwOGycOmw4Omw4nGw5LAS5MDiYcDpwNJwAEAED/bAPAAuwAIQAtADkAQwBVQFIbGgIHAwFAAAEACgABClkFAQMHAANNCwIMAwAJAQcGAAdZCAEGBAQGTQgBBgYEUQAEBgRFAQBDQj88NTQvLikoIyIeHBcUEQ8MCgcEACEBIQ0OKwEjNTQmIyEiBh0BIyIGFBY7AREUFjMhMjY1ETE1MzI2NCYAIiY1AzQ2MhYVERQWIiY1ETQ2MhYVExQBNDYzITIWHQEhA5yaKR3+iB0pmw4UFA5PKR0CEB0pTg8UFP4AHRQBFR0Usx0UFB0UAf68GhIBIhIa/oYCPWkdKSkdaRQdFP27HSkpHQIuFxQdFP25FA8BdA8UFA/+jA8UFA8BdA8UFA/+jA8CcREaGhE+AAAAAgBB/6wDvwKsAGAAvgNNQBylASUjqgEIEzMBCidDAQwABEC+vWEDJhYBBgI/S7ALUFhArhkYAhcaFRoXFWYWARUUGhUUZAAUHxoUH2QAIh8jHyIjZiQBIyUfIyVkACUTHyUTZAATCB8TCGQACAcfCAdkCQEHJh8HJmQoASYnHyYnZAAnCh8nCmQACgYfCgZkAAYLHwYLZAALBR8LBWQABQQfBQRkAAQDHwQDZAADAB8DAGQADQwODA0OZg8BDhAMDhBkHh0cGwQaISACHyIaH1kCAQIAEhECEAAQVgAMDAsMQhtLsAxQWECuGRgCFxoVGhcVZhYBFRQaFRRkABQfGhQfZAAiHyMfIiNmJAEjJR8jJWQAJRMfJRNkABMIHxMIZAAIBx8IB2QJAQcmHwcmZCgBJicfJidkACcKHycKZAAKBh8KBmQABgsfBgtkAAsFHwsFZAAFBB8FBGQABAMfBANkAAMAHwMAZAANDA4MDQ5mEA8CDhEMDhFkHh0cGwQaISACHyIaH1kCAQIAEgERABFWAAwMCwxCG0uwFlBYQK4ZGAIXGhUaFxVmFgEVFBoVFGQAFB8aFB9kACIfIx8iI2YkASMlHyMlZAAlEx8lE2QAEwgfEwhkAAgHHwgHZAkBByYfByZkKAEmJx8mJ2QAJwofJwpkAAoGHwoGZAAGCx8GC2QACwUfCwVkAAUEHwUEZAAEAx8EA2QAAwAfAwBkAA0MDgwNDmYPAQ4QDA4QZB4dHBsEGiEgAh8iGh9ZAgECABIRAhAAEFYADAwLDEIbQLoZGAIXGhUaFxVmFgEVFBoVFGQAFB8aFB9kACIfIx8iI2YkASMlHyMlZAAlEx8lE2QAEwgfEwhkAAgHHwgHZAkBByYfByZkKAEmJx8mJ2QAJwofJwpkAAoGHwoGZAAGCx8GC2QACwUfCwVkAAUEHwUEZAAEAx8EA2QAAwAfAwBkAAwADQAMDWYADQ4ADQ5kDwEOEAAOEGQeHRwbBBohIAIfIhofWQIBAgAMEABNAgECAAAQUhIRAhAAEEZZWVlAS7y6trWxr6ino6KhoJ2cmpmYl5WUjYyLiomIhoWEg4KAfnx6eXV0c3Jwb2ZlW1lYV1ZVVFJQT0xLSEc9PDY1MS8ULBQUExIRESEpFyslBiciJyImIyYnIicmJyImJyYnIicmJzAjMSYnMCcmJy4BMSY1MzI2LwEmIg8BBhY7ARQXFBYzFhcWFxYXMhYxFhcWFRYXHgEzFhcWMxYXFjMUFjMyFzIWMxYzMjc+AS4BNzQnMCYjJicwJjEmJzAmIyYnIiYjJicuASMuASMiLgEjIiYjJiMwJiMwIjEiBw4BHgE3NjMWFzIWMxYXMhcWFzIWMxYXMBYzFhcUMDEWFSMiBh8BFjI/ATYmKwE5AQKkS1wMDAIGAQ0FAQoLBgIGAQwHAQMNCQEkHQEICQECP0IDAwJvAgUBcAECA0NCAQEDCwQBCA0BASYvAgwQAQUBCg4KAggOCwQEAgQRAQUBFRF1Yg8HFiXFQgEBBQsCOlMDAQsPAQcCCBABCQMBBAICBgcCAggDDREEAQF2YQ8HFiUPS1sNDAIFAQsJAgcLCAEEAQwKAQE/LUFCAwMCbwIFAXABAgNDPTYCAQECAQIDAgIBBAMCBgUUHgEJCgEDUGYFA6oCAqoDBXdiAQIFDQYBCg4CJxoBAQYHAQIEBQQDAwMBAQMBAkYLJSAG5HdiAwcPAkgkAgUFAwMDAQIBAQEBAgEBRgslHwcLNQEBAQECAgMCAgQEARw2AVFoBQKrAgKrAgUABgDo/84FAQJeAAAAUgBgAHAAgACQAMlAKEoREAMJBHBpaGEABQgJgHl4cQQKC5CJiIEiBQYDXFhMNDMOBgUGBUBLsBxQWEA1AAEABAkBBFkACQAICwkIWQALAAoNCwpZAA0DBg1NAAMMAQYFAwZZBw4CBQUAUQIBAAALAEIbQDwAAQAECQEEWQAJAAgLCQhZAAsACg0LClkADQMGDU0AAwwBBgUDBlkHDgIFAAAFTQcOAgUFAFECAQAFAEVZQCABAY6LhoN+e3ZzbmtmY15dVFMBUgFSRUM7OjApLicPECsJAR4DBgcjIi4DJzQRMTQ+AzchMh4DFxwCNQ4EBzAqBCsBLgE3MTQ+AzczETQuAycwISIOAwcGFR4EFyUjDgIHMBwBMRcyNzYDFAYrASImNTE0NjsBMhYVFxQGKwEiJjUxNDY7ATIWFQcUBisBIiY1MTQ2OwEyFhUFAPzsAgMIAwYJlwQNJBwZAwINFSscAVUEDSMcGQIBAxQdOSUEBggJBgICDwEBAgoPIBRRAgkOHBL+tAMJGBIRAgEBAQkOHRQBhkYECxYBCAUdJTgPCt0KDw8K3QoPAQ8L3AsPDwvcCw+ADwtbCxAQC1sLDwGm/lMBAgkKDQcDEBkzIU0BQAQQKSEfBAMSGjYjEqiYAQQPLCo2FgQpQgMKGxYVBAFGAwsdFhUCAgoRJhnLtwMMHhcWAnEBBRoRIB8BHSUBcwoPDwoLDw8LlAsPDwsLDw8LlQsQEAsLEBALAAMAPwAFA8ECUwAPAB8ALwBCQD8PCAcABAABHxgXEAQCAy8oJyAEBAUDQAABAAADAQBZAAMAAgUDAlkABQQEBU0ABQUEUQAEBQRFNTU1NTUyBhQrARQGIyEiJjUxNDYzITIWHQEUBiMhIiY1MTQ2MyEyFh0BFAYjISImNTE0NjMhMhYVA8AYEvzUEhgYEgMsEhgYEvzUEhgYEgMsEhgYEvzUEhgYEgMsEhgCKBEZGRESGBgS/BEZGRERGRkR/BIYGBIRGRkRAAAABwCF//0DewMDAAcACwAPABMAFwAnACsAyLYGAQIJCAFAS7AbUFhARg4BAQABaAAJCAoKCV4AAAACAwACVwADAAQFAwRXAAUABgcFBlcABwAICQcIVw8BCgANDAoNWAAMCwsMSwAMDAtRAAsMC0UbQEcOAQEAAWgACQgKCAkKZgAAAAIDAAJXAAMABAUDBFcABQAGBwUGVwAHAAgJBwhXDwEKAA0MCg1YAAwLCwxLAAwMC1EACwwLRVlAJRoYAAArKikoIh8YJxonFxYVFBMSERAPDg0MCwoJCAAHAAcTEA8rARMHAyEDJxMXIRUhFSEVIRUhFSEVIRUhBSEiBh8BHgEzITI2PwE2JgUjNTMDJDI5Lf4gLTkyYwGC/n4Bgv5+AYL+fgGC/n4CK/0sCgoDUgMSCgIUChIDUgMK/u3CwgMC/lEHAYL+fgcBr2AwMTAwMTAwMQ0J9AoNDQr0CQ1gMAAAAAAHAAD/gAQAA4AADwAXAB8ALwA3AD8ATwBaQFcOAQALBwIFBAAFWQANAwQNTQ8MCgMECQEDAgQDWQgGAgIBAQJNCAYCAgIBUQABAgFFQkACAEpHQE9CTz08OTg1NDEwLSolIh0cGRgVFBEQCgcADwIPEA4rASEiBhURFBYzITI2NRE0JgAiJjQ2MhYUAiImNDYyFhQBFAYjISImNRE0NjMhMhYVEiImNDYyFhQCIiY0NjIWFAUjIgYdARQWOwEyNj0BNCYDQP2AUHBwUAKAT3Fx/R4aExMaExMaExMaEwIAJRv/ABslJhoBABslrRoTExoTExoTExoT/sCAGiYmGoAbJSUDgHBQ/YBPcXFPAoBQcPyAExoTExoCrRMaExMa/W0bJSUbAoAaJiUb/UATGhMTGgKtExoTExoTJhrAGiYlG8AbJQADAEQAFwO8AukABwAoACwAPUA6AwECAAcGAgdXCAEABAEATQAGBQEEAQYEWQgBAAABTwABAAFDAQAsKyopJyMeGRMQDwwFBAAHAQcJDislIg4BByEuASUCEzQmIwYhMSAnIgYVFgMUFjc2Fjc2Nz4BFxY3NhcWNichESECAyRGOgcBUgVoAX4DAxkiLf6t/q0zHBkBARccI5AjGRc4dzk/V14mIRo//QgC+JEYOig1RQwBCQEHIhoBARYc5/7HHBkBAQEBARAoCiElAgICAhpaAcgAAAUApv/WA1oDKgANABMAJQAxAD0A1EAKDgECBA0BBQICQEuwHVBYQDAAAgAFBgIFWQsBBgAHCAYHWQwBCAAJAwgJWQAEBABRAAAACkEKAQMDAVEAAQELAUIbS7AyUFhALgAAAAQCAARZAAIABQYCBVkLAQYABwgGB1kMAQgACQMICVkKAQMDAVEAAQELAUIbQDQAAAAEAgAEWQACAAUGAgVZCwEGAAcIBgdZDAEIAAkDCAlZCgEDAQEDTQoBAwMBUQABAwFFWVlAHzQyKCYWFDo3Mj00PS4rJjEoMSIgHRsUJRYlJTUgDRErASEiBhURFBYzITI2NREnFyMiJjUTISImNRE0NjMhFRQWOwERFAYDISIGFBYzITI2NCYHISIGFBYzITI2NCYChf6MLD4+LAHeLD7Wf2gJDmz+IhMbGxMBNjEigxtY/qwMEhIMAVQMEhIM/qwMEhIMAVQMEhIDKT4s/YIsPj4sAhSBfw0K/aUbEwJ+Ext/IjH+JhMbAXESGRERGRKcEhkRERkSAAEAAAABAADFmT0qXw889QALBAAAAAAA1QTHiAAAAADVBMeI////LAUBA4AAAAAIAAIAAAAAAAAAAQAAA4D/LABcBQH//wAABQEAAQAAAAAAAAAAAAAAAAAAACEEAAAAAAAAAAFVAAAD6QAsBAAAAAQAADoEAABLBAAASwQAAGYEAAB/BAAAVQQAAA8EAAAPBAAAAAQAAHQEAABrBAABMgQAAEkEAABABAAAQAQAAEAEAABXBAAAQAQAAF8EAAC/BAAAiQQAAAAEAAAABAAAAgQAAEAEAABBBQEA6AQAAD8AhQAAAEQApgAAAAAAAAAAATwCGgI4AoQC9ANWA7AENASMBOgFZAWuBhQGUgaMB4gIfAlKCboKSgqECw4Lzgw6DigO6g92EhYTMhOWFEgU6hVUFhoAAQAAACUAxAALAAAAAAACAFIAYABsAAABNQmWAAAAAAAAAAwAlgABAAAAAAABAAgAAAABAAAAAAACAAYACAABAAAAAAADACMADgABAAAAAAAEAAgAMQABAAAAAAAFAEUAOQABAAAAAAAGAAgAfgADAAEECQABABAAhgADAAEECQACAAwAlgADAAEECQADAEYAogADAAEECQAEABAA6AADAAEECQAFAIoA+AADAAEECQAGABABgmljb25mb250TWVkaXVtRm9udEZvcmdlIDIuMCA6IGljb25mb250IDogMS00LTIwMTdpY29uZm9udFZlcnNpb24gMS4wOyB0dGZhdXRvaGludCAodjAuOTQpIC1sIDggLXIgNTAgLUcgMjAwIC14IDE0IC13ICJHIiAtZiAtc2ljb25mb250AGkAYwBvAG4AZgBvAG4AdABNAGUAZABpAHUAbQBGAG8AbgB0AEYAbwByAGcAZQAgADIALgAwACAAOgAgAGkAYwBvAG4AZgBvAG4AdAAgADoAIAAxAC0ANAAtADIAMAAxADcAaQBjAG8AbgBmAG8AbgB0AFYAZQByAHMAaQBvAG4AIAAxAC4AMAA7ACAAdAB0AGYAYQB1AHQAbwBoAGkAbgB0ACAAKAB2ADAALgA5ADQAKQAgAC0AbAAgADgAIAAtAHIAIAA1ADAAIAAtAEcAIAAyADAAMAAgAC0AeAAgADEANAAgAC0AdwAgACIARwAiACAALQBmACAALQBzAGkAYwBvAG4AZgBvAG4AdAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUAAAABAAIAWwECAQMBBAEFAQYASwEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETARQBFQEWARcBGAEZARoBGwEcAR0BHgEfASABIQlzd2l0Y2hvZmYEaWNvbgh3YXJuZmlsbAR3YXJuAm9rBGxvY2sDb2ZmAm9uBnNlYXJjaARlZGl0BGluZm8FYWRkLXMEbW9yZQRncmlkCG1vdmVkb3duBm1vdmV1cANhZGQGZm9sZGVyBWdyb3VwBWxvY2syBWZpbGVzC3RpbWVzY2lyY2xlBWVhcnRoBG1vdmUGZGVsZXRlB3JlZnJlc2gDZG9jBGxpbmUIZmlsZS1ib3gIc3dpdGNob24Jc3lzc2VydmVyBGZpbGUAAAABAAH//wAPAAAAAAAAAAAAAAAAAAAAAAAyADIDGP/hA4D/LAMY/+EDgP8ssAAssCBgZi2wASwgZCCwwFCwBCZasARFW1ghIyEbilggsFBQWCGwQFkbILA4UFghsDhZWSCwCkVhZLAoUFghsApFILAwUFghsDBZGyCwwFBYIGYgiophILAKUFhgGyCwIFBYIbAKYBsgsDZQWCGwNmAbYFlZWRuwACtZWSOwAFBYZVlZLbACLCBFILAEJWFkILAFQ1BYsAUjQrAGI0IbISFZsAFgLbADLCMhIyEgZLEFYkIgsAYjQrIKAAIqISCwBkMgiiCKsAArsTAFJYpRWGBQG2FSWVgjWSEgsEBTWLAAKxshsEBZI7AAUFhlWS2wBCywCCNCsAcjQrAAI0KwAEOwB0NRWLAIQyuyAAEAQ2BCsBZlHFktsAUssABDIEUgsAJFY7ABRWJgRC2wBiywAEMgRSCwACsjsQQEJWAgRYojYSBkILAgUFghsAAbsDBQWLAgG7BAWVkjsABQWGVZsAMlI2FERC2wByyxBQVFsAFhRC2wCCywAWAgILAKQ0qwAFBYILAKI0JZsAtDSrAAUlggsAsjQlktsAksILgEAGIguAQAY4ojYbAMQ2AgimAgsAwjQiMtsAosS1RYsQcBRFkksA1lI3gtsAssS1FYS1NYsQcBRFkbIVkksBNlI3gtsAwssQANQ1VYsQ0NQ7ABYUKwCStZsABDsAIlQrIAAQBDYEKxCgIlQrELAiVCsAEWIyCwAyVQWLAAQ7AEJUKKiiCKI2GwCCohI7ABYSCKI2GwCCohG7AAQ7ACJUKwAiVhsAgqIVmwCkNHsAtDR2CwgGIgsAJFY7ABRWJgsQAAEyNEsAFDsAA+sgEBAUNgQi2wDSyxAAVFVFgAsA0jQiBgsAFhtQ4OAQAMAEJCimCxDAQrsGsrGyJZLbAOLLEADSstsA8ssQENKy2wECyxAg0rLbARLLEDDSstsBIssQQNKy2wEyyxBQ0rLbAULLEGDSstsBUssQcNKy2wFiyxCA0rLbAXLLEJDSstsBgssAcrsQAFRVRYALANI0IgYLABYbUODgEADABCQopgsQwEK7BrKxsiWS2wGSyxABgrLbAaLLEBGCstsBsssQIYKy2wHCyxAxgrLbAdLLEEGCstsB4ssQUYKy2wHyyxBhgrLbAgLLEHGCstsCEssQgYKy2wIiyxCRgrLbAjLCBgsA5gIEMjsAFgQ7ACJbACJVFYIyA8sAFgI7ASZRwbISFZLbAkLLAjK7AjKi2wJSwgIEcgILACRWOwAUViYCNhOCMgilVYIEcgILACRWOwAUViYCNhOBshWS2wJiyxAAVFVFgAsAEWsCUqsAEVMBsiWS2wJyywByuxAAVFVFgAsAEWsCUqsAEVMBsiWS2wKCwgNbABYC2wKSwAsANFY7ABRWKwACuwAkVjsAFFYrAAK7AAFrQAAAAAAEQ+IzixKAEVKi2wKiwgPCBHILACRWOwAUViYLAAQ2E4LbArLC4XPC2wLCwgPCBHILACRWOwAUViYLAAQ2GwAUNjOC2wLSyxAgAWJSAuIEewACNCsAIlSYqKRyNHI2EgWGIbIVmwASNCsiwBARUUKi2wLiywABawBCWwBCVHI0cjYbAGRStlii4jICA8ijgtsC8ssAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgsAlDIIojRyNHI2EjRmCwBEOwgGJgILAAKyCKimEgsAJDYGQjsANDYWRQWLACQ2EbsANDYFmwAyWwgGJhIyAgsAQmI0ZhOBsjsAlDRrACJbAJQ0cjRyNhYCCwBEOwgGJgIyCwACsjsARDYLAAK7AFJWGwBSWwgGKwBCZhILAEJWBkI7ADJWBkUFghGyMhWSMgILAEJiNGYThZLbAwLLAAFiAgILAFJiAuRyNHI2EjPDgtsDEssAAWILAJI0IgICBGI0ewACsjYTgtsDIssAAWsAMlsAIlRyNHI2GwAFRYLiA8IyEbsAIlsAIlRyNHI2EgsAUlsAQlRyNHI2GwBiWwBSVJsAIlYbABRWMjIFhiGyFZY7ABRWJgIy4jICA8ijgjIVktsDMssAAWILAJQyAuRyNHI2EgYLAgYGawgGIjICA8ijgtsDQsIyAuRrACJUZSWCA8WS6xJAEUKy2wNSwjIC5GsAIlRlBYIDxZLrEkARQrLbA2LCMgLkawAiVGUlggPFkjIC5GsAIlRlBYIDxZLrEkARQrLbA3LLAuKyMgLkawAiVGUlggPFkusSQBFCstsDgssC8riiAgPLAEI0KKOCMgLkawAiVGUlggPFkusSQBFCuwBEMusCQrLbA5LLAAFrAEJbAEJiAuRyNHI2GwBkUrIyA8IC4jOLEkARQrLbA6LLEJBCVCsAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgR7AEQ7CAYmAgsAArIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbCAYmGwAiVGYTgjIDwjOBshICBGI0ewACsjYTghWbEkARQrLbA7LLAuKy6xJAEUKy2wPCywLyshIyAgPLAEI0IjOLEkARQrsARDLrAkKy2wPSywABUgR7AAI0KyAAEBFRQTLrAqKi2wPiywABUgR7AAI0KyAAEBFRQTLrAqKi2wPyyxAAEUE7ArKi2wQCywLSotsEEssAAWRSMgLiBGiiNhOLEkARQrLbBCLLAJI0KwQSstsEMssgAAOistsEQssgABOistsEUssgEAOistsEYssgEBOistsEcssgAAOystsEgssgABOystsEkssgEAOystsEossgEBOystsEsssgAANystsEwssgABNystsE0ssgEANystsE4ssgEBNystsE8ssgAAOSstsFAssgABOSstsFEssgEAOSstsFIssgEBOSstsFMssgAAPCstsFQssgABPCstsFUssgEAPCstsFYssgEBPCstsFcssgAAOCstsFgssgABOCstsFkssgEAOCstsFossgEBOCstsFsssDArLrEkARQrLbBcLLAwK7A0Ky2wXSywMCuwNSstsF4ssAAWsDArsDYrLbBfLLAxKy6xJAEUKy2wYCywMSuwNCstsGEssDErsDUrLbBiLLAxK7A2Ky2wYyywMisusSQBFCstsGQssDIrsDQrLbBlLLAyK7A1Ky2wZiywMiuwNistsGcssDMrLrEkARQrLbBoLLAzK7A0Ky2waSywMyuwNSstsGossDMrsDYrLbBrLCuwCGWwAyRQeLABFTAtAABLuADIUlixAQGOWbkIAAgAYyCwASNEILADI3CwDkUgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbABRWMjYrACI0SzCgkFBCuzCgsFBCuzDg8FBCtZsgQoCUVSRLMKDQYEK7EGAUSxJAGIUViwQIhYsQYDRLEmAYhRWLgEAIhYsQYBRFlZWVm4Af+FsASNsQUARAAAAA=="
  14610. /***/ }),
  14611. /* 70 */
  14612. /***/ (function(module, exports, __webpack_require__) {
  14613. "use strict";
  14614. exports.version = [3, 2, 0, 4603];
  14615. /***/ }),
  14616. /* 71 */
  14617. /***/ (function(module, exports, __webpack_require__) {
  14618. "use strict";
  14619. /**
  14620. * kw
  14621. * @author oldj
  14622. * @blog http://oldj.net
  14623. */
  14624. function kw2re(kw) {
  14625. // 模糊搜索
  14626. var r = void 0;
  14627. var m = void 0;
  14628. var flag = [];
  14629. if (kw === '/') {
  14630. return;
  14631. } else if (m = kw.match(/^\/([^\/]+)\/?(\w*)$/)) {
  14632. if (m[2].indexOf('i') > -1) {
  14633. flag.push('i');
  14634. }
  14635. // if (m[2].indexOf('g') > -1) {
  14636. flag.push('g');
  14637. // }
  14638. try {
  14639. r = new RegExp(m[1], flag.join(''));
  14640. } catch (e) {}
  14641. } else if (kw.indexOf('*') > -1) {
  14642. try {
  14643. r = new RegExp(kw.replace(/\*/g, '.*'), 'ig');
  14644. } catch (e) {}
  14645. }
  14646. return r;
  14647. }
  14648. exports.findPositions = function (kw, code) {
  14649. if (!kw || kw === '/') return [];
  14650. var r = kw2re(kw);
  14651. if (!r) {
  14652. try {
  14653. r = new RegExp(kw.replace(/([\.\?\*\+\^\$\(\)\-\[\]\{\}])/g, '\\$1'), 'ig');
  14654. } catch (e) {
  14655. console.log(e);
  14656. return [];
  14657. }
  14658. }
  14659. var indexes = [];
  14660. var lines = code.split('\n');
  14661. lines.map(function (ln, idx) {
  14662. var match = void 0;
  14663. var max_loop = 30;
  14664. while (match = r.exec(ln)) {
  14665. indexes.push([{ line: idx, ch: match.index }, { line: idx, ch: match.index + match[0].length }]);
  14666. max_loop--;
  14667. if (max_loop < 0) break;
  14668. }
  14669. });
  14670. return indexes;
  14671. };
  14672. exports.kw2re = kw2re;
  14673. /***/ }),
  14674. /* 72 */
  14675. /***/ (function(module, exports, __webpack_require__) {
  14676. "use strict";
  14677. /**
  14678. * @author oldj
  14679. * @blog https://oldj.net
  14680. */
  14681. /**
  14682. * 将一个 node list 转为数组
  14683. * @param list {NodeList}
  14684. * 参见:http://www.planabc.net/2010/01/06/arguments_to_array/
  14685. */
  14686. module.exports = (list) => {
  14687. let arr
  14688. let length
  14689. try {
  14690. // works in every browser except IE
  14691. arr = [].slice.call(list);
  14692. return arr;
  14693. } catch(err) {
  14694. // slower, but works in IE
  14695. arr = [];
  14696. length = list.length;
  14697. for (let i = 0; i < length; i++) {
  14698. arr.push(list[i]);
  14699. }
  14700. return arr;
  14701. }
  14702. }
  14703. /***/ }),
  14704. /* 73 */
  14705. /***/ (function(module, exports, __webpack_require__) {
  14706. "use strict";
  14707. /**
  14708. * Copyright (c) 2013-present, Facebook, Inc.
  14709. *
  14710. * Licensed under the Apache License, Version 2.0 (the "License");
  14711. * you may not use this file except in compliance with the License.
  14712. * You may obtain a copy of the License at
  14713. *
  14714. * http://www.apache.org/licenses/LICENSE-2.0
  14715. *
  14716. * Unless required by applicable law or agreed to in writing, software
  14717. * distributed under the License is distributed on an "AS IS" BASIS,
  14718. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14719. * See the License for the specific language governing permissions and
  14720. * limitations under the License.
  14721. *
  14722. * @typechecks
  14723. */
  14724. var emptyFunction = __webpack_require__(10);
  14725. /**
  14726. * Upstream version of event listener. Does not take into account specific
  14727. * nature of platform.
  14728. */
  14729. var EventListener = {
  14730. /**
  14731. * Listen to DOM events during the bubble phase.
  14732. *
  14733. * @param {DOMEventTarget} target DOM element to register listener on.
  14734. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14735. * @param {function} callback Callback function.
  14736. * @return {object} Object with a `remove` method.
  14737. */
  14738. listen: function listen(target, eventType, callback) {
  14739. if (target.addEventListener) {
  14740. target.addEventListener(eventType, callback, false);
  14741. return {
  14742. remove: function remove() {
  14743. target.removeEventListener(eventType, callback, false);
  14744. }
  14745. };
  14746. } else if (target.attachEvent) {
  14747. target.attachEvent('on' + eventType, callback);
  14748. return {
  14749. remove: function remove() {
  14750. target.detachEvent('on' + eventType, callback);
  14751. }
  14752. };
  14753. }
  14754. },
  14755. /**
  14756. * Listen to DOM events during the capture phase.
  14757. *
  14758. * @param {DOMEventTarget} target DOM element to register listener on.
  14759. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14760. * @param {function} callback Callback function.
  14761. * @return {object} Object with a `remove` method.
  14762. */
  14763. capture: function capture(target, eventType, callback) {
  14764. if (target.addEventListener) {
  14765. target.addEventListener(eventType, callback, true);
  14766. return {
  14767. remove: function remove() {
  14768. target.removeEventListener(eventType, callback, true);
  14769. }
  14770. };
  14771. } else {
  14772. if (false) {
  14773. console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
  14774. }
  14775. return {
  14776. remove: emptyFunction
  14777. };
  14778. }
  14779. },
  14780. registerDefault: function registerDefault() {}
  14781. };
  14782. module.exports = EventListener;
  14783. /***/ }),
  14784. /* 74 */
  14785. /***/ (function(module, exports, __webpack_require__) {
  14786. "use strict";
  14787. /**
  14788. * Copyright (c) 2013-present, Facebook, Inc.
  14789. * All rights reserved.
  14790. *
  14791. * This source code is licensed under the BSD-style license found in the
  14792. * LICENSE file in the root directory of this source tree. An additional grant
  14793. * of patent rights can be found in the PATENTS file in the same directory.
  14794. *
  14795. */
  14796. /**
  14797. * @param {DOMElement} node input/textarea to focus
  14798. */
  14799. function focusNode(node) {
  14800. // IE8 can throw "Can't move focus to the control because it is invisible,
  14801. // not enabled, or of a type that does not accept the focus." for all kinds of
  14802. // reasons that are too expensive and fragile to test.
  14803. try {
  14804. node.focus();
  14805. } catch (e) {}
  14806. }
  14807. module.exports = focusNode;
  14808. /***/ }),
  14809. /* 75 */
  14810. /***/ (function(module, exports, __webpack_require__) {
  14811. "use strict";
  14812. /**
  14813. * Copyright (c) 2013-present, Facebook, Inc.
  14814. * All rights reserved.
  14815. *
  14816. * This source code is licensed under the BSD-style license found in the
  14817. * LICENSE file in the root directory of this source tree. An additional grant
  14818. * of patent rights can be found in the PATENTS file in the same directory.
  14819. *
  14820. * @typechecks
  14821. */
  14822. /* eslint-disable fb-www/typeof-undefined */
  14823. /**
  14824. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  14825. * not safe to call document.activeElement if there is nothing focused.
  14826. *
  14827. * The activeElement will be null only if the document or document body is not
  14828. * yet defined.
  14829. *
  14830. * @param {?DOMDocument} doc Defaults to current document.
  14831. * @return {?DOMElement}
  14832. */
  14833. function getActiveElement(doc) /*?DOMElement*/{
  14834. doc = doc || (typeof document !== 'undefined' ? document : undefined);
  14835. if (typeof doc === 'undefined') {
  14836. return null;
  14837. }
  14838. try {
  14839. return doc.activeElement || doc.body;
  14840. } catch (e) {
  14841. return doc.body;
  14842. }
  14843. }
  14844. module.exports = getActiveElement;
  14845. /***/ }),
  14846. /* 76 */
  14847. /***/ (function(module, exports, __webpack_require__) {
  14848. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**!
  14849. * Sortable
  14850. * @author RubaXa <[email protected]>
  14851. * @license MIT
  14852. */
  14853. (function sortableModule(factory) {
  14854. "use strict";
  14855. if (true) {
  14856. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14857. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14858. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14859. __WEBPACK_AMD_DEFINE_FACTORY__),
  14860. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  14861. }
  14862. else if (typeof module != "undefined" && typeof module.exports != "undefined") {
  14863. module.exports = factory();
  14864. }
  14865. else {
  14866. /* jshint sub:true */
  14867. window["Sortable"] = factory();
  14868. }
  14869. })(function sortableFactory() {
  14870. "use strict";
  14871. if (typeof window == "undefined" || !window.document) {
  14872. return function sortableError() {
  14873. throw new Error("Sortable.js requires a window with a document");
  14874. };
  14875. }
  14876. var dragEl,
  14877. parentEl,
  14878. ghostEl,
  14879. cloneEl,
  14880. rootEl,
  14881. nextEl,
  14882. lastDownEl,
  14883. scrollEl,
  14884. scrollParentEl,
  14885. scrollCustomFn,
  14886. lastEl,
  14887. lastCSS,
  14888. lastParentCSS,
  14889. oldIndex,
  14890. newIndex,
  14891. activeGroup,
  14892. putSortable,
  14893. autoScroll = {},
  14894. tapEvt,
  14895. touchEvt,
  14896. moved,
  14897. /** @const */
  14898. R_SPACE = /\s+/g,
  14899. R_FLOAT = /left|right|inline/,
  14900. expando = 'Sortable' + (new Date).getTime(),
  14901. win = window,
  14902. document = win.document,
  14903. parseInt = win.parseInt,
  14904. $ = win.jQuery || win.Zepto,
  14905. Polymer = win.Polymer,
  14906. captureMode = false,
  14907. supportDraggable = !!('draggable' in document.createElement('div')),
  14908. supportCssPointerEvents = (function (el) {
  14909. // false when IE11
  14910. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  14911. return false;
  14912. }
  14913. el = document.createElement('x');
  14914. el.style.cssText = 'pointer-events:auto';
  14915. return el.style.pointerEvents === 'auto';
  14916. })(),
  14917. _silent = false,
  14918. abs = Math.abs,
  14919. min = Math.min,
  14920. savedInputChecked = [],
  14921. touchDragOverListeners = [],
  14922. _autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  14923. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  14924. if (rootEl && options.scroll) {
  14925. var _this = rootEl[expando],
  14926. el,
  14927. rect,
  14928. sens = options.scrollSensitivity,
  14929. speed = options.scrollSpeed,
  14930. x = evt.clientX,
  14931. y = evt.clientY,
  14932. winWidth = window.innerWidth,
  14933. winHeight = window.innerHeight,
  14934. vx,
  14935. vy,
  14936. scrollOffsetX,
  14937. scrollOffsetY
  14938. ;
  14939. // Delect scrollEl
  14940. if (scrollParentEl !== rootEl) {
  14941. scrollEl = options.scroll;
  14942. scrollParentEl = rootEl;
  14943. scrollCustomFn = options.scrollFn;
  14944. if (scrollEl === true) {
  14945. scrollEl = rootEl;
  14946. do {
  14947. if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
  14948. (scrollEl.offsetHeight < scrollEl.scrollHeight)
  14949. ) {
  14950. break;
  14951. }
  14952. /* jshint boss:true */
  14953. } while (scrollEl = scrollEl.parentNode);
  14954. }
  14955. }
  14956. if (scrollEl) {
  14957. el = scrollEl;
  14958. rect = scrollEl.getBoundingClientRect();
  14959. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  14960. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  14961. }
  14962. if (!(vx || vy)) {
  14963. vx = (winWidth - x <= sens) - (x <= sens);
  14964. vy = (winHeight - y <= sens) - (y <= sens);
  14965. /* jshint expr:true */
  14966. (vx || vy) && (el = win);
  14967. }
  14968. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  14969. autoScroll.el = el;
  14970. autoScroll.vx = vx;
  14971. autoScroll.vy = vy;
  14972. clearInterval(autoScroll.pid);
  14973. if (el) {
  14974. autoScroll.pid = setInterval(function () {
  14975. scrollOffsetY = vy ? vy * speed : 0;
  14976. scrollOffsetX = vx ? vx * speed : 0;
  14977. if ('function' === typeof(scrollCustomFn)) {
  14978. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  14979. }
  14980. if (el === win) {
  14981. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  14982. } else {
  14983. el.scrollTop += scrollOffsetY;
  14984. el.scrollLeft += scrollOffsetX;
  14985. }
  14986. }, 24);
  14987. }
  14988. }
  14989. }
  14990. }, 30),
  14991. _prepareGroup = function (options) {
  14992. function toFn(value, pull) {
  14993. if (value === void 0 || value === true) {
  14994. value = group.name;
  14995. }
  14996. if (typeof value === 'function') {
  14997. return value;
  14998. } else {
  14999. return function (to, from) {
  15000. var fromGroup = from.options.group.name;
  15001. return pull
  15002. ? value
  15003. : value && (value.join
  15004. ? value.indexOf(fromGroup) > -1
  15005. : (fromGroup == value)
  15006. );
  15007. };
  15008. }
  15009. }
  15010. var group = {};
  15011. var originalGroup = options.group;
  15012. if (!originalGroup || typeof originalGroup != 'object') {
  15013. originalGroup = {name: originalGroup};
  15014. }
  15015. group.name = originalGroup.name;
  15016. group.checkPull = toFn(originalGroup.pull, true);
  15017. group.checkPut = toFn(originalGroup.put);
  15018. group.revertClone = originalGroup.revertClone;
  15019. options.group = group;
  15020. }
  15021. ;
  15022. /**
  15023. * @class Sortable
  15024. * @param {HTMLElement} el
  15025. * @param {Object} [options]
  15026. */
  15027. function Sortable(el, options) {
  15028. if (!(el && el.nodeType && el.nodeType === 1)) {
  15029. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  15030. }
  15031. this.el = el; // root element
  15032. this.options = options = _extend({}, options);
  15033. // Export instance
  15034. el[expando] = this;
  15035. // Default options
  15036. var defaults = {
  15037. group: Math.random(),
  15038. sort: true,
  15039. disabled: false,
  15040. store: null,
  15041. handle: null,
  15042. scroll: true,
  15043. scrollSensitivity: 30,
  15044. scrollSpeed: 10,
  15045. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  15046. ghostClass: 'sortable-ghost',
  15047. chosenClass: 'sortable-chosen',
  15048. dragClass: 'sortable-drag',
  15049. ignore: 'a, img',
  15050. filter: null,
  15051. preventOnFilter: true,
  15052. animation: 0,
  15053. setData: function (dataTransfer, dragEl) {
  15054. dataTransfer.setData('Text', dragEl.textContent);
  15055. },
  15056. dropBubble: false,
  15057. dragoverBubble: false,
  15058. dataIdAttr: 'data-id',
  15059. delay: 0,
  15060. forceFallback: false,
  15061. fallbackClass: 'sortable-fallback',
  15062. fallbackOnBody: false,
  15063. fallbackTolerance: 0,
  15064. fallbackOffset: {x: 0, y: 0}
  15065. };
  15066. // Set default options
  15067. for (var name in defaults) {
  15068. !(name in options) && (options[name] = defaults[name]);
  15069. }
  15070. _prepareGroup(options);
  15071. // Bind all private methods
  15072. for (var fn in this) {
  15073. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  15074. this[fn] = this[fn].bind(this);
  15075. }
  15076. }
  15077. // Setup drag mode
  15078. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  15079. // Bind events
  15080. _on(el, 'mousedown', this._onTapStart);
  15081. _on(el, 'touchstart', this._onTapStart);
  15082. _on(el, 'pointerdown', this._onTapStart);
  15083. if (this.nativeDraggable) {
  15084. _on(el, 'dragover', this);
  15085. _on(el, 'dragenter', this);
  15086. }
  15087. touchDragOverListeners.push(this._onDragOver);
  15088. // Restore sorting
  15089. options.store && this.sort(options.store.get(this));
  15090. }
  15091. Sortable.prototype = /** @lends Sortable.prototype */ {
  15092. constructor: Sortable,
  15093. _onTapStart: function (/** Event|TouchEvent */evt) {
  15094. var _this = this,
  15095. el = this.el,
  15096. options = this.options,
  15097. preventOnFilter = options.preventOnFilter,
  15098. type = evt.type,
  15099. touch = evt.touches && evt.touches[0],
  15100. target = (touch || evt).target,
  15101. originalTarget = evt.target.shadowRoot && evt.path[0] || target,
  15102. filter = options.filter,
  15103. startIndex;
  15104. _saveInputCheckedState(el);
  15105. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  15106. if (dragEl) {
  15107. return;
  15108. }
  15109. if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
  15110. return; // only left button or enabled
  15111. }
  15112. target = _closest(target, options.draggable, el);
  15113. if (!target) {
  15114. return;
  15115. }
  15116. if (lastDownEl === target) {
  15117. // Ignoring duplicate `down`
  15118. return;
  15119. }
  15120. // Get the index of the dragged element within its parent
  15121. startIndex = _index(target, options.draggable);
  15122. // Check filter
  15123. if (typeof filter === 'function') {
  15124. if (filter.call(this, evt, target, this)) {
  15125. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  15126. preventOnFilter && evt.preventDefault();
  15127. return; // cancel dnd
  15128. }
  15129. }
  15130. else if (filter) {
  15131. filter = filter.split(',').some(function (criteria) {
  15132. criteria = _closest(originalTarget, criteria.trim(), el);
  15133. if (criteria) {
  15134. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  15135. return true;
  15136. }
  15137. });
  15138. if (filter) {
  15139. preventOnFilter && evt.preventDefault();
  15140. return; // cancel dnd
  15141. }
  15142. }
  15143. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  15144. return;
  15145. }
  15146. // Prepare `dragstart`
  15147. this._prepareDragStart(evt, touch, target, startIndex);
  15148. },
  15149. _prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  15150. var _this = this,
  15151. el = _this.el,
  15152. options = _this.options,
  15153. ownerDocument = el.ownerDocument,
  15154. dragStartFn;
  15155. if (target && !dragEl && (target.parentNode === el)) {
  15156. tapEvt = evt;
  15157. rootEl = el;
  15158. dragEl = target;
  15159. parentEl = dragEl.parentNode;
  15160. nextEl = dragEl.nextSibling;
  15161. lastDownEl = target;
  15162. activeGroup = options.group;
  15163. oldIndex = startIndex;
  15164. this._lastX = (touch || evt).clientX;
  15165. this._lastY = (touch || evt).clientY;
  15166. dragEl.style['will-change'] = 'transform';
  15167. dragStartFn = function () {
  15168. // Delayed drag has been triggered
  15169. // we can re-enable the events: touchmove/mousemove
  15170. _this._disableDelayedDrag();
  15171. // Make the element draggable
  15172. dragEl.draggable = _this.nativeDraggable;
  15173. // Chosen item
  15174. _toggleClass(dragEl, options.chosenClass, true);
  15175. // Bind the events: dragstart/dragend
  15176. _this._triggerDragStart(evt, touch);
  15177. // Drag start event
  15178. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  15179. };
  15180. // Disable "draggable"
  15181. options.ignore.split(',').forEach(function (criteria) {
  15182. _find(dragEl, criteria.trim(), _disableDraggable);
  15183. });
  15184. _on(ownerDocument, 'mouseup', _this._onDrop);
  15185. _on(ownerDocument, 'touchend', _this._onDrop);
  15186. _on(ownerDocument, 'touchcancel', _this._onDrop);
  15187. _on(ownerDocument, 'pointercancel', _this._onDrop);
  15188. _on(ownerDocument, 'selectstart', _this);
  15189. if (options.delay) {
  15190. // If the user moves the pointer or let go the click or touch
  15191. // before the delay has been reached:
  15192. // disable the delayed drag
  15193. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  15194. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  15195. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  15196. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  15197. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  15198. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  15199. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  15200. } else {
  15201. dragStartFn();
  15202. }
  15203. }
  15204. },
  15205. _disableDelayedDrag: function () {
  15206. var ownerDocument = this.el.ownerDocument;
  15207. clearTimeout(this._dragStartTimer);
  15208. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  15209. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  15210. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  15211. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  15212. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  15213. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  15214. },
  15215. _triggerDragStart: function (/** Event */evt, /** Touch */touch) {
  15216. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  15217. if (touch) {
  15218. // Touch device support
  15219. tapEvt = {
  15220. target: dragEl,
  15221. clientX: touch.clientX,
  15222. clientY: touch.clientY
  15223. };
  15224. this._onDragStart(tapEvt, 'touch');
  15225. }
  15226. else if (!this.nativeDraggable) {
  15227. this._onDragStart(tapEvt, true);
  15228. }
  15229. else {
  15230. _on(dragEl, 'dragend', this);
  15231. _on(rootEl, 'dragstart', this._onDragStart);
  15232. }
  15233. try {
  15234. if (document.selection) {
  15235. // Timeout neccessary for IE9
  15236. setTimeout(function () {
  15237. document.selection.empty();
  15238. });
  15239. } else {
  15240. window.getSelection().removeAllRanges();
  15241. }
  15242. } catch (err) {
  15243. }
  15244. },
  15245. _dragStarted: function () {
  15246. if (rootEl && dragEl) {
  15247. var options = this.options;
  15248. // Apply effect
  15249. _toggleClass(dragEl, options.ghostClass, true);
  15250. _toggleClass(dragEl, options.dragClass, false);
  15251. Sortable.active = this;
  15252. // Drag start event
  15253. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  15254. } else {
  15255. this._nulling();
  15256. }
  15257. },
  15258. _emulateDragOver: function () {
  15259. if (touchEvt) {
  15260. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  15261. return;
  15262. }
  15263. this._lastX = touchEvt.clientX;
  15264. this._lastY = touchEvt.clientY;
  15265. if (!supportCssPointerEvents) {
  15266. _css(ghostEl, 'display', 'none');
  15267. }
  15268. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  15269. parent = target,
  15270. i = touchDragOverListeners.length;
  15271. if (parent) {
  15272. do {
  15273. if (parent[expando]) {
  15274. while (i--) {
  15275. touchDragOverListeners[i]({
  15276. clientX: touchEvt.clientX,
  15277. clientY: touchEvt.clientY,
  15278. target: target,
  15279. rootEl: parent
  15280. });
  15281. }
  15282. break;
  15283. }
  15284. target = parent; // store last element
  15285. }
  15286. /* jshint boss:true */
  15287. while (parent = parent.parentNode);
  15288. }
  15289. if (!supportCssPointerEvents) {
  15290. _css(ghostEl, 'display', '');
  15291. }
  15292. }
  15293. },
  15294. _onTouchMove: function (/**TouchEvent*/evt) {
  15295. if (tapEvt) {
  15296. var options = this.options,
  15297. fallbackTolerance = options.fallbackTolerance,
  15298. fallbackOffset = options.fallbackOffset,
  15299. touch = evt.touches ? evt.touches[0] : evt,
  15300. dx = (touch.clientX - tapEvt.clientX) + fallbackOffset.x,
  15301. dy = (touch.clientY - tapEvt.clientY) + fallbackOffset.y,
  15302. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  15303. // only set the status to dragging, when we are actually dragging
  15304. if (!Sortable.active) {
  15305. if (fallbackTolerance &&
  15306. min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance
  15307. ) {
  15308. return;
  15309. }
  15310. this._dragStarted();
  15311. }
  15312. // as well as creating the ghost element on the document body
  15313. this._appendGhost();
  15314. moved = true;
  15315. touchEvt = touch;
  15316. _css(ghostEl, 'webkitTransform', translate3d);
  15317. _css(ghostEl, 'mozTransform', translate3d);
  15318. _css(ghostEl, 'msTransform', translate3d);
  15319. _css(ghostEl, 'transform', translate3d);
  15320. evt.preventDefault();
  15321. }
  15322. },
  15323. _appendGhost: function () {
  15324. if (!ghostEl) {
  15325. var rect = dragEl.getBoundingClientRect(),
  15326. css = _css(dragEl),
  15327. options = this.options,
  15328. ghostRect;
  15329. ghostEl = dragEl.cloneNode(true);
  15330. _toggleClass(ghostEl, options.ghostClass, false);
  15331. _toggleClass(ghostEl, options.fallbackClass, true);
  15332. _toggleClass(ghostEl, options.dragClass, true);
  15333. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  15334. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  15335. _css(ghostEl, 'width', rect.width);
  15336. _css(ghostEl, 'height', rect.height);
  15337. _css(ghostEl, 'opacity', '0.8');
  15338. _css(ghostEl, 'position', 'fixed');
  15339. _css(ghostEl, 'zIndex', '100000');
  15340. _css(ghostEl, 'pointerEvents', 'none');
  15341. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  15342. // Fixing dimensions.
  15343. ghostRect = ghostEl.getBoundingClientRect();
  15344. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  15345. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  15346. }
  15347. },
  15348. _onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
  15349. var dataTransfer = evt.dataTransfer,
  15350. options = this.options;
  15351. this._offUpEvents();
  15352. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  15353. cloneEl = _clone(dragEl);
  15354. cloneEl.draggable = false;
  15355. cloneEl.style['will-change'] = '';
  15356. _css(cloneEl, 'display', 'none');
  15357. _toggleClass(cloneEl, this.options.chosenClass, false);
  15358. rootEl.insertBefore(cloneEl, dragEl);
  15359. _dispatchEvent(this, rootEl, 'clone', dragEl);
  15360. }
  15361. _toggleClass(dragEl, options.dragClass, true);
  15362. if (useFallback) {
  15363. if (useFallback === 'touch') {
  15364. // Bind touch events
  15365. _on(document, 'touchmove', this._onTouchMove);
  15366. _on(document, 'touchend', this._onDrop);
  15367. _on(document, 'touchcancel', this._onDrop);
  15368. _on(document, 'pointermove', this._onTouchMove);
  15369. _on(document, 'pointerup', this._onDrop);
  15370. } else {
  15371. // Old brwoser
  15372. _on(document, 'mousemove', this._onTouchMove);
  15373. _on(document, 'mouseup', this._onDrop);
  15374. }
  15375. this._loopId = setInterval(this._emulateDragOver, 50);
  15376. }
  15377. else {
  15378. if (dataTransfer) {
  15379. dataTransfer.effectAllowed = 'move';
  15380. options.setData && options.setData.call(this, dataTransfer, dragEl);
  15381. }
  15382. _on(document, 'drop', this);
  15383. setTimeout(this._dragStarted, 0);
  15384. }
  15385. },
  15386. _onDragOver: function (/**Event*/evt) {
  15387. var el = this.el,
  15388. target,
  15389. dragRect,
  15390. targetRect,
  15391. revert,
  15392. options = this.options,
  15393. group = options.group,
  15394. activeSortable = Sortable.active,
  15395. isOwner = (activeGroup === group),
  15396. isMovingBetweenSortable = false,
  15397. canSort = options.sort;
  15398. if (evt.preventDefault !== void 0) {
  15399. evt.preventDefault();
  15400. !options.dragoverBubble && evt.stopPropagation();
  15401. }
  15402. if (dragEl.animated) {
  15403. return;
  15404. }
  15405. moved = true;
  15406. if (activeSortable && !options.disabled &&
  15407. (isOwner
  15408. ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  15409. : (
  15410. putSortable === this ||
  15411. (
  15412. (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
  15413. group.checkPut(this, activeSortable, dragEl, evt)
  15414. )
  15415. )
  15416. ) &&
  15417. (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  15418. ) {
  15419. // Smart auto-scrolling
  15420. _autoScroll(evt, options, this.el);
  15421. if (_silent) {
  15422. return;
  15423. }
  15424. target = _closest(evt.target, options.draggable, el);
  15425. dragRect = dragEl.getBoundingClientRect();
  15426. if (putSortable !== this) {
  15427. putSortable = this;
  15428. isMovingBetweenSortable = true;
  15429. }
  15430. if (revert) {
  15431. _cloneHide(activeSortable, true);
  15432. parentEl = rootEl; // actualization
  15433. if (cloneEl || nextEl) {
  15434. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  15435. }
  15436. else if (!canSort) {
  15437. rootEl.appendChild(dragEl);
  15438. }
  15439. return;
  15440. }
  15441. if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
  15442. (el === evt.target) && (target = _ghostIsLast(el, evt))
  15443. ) {
  15444. if (target) {
  15445. if (target.animated) {
  15446. return;
  15447. }
  15448. targetRect = target.getBoundingClientRect();
  15449. }
  15450. _cloneHide(activeSortable, isOwner);
  15451. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  15452. if (!dragEl.contains(el)) {
  15453. el.appendChild(dragEl);
  15454. parentEl = el; // actualization
  15455. }
  15456. this._animate(dragRect, dragEl);
  15457. target && this._animate(targetRect, target);
  15458. }
  15459. }
  15460. else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
  15461. if (lastEl !== target) {
  15462. lastEl = target;
  15463. lastCSS = _css(target);
  15464. lastParentCSS = _css(target.parentNode);
  15465. }
  15466. targetRect = target.getBoundingClientRect();
  15467. var width = targetRect.right - targetRect.left,
  15468. height = targetRect.bottom - targetRect.top,
  15469. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display)
  15470. || (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
  15471. isWide = (target.offsetWidth > dragEl.offsetWidth),
  15472. isLong = (target.offsetHeight > dragEl.offsetHeight),
  15473. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  15474. nextSibling = target.nextElementSibling,
  15475. moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt),
  15476. after = false
  15477. ;
  15478. if (moveVector !== false) {
  15479. _silent = true;
  15480. setTimeout(_unsilent, 30);
  15481. _cloneHide(activeSortable, isOwner);
  15482. if (moveVector === 1 || moveVector === -1) {
  15483. after = (moveVector === 1);
  15484. }
  15485. else if (floating) {
  15486. var elTop = dragEl.offsetTop,
  15487. tgTop = target.offsetTop;
  15488. if (elTop === tgTop) {
  15489. after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
  15490. }
  15491. else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  15492. after = (evt.clientY - targetRect.top) / height > 0.5;
  15493. } else {
  15494. after = tgTop > elTop;
  15495. }
  15496. } else if (!isMovingBetweenSortable) {
  15497. after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
  15498. }
  15499. if (!dragEl.contains(el)) {
  15500. if (after && !nextSibling) {
  15501. el.appendChild(dragEl);
  15502. } else {
  15503. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  15504. }
  15505. }
  15506. parentEl = dragEl.parentNode; // actualization
  15507. this._animate(dragRect, dragEl);
  15508. this._animate(targetRect, target);
  15509. }
  15510. }
  15511. }
  15512. },
  15513. _animate: function (prevRect, target) {
  15514. var ms = this.options.animation;
  15515. if (ms) {
  15516. var currentRect = target.getBoundingClientRect();
  15517. if (prevRect.nodeType === 1) {
  15518. prevRect = prevRect.getBoundingClientRect();
  15519. }
  15520. _css(target, 'transition', 'none');
  15521. _css(target, 'transform', 'translate3d('
  15522. + (prevRect.left - currentRect.left) + 'px,'
  15523. + (prevRect.top - currentRect.top) + 'px,0)'
  15524. );
  15525. target.offsetWidth; // repaint
  15526. _css(target, 'transition', 'all ' + ms + 'ms');
  15527. _css(target, 'transform', 'translate3d(0,0,0)');
  15528. clearTimeout(target.animated);
  15529. target.animated = setTimeout(function () {
  15530. _css(target, 'transition', '');
  15531. _css(target, 'transform', '');
  15532. target.animated = false;
  15533. }, ms);
  15534. }
  15535. },
  15536. _offUpEvents: function () {
  15537. var ownerDocument = this.el.ownerDocument;
  15538. _off(document, 'touchmove', this._onTouchMove);
  15539. _off(document, 'pointermove', this._onTouchMove);
  15540. _off(ownerDocument, 'mouseup', this._onDrop);
  15541. _off(ownerDocument, 'touchend', this._onDrop);
  15542. _off(ownerDocument, 'pointerup', this._onDrop);
  15543. _off(ownerDocument, 'touchcancel', this._onDrop);
  15544. _off(ownerDocument, 'selectstart', this);
  15545. },
  15546. _onDrop: function (/**Event*/evt) {
  15547. var el = this.el,
  15548. options = this.options;
  15549. clearInterval(this._loopId);
  15550. clearInterval(autoScroll.pid);
  15551. clearTimeout(this._dragStartTimer);
  15552. // Unbind events
  15553. _off(document, 'mousemove', this._onTouchMove);
  15554. if (this.nativeDraggable) {
  15555. _off(document, 'drop', this);
  15556. _off(el, 'dragstart', this._onDragStart);
  15557. }
  15558. this._offUpEvents();
  15559. if (evt) {
  15560. if (moved) {
  15561. evt.preventDefault();
  15562. !options.dropBubble && evt.stopPropagation();
  15563. }
  15564. ghostEl && ghostEl.parentNode.removeChild(ghostEl);
  15565. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  15566. // Remove clone
  15567. cloneEl && cloneEl.parentNode.removeChild(cloneEl);
  15568. }
  15569. if (dragEl) {
  15570. if (this.nativeDraggable) {
  15571. _off(dragEl, 'dragend', this);
  15572. }
  15573. _disableDraggable(dragEl);
  15574. dragEl.style['will-change'] = '';
  15575. // Remove class's
  15576. _toggleClass(dragEl, this.options.ghostClass, false);
  15577. _toggleClass(dragEl, this.options.chosenClass, false);
  15578. if (rootEl !== parentEl) {
  15579. newIndex = _index(dragEl, options.draggable);
  15580. if (newIndex >= 0) {
  15581. // Add event
  15582. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  15583. // Remove event
  15584. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  15585. // drag from one list and drop into another
  15586. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  15587. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  15588. }
  15589. }
  15590. else {
  15591. if (dragEl.nextSibling !== nextEl) {
  15592. // Get the index of the dragged element within its parent
  15593. newIndex = _index(dragEl, options.draggable);
  15594. if (newIndex >= 0) {
  15595. // drag & drop within the same list
  15596. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  15597. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  15598. }
  15599. }
  15600. }
  15601. if (Sortable.active) {
  15602. /* jshint eqnull:true */
  15603. if (newIndex == null || newIndex === -1) {
  15604. newIndex = oldIndex;
  15605. }
  15606. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  15607. // Save sorting
  15608. this.save();
  15609. }
  15610. }
  15611. }
  15612. this._nulling();
  15613. },
  15614. _nulling: function() {
  15615. rootEl =
  15616. dragEl =
  15617. parentEl =
  15618. ghostEl =
  15619. nextEl =
  15620. cloneEl =
  15621. lastDownEl =
  15622. scrollEl =
  15623. scrollParentEl =
  15624. tapEvt =
  15625. touchEvt =
  15626. moved =
  15627. newIndex =
  15628. lastEl =
  15629. lastCSS =
  15630. putSortable =
  15631. activeGroup =
  15632. Sortable.active = null;
  15633. savedInputChecked.forEach(function (el) {
  15634. el.checked = true;
  15635. });
  15636. savedInputChecked.length = 0;
  15637. },
  15638. handleEvent: function (/**Event*/evt) {
  15639. switch (evt.type) {
  15640. case 'drop':
  15641. case 'dragend':
  15642. this._onDrop(evt);
  15643. break;
  15644. case 'dragover':
  15645. case 'dragenter':
  15646. if (dragEl) {
  15647. this._onDragOver(evt);
  15648. _globalDragOver(evt);
  15649. }
  15650. break;
  15651. case 'selectstart':
  15652. evt.preventDefault();
  15653. break;
  15654. }
  15655. },
  15656. /**
  15657. * Serializes the item into an array of string.
  15658. * @returns {String[]}
  15659. */
  15660. toArray: function () {
  15661. var order = [],
  15662. el,
  15663. children = this.el.children,
  15664. i = 0,
  15665. n = children.length,
  15666. options = this.options;
  15667. for (; i < n; i++) {
  15668. el = children[i];
  15669. if (_closest(el, options.draggable, this.el)) {
  15670. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  15671. }
  15672. }
  15673. return order;
  15674. },
  15675. /**
  15676. * Sorts the elements according to the array.
  15677. * @param {String[]} order order of the items
  15678. */
  15679. sort: function (order) {
  15680. var items = {}, rootEl = this.el;
  15681. this.toArray().forEach(function (id, i) {
  15682. var el = rootEl.children[i];
  15683. if (_closest(el, this.options.draggable, rootEl)) {
  15684. items[id] = el;
  15685. }
  15686. }, this);
  15687. order.forEach(function (id) {
  15688. if (items[id]) {
  15689. rootEl.removeChild(items[id]);
  15690. rootEl.appendChild(items[id]);
  15691. }
  15692. });
  15693. },
  15694. /**
  15695. * Save the current sorting
  15696. */
  15697. save: function () {
  15698. var store = this.options.store;
  15699. store && store.set(this);
  15700. },
  15701. /**
  15702. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  15703. * @param {HTMLElement} el
  15704. * @param {String} [selector] default: `options.draggable`
  15705. * @returns {HTMLElement|null}
  15706. */
  15707. closest: function (el, selector) {
  15708. return _closest(el, selector || this.options.draggable, this.el);
  15709. },
  15710. /**
  15711. * Set/get option
  15712. * @param {string} name
  15713. * @param {*} [value]
  15714. * @returns {*}
  15715. */
  15716. option: function (name, value) {
  15717. var options = this.options;
  15718. if (value === void 0) {
  15719. return options[name];
  15720. } else {
  15721. options[name] = value;
  15722. if (name === 'group') {
  15723. _prepareGroup(options);
  15724. }
  15725. }
  15726. },
  15727. /**
  15728. * Destroy
  15729. */
  15730. destroy: function () {
  15731. var el = this.el;
  15732. el[expando] = null;
  15733. _off(el, 'mousedown', this._onTapStart);
  15734. _off(el, 'touchstart', this._onTapStart);
  15735. _off(el, 'pointerdown', this._onTapStart);
  15736. if (this.nativeDraggable) {
  15737. _off(el, 'dragover', this);
  15738. _off(el, 'dragenter', this);
  15739. }
  15740. // Remove draggable attributes
  15741. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  15742. el.removeAttribute('draggable');
  15743. });
  15744. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  15745. this._onDrop();
  15746. this.el = el = null;
  15747. }
  15748. };
  15749. function _cloneHide(sortable, state) {
  15750. if (sortable.lastPullMode !== 'clone') {
  15751. state = true;
  15752. }
  15753. if (cloneEl && (cloneEl.state !== state)) {
  15754. _css(cloneEl, 'display', state ? 'none' : '');
  15755. if (!state) {
  15756. if (cloneEl.state) {
  15757. if (sortable.options.group.revertClone) {
  15758. rootEl.insertBefore(cloneEl, nextEl);
  15759. sortable._animate(dragEl, cloneEl);
  15760. } else {
  15761. rootEl.insertBefore(cloneEl, dragEl);
  15762. }
  15763. }
  15764. }
  15765. cloneEl.state = state;
  15766. }
  15767. }
  15768. function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  15769. if (el) {
  15770. ctx = ctx || document;
  15771. do {
  15772. if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
  15773. return el;
  15774. }
  15775. /* jshint boss:true */
  15776. } while (el = _getParentOrHost(el));
  15777. }
  15778. return null;
  15779. }
  15780. function _getParentOrHost(el) {
  15781. var parent = el.host;
  15782. return (parent && parent.nodeType) ? parent : el.parentNode;
  15783. }
  15784. function _globalDragOver(/**Event*/evt) {
  15785. if (evt.dataTransfer) {
  15786. evt.dataTransfer.dropEffect = 'move';
  15787. }
  15788. evt.preventDefault();
  15789. }
  15790. function _on(el, event, fn) {
  15791. el.addEventListener(event, fn, captureMode);
  15792. }
  15793. function _off(el, event, fn) {
  15794. el.removeEventListener(event, fn, captureMode);
  15795. }
  15796. function _toggleClass(el, name, state) {
  15797. if (el) {
  15798. if (el.classList) {
  15799. el.classList[state ? 'add' : 'remove'](name);
  15800. }
  15801. else {
  15802. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  15803. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  15804. }
  15805. }
  15806. }
  15807. function _css(el, prop, val) {
  15808. var style = el && el.style;
  15809. if (style) {
  15810. if (val === void 0) {
  15811. if (document.defaultView && document.defaultView.getComputedStyle) {
  15812. val = document.defaultView.getComputedStyle(el, '');
  15813. }
  15814. else if (el.currentStyle) {
  15815. val = el.currentStyle;
  15816. }
  15817. return prop === void 0 ? val : val[prop];
  15818. }
  15819. else {
  15820. if (!(prop in style)) {
  15821. prop = '-webkit-' + prop;
  15822. }
  15823. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  15824. }
  15825. }
  15826. }
  15827. function _find(ctx, tagName, iterator) {
  15828. if (ctx) {
  15829. var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
  15830. if (iterator) {
  15831. for (; i < n; i++) {
  15832. iterator(list[i], i);
  15833. }
  15834. }
  15835. return list;
  15836. }
  15837. return [];
  15838. }
  15839. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  15840. sortable = (sortable || rootEl[expando]);
  15841. var evt = document.createEvent('Event'),
  15842. options = sortable.options,
  15843. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  15844. evt.initEvent(name, true, true);
  15845. evt.to = rootEl;
  15846. evt.from = fromEl || rootEl;
  15847. evt.item = targetEl || rootEl;
  15848. evt.clone = cloneEl;
  15849. evt.oldIndex = startIndex;
  15850. evt.newIndex = newIndex;
  15851. rootEl.dispatchEvent(evt);
  15852. if (options[onName]) {
  15853. options[onName].call(sortable, evt);
  15854. }
  15855. }
  15856. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt) {
  15857. var evt,
  15858. sortable = fromEl[expando],
  15859. onMoveFn = sortable.options.onMove,
  15860. retVal;
  15861. evt = document.createEvent('Event');
  15862. evt.initEvent('move', true, true);
  15863. evt.to = toEl;
  15864. evt.from = fromEl;
  15865. evt.dragged = dragEl;
  15866. evt.draggedRect = dragRect;
  15867. evt.related = targetEl || toEl;
  15868. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  15869. fromEl.dispatchEvent(evt);
  15870. if (onMoveFn) {
  15871. retVal = onMoveFn.call(sortable, evt, originalEvt);
  15872. }
  15873. return retVal;
  15874. }
  15875. function _disableDraggable(el) {
  15876. el.draggable = false;
  15877. }
  15878. function _unsilent() {
  15879. _silent = false;
  15880. }
  15881. /** @returns {HTMLElement|false} */
  15882. function _ghostIsLast(el, evt) {
  15883. var lastEl = el.lastElementChild,
  15884. rect = lastEl.getBoundingClientRect();
  15885. // 5 — min delta
  15886. // abs — нельзя добавлять, а то глюки при наведении сверху
  15887. return (
  15888. (evt.clientY - (rect.top + rect.height) > 5) ||
  15889. (evt.clientX - (rect.right + rect.width) > 5)
  15890. ) && lastEl;
  15891. }
  15892. /**
  15893. * Generate id
  15894. * @param {HTMLElement} el
  15895. * @returns {String}
  15896. * @private
  15897. */
  15898. function _generateId(el) {
  15899. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  15900. i = str.length,
  15901. sum = 0;
  15902. while (i--) {
  15903. sum += str.charCodeAt(i);
  15904. }
  15905. return sum.toString(36);
  15906. }
  15907. /**
  15908. * Returns the index of an element within its parent for a selected set of
  15909. * elements
  15910. * @param {HTMLElement} el
  15911. * @param {selector} selector
  15912. * @return {number}
  15913. */
  15914. function _index(el, selector) {
  15915. var index = 0;
  15916. if (!el || !el.parentNode) {
  15917. return -1;
  15918. }
  15919. while (el && (el = el.previousElementSibling)) {
  15920. if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && (selector === '>*' || _matches(el, selector))) {
  15921. index++;
  15922. }
  15923. }
  15924. return index;
  15925. }
  15926. function _matches(/**HTMLElement*/el, /**String*/selector) {
  15927. if (el) {
  15928. selector = selector.split('.');
  15929. var tag = selector.shift().toUpperCase(),
  15930. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  15931. return (
  15932. (tag === '' || el.nodeName.toUpperCase() == tag) &&
  15933. (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
  15934. );
  15935. }
  15936. return false;
  15937. }
  15938. function _throttle(callback, ms) {
  15939. var args, _this;
  15940. return function () {
  15941. if (args === void 0) {
  15942. args = arguments;
  15943. _this = this;
  15944. setTimeout(function () {
  15945. if (args.length === 1) {
  15946. callback.call(_this, args[0]);
  15947. } else {
  15948. callback.apply(_this, args);
  15949. }
  15950. args = void 0;
  15951. }, ms);
  15952. }
  15953. };
  15954. }
  15955. function _extend(dst, src) {
  15956. if (dst && src) {
  15957. for (var key in src) {
  15958. if (src.hasOwnProperty(key)) {
  15959. dst[key] = src[key];
  15960. }
  15961. }
  15962. }
  15963. return dst;
  15964. }
  15965. function _clone(el) {
  15966. return $
  15967. ? $(el).clone(true)[0]
  15968. : (Polymer && Polymer.dom
  15969. ? Polymer.dom(el).cloneNode(true)
  15970. : el.cloneNode(true)
  15971. );
  15972. }
  15973. function _saveInputCheckedState(root) {
  15974. var inputs = root.getElementsByTagName('input');
  15975. var idx = inputs.length;
  15976. while (idx--) {
  15977. var el = inputs[idx];
  15978. el.checked && savedInputChecked.push(el);
  15979. }
  15980. }
  15981. // Fixed #973:
  15982. _on(document, 'touchmove', function (evt) {
  15983. if (Sortable.active) {
  15984. evt.preventDefault();
  15985. }
  15986. });
  15987. try {
  15988. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  15989. get: function () {
  15990. captureMode = {
  15991. capture: false,
  15992. passive: false
  15993. };
  15994. }
  15995. }));
  15996. } catch (err) {}
  15997. // Export utils
  15998. Sortable.utils = {
  15999. on: _on,
  16000. off: _off,
  16001. css: _css,
  16002. find: _find,
  16003. is: function (el, selector) {
  16004. return !!_closest(el, selector, el);
  16005. },
  16006. extend: _extend,
  16007. throttle: _throttle,
  16008. closest: _closest,
  16009. toggleClass: _toggleClass,
  16010. clone: _clone,
  16011. index: _index
  16012. };
  16013. /**
  16014. * Create sortable instance
  16015. * @param {HTMLElement} el
  16016. * @param {Object} [options]
  16017. */
  16018. Sortable.create = function (el, options) {
  16019. return new Sortable(el, options);
  16020. };
  16021. // Export
  16022. Sortable.version = '1.5.1';
  16023. return Sortable;
  16024. });
  16025. /***/ }),
  16026. /* 77 */
  16027. /***/ (function(module, exports, __webpack_require__) {
  16028. "use strict";
  16029. /**
  16030. * Copyright 2013-present, Facebook, Inc.
  16031. * All rights reserved.
  16032. *
  16033. * This source code is licensed under the BSD-style license found in the
  16034. * LICENSE file in the root directory of this source tree. An additional grant
  16035. * of patent rights can be found in the PATENTS file in the same directory.
  16036. *
  16037. */
  16038. /**
  16039. * CSS properties which accept numbers but are not in units of "px".
  16040. */
  16041. var isUnitlessNumber = {
  16042. animationIterationCount: true,
  16043. borderImageOutset: true,
  16044. borderImageSlice: true,
  16045. borderImageWidth: true,
  16046. boxFlex: true,
  16047. boxFlexGroup: true,
  16048. boxOrdinalGroup: true,
  16049. columnCount: true,
  16050. flex: true,
  16051. flexGrow: true,
  16052. flexPositive: true,
  16053. flexShrink: true,
  16054. flexNegative: true,
  16055. flexOrder: true,
  16056. gridRow: true,
  16057. gridColumn: true,
  16058. fontWeight: true,
  16059. lineClamp: true,
  16060. lineHeight: true,
  16061. opacity: true,
  16062. order: true,
  16063. orphans: true,
  16064. tabSize: true,
  16065. widows: true,
  16066. zIndex: true,
  16067. zoom: true,
  16068. // SVG-related properties
  16069. fillOpacity: true,
  16070. floodOpacity: true,
  16071. stopOpacity: true,
  16072. strokeDasharray: true,
  16073. strokeDashoffset: true,
  16074. strokeMiterlimit: true,
  16075. strokeOpacity: true,
  16076. strokeWidth: true
  16077. };
  16078. /**
  16079. * @param {string} prefix vendor-specific prefix, eg: Webkit
  16080. * @param {string} key style name, eg: transitionDuration
  16081. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  16082. * WebkitTransitionDuration
  16083. */
  16084. function prefixKey(prefix, key) {
  16085. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  16086. }
  16087. /**
  16088. * Support style names that may come passed in prefixed by adding permutations
  16089. * of vendor prefixes.
  16090. */
  16091. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  16092. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  16093. // infinite loop, because it iterates over the newly added props too.
  16094. Object.keys(isUnitlessNumber).forEach(function (prop) {
  16095. prefixes.forEach(function (prefix) {
  16096. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  16097. });
  16098. });
  16099. /**
  16100. * Most style properties can be unset by doing .style[prop] = '' but IE8
  16101. * doesn't like doing that with shorthand properties so for the properties that
  16102. * IE8 breaks on, which are listed here, we instead unset each of the
  16103. * individual properties. See http://bugs.jquery.com/ticket/12385.
  16104. * The 4-value 'clock' properties like margin, padding, border-width seem to
  16105. * behave without any problems. Curiously, list-style works too without any
  16106. * special prodding.
  16107. */
  16108. var shorthandPropertyExpansions = {
  16109. background: {
  16110. backgroundAttachment: true,
  16111. backgroundColor: true,
  16112. backgroundImage: true,
  16113. backgroundPositionX: true,
  16114. backgroundPositionY: true,
  16115. backgroundRepeat: true
  16116. },
  16117. backgroundPosition: {
  16118. backgroundPositionX: true,
  16119. backgroundPositionY: true
  16120. },
  16121. border: {
  16122. borderWidth: true,
  16123. borderStyle: true,
  16124. borderColor: true
  16125. },
  16126. borderBottom: {
  16127. borderBottomWidth: true,
  16128. borderBottomStyle: true,
  16129. borderBottomColor: true
  16130. },
  16131. borderLeft: {
  16132. borderLeftWidth: true,
  16133. borderLeftStyle: true,
  16134. borderLeftColor: true
  16135. },
  16136. borderRight: {
  16137. borderRightWidth: true,
  16138. borderRightStyle: true,
  16139. borderRightColor: true
  16140. },
  16141. borderTop: {
  16142. borderTopWidth: true,
  16143. borderTopStyle: true,
  16144. borderTopColor: true
  16145. },
  16146. font: {
  16147. fontStyle: true,
  16148. fontVariant: true,
  16149. fontWeight: true,
  16150. fontSize: true,
  16151. lineHeight: true,
  16152. fontFamily: true
  16153. },
  16154. outline: {
  16155. outlineWidth: true,
  16156. outlineStyle: true,
  16157. outlineColor: true
  16158. }
  16159. };
  16160. var CSSProperty = {
  16161. isUnitlessNumber: isUnitlessNumber,
  16162. shorthandPropertyExpansions: shorthandPropertyExpansions
  16163. };
  16164. module.exports = CSSProperty;
  16165. /***/ }),
  16166. /* 78 */
  16167. /***/ (function(module, exports, __webpack_require__) {
  16168. "use strict";
  16169. /**
  16170. * Copyright 2013-present, Facebook, Inc.
  16171. * All rights reserved.
  16172. *
  16173. * This source code is licensed under the BSD-style license found in the
  16174. * LICENSE file in the root directory of this source tree. An additional grant
  16175. * of patent rights can be found in the PATENTS file in the same directory.
  16176. *
  16177. *
  16178. */
  16179. var _prodInvariant = __webpack_require__(2);
  16180. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16181. var PooledClass = __webpack_require__(15);
  16182. var invariant = __webpack_require__(0);
  16183. /**
  16184. * A specialized pseudo-event module to help keep track of components waiting to
  16185. * be notified when their DOM representations are available for use.
  16186. *
  16187. * This implements `PooledClass`, so you should never need to instantiate this.
  16188. * Instead, use `CallbackQueue.getPooled()`.
  16189. *
  16190. * @class ReactMountReady
  16191. * @implements PooledClass
  16192. * @internal
  16193. */
  16194. var CallbackQueue = function () {
  16195. function CallbackQueue(arg) {
  16196. _classCallCheck(this, CallbackQueue);
  16197. this._callbacks = null;
  16198. this._contexts = null;
  16199. this._arg = arg;
  16200. }
  16201. /**
  16202. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  16203. *
  16204. * @param {function} callback Invoked when `notifyAll` is invoked.
  16205. * @param {?object} context Context to call `callback` with.
  16206. * @internal
  16207. */
  16208. CallbackQueue.prototype.enqueue = function enqueue(callback, context) {
  16209. this._callbacks = this._callbacks || [];
  16210. this._callbacks.push(callback);
  16211. this._contexts = this._contexts || [];
  16212. this._contexts.push(context);
  16213. };
  16214. /**
  16215. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  16216. * the DOM representation of a component has been created or updated.
  16217. *
  16218. * @internal
  16219. */
  16220. CallbackQueue.prototype.notifyAll = function notifyAll() {
  16221. var callbacks = this._callbacks;
  16222. var contexts = this._contexts;
  16223. var arg = this._arg;
  16224. if (callbacks && contexts) {
  16225. !(callbacks.length === contexts.length) ? false ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0;
  16226. this._callbacks = null;
  16227. this._contexts = null;
  16228. for (var i = 0; i < callbacks.length; i++) {
  16229. callbacks[i].call(contexts[i], arg);
  16230. }
  16231. callbacks.length = 0;
  16232. contexts.length = 0;
  16233. }
  16234. };
  16235. CallbackQueue.prototype.checkpoint = function checkpoint() {
  16236. return this._callbacks ? this._callbacks.length : 0;
  16237. };
  16238. CallbackQueue.prototype.rollback = function rollback(len) {
  16239. if (this._callbacks && this._contexts) {
  16240. this._callbacks.length = len;
  16241. this._contexts.length = len;
  16242. }
  16243. };
  16244. /**
  16245. * Resets the internal queue.
  16246. *
  16247. * @internal
  16248. */
  16249. CallbackQueue.prototype.reset = function reset() {
  16250. this._callbacks = null;
  16251. this._contexts = null;
  16252. };
  16253. /**
  16254. * `PooledClass` looks for this.
  16255. */
  16256. CallbackQueue.prototype.destructor = function destructor() {
  16257. this.reset();
  16258. };
  16259. return CallbackQueue;
  16260. }();
  16261. module.exports = PooledClass.addPoolingTo(CallbackQueue);
  16262. /***/ }),
  16263. /* 79 */
  16264. /***/ (function(module, exports, __webpack_require__) {
  16265. "use strict";
  16266. /**
  16267. * Copyright 2013-present, Facebook, Inc.
  16268. * All rights reserved.
  16269. *
  16270. * This source code is licensed under the BSD-style license found in the
  16271. * LICENSE file in the root directory of this source tree. An additional grant
  16272. * of patent rights can be found in the PATENTS file in the same directory.
  16273. *
  16274. */
  16275. var DOMProperty = __webpack_require__(19);
  16276. var ReactDOMComponentTree = __webpack_require__(5);
  16277. var ReactInstrumentation = __webpack_require__(11);
  16278. var quoteAttributeValueForBrowser = __webpack_require__(230);
  16279. var warning = __webpack_require__(1);
  16280. var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
  16281. var illegalAttributeNameCache = {};
  16282. var validatedAttributeNameCache = {};
  16283. function isAttributeNameSafe(attributeName) {
  16284. if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
  16285. return true;
  16286. }
  16287. if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
  16288. return false;
  16289. }
  16290. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  16291. validatedAttributeNameCache[attributeName] = true;
  16292. return true;
  16293. }
  16294. illegalAttributeNameCache[attributeName] = true;
  16295. false ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
  16296. return false;
  16297. }
  16298. function shouldIgnoreValue(propertyInfo, value) {
  16299. return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
  16300. }
  16301. /**
  16302. * Operations for dealing with DOM properties.
  16303. */
  16304. var DOMPropertyOperations = {
  16305. /**
  16306. * Creates markup for the ID property.
  16307. *
  16308. * @param {string} id Unescaped ID.
  16309. * @return {string} Markup string.
  16310. */
  16311. createMarkupForID: function (id) {
  16312. return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
  16313. },
  16314. setAttributeForID: function (node, id) {
  16315. node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
  16316. },
  16317. createMarkupForRoot: function () {
  16318. return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
  16319. },
  16320. setAttributeForRoot: function (node) {
  16321. node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
  16322. },
  16323. /**
  16324. * Creates markup for a property.
  16325. *
  16326. * @param {string} name
  16327. * @param {*} value
  16328. * @return {?string} Markup string, or null if the property was invalid.
  16329. */
  16330. createMarkupForProperty: function (name, value) {
  16331. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  16332. if (propertyInfo) {
  16333. if (shouldIgnoreValue(propertyInfo, value)) {
  16334. return '';
  16335. }
  16336. var attributeName = propertyInfo.attributeName;
  16337. if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  16338. return attributeName + '=""';
  16339. }
  16340. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  16341. } else if (DOMProperty.isCustomAttribute(name)) {
  16342. if (value == null) {
  16343. return '';
  16344. }
  16345. return name + '=' + quoteAttributeValueForBrowser(value);
  16346. }
  16347. return null;
  16348. },
  16349. /**
  16350. * Creates markup for a custom property.
  16351. *
  16352. * @param {string} name
  16353. * @param {*} value
  16354. * @return {string} Markup string, or empty string if the property was invalid.
  16355. */
  16356. createMarkupForCustomAttribute: function (name, value) {
  16357. if (!isAttributeNameSafe(name) || value == null) {
  16358. return '';
  16359. }
  16360. return name + '=' + quoteAttributeValueForBrowser(value);
  16361. },
  16362. /**
  16363. * Sets the value for a property on a node.
  16364. *
  16365. * @param {DOMElement} node
  16366. * @param {string} name
  16367. * @param {*} value
  16368. */
  16369. setValueForProperty: function (node, name, value) {
  16370. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  16371. if (propertyInfo) {
  16372. var mutationMethod = propertyInfo.mutationMethod;
  16373. if (mutationMethod) {
  16374. mutationMethod(node, value);
  16375. } else if (shouldIgnoreValue(propertyInfo, value)) {
  16376. this.deleteValueForProperty(node, name);
  16377. return;
  16378. } else if (propertyInfo.mustUseProperty) {
  16379. // Contrary to `setAttribute`, object properties are properly
  16380. // `toString`ed by IE8/9.
  16381. node[propertyInfo.propertyName] = value;
  16382. } else {
  16383. var attributeName = propertyInfo.attributeName;
  16384. var namespace = propertyInfo.attributeNamespace;
  16385. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  16386. // ('' + value) makes it output the correct toString()-value.
  16387. if (namespace) {
  16388. node.setAttributeNS(namespace, attributeName, '' + value);
  16389. } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  16390. node.setAttribute(attributeName, '');
  16391. } else {
  16392. node.setAttribute(attributeName, '' + value);
  16393. }
  16394. }
  16395. } else if (DOMProperty.isCustomAttribute(name)) {
  16396. DOMPropertyOperations.setValueForAttribute(node, name, value);
  16397. return;
  16398. }
  16399. if (false) {
  16400. var payload = {};
  16401. payload[name] = value;
  16402. ReactInstrumentation.debugTool.onHostOperation({
  16403. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  16404. type: 'update attribute',
  16405. payload: payload
  16406. });
  16407. }
  16408. },
  16409. setValueForAttribute: function (node, name, value) {
  16410. if (!isAttributeNameSafe(name)) {
  16411. return;
  16412. }
  16413. if (value == null) {
  16414. node.removeAttribute(name);
  16415. } else {
  16416. node.setAttribute(name, '' + value);
  16417. }
  16418. if (false) {
  16419. var payload = {};
  16420. payload[name] = value;
  16421. ReactInstrumentation.debugTool.onHostOperation({
  16422. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  16423. type: 'update attribute',
  16424. payload: payload
  16425. });
  16426. }
  16427. },
  16428. /**
  16429. * Deletes an attributes from a node.
  16430. *
  16431. * @param {DOMElement} node
  16432. * @param {string} name
  16433. */
  16434. deleteValueForAttribute: function (node, name) {
  16435. node.removeAttribute(name);
  16436. if (false) {
  16437. ReactInstrumentation.debugTool.onHostOperation({
  16438. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  16439. type: 'remove attribute',
  16440. payload: name
  16441. });
  16442. }
  16443. },
  16444. /**
  16445. * Deletes the value for a property on a node.
  16446. *
  16447. * @param {DOMElement} node
  16448. * @param {string} name
  16449. */
  16450. deleteValueForProperty: function (node, name) {
  16451. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  16452. if (propertyInfo) {
  16453. var mutationMethod = propertyInfo.mutationMethod;
  16454. if (mutationMethod) {
  16455. mutationMethod(node, undefined);
  16456. } else if (propertyInfo.mustUseProperty) {
  16457. var propName = propertyInfo.propertyName;
  16458. if (propertyInfo.hasBooleanValue) {
  16459. node[propName] = false;
  16460. } else {
  16461. node[propName] = '';
  16462. }
  16463. } else {
  16464. node.removeAttribute(propertyInfo.attributeName);
  16465. }
  16466. } else if (DOMProperty.isCustomAttribute(name)) {
  16467. node.removeAttribute(name);
  16468. }
  16469. if (false) {
  16470. ReactInstrumentation.debugTool.onHostOperation({
  16471. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  16472. type: 'remove attribute',
  16473. payload: name
  16474. });
  16475. }
  16476. }
  16477. };
  16478. module.exports = DOMPropertyOperations;
  16479. /***/ }),
  16480. /* 80 */
  16481. /***/ (function(module, exports, __webpack_require__) {
  16482. "use strict";
  16483. /**
  16484. * Copyright 2015-present, Facebook, Inc.
  16485. * All rights reserved.
  16486. *
  16487. * This source code is licensed under the BSD-style license found in the
  16488. * LICENSE file in the root directory of this source tree. An additional grant
  16489. * of patent rights can be found in the PATENTS file in the same directory.
  16490. *
  16491. */
  16492. var ReactDOMComponentFlags = {
  16493. hasCachedChildNodes: 1 << 0
  16494. };
  16495. module.exports = ReactDOMComponentFlags;
  16496. /***/ }),
  16497. /* 81 */
  16498. /***/ (function(module, exports, __webpack_require__) {
  16499. "use strict";
  16500. /**
  16501. * Copyright 2013-present, Facebook, Inc.
  16502. * All rights reserved.
  16503. *
  16504. * This source code is licensed under the BSD-style license found in the
  16505. * LICENSE file in the root directory of this source tree. An additional grant
  16506. * of patent rights can be found in the PATENTS file in the same directory.
  16507. *
  16508. */
  16509. var _assign = __webpack_require__(3);
  16510. var LinkedValueUtils = __webpack_require__(54);
  16511. var ReactDOMComponentTree = __webpack_require__(5);
  16512. var ReactUpdates = __webpack_require__(12);
  16513. var warning = __webpack_require__(1);
  16514. var didWarnValueLink = false;
  16515. var didWarnValueDefaultValue = false;
  16516. function updateOptionsIfPendingUpdateAndMounted() {
  16517. if (this._rootNodeID && this._wrapperState.pendingUpdate) {
  16518. this._wrapperState.pendingUpdate = false;
  16519. var props = this._currentElement.props;
  16520. var value = LinkedValueUtils.getValue(props);
  16521. if (value != null) {
  16522. updateOptions(this, Boolean(props.multiple), value);
  16523. }
  16524. }
  16525. }
  16526. function getDeclarationErrorAddendum(owner) {
  16527. if (owner) {
  16528. var name = owner.getName();
  16529. if (name) {
  16530. return ' Check the render method of `' + name + '`.';
  16531. }
  16532. }
  16533. return '';
  16534. }
  16535. var valuePropNames = ['value', 'defaultValue'];
  16536. /**
  16537. * Validation function for `value` and `defaultValue`.
  16538. * @private
  16539. */
  16540. function checkSelectPropTypes(inst, props) {
  16541. var owner = inst._currentElement._owner;
  16542. LinkedValueUtils.checkPropTypes('select', props, owner);
  16543. if (props.valueLink !== undefined && !didWarnValueLink) {
  16544. false ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
  16545. didWarnValueLink = true;
  16546. }
  16547. for (var i = 0; i < valuePropNames.length; i++) {
  16548. var propName = valuePropNames[i];
  16549. if (props[propName] == null) {
  16550. continue;
  16551. }
  16552. var isArray = Array.isArray(props[propName]);
  16553. if (props.multiple && !isArray) {
  16554. false ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  16555. } else if (!props.multiple && isArray) {
  16556. false ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  16557. }
  16558. }
  16559. }
  16560. /**
  16561. * @param {ReactDOMComponent} inst
  16562. * @param {boolean} multiple
  16563. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  16564. * @private
  16565. */
  16566. function updateOptions(inst, multiple, propValue) {
  16567. var selectedValue, i;
  16568. var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
  16569. if (multiple) {
  16570. selectedValue = {};
  16571. for (i = 0; i < propValue.length; i++) {
  16572. selectedValue['' + propValue[i]] = true;
  16573. }
  16574. for (i = 0; i < options.length; i++) {
  16575. var selected = selectedValue.hasOwnProperty(options[i].value);
  16576. if (options[i].selected !== selected) {
  16577. options[i].selected = selected;
  16578. }
  16579. }
  16580. } else {
  16581. // Do not set `select.value` as exact behavior isn't consistent across all
  16582. // browsers for all cases.
  16583. selectedValue = '' + propValue;
  16584. for (i = 0; i < options.length; i++) {
  16585. if (options[i].value === selectedValue) {
  16586. options[i].selected = true;
  16587. return;
  16588. }
  16589. }
  16590. if (options.length) {
  16591. options[0].selected = true;
  16592. }
  16593. }
  16594. }
  16595. /**
  16596. * Implements a <select> host component that allows optionally setting the
  16597. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  16598. * stringable. If `multiple` is true, the prop must be an array of stringables.
  16599. *
  16600. * If `value` is not supplied (or null/undefined), user actions that change the
  16601. * selected option will trigger updates to the rendered options.
  16602. *
  16603. * If it is supplied (and not null/undefined), the rendered options will not
  16604. * update in response to user actions. Instead, the `value` prop must change in
  16605. * order for the rendered options to update.
  16606. *
  16607. * If `defaultValue` is provided, any options with the supplied values will be
  16608. * selected.
  16609. */
  16610. var ReactDOMSelect = {
  16611. getHostProps: function (inst, props) {
  16612. return _assign({}, props, {
  16613. onChange: inst._wrapperState.onChange,
  16614. value: undefined
  16615. });
  16616. },
  16617. mountWrapper: function (inst, props) {
  16618. if (false) {
  16619. checkSelectPropTypes(inst, props);
  16620. }
  16621. var value = LinkedValueUtils.getValue(props);
  16622. inst._wrapperState = {
  16623. pendingUpdate: false,
  16624. initialValue: value != null ? value : props.defaultValue,
  16625. listeners: null,
  16626. onChange: _handleChange.bind(inst),
  16627. wasMultiple: Boolean(props.multiple)
  16628. };
  16629. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  16630. false ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
  16631. didWarnValueDefaultValue = true;
  16632. }
  16633. },
  16634. getSelectValueContext: function (inst) {
  16635. // ReactDOMOption looks at this initial value so the initial generated
  16636. // markup has correct `selected` attributes
  16637. return inst._wrapperState.initialValue;
  16638. },
  16639. postUpdateWrapper: function (inst) {
  16640. var props = inst._currentElement.props;
  16641. // After the initial mount, we control selected-ness manually so don't pass
  16642. // this value down
  16643. inst._wrapperState.initialValue = undefined;
  16644. var wasMultiple = inst._wrapperState.wasMultiple;
  16645. inst._wrapperState.wasMultiple = Boolean(props.multiple);
  16646. var value = LinkedValueUtils.getValue(props);
  16647. if (value != null) {
  16648. inst._wrapperState.pendingUpdate = false;
  16649. updateOptions(inst, Boolean(props.multiple), value);
  16650. } else if (wasMultiple !== Boolean(props.multiple)) {
  16651. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  16652. if (props.defaultValue != null) {
  16653. updateOptions(inst, Boolean(props.multiple), props.defaultValue);
  16654. } else {
  16655. // Revert the select back to its default unselected state.
  16656. updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
  16657. }
  16658. }
  16659. }
  16660. };
  16661. function _handleChange(event) {
  16662. var props = this._currentElement.props;
  16663. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  16664. if (this._rootNodeID) {
  16665. this._wrapperState.pendingUpdate = true;
  16666. }
  16667. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  16668. return returnValue;
  16669. }
  16670. module.exports = ReactDOMSelect;
  16671. /***/ }),
  16672. /* 82 */
  16673. /***/ (function(module, exports, __webpack_require__) {
  16674. "use strict";
  16675. /**
  16676. * Copyright 2014-present, Facebook, Inc.
  16677. * All rights reserved.
  16678. *
  16679. * This source code is licensed under the BSD-style license found in the
  16680. * LICENSE file in the root directory of this source tree. An additional grant
  16681. * of patent rights can be found in the PATENTS file in the same directory.
  16682. *
  16683. */
  16684. var emptyComponentFactory;
  16685. var ReactEmptyComponentInjection = {
  16686. injectEmptyComponentFactory: function (factory) {
  16687. emptyComponentFactory = factory;
  16688. }
  16689. };
  16690. var ReactEmptyComponent = {
  16691. create: function (instantiate) {
  16692. return emptyComponentFactory(instantiate);
  16693. }
  16694. };
  16695. ReactEmptyComponent.injection = ReactEmptyComponentInjection;
  16696. module.exports = ReactEmptyComponent;
  16697. /***/ }),
  16698. /* 83 */
  16699. /***/ (function(module, exports, __webpack_require__) {
  16700. "use strict";
  16701. /**
  16702. * Copyright 2013-present, Facebook, Inc.
  16703. * All rights reserved.
  16704. *
  16705. * This source code is licensed under the BSD-style license found in the
  16706. * LICENSE file in the root directory of this source tree. An additional grant
  16707. * of patent rights can be found in the PATENTS file in the same directory.
  16708. *
  16709. *
  16710. */
  16711. var ReactFeatureFlags = {
  16712. // When true, call console.time() before and .timeEnd() after each top-level
  16713. // render (both initial renders and updates). Useful when looking at prod-mode
  16714. // timeline profiles in Chrome, for example.
  16715. logTopLevelRenders: false
  16716. };
  16717. module.exports = ReactFeatureFlags;
  16718. /***/ }),
  16719. /* 84 */
  16720. /***/ (function(module, exports, __webpack_require__) {
  16721. "use strict";
  16722. /**
  16723. * Copyright 2014-present, Facebook, Inc.
  16724. * All rights reserved.
  16725. *
  16726. * This source code is licensed under the BSD-style license found in the
  16727. * LICENSE file in the root directory of this source tree. An additional grant
  16728. * of patent rights can be found in the PATENTS file in the same directory.
  16729. *
  16730. */
  16731. var _prodInvariant = __webpack_require__(2);
  16732. var invariant = __webpack_require__(0);
  16733. var genericComponentClass = null;
  16734. var textComponentClass = null;
  16735. var ReactHostComponentInjection = {
  16736. // This accepts a class that receives the tag string. This is a catch all
  16737. // that can render any kind of tag.
  16738. injectGenericComponentClass: function (componentClass) {
  16739. genericComponentClass = componentClass;
  16740. },
  16741. // This accepts a text component class that takes the text string to be
  16742. // rendered as props.
  16743. injectTextComponentClass: function (componentClass) {
  16744. textComponentClass = componentClass;
  16745. }
  16746. };
  16747. /**
  16748. * Get a host internal component class for a specific tag.
  16749. *
  16750. * @param {ReactElement} element The element to create.
  16751. * @return {function} The internal class constructor function.
  16752. */
  16753. function createInternalComponent(element) {
  16754. !genericComponentClass ? false ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
  16755. return new genericComponentClass(element);
  16756. }
  16757. /**
  16758. * @param {ReactText} text
  16759. * @return {ReactComponent}
  16760. */
  16761. function createInstanceForText(text) {
  16762. return new textComponentClass(text);
  16763. }
  16764. /**
  16765. * @param {ReactComponent} component
  16766. * @return {boolean}
  16767. */
  16768. function isTextComponent(component) {
  16769. return component instanceof textComponentClass;
  16770. }
  16771. var ReactHostComponent = {
  16772. createInternalComponent: createInternalComponent,
  16773. createInstanceForText: createInstanceForText,
  16774. isTextComponent: isTextComponent,
  16775. injection: ReactHostComponentInjection
  16776. };
  16777. module.exports = ReactHostComponent;
  16778. /***/ }),
  16779. /* 85 */
  16780. /***/ (function(module, exports, __webpack_require__) {
  16781. "use strict";
  16782. /**
  16783. * Copyright 2013-present, Facebook, Inc.
  16784. * All rights reserved.
  16785. *
  16786. * This source code is licensed under the BSD-style license found in the
  16787. * LICENSE file in the root directory of this source tree. An additional grant
  16788. * of patent rights can be found in the PATENTS file in the same directory.
  16789. *
  16790. */
  16791. var ReactDOMSelection = __webpack_require__(189);
  16792. var containsNode = __webpack_require__(158);
  16793. var focusNode = __webpack_require__(74);
  16794. var getActiveElement = __webpack_require__(75);
  16795. function isInDocument(node) {
  16796. return containsNode(document.documentElement, node);
  16797. }
  16798. /**
  16799. * @ReactInputSelection: React input selection module. Based on Selection.js,
  16800. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  16801. * assume buttons have range selections allowed).
  16802. * Input selection module for React.
  16803. */
  16804. var ReactInputSelection = {
  16805. hasSelectionCapabilities: function (elem) {
  16806. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  16807. return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
  16808. },
  16809. getSelectionInformation: function () {
  16810. var focusedElem = getActiveElement();
  16811. return {
  16812. focusedElem: focusedElem,
  16813. selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
  16814. };
  16815. },
  16816. /**
  16817. * @restoreSelection: If any selection information was potentially lost,
  16818. * restore it. This is useful when performing operations that could remove dom
  16819. * nodes and place them back in, resulting in focus being lost.
  16820. */
  16821. restoreSelection: function (priorSelectionInformation) {
  16822. var curFocusedElem = getActiveElement();
  16823. var priorFocusedElem = priorSelectionInformation.focusedElem;
  16824. var priorSelectionRange = priorSelectionInformation.selectionRange;
  16825. if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  16826. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  16827. ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
  16828. }
  16829. focusNode(priorFocusedElem);
  16830. }
  16831. },
  16832. /**
  16833. * @getSelection: Gets the selection bounds of a focused textarea, input or
  16834. * contentEditable node.
  16835. * -@input: Look up selection bounds of this input
  16836. * -@return {start: selectionStart, end: selectionEnd}
  16837. */
  16838. getSelection: function (input) {
  16839. var selection;
  16840. if ('selectionStart' in input) {
  16841. // Modern browser with input or textarea.
  16842. selection = {
  16843. start: input.selectionStart,
  16844. end: input.selectionEnd
  16845. };
  16846. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  16847. // IE8 input.
  16848. var range = document.selection.createRange();
  16849. // There can only be one selection per document in IE, so it must
  16850. // be in our element.
  16851. if (range.parentElement() === input) {
  16852. selection = {
  16853. start: -range.moveStart('character', -input.value.length),
  16854. end: -range.moveEnd('character', -input.value.length)
  16855. };
  16856. }
  16857. } else {
  16858. // Content editable or old IE textarea.
  16859. selection = ReactDOMSelection.getOffsets(input);
  16860. }
  16861. return selection || { start: 0, end: 0 };
  16862. },
  16863. /**
  16864. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  16865. * the input.
  16866. * -@input Set selection bounds of this input or textarea
  16867. * -@offsets Object of same form that is returned from get*
  16868. */
  16869. setSelection: function (input, offsets) {
  16870. var start = offsets.start;
  16871. var end = offsets.end;
  16872. if (end === undefined) {
  16873. end = start;
  16874. }
  16875. if ('selectionStart' in input) {
  16876. input.selectionStart = start;
  16877. input.selectionEnd = Math.min(end, input.value.length);
  16878. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  16879. var range = input.createTextRange();
  16880. range.collapse(true);
  16881. range.moveStart('character', start);
  16882. range.moveEnd('character', end - start);
  16883. range.select();
  16884. } else {
  16885. ReactDOMSelection.setOffsets(input, offsets);
  16886. }
  16887. }
  16888. };
  16889. module.exports = ReactInputSelection;
  16890. /***/ }),
  16891. /* 86 */
  16892. /***/ (function(module, exports, __webpack_require__) {
  16893. "use strict";
  16894. /**
  16895. * Copyright 2013-present, Facebook, Inc.
  16896. * All rights reserved.
  16897. *
  16898. * This source code is licensed under the BSD-style license found in the
  16899. * LICENSE file in the root directory of this source tree. An additional grant
  16900. * of patent rights can be found in the PATENTS file in the same directory.
  16901. *
  16902. */
  16903. var _prodInvariant = __webpack_require__(2);
  16904. var DOMLazyTree = __webpack_require__(18);
  16905. var DOMProperty = __webpack_require__(19);
  16906. var React = __webpack_require__(21);
  16907. var ReactBrowserEventEmitter = __webpack_require__(32);
  16908. var ReactCurrentOwner = __webpack_require__(14);
  16909. var ReactDOMComponentTree = __webpack_require__(5);
  16910. var ReactDOMContainerInfo = __webpack_require__(183);
  16911. var ReactDOMFeatureFlags = __webpack_require__(185);
  16912. var ReactFeatureFlags = __webpack_require__(83);
  16913. var ReactInstanceMap = __webpack_require__(27);
  16914. var ReactInstrumentation = __webpack_require__(11);
  16915. var ReactMarkupChecksum = __webpack_require__(199);
  16916. var ReactReconciler = __webpack_require__(20);
  16917. var ReactUpdateQueue = __webpack_require__(57);
  16918. var ReactUpdates = __webpack_require__(12);
  16919. var emptyObject = __webpack_require__(24);
  16920. var instantiateReactComponent = __webpack_require__(93);
  16921. var invariant = __webpack_require__(0);
  16922. var setInnerHTML = __webpack_require__(36);
  16923. var shouldUpdateReactComponent = __webpack_require__(63);
  16924. var warning = __webpack_require__(1);
  16925. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  16926. var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
  16927. var ELEMENT_NODE_TYPE = 1;
  16928. var DOC_NODE_TYPE = 9;
  16929. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  16930. var instancesByReactRootID = {};
  16931. /**
  16932. * Finds the index of the first character
  16933. * that's not common between the two given strings.
  16934. *
  16935. * @return {number} the index of the character where the strings diverge
  16936. */
  16937. function firstDifferenceIndex(string1, string2) {
  16938. var minLen = Math.min(string1.length, string2.length);
  16939. for (var i = 0; i < minLen; i++) {
  16940. if (string1.charAt(i) !== string2.charAt(i)) {
  16941. return i;
  16942. }
  16943. }
  16944. return string1.length === string2.length ? -1 : minLen;
  16945. }
  16946. /**
  16947. * @param {DOMElement|DOMDocument} container DOM element that may contain
  16948. * a React component
  16949. * @return {?*} DOM element that may have the reactRoot ID, or null.
  16950. */
  16951. function getReactRootElementInContainer(container) {
  16952. if (!container) {
  16953. return null;
  16954. }
  16955. if (container.nodeType === DOC_NODE_TYPE) {
  16956. return container.documentElement;
  16957. } else {
  16958. return container.firstChild;
  16959. }
  16960. }
  16961. function internalGetID(node) {
  16962. // If node is something like a window, document, or text node, none of
  16963. // which support attributes or a .getAttribute method, gracefully return
  16964. // the empty string, as if the attribute were missing.
  16965. return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  16966. }
  16967. /**
  16968. * Mounts this component and inserts it into the DOM.
  16969. *
  16970. * @param {ReactComponent} componentInstance The instance to mount.
  16971. * @param {DOMElement} container DOM element to mount into.
  16972. * @param {ReactReconcileTransaction} transaction
  16973. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  16974. */
  16975. function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
  16976. var markerName;
  16977. if (ReactFeatureFlags.logTopLevelRenders) {
  16978. var wrappedElement = wrapperInstance._currentElement.props.child;
  16979. var type = wrappedElement.type;
  16980. markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
  16981. console.time(markerName);
  16982. }
  16983. var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
  16984. );
  16985. if (markerName) {
  16986. console.timeEnd(markerName);
  16987. }
  16988. wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
  16989. ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
  16990. }
  16991. /**
  16992. * Batched mount.
  16993. *
  16994. * @param {ReactComponent} componentInstance The instance to mount.
  16995. * @param {DOMElement} container DOM element to mount into.
  16996. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  16997. */
  16998. function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
  16999. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  17000. /* useCreateElement */
  17001. !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
  17002. transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
  17003. ReactUpdates.ReactReconcileTransaction.release(transaction);
  17004. }
  17005. /**
  17006. * Unmounts a component and removes it from the DOM.
  17007. *
  17008. * @param {ReactComponent} instance React component instance.
  17009. * @param {DOMElement} container DOM element to unmount from.
  17010. * @final
  17011. * @internal
  17012. * @see {ReactMount.unmountComponentAtNode}
  17013. */
  17014. function unmountComponentFromNode(instance, container, safely) {
  17015. if (false) {
  17016. ReactInstrumentation.debugTool.onBeginFlush();
  17017. }
  17018. ReactReconciler.unmountComponent(instance, safely);
  17019. if (false) {
  17020. ReactInstrumentation.debugTool.onEndFlush();
  17021. }
  17022. if (container.nodeType === DOC_NODE_TYPE) {
  17023. container = container.documentElement;
  17024. }
  17025. // http://jsperf.com/emptying-a-node
  17026. while (container.lastChild) {
  17027. container.removeChild(container.lastChild);
  17028. }
  17029. }
  17030. /**
  17031. * True if the supplied DOM node has a direct React-rendered child that is
  17032. * not a React root element. Useful for warning in `render`,
  17033. * `unmountComponentAtNode`, etc.
  17034. *
  17035. * @param {?DOMElement} node The candidate DOM node.
  17036. * @return {boolean} True if the DOM element contains a direct child that was
  17037. * rendered by React but is not a root element.
  17038. * @internal
  17039. */
  17040. function hasNonRootReactChild(container) {
  17041. var rootEl = getReactRootElementInContainer(container);
  17042. if (rootEl) {
  17043. var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
  17044. return !!(inst && inst._hostParent);
  17045. }
  17046. }
  17047. /**
  17048. * True if the supplied DOM node is a React DOM element and
  17049. * it has been rendered by another copy of React.
  17050. *
  17051. * @param {?DOMElement} node The candidate DOM node.
  17052. * @return {boolean} True if the DOM has been rendered by another copy of React
  17053. * @internal
  17054. */
  17055. function nodeIsRenderedByOtherInstance(container) {
  17056. var rootEl = getReactRootElementInContainer(container);
  17057. return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
  17058. }
  17059. /**
  17060. * True if the supplied DOM node is a valid node element.
  17061. *
  17062. * @param {?DOMElement} node The candidate DOM node.
  17063. * @return {boolean} True if the DOM is a valid DOM node.
  17064. * @internal
  17065. */
  17066. function isValidContainer(node) {
  17067. return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
  17068. }
  17069. /**
  17070. * True if the supplied DOM node is a valid React node element.
  17071. *
  17072. * @param {?DOMElement} node The candidate DOM node.
  17073. * @return {boolean} True if the DOM is a valid React DOM node.
  17074. * @internal
  17075. */
  17076. function isReactNode(node) {
  17077. return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
  17078. }
  17079. function getHostRootInstanceInContainer(container) {
  17080. var rootEl = getReactRootElementInContainer(container);
  17081. var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
  17082. return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
  17083. }
  17084. function getTopLevelWrapperInContainer(container) {
  17085. var root = getHostRootInstanceInContainer(container);
  17086. return root ? root._hostContainerInfo._topLevelWrapper : null;
  17087. }
  17088. /**
  17089. * Temporary (?) hack so that we can store all top-level pending updates on
  17090. * composites instead of having to worry about different types of components
  17091. * here.
  17092. */
  17093. var topLevelRootCounter = 1;
  17094. var TopLevelWrapper = function () {
  17095. this.rootID = topLevelRootCounter++;
  17096. };
  17097. TopLevelWrapper.prototype.isReactComponent = {};
  17098. if (false) {
  17099. TopLevelWrapper.displayName = 'TopLevelWrapper';
  17100. }
  17101. TopLevelWrapper.prototype.render = function () {
  17102. return this.props.child;
  17103. };
  17104. TopLevelWrapper.isReactTopLevelWrapper = true;
  17105. /**
  17106. * Mounting is the process of initializing a React component by creating its
  17107. * representative DOM elements and inserting them into a supplied `container`.
  17108. * Any prior content inside `container` is destroyed in the process.
  17109. *
  17110. * ReactMount.render(
  17111. * component,
  17112. * document.getElementById('container')
  17113. * );
  17114. *
  17115. * <div id="container"> <-- Supplied `container`.
  17116. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  17117. * // ... component.
  17118. * </div>
  17119. * </div>
  17120. *
  17121. * Inside of `container`, the first element rendered is the "reactRoot".
  17122. */
  17123. var ReactMount = {
  17124. TopLevelWrapper: TopLevelWrapper,
  17125. /**
  17126. * Used by devtools. The keys are not important.
  17127. */
  17128. _instancesByReactRootID: instancesByReactRootID,
  17129. /**
  17130. * This is a hook provided to support rendering React components while
  17131. * ensuring that the apparent scroll position of its `container` does not
  17132. * change.
  17133. *
  17134. * @param {DOMElement} container The `container` being rendered into.
  17135. * @param {function} renderCallback This must be called once to do the render.
  17136. */
  17137. scrollMonitor: function (container, renderCallback) {
  17138. renderCallback();
  17139. },
  17140. /**
  17141. * Take a component that's already mounted into the DOM and replace its props
  17142. * @param {ReactComponent} prevComponent component instance already in the DOM
  17143. * @param {ReactElement} nextElement component instance to render
  17144. * @param {DOMElement} container container to render into
  17145. * @param {?function} callback function triggered on completion
  17146. */
  17147. _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) {
  17148. ReactMount.scrollMonitor(container, function () {
  17149. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
  17150. if (callback) {
  17151. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  17152. }
  17153. });
  17154. return prevComponent;
  17155. },
  17156. /**
  17157. * Render a new component into the DOM. Hooked by hooks!
  17158. *
  17159. * @param {ReactElement} nextElement element to render
  17160. * @param {DOMElement} container container to render into
  17161. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  17162. * @return {ReactComponent} nextComponent
  17163. */
  17164. _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
  17165. // Various parts of our code (such as ReactCompositeComponent's
  17166. // _renderValidatedComponent) assume that calls to render aren't nested;
  17167. // verify that that's the case.
  17168. false ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
  17169. !isValidContainer(container) ? false ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;
  17170. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  17171. var componentInstance = instantiateReactComponent(nextElement, false);
  17172. // The initial render is synchronous but any updates that happen during
  17173. // rendering, in componentWillMount or componentDidMount, will be batched
  17174. // according to the current batching strategy.
  17175. ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
  17176. var wrapperID = componentInstance._instance.rootID;
  17177. instancesByReactRootID[wrapperID] = componentInstance;
  17178. return componentInstance;
  17179. },
  17180. /**
  17181. * Renders a React component into the DOM in the supplied `container`.
  17182. *
  17183. * If the React component was previously rendered into `container`, this will
  17184. * perform an update on it and only mutate the DOM as necessary to reflect the
  17185. * latest React component.
  17186. *
  17187. * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
  17188. * @param {ReactElement} nextElement Component element to render.
  17189. * @param {DOMElement} container DOM element to render into.
  17190. * @param {?function} callback function triggered on completion
  17191. * @return {ReactComponent} Component instance rendered in `container`.
  17192. */
  17193. renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  17194. !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? false ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
  17195. return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
  17196. },
  17197. _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  17198. ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
  17199. !React.isValidElement(nextElement) ? false ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' :
  17200. // Check if it quacks like an element
  17201. nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0;
  17202. false ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
  17203. var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement });
  17204. var nextContext;
  17205. if (parentComponent) {
  17206. var parentInst = ReactInstanceMap.get(parentComponent);
  17207. nextContext = parentInst._processChildContext(parentInst._context);
  17208. } else {
  17209. nextContext = emptyObject;
  17210. }
  17211. var prevComponent = getTopLevelWrapperInContainer(container);
  17212. if (prevComponent) {
  17213. var prevWrappedElement = prevComponent._currentElement;
  17214. var prevElement = prevWrappedElement.props.child;
  17215. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  17216. var publicInst = prevComponent._renderedComponent.getPublicInstance();
  17217. var updatedCallback = callback && function () {
  17218. callback.call(publicInst);
  17219. };
  17220. ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);
  17221. return publicInst;
  17222. } else {
  17223. ReactMount.unmountComponentAtNode(container);
  17224. }
  17225. }
  17226. var reactRootElement = getReactRootElementInContainer(container);
  17227. var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
  17228. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  17229. if (false) {
  17230. process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
  17231. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  17232. var rootElementSibling = reactRootElement;
  17233. while (rootElementSibling) {
  17234. if (internalGetID(rootElementSibling)) {
  17235. process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0;
  17236. break;
  17237. }
  17238. rootElementSibling = rootElementSibling.nextSibling;
  17239. }
  17240. }
  17241. }
  17242. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
  17243. var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();
  17244. if (callback) {
  17245. callback.call(component);
  17246. }
  17247. return component;
  17248. },
  17249. /**
  17250. * Renders a React component into the DOM in the supplied `container`.
  17251. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
  17252. *
  17253. * If the React component was previously rendered into `container`, this will
  17254. * perform an update on it and only mutate the DOM as necessary to reflect the
  17255. * latest React component.
  17256. *
  17257. * @param {ReactElement} nextElement Component element to render.
  17258. * @param {DOMElement} container DOM element to render into.
  17259. * @param {?function} callback function triggered on completion
  17260. * @return {ReactComponent} Component instance rendered in `container`.
  17261. */
  17262. render: function (nextElement, container, callback) {
  17263. return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
  17264. },
  17265. /**
  17266. * Unmounts and destroys the React component rendered in the `container`.
  17267. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
  17268. *
  17269. * @param {DOMElement} container DOM element containing a React component.
  17270. * @return {boolean} True if a component was found in and unmounted from
  17271. * `container`
  17272. */
  17273. unmountComponentAtNode: function (container) {
  17274. // Various parts of our code (such as ReactCompositeComponent's
  17275. // _renderValidatedComponent) assume that calls to render aren't nested;
  17276. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  17277. // render but we still don't expect to be in a render call here.)
  17278. false ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
  17279. !isValidContainer(container) ? false ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
  17280. if (false) {
  17281. process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by another copy of React.') : void 0;
  17282. }
  17283. var prevComponent = getTopLevelWrapperInContainer(container);
  17284. if (!prevComponent) {
  17285. // Check if the node being unmounted was rendered by React, but isn't a
  17286. // root node.
  17287. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  17288. // Check if the container itself is a React root node.
  17289. var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
  17290. if (false) {
  17291. process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
  17292. }
  17293. return false;
  17294. }
  17295. delete instancesByReactRootID[prevComponent._instance.rootID];
  17296. ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
  17297. return true;
  17298. },
  17299. _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
  17300. !isValidContainer(container) ? false ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;
  17301. if (shouldReuseMarkup) {
  17302. var rootElement = getReactRootElementInContainer(container);
  17303. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  17304. ReactDOMComponentTree.precacheNode(instance, rootElement);
  17305. return;
  17306. } else {
  17307. var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  17308. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  17309. var rootMarkup = rootElement.outerHTML;
  17310. rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
  17311. var normalizedMarkup = markup;
  17312. if (false) {
  17313. // because rootMarkup is retrieved from the DOM, various normalizations
  17314. // will have occurred which will not be present in `markup`. Here,
  17315. // insert markup into a <div> or <iframe> depending on the container
  17316. // type to perform the same normalizations before comparing.
  17317. var normalizer;
  17318. if (container.nodeType === ELEMENT_NODE_TYPE) {
  17319. normalizer = document.createElement('div');
  17320. normalizer.innerHTML = markup;
  17321. normalizedMarkup = normalizer.innerHTML;
  17322. } else {
  17323. normalizer = document.createElement('iframe');
  17324. document.body.appendChild(normalizer);
  17325. normalizer.contentDocument.write(markup);
  17326. normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
  17327. document.body.removeChild(normalizer);
  17328. }
  17329. }
  17330. var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
  17331. var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  17332. !(container.nodeType !== DOC_NODE_TYPE) ? false ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0;
  17333. if (false) {
  17334. process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0;
  17335. }
  17336. }
  17337. }
  17338. !(container.nodeType !== DOC_NODE_TYPE) ? false ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0;
  17339. if (transaction.useCreateElement) {
  17340. while (container.lastChild) {
  17341. container.removeChild(container.lastChild);
  17342. }
  17343. DOMLazyTree.insertTreeBefore(container, markup, null);
  17344. } else {
  17345. setInnerHTML(container, markup);
  17346. ReactDOMComponentTree.precacheNode(instance, container.firstChild);
  17347. }
  17348. if (false) {
  17349. var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
  17350. if (hostNode._debugID !== 0) {
  17351. ReactInstrumentation.debugTool.onHostOperation({
  17352. instanceID: hostNode._debugID,
  17353. type: 'mount',
  17354. payload: markup.toString()
  17355. });
  17356. }
  17357. }
  17358. }
  17359. };
  17360. module.exports = ReactMount;
  17361. /***/ }),
  17362. /* 87 */
  17363. /***/ (function(module, exports, __webpack_require__) {
  17364. "use strict";
  17365. /**
  17366. * Copyright 2013-present, Facebook, Inc.
  17367. * All rights reserved.
  17368. *
  17369. * This source code is licensed under the BSD-style license found in the
  17370. * LICENSE file in the root directory of this source tree. An additional grant
  17371. * of patent rights can be found in the PATENTS file in the same directory.
  17372. *
  17373. *
  17374. */
  17375. var _prodInvariant = __webpack_require__(2);
  17376. var React = __webpack_require__(21);
  17377. var invariant = __webpack_require__(0);
  17378. var ReactNodeTypes = {
  17379. HOST: 0,
  17380. COMPOSITE: 1,
  17381. EMPTY: 2,
  17382. getType: function (node) {
  17383. if (node === null || node === false) {
  17384. return ReactNodeTypes.EMPTY;
  17385. } else if (React.isValidElement(node)) {
  17386. if (typeof node.type === 'function') {
  17387. return ReactNodeTypes.COMPOSITE;
  17388. } else {
  17389. return ReactNodeTypes.HOST;
  17390. }
  17391. }
  17392. true ? false ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
  17393. }
  17394. };
  17395. module.exports = ReactNodeTypes;
  17396. /***/ }),
  17397. /* 88 */
  17398. /***/ (function(module, exports, __webpack_require__) {
  17399. "use strict";
  17400. /**
  17401. * Copyright 2013-present, Facebook, Inc.
  17402. * All rights reserved.
  17403. *
  17404. * This source code is licensed under the BSD-style license found in the
  17405. * LICENSE file in the root directory of this source tree. An additional grant
  17406. * of patent rights can be found in the PATENTS file in the same directory.
  17407. *
  17408. */
  17409. var ViewportMetrics = {
  17410. currentScrollLeft: 0,
  17411. currentScrollTop: 0,
  17412. refreshScrollValues: function (scrollPosition) {
  17413. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  17414. ViewportMetrics.currentScrollTop = scrollPosition.y;
  17415. }
  17416. };
  17417. module.exports = ViewportMetrics;
  17418. /***/ }),
  17419. /* 89 */
  17420. /***/ (function(module, exports, __webpack_require__) {
  17421. "use strict";
  17422. /**
  17423. * Copyright 2014-present, Facebook, Inc.
  17424. * All rights reserved.
  17425. *
  17426. * This source code is licensed under the BSD-style license found in the
  17427. * LICENSE file in the root directory of this source tree. An additional grant
  17428. * of patent rights can be found in the PATENTS file in the same directory.
  17429. *
  17430. *
  17431. */
  17432. var _prodInvariant = __webpack_require__(2);
  17433. var invariant = __webpack_require__(0);
  17434. /**
  17435. * Accumulates items that must not be null or undefined into the first one. This
  17436. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  17437. * API cleanness. Since `current` can be null before being passed in and not
  17438. * null after this function, make sure to assign it back to `current`:
  17439. *
  17440. * `a = accumulateInto(a, b);`
  17441. *
  17442. * This API should be sparingly used. Try `accumulate` for something cleaner.
  17443. *
  17444. * @return {*|array<*>} An accumulation of items.
  17445. */
  17446. function accumulateInto(current, next) {
  17447. !(next != null) ? false ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
  17448. if (current == null) {
  17449. return next;
  17450. }
  17451. // Both are not empty. Warning: Never call x.concat(y) when you are not
  17452. // certain that x is an Array (x could be a string with concat method).
  17453. if (Array.isArray(current)) {
  17454. if (Array.isArray(next)) {
  17455. current.push.apply(current, next);
  17456. return current;
  17457. }
  17458. current.push(next);
  17459. return current;
  17460. }
  17461. if (Array.isArray(next)) {
  17462. // A bit too dangerous to mutate `next`.
  17463. return [current].concat(next);
  17464. }
  17465. return [current, next];
  17466. }
  17467. module.exports = accumulateInto;
  17468. /***/ }),
  17469. /* 90 */
  17470. /***/ (function(module, exports, __webpack_require__) {
  17471. "use strict";
  17472. /**
  17473. * Copyright 2013-present, Facebook, Inc.
  17474. * All rights reserved.
  17475. *
  17476. * This source code is licensed under the BSD-style license found in the
  17477. * LICENSE file in the root directory of this source tree. An additional grant
  17478. * of patent rights can be found in the PATENTS file in the same directory.
  17479. *
  17480. *
  17481. */
  17482. /**
  17483. * @param {array} arr an "accumulation" of items which is either an Array or
  17484. * a single item. Useful when paired with the `accumulate` module. This is a
  17485. * simple utility that allows us to reason about a collection of items, but
  17486. * handling the case when there is exactly one item (and we do not need to
  17487. * allocate an array).
  17488. */
  17489. function forEachAccumulated(arr, cb, scope) {
  17490. if (Array.isArray(arr)) {
  17491. arr.forEach(cb, scope);
  17492. } else if (arr) {
  17493. cb.call(scope, arr);
  17494. }
  17495. }
  17496. module.exports = forEachAccumulated;
  17497. /***/ }),
  17498. /* 91 */
  17499. /***/ (function(module, exports, __webpack_require__) {
  17500. "use strict";
  17501. /**
  17502. * Copyright 2013-present, Facebook, Inc.
  17503. * All rights reserved.
  17504. *
  17505. * This source code is licensed under the BSD-style license found in the
  17506. * LICENSE file in the root directory of this source tree. An additional grant
  17507. * of patent rights can be found in the PATENTS file in the same directory.
  17508. *
  17509. */
  17510. var ReactNodeTypes = __webpack_require__(87);
  17511. function getHostComponentFromComposite(inst) {
  17512. var type;
  17513. while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
  17514. inst = inst._renderedComponent;
  17515. }
  17516. if (type === ReactNodeTypes.HOST) {
  17517. return inst._renderedComponent;
  17518. } else if (type === ReactNodeTypes.EMPTY) {
  17519. return null;
  17520. }
  17521. }
  17522. module.exports = getHostComponentFromComposite;
  17523. /***/ }),
  17524. /* 92 */
  17525. /***/ (function(module, exports, __webpack_require__) {
  17526. "use strict";
  17527. /**
  17528. * Copyright 2013-present, Facebook, Inc.
  17529. * All rights reserved.
  17530. *
  17531. * This source code is licensed under the BSD-style license found in the
  17532. * LICENSE file in the root directory of this source tree. An additional grant
  17533. * of patent rights can be found in the PATENTS file in the same directory.
  17534. *
  17535. */
  17536. var ExecutionEnvironment = __webpack_require__(9);
  17537. var contentKey = null;
  17538. /**
  17539. * Gets the key used to access text content on a DOM node.
  17540. *
  17541. * @return {?string} Key used to access text content.
  17542. * @internal
  17543. */
  17544. function getTextContentAccessor() {
  17545. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  17546. // Prefer textContent to innerText because many browsers support both but
  17547. // SVG <text> elements don't support innerText even when <div> does.
  17548. contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
  17549. }
  17550. return contentKey;
  17551. }
  17552. module.exports = getTextContentAccessor;
  17553. /***/ }),
  17554. /* 93 */
  17555. /***/ (function(module, exports, __webpack_require__) {
  17556. "use strict";
  17557. /**
  17558. * Copyright 2013-present, Facebook, Inc.
  17559. * All rights reserved.
  17560. *
  17561. * This source code is licensed under the BSD-style license found in the
  17562. * LICENSE file in the root directory of this source tree. An additional grant
  17563. * of patent rights can be found in the PATENTS file in the same directory.
  17564. *
  17565. */
  17566. var _prodInvariant = __webpack_require__(2),
  17567. _assign = __webpack_require__(3);
  17568. var ReactCompositeComponent = __webpack_require__(180);
  17569. var ReactEmptyComponent = __webpack_require__(82);
  17570. var ReactHostComponent = __webpack_require__(84);
  17571. var getNextDebugID = __webpack_require__(227);
  17572. var invariant = __webpack_require__(0);
  17573. var warning = __webpack_require__(1);
  17574. // To avoid a cyclic dependency, we create the final class in this module
  17575. var ReactCompositeComponentWrapper = function (element) {
  17576. this.construct(element);
  17577. };
  17578. _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, {
  17579. _instantiateReactComponent: instantiateReactComponent
  17580. });
  17581. function getDeclarationErrorAddendum(owner) {
  17582. if (owner) {
  17583. var name = owner.getName();
  17584. if (name) {
  17585. return ' Check the render method of `' + name + '`.';
  17586. }
  17587. }
  17588. return '';
  17589. }
  17590. /**
  17591. * Check if the type reference is a known internal type. I.e. not a user
  17592. * provided composite type.
  17593. *
  17594. * @param {function} type
  17595. * @return {boolean} Returns true if this is a valid internal type.
  17596. */
  17597. function isInternalComponentType(type) {
  17598. return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
  17599. }
  17600. /**
  17601. * Given a ReactNode, create an instance that will actually be mounted.
  17602. *
  17603. * @param {ReactNode} node
  17604. * @param {boolean} shouldHaveDebugID
  17605. * @return {object} A new instance of the element's constructor.
  17606. * @protected
  17607. */
  17608. function instantiateReactComponent(node, shouldHaveDebugID) {
  17609. var instance;
  17610. if (node === null || node === false) {
  17611. instance = ReactEmptyComponent.create(instantiateReactComponent);
  17612. } else if (typeof node === 'object') {
  17613. var element = node;
  17614. var type = element.type;
  17615. if (typeof type !== 'function' && typeof type !== 'string') {
  17616. var info = '';
  17617. if (false) {
  17618. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  17619. info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
  17620. }
  17621. }
  17622. info += getDeclarationErrorAddendum(element._owner);
  17623. true ? false ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0;
  17624. }
  17625. // Special case string values
  17626. if (typeof element.type === 'string') {
  17627. instance = ReactHostComponent.createInternalComponent(element);
  17628. } else if (isInternalComponentType(element.type)) {
  17629. // This is temporarily available for custom components that are not string
  17630. // representations. I.e. ART. Once those are updated to use the string
  17631. // representation, we can drop this code path.
  17632. instance = new element.type(element);
  17633. // We renamed this. Allow the old name for compat. :(
  17634. if (!instance.getHostNode) {
  17635. instance.getHostNode = instance.getNativeNode;
  17636. }
  17637. } else {
  17638. instance = new ReactCompositeComponentWrapper(element);
  17639. }
  17640. } else if (typeof node === 'string' || typeof node === 'number') {
  17641. instance = ReactHostComponent.createInstanceForText(node);
  17642. } else {
  17643. true ? false ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0;
  17644. }
  17645. if (false) {
  17646. process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0;
  17647. }
  17648. // These two fields are used by the DOM and ART diffing algorithms
  17649. // respectively. Instead of using expandos on components, we should be
  17650. // storing the state needed by the diffing algorithms elsewhere.
  17651. instance._mountIndex = 0;
  17652. instance._mountImage = null;
  17653. if (false) {
  17654. instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0;
  17655. }
  17656. // Internal instances should fully constructed at this point, so they should
  17657. // not get any new fields added to them at this point.
  17658. if (false) {
  17659. if (Object.preventExtensions) {
  17660. Object.preventExtensions(instance);
  17661. }
  17662. }
  17663. return instance;
  17664. }
  17665. module.exports = instantiateReactComponent;
  17666. /***/ }),
  17667. /* 94 */
  17668. /***/ (function(module, exports, __webpack_require__) {
  17669. "use strict";
  17670. /**
  17671. * Copyright 2013-present, Facebook, Inc.
  17672. * All rights reserved.
  17673. *
  17674. * This source code is licensed under the BSD-style license found in the
  17675. * LICENSE file in the root directory of this source tree. An additional grant
  17676. * of patent rights can be found in the PATENTS file in the same directory.
  17677. *
  17678. *
  17679. */
  17680. /**
  17681. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  17682. */
  17683. var supportedInputTypes = {
  17684. 'color': true,
  17685. 'date': true,
  17686. 'datetime': true,
  17687. 'datetime-local': true,
  17688. 'email': true,
  17689. 'month': true,
  17690. 'number': true,
  17691. 'password': true,
  17692. 'range': true,
  17693. 'search': true,
  17694. 'tel': true,
  17695. 'text': true,
  17696. 'time': true,
  17697. 'url': true,
  17698. 'week': true
  17699. };
  17700. function isTextInputElement(elem) {
  17701. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  17702. if (nodeName === 'input') {
  17703. return !!supportedInputTypes[elem.type];
  17704. }
  17705. if (nodeName === 'textarea') {
  17706. return true;
  17707. }
  17708. return false;
  17709. }
  17710. module.exports = isTextInputElement;
  17711. /***/ }),
  17712. /* 95 */
  17713. /***/ (function(module, exports, __webpack_require__) {
  17714. "use strict";
  17715. /**
  17716. * Copyright 2013-present, Facebook, Inc.
  17717. * All rights reserved.
  17718. *
  17719. * This source code is licensed under the BSD-style license found in the
  17720. * LICENSE file in the root directory of this source tree. An additional grant
  17721. * of patent rights can be found in the PATENTS file in the same directory.
  17722. *
  17723. */
  17724. var ExecutionEnvironment = __webpack_require__(9);
  17725. var escapeTextContentForBrowser = __webpack_require__(35);
  17726. var setInnerHTML = __webpack_require__(36);
  17727. /**
  17728. * Set the textContent property of a node, ensuring that whitespace is preserved
  17729. * even in IE8. innerText is a poor substitute for textContent and, among many
  17730. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  17731. * as it should.
  17732. *
  17733. * @param {DOMElement} node
  17734. * @param {string} text
  17735. * @internal
  17736. */
  17737. var setTextContent = function (node, text) {
  17738. if (text) {
  17739. var firstChild = node.firstChild;
  17740. if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) {
  17741. firstChild.nodeValue = text;
  17742. return;
  17743. }
  17744. }
  17745. node.textContent = text;
  17746. };
  17747. if (ExecutionEnvironment.canUseDOM) {
  17748. if (!('textContent' in document.documentElement)) {
  17749. setTextContent = function (node, text) {
  17750. if (node.nodeType === 3) {
  17751. node.nodeValue = text;
  17752. return;
  17753. }
  17754. setInnerHTML(node, escapeTextContentForBrowser(text));
  17755. };
  17756. }
  17757. }
  17758. module.exports = setTextContent;
  17759. /***/ }),
  17760. /* 96 */
  17761. /***/ (function(module, exports, __webpack_require__) {
  17762. "use strict";
  17763. /**
  17764. * Copyright 2013-present, Facebook, Inc.
  17765. * All rights reserved.
  17766. *
  17767. * This source code is licensed under the BSD-style license found in the
  17768. * LICENSE file in the root directory of this source tree. An additional grant
  17769. * of patent rights can be found in the PATENTS file in the same directory.
  17770. *
  17771. */
  17772. var _prodInvariant = __webpack_require__(2);
  17773. var ReactCurrentOwner = __webpack_require__(14);
  17774. var REACT_ELEMENT_TYPE = __webpack_require__(195);
  17775. var getIteratorFn = __webpack_require__(226);
  17776. var invariant = __webpack_require__(0);
  17777. var KeyEscapeUtils = __webpack_require__(53);
  17778. var warning = __webpack_require__(1);
  17779. var SEPARATOR = '.';
  17780. var SUBSEPARATOR = ':';
  17781. /**
  17782. * This is inlined from ReactElement since this file is shared between
  17783. * isomorphic and renderers. We could extract this to a
  17784. *
  17785. */
  17786. /**
  17787. * TODO: Test that a single child and an array with one item have the same key
  17788. * pattern.
  17789. */
  17790. var didWarnAboutMaps = false;
  17791. /**
  17792. * Generate a key string that identifies a component within a set.
  17793. *
  17794. * @param {*} component A component that could contain a manual key.
  17795. * @param {number} index Index that is used if a manual key is not provided.
  17796. * @return {string}
  17797. */
  17798. function getComponentKey(component, index) {
  17799. // Do some typechecking here since we call this blindly. We want to ensure
  17800. // that we don't block potential future ES APIs.
  17801. if (component && typeof component === 'object' && component.key != null) {
  17802. // Explicit key
  17803. return KeyEscapeUtils.escape(component.key);
  17804. }
  17805. // Implicit key determined by the index in the set
  17806. return index.toString(36);
  17807. }
  17808. /**
  17809. * @param {?*} children Children tree container.
  17810. * @param {!string} nameSoFar Name of the key path so far.
  17811. * @param {!function} callback Callback to invoke with each child found.
  17812. * @param {?*} traverseContext Used to pass information throughout the traversal
  17813. * process.
  17814. * @return {!number} The number of children in this subtree.
  17815. */
  17816. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  17817. var type = typeof children;
  17818. if (type === 'undefined' || type === 'boolean') {
  17819. // All of the above are perceived as null.
  17820. children = null;
  17821. }
  17822. if (children === null || type === 'string' || type === 'number' ||
  17823. // The following is inlined from ReactElement. This means we can optimize
  17824. // some checks. React Fiber also inlines this logic for similar purposes.
  17825. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  17826. callback(traverseContext, children,
  17827. // If it's the only child, treat the name as if it was wrapped in an array
  17828. // so that it's consistent if the number of children grows.
  17829. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  17830. return 1;
  17831. }
  17832. var child;
  17833. var nextName;
  17834. var subtreeCount = 0; // Count of children found in the current subtree.
  17835. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  17836. if (Array.isArray(children)) {
  17837. for (var i = 0; i < children.length; i++) {
  17838. child = children[i];
  17839. nextName = nextNamePrefix + getComponentKey(child, i);
  17840. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  17841. }
  17842. } else {
  17843. var iteratorFn = getIteratorFn(children);
  17844. if (iteratorFn) {
  17845. var iterator = iteratorFn.call(children);
  17846. var step;
  17847. if (iteratorFn !== children.entries) {
  17848. var ii = 0;
  17849. while (!(step = iterator.next()).done) {
  17850. child = step.value;
  17851. nextName = nextNamePrefix + getComponentKey(child, ii++);
  17852. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  17853. }
  17854. } else {
  17855. if (false) {
  17856. var mapsAsChildrenAddendum = '';
  17857. if (ReactCurrentOwner.current) {
  17858. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  17859. if (mapsAsChildrenOwnerName) {
  17860. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  17861. }
  17862. }
  17863. process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
  17864. didWarnAboutMaps = true;
  17865. }
  17866. // Iterator will provide entry [k,v] tuples rather than values.
  17867. while (!(step = iterator.next()).done) {
  17868. var entry = step.value;
  17869. if (entry) {
  17870. child = entry[1];
  17871. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  17872. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  17873. }
  17874. }
  17875. }
  17876. } else if (type === 'object') {
  17877. var addendum = '';
  17878. if (false) {
  17879. addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
  17880. if (children._isReactElement) {
  17881. addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
  17882. }
  17883. if (ReactCurrentOwner.current) {
  17884. var name = ReactCurrentOwner.current.getName();
  17885. if (name) {
  17886. addendum += ' Check the render method of `' + name + '`.';
  17887. }
  17888. }
  17889. }
  17890. var childrenString = String(children);
  17891. true ? false ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
  17892. }
  17893. }
  17894. return subtreeCount;
  17895. }
  17896. /**
  17897. * Traverses children that are typically specified as `props.children`, but
  17898. * might also be specified through attributes:
  17899. *
  17900. * - `traverseAllChildren(this.props.children, ...)`
  17901. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  17902. *
  17903. * The `traverseContext` is an optional argument that is passed through the
  17904. * entire traversal. It can be used to store accumulations or anything else that
  17905. * the callback might find relevant.
  17906. *
  17907. * @param {?*} children Children tree object.
  17908. * @param {!function} callback To invoke upon traversing each child.
  17909. * @param {?*} traverseContext Context for traversal.
  17910. * @return {!number} The number of children in this subtree.
  17911. */
  17912. function traverseAllChildren(children, callback, traverseContext) {
  17913. if (children == null) {
  17914. return 0;
  17915. }
  17916. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  17917. }
  17918. module.exports = traverseAllChildren;
  17919. /***/ }),
  17920. /* 97 */
  17921. /***/ (function(module, exports, __webpack_require__) {
  17922. "use strict";
  17923. /**
  17924. * Copyright 2016-present, Facebook, Inc.
  17925. * All rights reserved.
  17926. *
  17927. * This source code is licensed under the BSD-style license found in the
  17928. * LICENSE file in the root directory of this source tree. An additional grant
  17929. * of patent rights can be found in the PATENTS file in the same directory.
  17930. *
  17931. *
  17932. */
  17933. var _prodInvariant = __webpack_require__(23);
  17934. var ReactCurrentOwner = __webpack_require__(14);
  17935. var invariant = __webpack_require__(0);
  17936. var warning = __webpack_require__(1);
  17937. function isNative(fn) {
  17938. // Based on isNative() from Lodash
  17939. var funcToString = Function.prototype.toString;
  17940. var hasOwnProperty = Object.prototype.hasOwnProperty;
  17941. var reIsNative = RegExp('^' + funcToString
  17942. // Take an example native function source for comparison
  17943. .call(hasOwnProperty)
  17944. // Strip regex characters so we can use it for regex
  17945. .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
  17946. // Remove hasOwnProperty from the template to make it generic
  17947. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
  17948. try {
  17949. var source = funcToString.call(fn);
  17950. return reIsNative.test(source);
  17951. } catch (err) {
  17952. return false;
  17953. }
  17954. }
  17955. var canUseCollections =
  17956. // Array.from
  17957. typeof Array.from === 'function' &&
  17958. // Map
  17959. typeof Map === 'function' && isNative(Map) &&
  17960. // Map.prototype.keys
  17961. Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
  17962. // Set
  17963. typeof Set === 'function' && isNative(Set) &&
  17964. // Set.prototype.keys
  17965. Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
  17966. var setItem;
  17967. var getItem;
  17968. var removeItem;
  17969. var getItemIDs;
  17970. var addRoot;
  17971. var removeRoot;
  17972. var getRootIDs;
  17973. if (canUseCollections) {
  17974. var itemMap = new Map();
  17975. var rootIDSet = new Set();
  17976. setItem = function (id, item) {
  17977. itemMap.set(id, item);
  17978. };
  17979. getItem = function (id) {
  17980. return itemMap.get(id);
  17981. };
  17982. removeItem = function (id) {
  17983. itemMap['delete'](id);
  17984. };
  17985. getItemIDs = function () {
  17986. return Array.from(itemMap.keys());
  17987. };
  17988. addRoot = function (id) {
  17989. rootIDSet.add(id);
  17990. };
  17991. removeRoot = function (id) {
  17992. rootIDSet['delete'](id);
  17993. };
  17994. getRootIDs = function () {
  17995. return Array.from(rootIDSet.keys());
  17996. };
  17997. } else {
  17998. var itemByKey = {};
  17999. var rootByKey = {};
  18000. // Use non-numeric keys to prevent V8 performance issues:
  18001. // https://github.com/facebook/react/pull/7232
  18002. var getKeyFromID = function (id) {
  18003. return '.' + id;
  18004. };
  18005. var getIDFromKey = function (key) {
  18006. return parseInt(key.substr(1), 10);
  18007. };
  18008. setItem = function (id, item) {
  18009. var key = getKeyFromID(id);
  18010. itemByKey[key] = item;
  18011. };
  18012. getItem = function (id) {
  18013. var key = getKeyFromID(id);
  18014. return itemByKey[key];
  18015. };
  18016. removeItem = function (id) {
  18017. var key = getKeyFromID(id);
  18018. delete itemByKey[key];
  18019. };
  18020. getItemIDs = function () {
  18021. return Object.keys(itemByKey).map(getIDFromKey);
  18022. };
  18023. addRoot = function (id) {
  18024. var key = getKeyFromID(id);
  18025. rootByKey[key] = true;
  18026. };
  18027. removeRoot = function (id) {
  18028. var key = getKeyFromID(id);
  18029. delete rootByKey[key];
  18030. };
  18031. getRootIDs = function () {
  18032. return Object.keys(rootByKey).map(getIDFromKey);
  18033. };
  18034. }
  18035. var unmountedIDs = [];
  18036. function purgeDeep(id) {
  18037. var item = getItem(id);
  18038. if (item) {
  18039. var childIDs = item.childIDs;
  18040. removeItem(id);
  18041. childIDs.forEach(purgeDeep);
  18042. }
  18043. }
  18044. function describeComponentFrame(name, source, ownerName) {
  18045. return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
  18046. }
  18047. function getDisplayName(element) {
  18048. if (element == null) {
  18049. return '#empty';
  18050. } else if (typeof element === 'string' || typeof element === 'number') {
  18051. return '#text';
  18052. } else if (typeof element.type === 'string') {
  18053. return element.type;
  18054. } else {
  18055. return element.type.displayName || element.type.name || 'Unknown';
  18056. }
  18057. }
  18058. function describeID(id) {
  18059. var name = ReactComponentTreeHook.getDisplayName(id);
  18060. var element = ReactComponentTreeHook.getElement(id);
  18061. var ownerID = ReactComponentTreeHook.getOwnerID(id);
  18062. var ownerName;
  18063. if (ownerID) {
  18064. ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
  18065. }
  18066. false ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
  18067. return describeComponentFrame(name, element && element._source, ownerName);
  18068. }
  18069. var ReactComponentTreeHook = {
  18070. onSetChildren: function (id, nextChildIDs) {
  18071. var item = getItem(id);
  18072. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  18073. item.childIDs = nextChildIDs;
  18074. for (var i = 0; i < nextChildIDs.length; i++) {
  18075. var nextChildID = nextChildIDs[i];
  18076. var nextChild = getItem(nextChildID);
  18077. !nextChild ? false ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
  18078. !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? false ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0;
  18079. !nextChild.isMounted ? false ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
  18080. if (nextChild.parentID == null) {
  18081. nextChild.parentID = id;
  18082. // TODO: This shouldn't be necessary but mounting a new root during in
  18083. // componentWillMount currently causes not-yet-mounted components to
  18084. // be purged from our tree data so their parent id is missing.
  18085. }
  18086. !(nextChild.parentID === id) ? false ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0;
  18087. }
  18088. },
  18089. onBeforeMountComponent: function (id, element, parentID) {
  18090. var item = {
  18091. element: element,
  18092. parentID: parentID,
  18093. text: null,
  18094. childIDs: [],
  18095. isMounted: false,
  18096. updateCount: 0
  18097. };
  18098. setItem(id, item);
  18099. },
  18100. onBeforeUpdateComponent: function (id, element) {
  18101. var item = getItem(id);
  18102. if (!item || !item.isMounted) {
  18103. // We may end up here as a result of setState() in componentWillUnmount().
  18104. // In this case, ignore the element.
  18105. return;
  18106. }
  18107. item.element = element;
  18108. },
  18109. onMountComponent: function (id) {
  18110. var item = getItem(id);
  18111. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  18112. item.isMounted = true;
  18113. var isRoot = item.parentID === 0;
  18114. if (isRoot) {
  18115. addRoot(id);
  18116. }
  18117. },
  18118. onUpdateComponent: function (id) {
  18119. var item = getItem(id);
  18120. if (!item || !item.isMounted) {
  18121. // We may end up here as a result of setState() in componentWillUnmount().
  18122. // In this case, ignore the element.
  18123. return;
  18124. }
  18125. item.updateCount++;
  18126. },
  18127. onUnmountComponent: function (id) {
  18128. var item = getItem(id);
  18129. if (item) {
  18130. // We need to check if it exists.
  18131. // `item` might not exist if it is inside an error boundary, and a sibling
  18132. // error boundary child threw while mounting. Then this instance never
  18133. // got a chance to mount, but it still gets an unmounting event during
  18134. // the error boundary cleanup.
  18135. item.isMounted = false;
  18136. var isRoot = item.parentID === 0;
  18137. if (isRoot) {
  18138. removeRoot(id);
  18139. }
  18140. }
  18141. unmountedIDs.push(id);
  18142. },
  18143. purgeUnmountedComponents: function () {
  18144. if (ReactComponentTreeHook._preventPurging) {
  18145. // Should only be used for testing.
  18146. return;
  18147. }
  18148. for (var i = 0; i < unmountedIDs.length; i++) {
  18149. var id = unmountedIDs[i];
  18150. purgeDeep(id);
  18151. }
  18152. unmountedIDs.length = 0;
  18153. },
  18154. isMounted: function (id) {
  18155. var item = getItem(id);
  18156. return item ? item.isMounted : false;
  18157. },
  18158. getCurrentStackAddendum: function (topElement) {
  18159. var info = '';
  18160. if (topElement) {
  18161. var name = getDisplayName(topElement);
  18162. var owner = topElement._owner;
  18163. info += describeComponentFrame(name, topElement._source, owner && owner.getName());
  18164. }
  18165. var currentOwner = ReactCurrentOwner.current;
  18166. var id = currentOwner && currentOwner._debugID;
  18167. info += ReactComponentTreeHook.getStackAddendumByID(id);
  18168. return info;
  18169. },
  18170. getStackAddendumByID: function (id) {
  18171. var info = '';
  18172. while (id) {
  18173. info += describeID(id);
  18174. id = ReactComponentTreeHook.getParentID(id);
  18175. }
  18176. return info;
  18177. },
  18178. getChildIDs: function (id) {
  18179. var item = getItem(id);
  18180. return item ? item.childIDs : [];
  18181. },
  18182. getDisplayName: function (id) {
  18183. var element = ReactComponentTreeHook.getElement(id);
  18184. if (!element) {
  18185. return null;
  18186. }
  18187. return getDisplayName(element);
  18188. },
  18189. getElement: function (id) {
  18190. var item = getItem(id);
  18191. return item ? item.element : null;
  18192. },
  18193. getOwnerID: function (id) {
  18194. var element = ReactComponentTreeHook.getElement(id);
  18195. if (!element || !element._owner) {
  18196. return null;
  18197. }
  18198. return element._owner._debugID;
  18199. },
  18200. getParentID: function (id) {
  18201. var item = getItem(id);
  18202. return item ? item.parentID : null;
  18203. },
  18204. getSource: function (id) {
  18205. var item = getItem(id);
  18206. var element = item ? item.element : null;
  18207. var source = element != null ? element._source : null;
  18208. return source;
  18209. },
  18210. getText: function (id) {
  18211. var element = ReactComponentTreeHook.getElement(id);
  18212. if (typeof element === 'string') {
  18213. return element;
  18214. } else if (typeof element === 'number') {
  18215. return '' + element;
  18216. } else {
  18217. return null;
  18218. }
  18219. },
  18220. getUpdateCount: function (id) {
  18221. var item = getItem(id);
  18222. return item ? item.updateCount : 0;
  18223. },
  18224. getRootIDs: getRootIDs,
  18225. getRegisteredIDs: getItemIDs
  18226. };
  18227. module.exports = ReactComponentTreeHook;
  18228. /***/ }),
  18229. /* 98 */
  18230. /***/ (function(module, exports, __webpack_require__) {
  18231. "use strict";
  18232. /**
  18233. * Copyright 2014-present, Facebook, Inc.
  18234. * All rights reserved.
  18235. *
  18236. * This source code is licensed under the BSD-style license found in the
  18237. * LICENSE file in the root directory of this source tree. An additional grant
  18238. * of patent rights can be found in the PATENTS file in the same directory.
  18239. *
  18240. *
  18241. */
  18242. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  18243. // nor polyfill, then a plain number is used for performance.
  18244. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  18245. module.exports = REACT_ELEMENT_TYPE;
  18246. /***/ }),
  18247. /* 99 */
  18248. /***/ (function(module, exports, __webpack_require__) {
  18249. "use strict";
  18250. /**
  18251. * Copyright 2013-present, Facebook, Inc.
  18252. * All rights reserved.
  18253. *
  18254. * This source code is licensed under the BSD-style license found in the
  18255. * LICENSE file in the root directory of this source tree. An additional grant
  18256. * of patent rights can be found in the PATENTS file in the same directory.
  18257. *
  18258. *
  18259. */
  18260. var ReactPropTypeLocationNames = {};
  18261. if (false) {
  18262. ReactPropTypeLocationNames = {
  18263. prop: 'prop',
  18264. context: 'context',
  18265. childContext: 'child context'
  18266. };
  18267. }
  18268. module.exports = ReactPropTypeLocationNames;
  18269. /***/ }),
  18270. /* 100 */
  18271. /***/ (function(module, exports, __webpack_require__) {
  18272. "use strict";
  18273. /**
  18274. * Copyright 2013-present, Facebook, Inc.
  18275. * All rights reserved.
  18276. *
  18277. * This source code is licensed under the BSD-style license found in the
  18278. * LICENSE file in the root directory of this source tree. An additional grant
  18279. * of patent rights can be found in the PATENTS file in the same directory.
  18280. *
  18281. *
  18282. */
  18283. var canDefineProperty = false;
  18284. if (false) {
  18285. try {
  18286. // $FlowFixMe https://github.com/facebook/flow/issues/285
  18287. Object.defineProperty({}, 'x', { get: function () {} });
  18288. canDefineProperty = true;
  18289. } catch (x) {
  18290. // IE will fail on defineProperty
  18291. }
  18292. }
  18293. module.exports = canDefineProperty;
  18294. /***/ }),
  18295. /* 101 */
  18296. /***/ (function(module, exports, __webpack_require__) {
  18297. "use strict";
  18298. /**
  18299. * Copyright 2013-present, Facebook, Inc.
  18300. * All rights reserved.
  18301. *
  18302. * This source code is licensed under the BSD-style license found in the
  18303. * LICENSE file in the root directory of this source tree. An additional grant
  18304. * of patent rights can be found in the PATENTS file in the same directory.
  18305. *
  18306. *
  18307. */
  18308. /* global Symbol */
  18309. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  18310. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  18311. /**
  18312. * Returns the iterator method function contained on the iterable object.
  18313. *
  18314. * Be sure to invoke the function with the iterable as context:
  18315. *
  18316. * var iteratorFn = getIteratorFn(myIterable);
  18317. * if (iteratorFn) {
  18318. * var iterator = iteratorFn.call(myIterable);
  18319. * ...
  18320. * }
  18321. *
  18322. * @param {?object} maybeIterable
  18323. * @return {?function}
  18324. */
  18325. function getIteratorFn(maybeIterable) {
  18326. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  18327. if (typeof iteratorFn === 'function') {
  18328. return iteratorFn;
  18329. }
  18330. }
  18331. module.exports = getIteratorFn;
  18332. /***/ }),
  18333. /* 102 */
  18334. /***/ (function(module, exports, __webpack_require__) {
  18335. "use strict";
  18336. /**
  18337. * @author oldj
  18338. * @blog http://oldj.net
  18339. */
  18340. Object.defineProperty(exports, "__esModule", {
  18341. value: true
  18342. });
  18343. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  18344. var _react = __webpack_require__(7);
  18345. var _react2 = _interopRequireDefault(_react);
  18346. var _panel = __webpack_require__(151);
  18347. var _panel2 = _interopRequireDefault(_panel);
  18348. var _content = __webpack_require__(141);
  18349. var _content2 = _interopRequireDefault(_content);
  18350. var _sudo = __webpack_require__(146);
  18351. var _sudo2 = _interopRequireDefault(_sudo);
  18352. var _edit = __webpack_require__(143);
  18353. var _edit2 = _interopRequireDefault(_edit);
  18354. var _preferences = __webpack_require__(145);
  18355. var _preferences2 = _interopRequireDefault(_preferences);
  18356. var _Agent = __webpack_require__(4);
  18357. var _Agent2 = _interopRequireDefault(_Agent);
  18358. var _index = __webpack_require__(29);
  18359. __webpack_require__(105);
  18360. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18361. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18362. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  18363. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  18364. var App = function (_React$Component) {
  18365. _inherits(App, _React$Component);
  18366. function App(props) {
  18367. _classCallCheck(this, App);
  18368. var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props));
  18369. _this.state = {
  18370. list: [], // 用户的 hosts 列表
  18371. sys_hosts: {}, // 系统 hosts
  18372. current: {}, // 当前 hosts
  18373. lang: {}, // 语言
  18374. just_added_id: null
  18375. };
  18376. _this.is_dragging = false;
  18377. _this.loadHosts();
  18378. _Agent2.default.pact('getPref').then(function (pref) {
  18379. return pref.user_language || 'en';
  18380. }).then(function (l) {
  18381. _Agent2.default.pact('getLang', l).then(function (lang) {
  18382. _this.setState({ lang: lang });
  18383. });
  18384. });
  18385. (0, _index.reg)(_this);
  18386. _Agent2.default.on('drag_start', function () {
  18387. _this.is_dragging = true;
  18388. console.log('drag_start');
  18389. });
  18390. _Agent2.default.on('drag_end', function () {
  18391. _this.is_dragging = false;
  18392. console.log('drag_end');
  18393. });
  18394. setInterval(function () {
  18395. var list = _this.state.list;
  18396. if (_this.is_dragging || !list || list.length === 0) return;
  18397. console.log('checkNeedRemoteRefresh');
  18398. _Agent2.default.pact('checkNeedRemoteRefresh', list).then(function (list) {
  18399. if (!list) return;
  18400. _Agent2.default.emit('list_updated', list);
  18401. }).catch(function (e) {
  18402. console.log(e);
  18403. });
  18404. }, 60 * 1000);
  18405. return _this;
  18406. }
  18407. _createClass(App, [{
  18408. key: 'loadHosts',
  18409. value: function loadHosts() {
  18410. var _this2 = this;
  18411. _Agent2.default.pact('getHosts').then(function (data) {
  18412. var state = {
  18413. list: data.list,
  18414. sys_hosts: data.sys_hosts
  18415. };
  18416. var current = _this2.state.current;
  18417. state.current = data.list.find(function (item) {
  18418. return item.id === current.id;
  18419. }) || data.sys_hosts;
  18420. _this2.setState(state);
  18421. });
  18422. }
  18423. }, {
  18424. key: 'setCurrent',
  18425. value: function setCurrent(hosts) {
  18426. var _this3 = this;
  18427. if (hosts.is_sys) {
  18428. _Agent2.default.pact('getSysHosts').then(function (_hosts) {
  18429. _this3.setState({
  18430. sys_hosts: _hosts,
  18431. current: _hosts
  18432. });
  18433. });
  18434. } else {
  18435. this.setState({
  18436. current: hosts
  18437. });
  18438. }
  18439. }
  18440. }, {
  18441. key: 'toSave',
  18442. value: function toSave() {
  18443. var _this4 = this;
  18444. clearTimeout(this._t);
  18445. this._t = setTimeout(function () {
  18446. _Agent2.default.emit('save', _this4.state.list);
  18447. }, 1000);
  18448. }
  18449. }, {
  18450. key: 'setHostsContent',
  18451. value: function setHostsContent(v) {
  18452. if (this.state.current.content === v) return; // not changed
  18453. this.state.current.content = v || '';
  18454. this.toSave();
  18455. }
  18456. }, {
  18457. key: 'justAdd',
  18458. value: function justAdd(id) {
  18459. this.setState({
  18460. just_added_id: id
  18461. });
  18462. }
  18463. }, {
  18464. key: 'componentDidMount',
  18465. value: function componentDidMount() {
  18466. window.addEventListener('keydown', function (e) {
  18467. if (e.keyCode === 27) {
  18468. _Agent2.default.emit('esc');
  18469. }
  18470. }, false);
  18471. window.addEventListener('mouseup', function () {
  18472. _Agent2.default.emit('drag_end');
  18473. });
  18474. }
  18475. }, {
  18476. key: 'render',
  18477. value: function render() {
  18478. var current = this.state.current;
  18479. return _react2.default.createElement(
  18480. 'div',
  18481. { id: 'app', className: 'platform-' + _Agent2.default.platform },
  18482. _react2.default.createElement(_panel2.default, {
  18483. list: this.state.list,
  18484. sys_hosts: this.state.sys_hosts,
  18485. current: current,
  18486. setCurrent: this.setCurrent.bind(this),
  18487. lang: this.state.lang,
  18488. just_added_id: this.state.just_added_id,
  18489. justAdd: this.justAdd.bind(this)
  18490. }),
  18491. _react2.default.createElement(_content2.default, {
  18492. current: current,
  18493. readonly: App.isReadOnly(current),
  18494. setHostsContent: this.setHostsContent.bind(this),
  18495. lang: this.state.lang
  18496. }),
  18497. _react2.default.createElement(
  18498. 'div',
  18499. { className: 'frames' },
  18500. _react2.default.createElement(_sudo2.default, { lang: this.state.lang }),
  18501. _react2.default.createElement(_edit2.default, {
  18502. lang: this.state.lang,
  18503. list: this.state.list,
  18504. justAdd: this.justAdd.bind(this)
  18505. }),
  18506. _react2.default.createElement(_preferences2.default, {
  18507. lang: this.state.lang
  18508. })
  18509. )
  18510. );
  18511. }
  18512. }], [{
  18513. key: 'isReadOnly',
  18514. value: function isReadOnly(hosts) {
  18515. return !hosts || hosts.is_sys || hosts.where === 'remote' || hosts.where === 'group';
  18516. }
  18517. }]);
  18518. return App;
  18519. }(_react2.default.Component);
  18520. exports.default = App;
  18521. /***/ }),
  18522. /* 103 */
  18523. /***/ (function(module, exports, __webpack_require__) {
  18524. "use strict";
  18525. module.exports = __webpack_require__(181);
  18526. /***/ }),
  18527. /* 104 */
  18528. /***/ (function(module, exports) {
  18529. /**
  18530. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  18531. * embed the css on the page. This breaks all relative urls because now they are relative to a
  18532. * bundle instead of the current page.
  18533. *
  18534. * One solution is to only use full urls, but that may be impossible.
  18535. *
  18536. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  18537. *
  18538. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  18539. *
  18540. */
  18541. module.exports = function (css) {
  18542. // get current location
  18543. var location = typeof window !== "undefined" && window.location;
  18544. if (!location) {
  18545. throw new Error("fixUrls requires window.location");
  18546. }
  18547. // blank or null?
  18548. if (!css || typeof css !== "string") {
  18549. return css;
  18550. }
  18551. var baseUrl = location.protocol + "//" + location.host;
  18552. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  18553. // convert each url(...)
  18554. /*
  18555. This regular expression is just a way to recursively match brackets within
  18556. a string.
  18557. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  18558. ( = Start a capturing group
  18559. (?: = Start a non-capturing group
  18560. [^)(] = Match anything that isn't a parentheses
  18561. | = OR
  18562. \( = Match a start parentheses
  18563. (?: = Start another non-capturing groups
  18564. [^)(]+ = Match anything that isn't a parentheses
  18565. | = OR
  18566. \( = Match a start parentheses
  18567. [^)(]* = Match anything that isn't a parentheses
  18568. \) = Match a end parentheses
  18569. ) = End Group
  18570. *\) = Match anything and then a close parens
  18571. ) = Close non-capturing group
  18572. * = Match anything
  18573. ) = Close capturing group
  18574. \) = Match a close parens
  18575. /gi = Get all matches, not the first. Be case insensitive.
  18576. */
  18577. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  18578. // strip quotes (if they exist)
  18579. var unquotedOrigUrl = origUrl
  18580. .trim()
  18581. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  18582. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  18583. // already a full url? no change
  18584. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) {
  18585. return fullMatch;
  18586. }
  18587. // convert the url to a full url
  18588. var newUrl;
  18589. if (unquotedOrigUrl.indexOf("//") === 0) {
  18590. //TODO: should we add protocol?
  18591. newUrl = unquotedOrigUrl;
  18592. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  18593. // path should be relative to the base url
  18594. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  18595. } else {
  18596. // path should be relative to current directory
  18597. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  18598. }
  18599. // send back the fixed url(...)
  18600. return "url(" + JSON.stringify(newUrl) + ")";
  18601. });
  18602. // send back the fixed css
  18603. return fixedCss;
  18604. };
  18605. /***/ }),
  18606. /* 105 */
  18607. /***/ (function(module, exports, __webpack_require__) {
  18608. // style-loader: Adds some css to the DOM by adding a <style> tag
  18609. // load the styles
  18610. var content = __webpack_require__(119);
  18611. if(typeof content === 'string') content = [[module.i, content, '']];
  18612. // add the styles to the DOM
  18613. var update = __webpack_require__(8)(content, {});
  18614. if(content.locals) module.exports = content.locals;
  18615. // Hot Module Replacement
  18616. if(false) {
  18617. // When the styles change, update the <style> tags
  18618. if(!content.locals) {
  18619. module.hot.accept("!!../node_modules/.0.26.4@css-loader/index.js!../node_modules/.4.0.2@less-loader/dist/index.js!./app.less", function() {
  18620. var newContent = require("!!../node_modules/.0.26.4@css-loader/index.js!../node_modules/.4.0.2@less-loader/dist/index.js!./app.less");
  18621. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18622. update(newContent);
  18623. });
  18624. }
  18625. // When the module is disposed, remove the <style> tags
  18626. module.hot.dispose(function() { update(); });
  18627. }
  18628. /***/ }),
  18629. /* 106 */
  18630. /***/ (function(module, exports, __webpack_require__) {
  18631. // style-loader: Adds some css to the DOM by adding a <style> tag
  18632. // load the styles
  18633. var content = __webpack_require__(120);
  18634. if(typeof content === 'string') content = [[module.i, content, '']];
  18635. // add the styles to the DOM
  18636. var update = __webpack_require__(8)(content, {});
  18637. if(content.locals) module.exports = content.locals;
  18638. // Hot Module Replacement
  18639. if(false) {
  18640. // When the styles change, update the <style> tags
  18641. if(!content.locals) {
  18642. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./content.less", function() {
  18643. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./content.less");
  18644. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18645. update(newContent);
  18646. });
  18647. }
  18648. // When the module is disposed, remove the <style> tags
  18649. module.hot.dispose(function() { update(); });
  18650. }
  18651. /***/ }),
  18652. /* 107 */
  18653. /***/ (function(module, exports, __webpack_require__) {
  18654. // style-loader: Adds some css to the DOM by adding a <style> tag
  18655. // load the styles
  18656. var content = __webpack_require__(121);
  18657. if(typeof content === 'string') content = [[module.i, content, '']];
  18658. // add the styles to the DOM
  18659. var update = __webpack_require__(8)(content, {});
  18660. if(content.locals) module.exports = content.locals;
  18661. // Hot Module Replacement
  18662. if(false) {
  18663. // When the styles change, update the <style> tags
  18664. if(!content.locals) {
  18665. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./editor.less", function() {
  18666. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./editor.less");
  18667. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18668. update(newContent);
  18669. });
  18670. }
  18671. // When the module is disposed, remove the <style> tags
  18672. module.hot.dispose(function() { update(); });
  18673. }
  18674. /***/ }),
  18675. /* 108 */
  18676. /***/ (function(module, exports, __webpack_require__) {
  18677. // style-loader: Adds some css to the DOM by adding a <style> tag
  18678. // load the styles
  18679. var content = __webpack_require__(122);
  18680. if(typeof content === 'string') content = [[module.i, content, '']];
  18681. // add the styles to the DOM
  18682. var update = __webpack_require__(8)(content, {});
  18683. if(content.locals) module.exports = content.locals;
  18684. // Hot Module Replacement
  18685. if(false) {
  18686. // When the styles change, update the <style> tags
  18687. if(!content.locals) {
  18688. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./edit.less", function() {
  18689. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./edit.less");
  18690. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18691. update(newContent);
  18692. });
  18693. }
  18694. // When the module is disposed, remove the <style> tags
  18695. module.hot.dispose(function() { update(); });
  18696. }
  18697. /***/ }),
  18698. /* 109 */
  18699. /***/ (function(module, exports, __webpack_require__) {
  18700. // style-loader: Adds some css to the DOM by adding a <style> tag
  18701. // load the styles
  18702. var content = __webpack_require__(123);
  18703. if(typeof content === 'string') content = [[module.i, content, '']];
  18704. // add the styles to the DOM
  18705. var update = __webpack_require__(8)(content, {});
  18706. if(content.locals) module.exports = content.locals;
  18707. // Hot Module Replacement
  18708. if(false) {
  18709. // When the styles change, update the <style> tags
  18710. if(!content.locals) {
  18711. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./frame.less", function() {
  18712. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./frame.less");
  18713. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18714. update(newContent);
  18715. });
  18716. }
  18717. // When the module is disposed, remove the <style> tags
  18718. module.hot.dispose(function() { update(); });
  18719. }
  18720. /***/ }),
  18721. /* 110 */
  18722. /***/ (function(module, exports, __webpack_require__) {
  18723. // style-loader: Adds some css to the DOM by adding a <style> tag
  18724. // load the styles
  18725. var content = __webpack_require__(124);
  18726. if(typeof content === 'string') content = [[module.i, content, '']];
  18727. // add the styles to the DOM
  18728. var update = __webpack_require__(8)(content, {});
  18729. if(content.locals) module.exports = content.locals;
  18730. // Hot Module Replacement
  18731. if(false) {
  18732. // When the styles change, update the <style> tags
  18733. if(!content.locals) {
  18734. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./group.less", function() {
  18735. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./group.less");
  18736. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18737. update(newContent);
  18738. });
  18739. }
  18740. // When the module is disposed, remove the <style> tags
  18741. module.hot.dispose(function() { update(); });
  18742. }
  18743. /***/ }),
  18744. /* 111 */
  18745. /***/ (function(module, exports, __webpack_require__) {
  18746. // style-loader: Adds some css to the DOM by adding a <style> tag
  18747. // load the styles
  18748. var content = __webpack_require__(125);
  18749. if(typeof content === 'string') content = [[module.i, content, '']];
  18750. // add the styles to the DOM
  18751. var update = __webpack_require__(8)(content, {});
  18752. if(content.locals) module.exports = content.locals;
  18753. // Hot Module Replacement
  18754. if(false) {
  18755. // When the styles change, update the <style> tags
  18756. if(!content.locals) {
  18757. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./preferences.less", function() {
  18758. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./preferences.less");
  18759. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18760. update(newContent);
  18761. });
  18762. }
  18763. // When the module is disposed, remove the <style> tags
  18764. module.hot.dispose(function() { update(); });
  18765. }
  18766. /***/ }),
  18767. /* 112 */
  18768. /***/ (function(module, exports, __webpack_require__) {
  18769. // style-loader: Adds some css to the DOM by adding a <style> tag
  18770. // load the styles
  18771. var content = __webpack_require__(126);
  18772. if(typeof content === 'string') content = [[module.i, content, '']];
  18773. // add the styles to the DOM
  18774. var update = __webpack_require__(8)(content, {});
  18775. if(content.locals) module.exports = content.locals;
  18776. // Hot Module Replacement
  18777. if(false) {
  18778. // When the styles change, update the <style> tags
  18779. if(!content.locals) {
  18780. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./sudo.less", function() {
  18781. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./sudo.less");
  18782. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18783. update(newContent);
  18784. });
  18785. }
  18786. // When the module is disposed, remove the <style> tags
  18787. module.hot.dispose(function() { update(); });
  18788. }
  18789. /***/ }),
  18790. /* 113 */
  18791. /***/ (function(module, exports, __webpack_require__) {
  18792. // style-loader: Adds some css to the DOM by adding a <style> tag
  18793. // load the styles
  18794. var content = __webpack_require__(127);
  18795. if(typeof content === 'string') content = [[module.i, content, '']];
  18796. // add the styles to the DOM
  18797. var update = __webpack_require__(8)(content, {});
  18798. if(content.locals) module.exports = content.locals;
  18799. // Hot Module Replacement
  18800. if(false) {
  18801. // When the styles change, update the <style> tags
  18802. if(!content.locals) {
  18803. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./buttons.less", function() {
  18804. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./buttons.less");
  18805. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18806. update(newContent);
  18807. });
  18808. }
  18809. // When the module is disposed, remove the <style> tags
  18810. module.hot.dispose(function() { update(); });
  18811. }
  18812. /***/ }),
  18813. /* 114 */
  18814. /***/ (function(module, exports, __webpack_require__) {
  18815. // style-loader: Adds some css to the DOM by adding a <style> tag
  18816. // load the styles
  18817. var content = __webpack_require__(128);
  18818. if(typeof content === 'string') content = [[module.i, content, '']];
  18819. // add the styles to the DOM
  18820. var update = __webpack_require__(8)(content, {});
  18821. if(content.locals) module.exports = content.locals;
  18822. // Hot Module Replacement
  18823. if(false) {
  18824. // When the styles change, update the <style> tags
  18825. if(!content.locals) {
  18826. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./list-item.less", function() {
  18827. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./list-item.less");
  18828. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18829. update(newContent);
  18830. });
  18831. }
  18832. // When the module is disposed, remove the <style> tags
  18833. module.hot.dispose(function() { update(); });
  18834. }
  18835. /***/ }),
  18836. /* 115 */
  18837. /***/ (function(module, exports, __webpack_require__) {
  18838. // style-loader: Adds some css to the DOM by adding a <style> tag
  18839. // load the styles
  18840. var content = __webpack_require__(129);
  18841. if(typeof content === 'string') content = [[module.i, content, '']];
  18842. // add the styles to the DOM
  18843. var update = __webpack_require__(8)(content, {});
  18844. if(content.locals) module.exports = content.locals;
  18845. // Hot Module Replacement
  18846. if(false) {
  18847. // When the styles change, update the <style> tags
  18848. if(!content.locals) {
  18849. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./list.less", function() {
  18850. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./list.less");
  18851. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18852. update(newContent);
  18853. });
  18854. }
  18855. // When the module is disposed, remove the <style> tags
  18856. module.hot.dispose(function() { update(); });
  18857. }
  18858. /***/ }),
  18859. /* 116 */
  18860. /***/ (function(module, exports, __webpack_require__) {
  18861. // style-loader: Adds some css to the DOM by adding a <style> tag
  18862. // load the styles
  18863. var content = __webpack_require__(130);
  18864. if(typeof content === 'string') content = [[module.i, content, '']];
  18865. // add the styles to the DOM
  18866. var update = __webpack_require__(8)(content, {});
  18867. if(content.locals) module.exports = content.locals;
  18868. // Hot Module Replacement
  18869. if(false) {
  18870. // When the styles change, update the <style> tags
  18871. if(!content.locals) {
  18872. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./panel.less", function() {
  18873. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./panel.less");
  18874. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18875. update(newContent);
  18876. });
  18877. }
  18878. // When the module is disposed, remove the <style> tags
  18879. module.hot.dispose(function() { update(); });
  18880. }
  18881. /***/ }),
  18882. /* 117 */
  18883. /***/ (function(module, exports, __webpack_require__) {
  18884. // style-loader: Adds some css to the DOM by adding a <style> tag
  18885. // load the styles
  18886. var content = __webpack_require__(131);
  18887. if(typeof content === 'string') content = [[module.i, content, '']];
  18888. // add the styles to the DOM
  18889. var update = __webpack_require__(8)(content, {});
  18890. if(content.locals) module.exports = content.locals;
  18891. // Hot Module Replacement
  18892. if(false) {
  18893. // When the styles change, update the <style> tags
  18894. if(!content.locals) {
  18895. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./searchbar.less", function() {
  18896. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./searchbar.less");
  18897. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18898. update(newContent);
  18899. });
  18900. }
  18901. // When the module is disposed, remove the <style> tags
  18902. module.hot.dispose(function() { update(); });
  18903. }
  18904. /***/ }),
  18905. /* 118 */
  18906. /***/ (function(module, exports, __webpack_require__) {
  18907. // style-loader: Adds some css to the DOM by adding a <style> tag
  18908. // load the styles
  18909. var content = __webpack_require__(132);
  18910. if(typeof content === 'string') content = [[module.i, content, '']];
  18911. // add the styles to the DOM
  18912. var update = __webpack_require__(8)(content, {});
  18913. if(content.locals) module.exports = content.locals;
  18914. // Hot Module Replacement
  18915. if(false) {
  18916. // When the styles change, update the <style> tags
  18917. if(!content.locals) {
  18918. module.hot.accept("!!../../../../node_modules/.0.26.4@css-loader/index.js!./codemirror.css", function() {
  18919. var newContent = require("!!../../../../node_modules/.0.26.4@css-loader/index.js!./codemirror.css");
  18920. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18921. update(newContent);
  18922. });
  18923. }
  18924. // When the module is disposed, remove the <style> tags
  18925. module.hot.dispose(function() { update(); });
  18926. }
  18927. /***/ }),
  18928. /* 119 */
  18929. /***/ (function(module, exports, __webpack_require__) {
  18930. exports = module.exports = __webpack_require__(6)();
  18931. // imports
  18932. // module
  18933. exports.push([module.i, "html,\nbody {\n margin: 0;\n padding: 0;\n height: 100%;\n font-size: 12px;\n font-family: Arial, Helvetica, sans-serif;\n color: #212121;\n line-height: 20px;\n background: #fff;\n}\na {\n text-decoration: none;\n}\n#app {\n height: 100%;\n}\n", ""]);
  18934. // exports
  18935. /***/ }),
  18936. /* 120 */
  18937. /***/ (function(module, exports, __webpack_require__) {
  18938. exports = module.exports = __webpack_require__(6)();
  18939. // imports
  18940. // module
  18941. exports.push([module.i, "#sh-content {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 240px;\n height: 100%;\n}\n#sh-content .inform {\n position: absolute;\n z-index: 100;\n top: 5px;\n right: 10px;\n opacity: 0.5;\n background: #fff;\n}\n#sh-content .inform i {\n display: none;\n color: #666;\n margin-left: 5px;\n}\n#sh-content .inform i.show {\n display: inline-block;\n}\n#sh-content .inform span {\n display: none;\n}\n#sh-content .inform span.show {\n display: inline-block;\n}\n#sh-content .errorMessage {\n display: none;\n position: absolute;\n z-index: 101;\n top: 0;\n left: 0;\n right: 0;\n padding: 4px 40px;\n text-align: center;\n background: rgba(153, 0, 0, 0.5);\n color: #fff;\n transition: 0.5s;\n}\n#sh-content .errorMessage.show {\n display: block;\n}\n.platform-win32 #sh-content .inform {\n right: 20px;\n}\n", ""]);
  18942. // exports
  18943. /***/ }),
  18944. /* 121 */
  18945. /***/ (function(module, exports, __webpack_require__) {
  18946. exports = module.exports = __webpack_require__(6)();
  18947. // imports
  18948. // module
  18949. exports.push([module.i, "#sh-editor {\n height: 100%;\n font-family: Menlo, \"Source Code Pro\", Monaco, \"Courier New\", sans-serif;\n}\n#sh-editor .cm-s-default .cm-comment {\n color: #090;\n}\n#sh-editor .cm-s-default .cm-ip {\n color: #00a;\n font-weight: bold;\n}\n#sh-editor .cm-s-default .cm-hl {\n background: #ff0;\n}\n#sh-editor .CodeMirror-gutters {\n border-right: none;\n padding-right: 6px;\n}\n#sh-editor .CodeMirror-linenumber {\n cursor: pointer;\n}\n#sh-editor.readonly .CodeMirror .CodeMirror-linenumber {\n cursor: default;\n}\n#sh-editor.readonly .CodeMirror .CodeMirror-cursors {\n display: none;\n}\n", ""]);
  18950. // exports
  18951. /***/ }),
  18952. /* 122 */
  18953. /***/ (function(module, exports, __webpack_require__) {
  18954. exports = module.exports = __webpack_require__(6)();
  18955. // imports
  18956. // module
  18957. exports.push([module.i, "@keyframes loading {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n.frame label {\n padding: 0 4em 0 0.5em;\n}\n.frame .spiner {\n transform-origin: right center;\n animation: spin 1s;\n animation-iteration-count: 1;\n -webkit-animation-iteration-count: 1;\n}\n.frame .ln i.icon-refresh {\n display: inline-block;\n color: #999;\n margin: 0 5px;\n cursor: pointer;\n width: 20px;\n height: 20px;\n overflow: hidden;\n text-align: center;\n line-height: 20px;\n vertical-align: middle;\n}\n.frame .ln i.icon-refresh:hover {\n color: #333;\n}\n.frame .ln i.icon-refresh.loading {\n animation: loading 1s infinite linear;\n}\n.frame .ln i.icon-refresh.invisible {\n visibility: hidden;\n}\n.frame .last-refresh {\n color: #999;\n}\n.frame a.del {\n color: red;\n}\n.frame a.del span {\n padding-left: 0.5em;\n}\n", ""]);
  18958. // exports
  18959. /***/ }),
  18960. /* 123 */
  18961. /***/ (function(module, exports, __webpack_require__) {
  18962. exports = module.exports = __webpack_require__(6)();
  18963. // imports
  18964. // module
  18965. exports.push([module.i, ".frame {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.frame .overlay {\n position: absolute;\n z-index: -1;\n width: 100%;\n height: 100%;\n background: #000;\n opacity: 0.5;\n}\n.frame .prompt {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n min-width: 300px;\n max-width: 600px;\n background: #fff;\n box-shadow: 0 0 4px 4px rgba(0, 0, 0, 0.1);\n}\n.frame .prompt .head {\n padding: 20px;\n font-size: 16px;\n background: #f5f5f5;\n}\n.frame .prompt .body {\n padding: 20px 20px;\n}\n.frame .prompt .body .ln {\n line-height: 30px;\n padding: 2px 0;\n}\n.frame .prompt .body .ln .title {\n float: left;\n width: 100px;\n line-height: 24px;\n}\n.frame .prompt .body .ln .cnt {\n margin-left: 100px;\n line-height: 24px;\n}\n.frame .prompt .body .ln .cnt input[type=text] {\n width: 240px;\n outline: none;\n padding: 6px 10px;\n}\n.frame .prompt .body .ln .cnt textarea {\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\n}\n.frame .prompt .body .ln .inform {\n color: #999;\n line-height: 24px;\n}\n.frame .prompt .body input {\n padding: 6px 4px;\n}\n.frame .prompt .body input[type=password] {\n letter-spacing: 8px;\n width: 240px;\n outline: none;\n padding: 6px 10px;\n}\n.frame .prompt .foot {\n padding: 20px;\n background: #f5f5f5;\n text-align: right;\n}\n.frame .prompt .foot .button {\n display: inline-block;\n background: #ccc;\n padding: 8px 20px;\n margin-left: 1em;\n cursor: pointer;\n}\n.frame .prompt .foot .button:hover {\n background: #ddd;\n}\n.frame .prompt .foot .button.btn-default {\n background: #05a;\n color: #fff;\n}\n.frame .prompt .foot .button.btn-default:hover {\n background: #0077ee;\n}\n", ""]);
  18966. // exports
  18967. /***/ }),
  18968. /* 124 */
  18969. /***/ (function(module, exports, __webpack_require__) {
  18970. exports = module.exports = __webpack_require__(6)();
  18971. // imports
  18972. // module
  18973. exports.push([module.i, "#hosts-group {\n position: relative;\n margin-top: 20px;\n height: 162px;\n overflow: auto;\n}\n#hosts-group::after {\n content: '';\n clear: both;\n}\n#hosts-group .arrow {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 20px;\n height: 20px;\n line-height: 20px;\n text-align: center;\n transform: translate(-50%, -50%);\n}\n#hosts-group .arrow::after {\n content: '\\2192';\n}\n#hosts-group .hosts-group-list {\n height: 160px;\n overflow: auto;\n border: solid 1px #ccc;\n}\n#hosts-group .hosts-group-list .hosts-item {\n cursor: move;\n padding: 2px 6px;\n}\n#hosts-group .hosts-group-list .hosts-item:hover {\n background: #f5f5f5;\n}\n#hosts-group .hosts-group-list .hosts-item i {\n font-size: 12px;\n color: #999;\n}\n#hosts-group .hosts-group-list .hosts-item > span {\n padding-left: 6px;\n}\n#hosts-group-valid {\n width: 45%;\n float: left;\n}\n#hosts-group-current {\n width: 45%;\n float: right;\n}\n", ""]);
  18974. // exports
  18975. /***/ }),
  18976. /* 125 */
  18977. /***/ (function(module, exports, __webpack_require__) {
  18978. exports = module.exports = __webpack_require__(6)();
  18979. // imports
  18980. // module
  18981. exports.push([module.i, ".frame textarea {\n width: 300px;\n height: 80px;\n padding: 2px 4px;\n outline: none;\n border: solid 1px #ccc;\n}\n.frame .current-version {\n float: right;\n margin-top: -60px;\n color: #999;\n}\n.frame .current-version a {\n color: #999;\n}\n.frame .current-version a:hover {\n color: #000;\n}\n.frame .current-version.update-found:after {\n content: '';\n display: block;\n float: right;\n width: 6px;\n height: 6px;\n background: #f00;\n border-radius: 3px;\n}\n", ""]);
  18982. // exports
  18983. /***/ }),
  18984. /* 126 */
  18985. /***/ (function(module, exports, __webpack_require__) {
  18986. exports = module.exports = __webpack_require__(6)();
  18987. // imports
  18988. // module
  18989. exports.push([module.i, ".frame {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.frame .overlay {\n position: absolute;\n z-index: -1;\n width: 100%;\n height: 100%;\n background: #000;\n opacity: 0.5;\n}\n.frame .prompt {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n min-width: 300px;\n max-width: 600px;\n background: #fff;\n box-shadow: 0 0 4px 4px rgba(0, 0, 0, 0.1);\n}\n.frame .prompt .head {\n padding: 20px;\n font-size: 16px;\n background: #f5f5f5;\n}\n.frame .prompt .body {\n padding: 20px 20px;\n}\n.frame .prompt .body .ln {\n line-height: 30px;\n padding: 2px 0;\n}\n.frame .prompt .body .ln .title {\n float: left;\n width: 100px;\n line-height: 24px;\n}\n.frame .prompt .body .ln .cnt {\n margin-left: 100px;\n line-height: 24px;\n}\n.frame .prompt .body .ln .cnt input[type=text] {\n width: 240px;\n outline: none;\n padding: 6px 10px;\n}\n.frame .prompt .body .ln .cnt textarea {\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\n}\n.frame .prompt .body .ln .inform {\n color: #999;\n line-height: 24px;\n}\n.frame .prompt .body input {\n padding: 6px 4px;\n}\n.frame .prompt .body input[type=password] {\n letter-spacing: 8px;\n width: 240px;\n outline: none;\n padding: 6px 10px;\n}\n.frame .prompt .foot {\n padding: 20px;\n background: #f5f5f5;\n text-align: right;\n}\n.frame .prompt .foot .button {\n display: inline-block;\n background: #ccc;\n padding: 8px 20px;\n margin-left: 1em;\n cursor: pointer;\n}\n.frame .prompt .foot .button:hover {\n background: #ddd;\n}\n.frame .prompt .foot .button.btn-default {\n background: #05a;\n color: #fff;\n}\n.frame .prompt .foot .button.btn-default:hover {\n background: #0077ee;\n}\n.frame .prompt {\n width: 480px;\n}\n", ""]);
  18990. // exports
  18991. /***/ }),
  18992. /* 127 */
  18993. /***/ (function(module, exports, __webpack_require__) {
  18994. exports = module.exports = __webpack_require__(6)();
  18995. // imports
  18996. // module
  18997. exports.push([module.i, "#sh-buttons {\n position: absolute;\n bottom: 0;\n width: 240px;\n height: 30px;\n line-height: 30px;\n background: #373d47;\n}\n#sh-buttons .left {\n float: left;\n padding-left: 10px;\n}\n#sh-buttons .left .btn-add {\n display: inline-block;\n text-align: center;\n width: 20px;\n color: #979da7;\n text-decoration: none;\n}\n#sh-buttons .left .btn-add:hover {\n background: rgba(255, 255, 255, 0.1);\n}\n#sh-buttons .right {\n float: right;\n padding-right: 17px;\n height: 30px;\n}\n#sh-buttons .right i {\n display: inline-block;\n margin-left: 10px;\n cursor: pointer;\n}\n#sh-buttons .right i.icon-switchoff {\n position: relative;\n top: -1px;\n}\n#sh-buttons .right i.icon-search {\n padding: 0 8px;\n}\n#sh-buttons .right i.icon-search.on {\n background: #3d434e;\n}\n", ""]);
  18998. // exports
  18999. /***/ }),
  19000. /* 128 */
  19001. /***/ (function(module, exports, __webpack_require__) {
  19002. exports = module.exports = __webpack_require__(6)();
  19003. // imports
  19004. // module
  19005. exports.push([module.i, "#sh-list .list-item {\n position: relative;\n padding: 7px 10px 7px 15px;\n cursor: pointer;\n}\n#sh-list .list-item.hidden {\n display: none;\n}\n#sh-list .list-item.sys-hosts {\n font-size: 14px;\n padding: 8px 10px 8px 13px;\n}\n#sh-list .list-item.sys-hosts i {\n width: 22px;\n}\n#sh-list .list-item.selected {\n background: #2d3138;\n}\n#sh-list .list-item.selected span {\n color: #fff;\n}\n#sh-list .list-item.selected i.item-icon {\n color: #fff;\n}\n#sh-list .list-item.selected:hover i.icon-edit {\n display: inline-block;\n color: #fff;\n}\n#sh-list .list-item i {\n display: inline-block;\n width: 20px;\n text-align: center;\n margin-right: 5px;\n}\n#sh-list .list-item i.item-icon {\n font-size: 12px;\n}\n#sh-list .list-item i.switch {\n cursor: pointer;\n line-height: 23px;\n}\n#sh-list .list-item i.switch.icon-on {\n color: #af9;\n}\n#sh-list .list-item i.icon-edit {\n display: none;\n}\n#sh-list .list-item .item-buttons {\n position: absolute;\n right: 10px;\n}\n", ""]);
  19006. // exports
  19007. /***/ }),
  19008. /* 129 */
  19009. /***/ (function(module, exports, __webpack_require__) {
  19010. exports = module.exports = __webpack_require__(6)();
  19011. // imports
  19012. // module
  19013. exports.push([module.i, "#sh-list .custom-items {\n position: fixed;\n width: 240px;\n top: 36px;\n bottom: 30px;\n overflow: auto;\n}\n#sh-list .hidden {\n display: none;\n}\n", ""]);
  19014. // exports
  19015. /***/ }),
  19016. /* 130 */
  19017. /***/ (function(module, exports, __webpack_require__) {
  19018. exports = module.exports = __webpack_require__(6)();
  19019. // imports
  19020. exports.i(__webpack_require__(133), "");
  19021. // module
  19022. exports.push([module.i, "#panel {\n width: 240px;\n height: 100%;\n background: #373d47;\n color: #979da7;\n}\n", ""]);
  19023. // exports
  19024. /***/ }),
  19025. /* 131 */
  19026. /***/ (function(module, exports, __webpack_require__) {
  19027. exports = module.exports = __webpack_require__(6)();
  19028. // imports
  19029. // module
  19030. exports.push([module.i, "#sh-searchbar {\n position: fixed;\n width: 240px;\n left: 0;\n bottom: 30px;\n background: #3d434e;\n padding: 6px 20px 5px 18px;\n border-top: solid 1px #323740;\n}\n#sh-searchbar input {\n background: transparent;\n border: 0;\n outline: 0;\n color: #fff;\n font-size: 13px;\n}\n", ""]);
  19031. // exports
  19032. /***/ }),
  19033. /* 132 */
  19034. /***/ (function(module, exports, __webpack_require__) {
  19035. exports = module.exports = __webpack_require__(6)();
  19036. // imports
  19037. // module
  19038. exports.push([module.i, "/* BASICS */\n\n.CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-family: monospace;\n height: 300px;\n color: black;\n}\n\n/* PADDING */\n\n.CodeMirror-lines {\n padding: 4px 0; /* Vertical padding around content */\n}\n.CodeMirror pre {\n padding: 0 4px; /* Horizontal padding of content */\n}\n\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n background-color: white; /* The little square between H and V scrollbars */\n}\n\n/* GUTTER */\n\n.CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n}\n.CodeMirror-linenumbers {}\n.CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n}\n\n.CodeMirror-guttermarker { color: black; }\n.CodeMirror-guttermarker-subtle { color: #999; }\n\n/* CURSOR */\n\n.CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n}\n/* Shown when moving in bi-directional text */\n.CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n}\n.cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n}\n.cm-fat-cursor div.CodeMirror-cursors {\n z-index: 1;\n}\n\n.cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n}\n@-moz-keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n@-webkit-keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n@keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n\n/* Can style cursor different in overwrite (non-insert) mode */\n.CodeMirror-overwrite .CodeMirror-cursor {}\n\n.cm-tab { display: inline-block; text-decoration: inherit; }\n\n.CodeMirror-rulers {\n position: absolute;\n left: 0; right: 0; top: -50px; bottom: -20px;\n overflow: hidden;\n}\n.CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0; bottom: 0;\n position: absolute;\n}\n\n/* DEFAULT THEME */\n\n.cm-s-default .cm-header {color: blue;}\n.cm-s-default .cm-quote {color: #090;}\n.cm-negative {color: #d44;}\n.cm-positive {color: #292;}\n.cm-header, .cm-strong {font-weight: bold;}\n.cm-em {font-style: italic;}\n.cm-link {text-decoration: underline;}\n.cm-strikethrough {text-decoration: line-through;}\n\n.cm-s-default .cm-keyword {color: #708;}\n.cm-s-default .cm-atom {color: #219;}\n.cm-s-default .cm-number {color: #164;}\n.cm-s-default .cm-def {color: #00f;}\n.cm-s-default .cm-variable,\n.cm-s-default .cm-punctuation,\n.cm-s-default .cm-property,\n.cm-s-default .cm-operator {}\n.cm-s-default .cm-variable-2 {color: #05a;}\n.cm-s-default .cm-variable-3 {color: #085;}\n.cm-s-default .cm-comment {color: #a50;}\n.cm-s-default .cm-string {color: #a11;}\n.cm-s-default .cm-string-2 {color: #f50;}\n.cm-s-default .cm-meta {color: #555;}\n.cm-s-default .cm-qualifier {color: #555;}\n.cm-s-default .cm-builtin {color: #30a;}\n.cm-s-default .cm-bracket {color: #997;}\n.cm-s-default .cm-tag {color: #170;}\n.cm-s-default .cm-attribute {color: #00c;}\n.cm-s-default .cm-hr {color: #999;}\n.cm-s-default .cm-link {color: #00c;}\n\n.cm-s-default .cm-error {color: #f00;}\n.cm-invalidchar {color: #f00;}\n\n.CodeMirror-composing { border-bottom: 2px solid; }\n\n/* Default styles for common addons */\n\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\n.CodeMirror-activeline-background {background: #e8f2ff;}\n\n/* STOP */\n\n/* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n.CodeMirror {\n position: relative;\n overflow: hidden;\n background: white;\n}\n\n.CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 30px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -30px; margin-right: -30px;\n padding-bottom: 30px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n}\n.CodeMirror-sizer {\n position: relative;\n border-right: 30px solid transparent;\n}\n\n/* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 6;\n display: none;\n}\n.CodeMirror-vscrollbar {\n right: 0; top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n}\n.CodeMirror-hscrollbar {\n bottom: 0; left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n}\n.CodeMirror-scrollbar-filler {\n right: 0; bottom: 0;\n}\n.CodeMirror-gutter-filler {\n left: 0; bottom: 0;\n}\n\n.CodeMirror-gutters {\n position: absolute; left: 0; top: 0;\n min-height: 100%;\n z-index: 3;\n}\n.CodeMirror-gutter {\n white-space: normal;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n margin-bottom: -30px;\n}\n.CodeMirror-gutter-wrapper {\n position: absolute;\n z-index: 4;\n background: none !important;\n border: none !important;\n}\n.CodeMirror-gutter-background {\n position: absolute;\n top: 0; bottom: 0;\n z-index: 4;\n}\n.CodeMirror-gutter-elt {\n position: absolute;\n cursor: default;\n z-index: 4;\n}\n.CodeMirror-gutter-wrapper ::selection { background-color: transparent }\n.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }\n\n.CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n}\n.CodeMirror pre {\n /* Reset some styles that the rest of the page might have set */\n -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: inherit;\n color: inherit;\n z-index: 2;\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n}\n.CodeMirror-wrap pre {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: normal;\n}\n\n.CodeMirror-linebackground {\n position: absolute;\n left: 0; right: 0; top: 0; bottom: 0;\n z-index: 0;\n}\n\n.CodeMirror-linewidget {\n position: relative;\n z-index: 2;\n overflow: auto;\n}\n\n.CodeMirror-widget {}\n\n.CodeMirror-rtl pre { direction: rtl; }\n\n.CodeMirror-code {\n outline: none;\n}\n\n/* Force content-box sizing for the elements where we expect it */\n.CodeMirror-scroll,\n.CodeMirror-sizer,\n.CodeMirror-gutter,\n.CodeMirror-gutters,\n.CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n}\n\n.CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n}\n\n.CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n}\n.CodeMirror-measure pre { position: static; }\n\ndiv.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n z-index: 3;\n}\ndiv.CodeMirror-dragcursors {\n visibility: visible;\n}\n\n.CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n}\n\n.CodeMirror-selected { background: #d9d9d9; }\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\n.CodeMirror-crosshair { cursor: crosshair; }\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\n\n.cm-searching {\n background: #ffa;\n background: rgba(255, 255, 0, .4);\n}\n\n/* Used to force a border model for a node */\n.cm-force-border { padding-right: .1px; }\n\n@media print {\n /* Hide the cursor when printing */\n .CodeMirror div.CodeMirror-cursors {\n visibility: hidden;\n }\n}\n\n/* See issue #2901 */\n.cm-tab-wrap-hack:after { content: ''; }\n\n/* Help users use markselection to safely style text background */\nspan.CodeMirror-selectedtext { background: none; }\n", ""]);
  19039. // exports
  19040. /***/ }),
  19041. /* 133 */
  19042. /***/ (function(module, exports, __webpack_require__) {
  19043. exports = module.exports = __webpack_require__(6)();
  19044. // imports
  19045. // module
  19046. exports.push([module.i, "\n@font-face {font-family: \"iconfont\";\n src: url(" + __webpack_require__(69) + "); /* IE9*/\n src: url(" + __webpack_require__(69) + "#iefix) format('embedded-opentype'), \n url(" + __webpack_require__(136) + ") format('woff'), \n url(" + __webpack_require__(135) + ") format('truetype'), \n url(" + __webpack_require__(134) + "#iconfont) format('svg'); /* iOS 4.1- */\n}\n\n.iconfont {\n font-family:\"iconfont\" !important;\n font-size:16px;\n font-style:normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.icon-switchoff:before { content: \"\\E60D\"; }\n\n.icon-icon:before { content: \"\\E600\"; }\n\n.icon-warnfill:before { content: \"\\E607\"; }\n\n.icon-warn:before { content: \"\\E608\"; }\n\n.icon-ok:before { content: \"\\E604\"; }\n\n.icon-h:before { content: \"\\E617\"; }\n\n.icon-lock:before { content: \"\\E61D\"; }\n\n.icon-off:before { content: \"\\E613\"; }\n\n.icon-on:before { content: \"\\E614\"; }\n\n.icon-search:before { content: \"\\E61C\"; }\n\n.icon-edit:before { content: \"\\E609\"; }\n\n.icon-info:before { content: \"\\E601\"; }\n\n.icon-add-s:before { content: \"\\E612\"; }\n\n.icon-more:before { content: \"\\E602\"; }\n\n.icon-grid:before { content: \"\\E603\"; }\n\n.icon-movedown:before { content: \"\\E60A\"; }\n\n.icon-moveup:before { content: \"\\E60B\"; }\n\n.icon-add:before { content: \"\\E60C\"; }\n\n.icon-folder:before { content: \"\\E618\"; }\n\n.icon-group:before { content: \"\\E619\"; }\n\n.icon-lock2:before { content: \"\\E61E\"; }\n\n.icon-files:before { content: \"\\E61F\"; }\n\n.icon-timescircle:before { content: \"\\E60E\"; }\n\n.icon-earth:before { content: \"\\E61A\"; }\n\n.icon-move:before { content: \"\\E60F\"; }\n\n.icon-delete:before { content: \"\\E610\"; }\n\n.icon-refresh:before { content: \"\\E63A\"; }\n\n.icon-doc:before { content: \"\\E606\"; }\n\n.icon-line:before { content: \"\\E611\"; }\n\n.icon-file-box:before { content: \"\\E61B\"; }\n\n.icon-switchon:before { content: \"\\E615\"; }\n\n.icon-sysserver:before { content: \"\\E605\"; }\n\n.icon-file:before { content: \"\\E77D\"; }\n\n", ""]);
  19047. // exports
  19048. /***/ }),
  19049. /* 134 */
  19050. /***/ (function(module, exports) {
  19051. module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiID4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8bWV0YWRhdGE+CkNyZWF0ZWQgYnkgRm9udEZvcmdlIDIwMTIwNzMxIGF0IFNhdCBBcHIgIDEgMTA6NTc6MTIgMjAxNwogQnkgYWRtaW4KPC9tZXRhZGF0YT4KPGRlZnM+Cjxmb250IGlkPSJpY29uZm9udCIgaG9yaXotYWR2LXg9IjEwMjQiID4KICA8Zm9udC1mYWNlIAogICAgZm9udC1mYW1pbHk9Imljb25mb250IgogICAgZm9udC13ZWlnaHQ9IjUwMCIKICAgIGZvbnQtc3RyZXRjaD0ibm9ybWFsIgogICAgdW5pdHMtcGVyLWVtPSIxMDI0IgogICAgcGFub3NlLTE9IjIgMCA2IDMgMCAwIDAgMCAwIDAiCiAgICBhc2NlbnQ9Ijg5NiIKICAgIGRlc2NlbnQ9Ii0xMjgiCiAgICB4LWhlaWdodD0iNzkyIgogICAgYmJveD0iMCAtMjEyIDEwMjQgODk2IgogICAgdW5kZXJsaW5lLXRoaWNrbmVzcz0iMCIKICAgIHVuZGVybGluZS1wb3NpdGlvbj0iMCIKICAgIHVuaWNvZGUtcmFuZ2U9IlUrMDA3OC1FNzdEIgogIC8+CjxtaXNzaW5nLWdseXBoIAogLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSIubm90ZGVmIiAKIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iLm5vdGRlZiIgCiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Ii5udWxsIiBob3Jpei1hZHYteD0iMCIgCiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im5vbm1hcmtpbmdyZXR1cm4iIGhvcml6LWFkdi14PSIzNDEiIAogLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJ4IiB1bmljb2RlPSJ4IiBob3Jpei1hZHYteD0iMTAwMSIgCmQ9Ik0yODEgNTQzcS0yNyAtMSAtNTMgLTFoLTgzcS0xOCAwIC0zNi41IC02dC0zMi41IC0xOC41dC0yMyAtMzJ0LTkgLTQ1LjV2LTc2aDkxMnY0MXEwIDE2IC0wLjUgMzB0LTAuNSAxOHEwIDEzIC01IDI5dC0xNyAyOS41dC0zMS41IDIyLjV0LTQ5LjUgOWgtMTMzdi05N2gtNDM4djk3ek05NTUgMzEwdi01MnEwIC0yMyAwLjUgLTUydDAuNSAtNTh0LTEwLjUgLTQ3LjV0LTI2IC0zMHQtMzMgLTE2dC0zMS41IC00LjVxLTE0IC0xIC0yOS41IC0wLjUKdC0yOS41IDAuNWgtMzJsLTQ1IDEyOGgtNDM5bC00NCAtMTI4aC0yOWgtMzRxLTIwIDAgLTQ1IDFxLTI1IDAgLTQxIDkuNXQtMjUuNSAyM3QtMTMuNSAyOS41dC00IDMwdjE2N2g5MTF6TTE2MyAyNDdxLTEyIDAgLTIxIC04LjV0LTkgLTIxLjV0OSAtMjEuNXQyMSAtOC41cTEzIDAgMjIgOC41dDkgMjEuNXQtOSAyMS41dC0yMiA4LjV6TTMxNiAxMjNxLTggLTI2IC0xNCAtNDhxLTUgLTE5IC0xMC41IC0zN3QtNy41IC0yNXQtMyAtMTV0MSAtMTQuNQp0OS41IC0xMC41dDIxLjUgLTRoMzdoNjdoODFoODBoNjRoMzZxMjMgMCAzNCAxMnQyIDM4cS01IDEzIC05LjUgMzAuNXQtOS41IDM0LjVxLTUgMTkgLTExIDM5aC0zNjh6TTMzNiA0OTh2MjI4cTAgMTEgMi41IDIzdDEwIDIxLjV0MjAuNSAxNS41dDM0IDZoMTg4cTMxIDAgNTEuNSAtMTQuNXQyMC41IC01Mi41di0yMjdoLTMyN3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ic3dpdGNob2ZmIiB1bmljb2RlPSImI3hlNjBkOyIgCmQ9Ik04MzIgODEyaC02NDBxLTgwIDAgLTEzNiAtNTZ0LTU2IC0xMzZ2LTY0MHEwIC03OSA1NiAtMTM1LjV0MTM2IC01Ni41aDY0MHE3OSAwIDEzNS41IDU2LjV0NTYuNSAxMzUuNXY2NDBxMCA4MCAtNTYuNSAxMzZ0LTEzNS41IDU2ek0xNjAgLTg0cS0xMyAwIC0yMi41IDkuNXQtOS41IDIyLjV0OS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTE2MCA2MjBxLTEzIDAgLTIyLjUgOS41CnQtOS41IDIyLjV0OS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTcwNCAtMjBxMCAtMjcgLTE4LjUgLTQ1LjV0LTQ1LjUgLTE4LjVoLTI1NnEtMjcgMCAtNDUuNSAxOC41dC0xOC41IDQ1LjV2NjQwcTAgMjYgMTkgNDV0NDUgMTloMjU2cTI3IDAgNDUuNSAtMTguNXQxOC41IC00NS41di02NDB6TTg2NCAtODRxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNQp0MjIuNSAtOS41dDkuNSAtMjIuNXQtOS41IC0yMi41dC0yMi41IC05LjV6TTg2NCA2MjBxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNTc2IDMwMGgtMTI4cS0yNiAwIC00NSAtMTl0LTE5IC00NXYtMTkycTAgLTI3IDE4LjUgLTQ1LjV0NDUuNSAtMTguNWgxMjhxMjcgMCA0NS41IDE4LjV0MTguNSA0NS41djE5MgpxMCAyNyAtMTguNSA0NS41dC00NS41IDE4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Imljb24iIHVuaWNvZGU9IiYjeGU2MDA7IiAKZD0iTTQ4OCA3NDVsMTMyIC0yNjlsMjk3IC00M2wtMjE1IC0yMDlsNTEgLTI5NmwtMjY1IDE0MGwtMjY2IC0xNDBsNTEgMjk2bC0yMTUgMjA5bDI5NyA0M3oiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0id2FybmZpbGwiIHVuaWNvZGU9IiYjeGU2MDc7IiAKZD0iTTk0MyAxMjdsLTM0MSA2MDlxLTM1IDYzIC05MC41IDYzdC05MC41IC02M2wtMzQwIC02MDlxLTM0IC02MiAtNiAtMTExcTI5IC00OCAxMDAgLTQ4aDY3NHE3MSAwIDk5LjUgNDguNXQtNS41IDExMC41ek00ODAgNTc2cTAgMTMgOS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXYtMjg4cTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNXQtMjIuNSA5LjV0LTkuNSAyMi41djI4OHpNNTEyIDY0cS0yMCAwIC0zNCAxNHQtMTQgMzQKdDE0IDM0dDM0IDE0dDM0IC0xNHQxNCAtMzR0LTE0IC0zNHQtMzQgLTE0eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJ3YXJuIiB1bmljb2RlPSImI3hlNjA4OyIgCmQ9Ik04NDkgLTMzaC02NzRxLTcxIDAgLTk5LjUgNDl0NS41IDExMWwzNDAgNjA5cTM1IDYzIDkwLjUgNjN0OTAuNSAtNjNsMzQxIC02MDlxMzQgLTYzIDUuNSAtMTExLjV0LTk5LjUgLTQ4LjV6TTUxMiA3MzVxLTE4IDAgLTM1IC0zMGwtMzQwIC02MTBxLTE3IC0zMCAtNyAtNDd0NDUgLTE3aDY3NHEzNSAwIDQ1IDE3dC03IDQ3bC0zNDEgNjEwcS0xNiAzMCAtMzQgMzB6TTUxMiAyNTZxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXYyODgKcTAgMTMgOS41IDIyLjV0MjIuNSA5LjV0MjIuNSAtOS41dDkuNSAtMjIuNXYtMjg4cTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNTEyIDE0NHpNNDY0IDE0NHEwIDIwIDE0IDM0dDM0IDE0dDM0IC0xNHQxNCAtMzR0LTE0IC0zNHQtMzQgLTE0dC0zNCAxNHQtMTQgMzR6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im9rIiB1bmljb2RlPSImI3hlNjA0OyIgCmQ9Ik01MTIgNzA5cS0xMTEgMCAtMjA1LjUgLTU0LjV0LTE0OSAtMTQ5dC01NC41IC0yMDUuNXQ1NC41IC0yMDUuNXQxNDkgLTE0OXQyMDUuNSAtNTQuNXQyMDUuNSA1NC41dDE0OSAxNDl0NTQuNSAyMDUuNXQtNTQuNSAyMDUuNXQtMTQ5IDE0OXQtMjA1LjUgNTQuNXpNMzc2IDI1M3EwIC0xIDUgLTZsOSAtOXQxMCAtNy41dDEwIC0zLjVxMTYgMCAxMDkgMTA0bDEzOCAxNThxNyA4IDE1IDlxMTMgMCAyMSAtN2w0NSAtNDRxNyAtOCA3LjUgLTE4LjUKdC02LjUgLTE4LjVsLTI1MCAtMjY0djBsLTUzIC01N3EtNyAtNyAtMTggLTcuNXQtMTggNi41bC0xNTEgMTQycS04IDcgLTguNSAxOHQ3LjUgMTlsMzUgMzdxNyA4IDE4IDguNXQxOSAtNy41eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJoIiB1bmljb2RlPSImI3hlNjE3OyIgCmQ9Ik01MTIgODAycS0xMDQgMCAtMTkyLjUgLTUxLjV0LTE0MCAtMTQwdC01MS41IC0xOTN0NTEuNSAtMTkzdDE0MCAtMTQwdDE5Mi41IC01MS41dDE5Mi41IDUxLjV0MTQwIDE0MHQ1MS41IDE5M3QtNTEuNSAxOTN0LTE0MCAxNDB0LTE5Mi41IDUxLjV6TTY2MCAyMTRoLTUwdjE3NWgtMTk2di0xNzVoLTUwdjM5NWg1MHYtMTc5aDE5NnYxNzloNTB2LTM5NXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ibG9jayIgdW5pY29kZT0iJiN4ZTYxZDsiIApkPSJNNDI3IDE1MXEwIDM1IDI1IDYwdDYwIDI1dDYwIC0yNXQyNSAtNjBxMCAtNDcgLTM5IC03MnE5IC01MCAxOCAtMTEwcTAgLTEzIC05LjUgLTIyLjV0LTIyLjUgLTkuNWgtNjRxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNWwxOCAxMTBxLTM5IDI1IC0zOSA3MnpNMzQxIDM4NXYxNTBxMCA3MCA1MCAxMjB0MTIxIDUwdDEyMSAtNTB0NTAgLTEyMHYtMTUwaC0zNDJ6TTIzNSA1MzV2LTE1MGgtNjRxLTM2IDAgLTYxIC0yNXQtMjUgLTYwdi00MjcKcTAgLTM1IDI1IC02MHQ2MSAtMjVoNjgycTM2IDAgNjEgMjV0MjUgNjB2NDI3cTAgMzUgLTI1IDYwdC02MSAyNWgtNjR2MTUwcTAgMTE1IC04MSAxOTZ0LTE5NiA4MXQtMTk2IC04MXQtODEgLTE5NnYweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJvZmYiIHVuaWNvZGU9IiYjeGU2MTM7IiAKZD0iTTcyOSA5MGgtNDM0cS0xMTYgMCAtMTk3LjUgODEuNXQtODEuNSAxOTYuNXYzMnEwIDExNSA4MS41IDE5Ni41dDE5Ny41IDgxLjVoNDM0cTExNiAwIDE5Ny41IC04MS41dDgxLjUgLTE5Ni41di0zMnEwIC0xMTUgLTgxLjUgLTE5Ni41dC0xOTcuNSAtODEuNXpNOTQ2IDQwMHEwIDkwIC02My41IDE1M3QtMTUzLjUgNjNoLTQzNHEtOTAgMCAtMTUzLjUgLTYzdC02My41IC0xNTN2LTMycTAgLTkwIDYzLjUgLTE1My41dDE1My41IC02My41aDQzNApxOTAgMCAxNTMuNSA2My41dDYzLjUgMTUzLjV2MzJ6TTMyMiAyMjNxLTY4IDAgLTExNiA0OC41dC00OCAxMTYuNXQ0OCAxMTZ0MTE2IDQ4dDExNiAtNDh0NDggLTExNnQtNDggLTExNi41dC0xMTYgLTQ4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Im9uIiB1bmljb2RlPSImI3hlNjE0OyIgCmQ9Ik03MjkgOTBoLTQzNHEtMTE2IDAgLTE5Ny41IDgxLjV0LTgxLjUgMTk2LjV2MzJxMCAxMTUgODEuNSAxOTYuNXQxOTcuNSA4MS41aDQzNHExMTYgMCAxOTcuNSAtODEuNXQ4MS41IC0xOTYuNXYtMzJxMCAtMTE1IC04MS41IC0xOTYuNXQtMTk3LjUgLTgxLjV6TTk0NyAzOTlxMCA5MCAtNjMuNSAxNTMuNXQtMTUzLjUgNjMuNWgtNDM2cS04OSAwIC0xNTIuNSAtNjMuNXQtNjMuNSAtMTUzLjV2LTMxcTAgLTkwIDYzLjUgLTE1My41CnQxNTIuNSAtNjMuNWg0MzZxOTAgMCAxNTMuNSA2My41dDYzLjUgMTUzLjV2MzF2MHpNNzAyIDIyM3EtNjggMCAtMTE2IDQ4LjV0LTQ4IDExNi41dDQ4IDExNnQxMTYgNDh0MTE2LjUgLTQ4dDQ4LjUgLTExNnQtNDguNSAtMTE2LjV0LTExNi41IC00OC41eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJzZWFyY2giIHVuaWNvZGU9IiYjeGU2MWM7IiAKZD0iTTk5NSAzbC0yNzIgMjI3cS0yIDIgLTYgNHEzNyA3OSAzNyAxNjBxMCA4MiAtMzQuNSAxNTh0LTk5LjUgMTMxcS0xMDUgODkgLTI0MyA4OXEtODIgMCAtMTU4IC0zNXQtMTMxIC0xMDBxLTg4IC0xMDUgLTg4IC0yNDNxMCAtODIgMzQuNSAtMTU4LjV0MTAwLjUgLTEzMS41cTEwNSAtODggMjQxIC04OGgxcTEyMSAwIDIyMSA3MnExIDAgMiAtMS41bDEgLTEuNWwyNzIgLTIyN3EyNyAtMjMgNjMgLTE4LjV0NTkgMzMuNWw2IDcKcTI0IDI4IDIyIDY0LjV0LTI4IDU4LjV6TTU4NSAyMTlxLTQwIC00NyAtOTQuNSAtNzJ0LTExMy41IC0yNXEtOTggMSAtMTc0IDY0cS00NyAzOSAtNzIgOTR0LTI1IDExNHEwIDk5IDY0IDE3NHEzOSA0OCA5My41IDcyLjV0MTEzLjUgMjQuNXE5OSAwIDE3NCAtNjNxNDcgLTQwIDcyIC05NC41dDI1IC0xMTMuNXEwIC05OSAtNjMgLTE3NXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZWRpdCIgdW5pY29kZT0iJiN4ZTYwOTsiIApkPSJNMzg0IDNsLTE2OSAxNjlxLTYgNSAtNiAxMy41dDYgMTQuNWwzODAgMzgwcTYgNiAxNCA2dDE0IC02bDE2OSAtMTY5cTYgLTYgNiAtMTR0LTYgLTE0bC0zODAgLTM4MHEtNiAtNiAtMTQuNSAtNnQtMTMuNSA2ek02OTMgNjc4cTE4IDE4IDQyLjUgMTh0NDIuNSAtMThsMTEyIC0xMTJxMTggLTE4IDE4IC00Mi41dC0xOCAtNDIuNWwtNTYgLTU2bC0xOTcgMTk3ek0xMTYgLTk2bDU2IDI1NGwxOTggLTE5OHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iaW5mbyIgdW5pY29kZT0iJiN4ZTYwMTsiIApkPSJNNTEyIC0yMHEtMTEwIDAgLTIwMyA1NHQtMTQ3IDE0N3QtNTQgMjAzdDU0IDIwM3QxNDcgMTQ3dDIwMyA1NHQyMDMgLTU0dDE0NyAtMTQ3dDU0IC0yMDN0LTU0IC0yMDN0LTE0NyAtMTQ3dC0yMDMgLTU0ek01NjcgNjA1cTAgNyAtNS41IDEyLjV0LTEyLjUgNS41aC03NHEtNyAwIC0xMi41IC01LjV0LTUuNSAtMTIuNXYtNzRxMCAtOCA1LjUgLTEzdDEyLjUgLTVoNzRxNyAwIDEyLjUgNXQ1LjUgMTN2NzR6TTU2NyA0MDJxMCA4IC01LjUgMTMuNQp0LTEyLjUgNS41aC03NHEtNyAwIC0xMi41IC01LjV0LTUuNSAtMTMuNXYtMjM5cTAgLTcgNS41IC0xMi41dDEyLjUgLTUuNWg3NHE3IDAgMTIuNSA1LjV0NS41IDEyLjV2MjM5eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJhZGQtcyIgdW5pY29kZT0iJiN4ZTYxMjsiIApkPSJNNjk5IDM1OGgtMTU3di0xNThxMCAtMTAgLTcuNSAtMTh0LTE4LjUgLTh0LTE5IDh0LTggMTh2MTU4aC0xNTdxLTExIDAgLTE4LjUgNy41dC03LjUgMTguNXQ3LjUgMTguNXQxOC41IDcuNWgxNTd2MTU3cTAgMTEgOCAxOC41dDE5IDcuNXQxOC41IC03LjV0Ny41IC0xOC41di0xNTdoMTU3cTExIDAgMTguNSAtNy41dDcuNSAtMTguNXQtNy41IC0xOC41dC0xOC41IC03LjV2MHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ibW9yZSIgdW5pY29kZT0iJiN4ZTYwMjsiIApkPSJNMTc0LjUgNTAxcS00MS41IDAgLTcxIC0yOS41dC0yOS41IC03MS41dDI5LjUgLTcxLjV0NzEgLTI5LjV0NzEuNSAyOS41dDMwIDcxLjV0LTMwIDcxLjV0LTcxLjUgMjkuNXpNNTExIDUwMXEtNDIgMCAtNzEuNSAtMjkuNXQtMjkuNSAtNzEuNXQyOS41IC03MS41dDcxLjUgLTI5LjV0NzEuNSAyOS41dDI5LjUgNzEuNXQtMjkuNSA3MS41dC03MS41IDI5LjV6TTg0OCA1MDFxLTQyIDAgLTcxLjUgLTI5LjV0LTI5LjUgLTcxLjV0MjkuNSAtNzEuNQp0NzEuNSAtMjkuNXQ3MS41IDI5LjV0MjkuNSA3MS41dC0yOS41IDcxLjV0LTcxLjUgMjkuNXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZ3JpZCIgdW5pY29kZT0iJiN4ZTYwMzsiIApkPSJNNjAxIDgzMGgtMTc5cS0xMiAwIC0yMSAtOXQtOSAtMjF2LTE3OXEwIC0xMiA5IC0yMXQyMSAtOWgxNzlxMTIgMCAyMSA5dDkgMjF2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTkyOSA4MzBoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTIgOSAtMjF0MjEgLTloMTc5cTEyIDAgMjEgOXQ5IDIxdjE3OXEwIDEyIC05IDIxdC0yMSA5ek0yNzMgODMwaC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5cTAgLTEyIDkgLTIxdDIxIC05CmgxNzlxMTIgMCAyMSA5dDkgMjF2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTYwMSA1MDJoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTMgOSAtMjEuNXQyMSAtOC41aDE3OXExMiAwIDIxIDguNXQ5IDIxLjV2MTc5cTAgMTIgLTkgMjF0LTIxIDl6TTkyOSA1MDJoLTE3OXEtMTIgMCAtMjEgLTl0LTkgLTIxdi0xNzlxMCAtMTMgOSAtMjEuNXQyMSAtOC41aDE3OXExMiAwIDIxIDguNXQ5IDIxLjV2MTc5cTAgMTIgLTkgMjF0LTIxIDl6Ck0yNzMgNTAyaC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5cTAgLTEzIDkgLTIxLjV0MjEgLTguNWgxNzlxMTIgMCAyMSA4LjV0OSAyMS41djE3OXEwIDEyIC05IDIxdC0yMSA5ek02MDEgMTc0aC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5cTAgLTEzIDkgLTIxLjV0MjEgLTguNWgxNzlxMTIgMCAyMSA4LjV0OSAyMS41djE3OXEwIDEyIC05IDIxdC0yMSA5ek05MjkgMTc0aC0xNzlxLTEyIDAgLTIxIC05dC05IC0yMXYtMTc5CnEwIC0xMyA5IC0yMS41dDIxIC04LjVoMTc5cTEyIDAgMjEgOC41dDkgMjEuNXYxNzlxMCAxMiAtOSAyMXQtMjEgOXpNMjczIDE3NGgtMTc5cS0xMiAwIC0yMSAtOXQtOSAtMjF2LTE3OXEwIC0xMyA5IC0yMS41dDIxIC04LjVoMTc5cTEyIDAgMjEgOC41dDkgMjEuNXYxNzlxMCAxMiAtOSAyMXQtMjEgOXoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0ibW92ZWRvd24iIHVuaWNvZGU9IiYjeGU2MGE7IiAKZD0iTTc2OCAxMDh2Mzg0aC02NHYtMzg0aC0xNjBsMTkyIC0xOTJsMTkyIDE5MmgtMTYwek0zMjAgNTU2di0xOTJoLTE5MnYxOTJoMTkyek0zODQgNjIwaC0zMjB2LTMyMGgzMjB2MzIwek02NCAxNzJoOTZ2LTY0aC05NnY2NHpNMTkyIDE3Mmg5NnYtNjRoLTk2djY0ek0zMjAgMTcyaDY0di05NmgtNjR2OTZ6TTY0IC01Mmg2NHYtOTZoLTY0djk2ek0xNjAgLTg0aDk2di02NGgtOTZ2NjR6TTI4OCAtODRoOTZ2LTY0aC05NnY2NHpNNjQgNzZoNjQKdi05NmgtNjR2OTZ6TTMyMCA0NGg2NHYtOTZoLTY0djk2eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJtb3ZldXAiIHVuaWNvZGU9IiYjeGU2MGI7IiAKZD0iTTcwNCAzMDB2LTM4NGg2NHYzODRoMTYwbC0xOTIgMTkybC0xOTIgLTE5MmgxNjB6TTY0IDYyMGg5NnYtNjRoLTk2djY0ek0xOTIgNjIwaDk2di02NGgtOTZ2NjR6TTMyMCA2MjBoNjR2LTk2aC02NHY5NnpNNjQgMzk2aDY0di05NmgtNjR2OTZ6TTE2MCAzNjRoOTZ2LTY0aC05NnY2NHpNMjg4IDM2NGg5NnYtNjRoLTk2djY0ek02NCA1MjRoNjR2LTk2aC02NHY5NnpNMzIwIDQ5Mmg2NHYtOTZoLTY0djk2ek0zMjAgMTA4di0xOTJoLTE5MnYxOTIKaDE5MnpNMzg0IDE3MmgtMzIwdi0zMjBoMzIwdjMyMHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iYWRkIiB1bmljb2RlPSImI3hlNjBjOyIgCmQ9Ik01MTIgLTQxcS0xMTUgMCAtMjEzIDU3dC0xNTUgMTU1dC01NyAyMTN0NTcgMjEzdDE1NSAxNTV0MjEzIDU3dDIxMyAtNTd0MTU1IC0xNTV0NTcgLTIxM3QtNTcgLTIxM3QtMTU1IC0xNTV0LTIxMyAtNTd6TTcyNCA0MjZoLTE3MHYxNzBoLTg0di0xNzBoLTE3MHYtODRoMTcwdi0xNzBoODR2MTcwaDE3MHY4NHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZm9sZGVyIiB1bmljb2RlPSImI3hlNjE4OyIgCmQ9Ik05NjEgNjQwcTAgNDAgLTI4LjUgNjh0LTY3LjUgMjhoLTE4NmgtMWgtMXEtNiAtMSAtMTAgLTJsLTEgLTFoLTFxLTUgLTMgLTggLTZxLTE4IC0xNyAtMzUgLTg4cS0zIC0xMiAtNCAtMTRxLTQgLTE3IC0yNyAtMTdoLTcuNWgtNy41aC00MTZxLTQwIDAgLTY4IC0yOC41dC0yOCAtNjkuNWwzMiAtNDE0cTAgLTQwIDI4IC02OHQ2OCAtMjhoNjQwcTQwIDAgNjggMjh0MjggNjZ6TTg2NCA5NnEwIC0xMyAtOS41IC0yMi41dC0yMi41IC05LjUKaC02NDBxLTEzIDAgLTIyLjUgMTB0LTkuNSAyNGwtMzIgNDE0cTAgMTMgOS41IDIyLjV0MjIuNSA5LjVoNDE2aDcuNWg3LjVxMzUgMCA1OC41IDE3dDMwLjUgNDhxMiA0IDQgMTVxOCAzNCAxMyA0OGgxNjhxMTMgMCAyMi41IC05LjV0OS41IC0yMi41di0ydi0xek0xMjggNjcyaDQxNnExMyAwIDIyLjUgOS41dDkuNSAyMi41dC05LjUgMjIuNXQtMjIuNSA5LjVoLTQxNnEtMTMgMCAtMjIuNSAtOS41dC05LjUgLTIyLjV0OS41IC0yMi41CnQyMi41IC05LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9Imdyb3VwIiB1bmljb2RlPSImI3hlNjE5OyIgCmQ9Ik01MjEgMTk0bC0zNzYgMjQ3bC01MCAtNTJsNDI2IC0yOTFsNDI2IDI5MWwtNTEgNTN6TTk0NyA1NTBsLTQyNiAyOTFsLTQyNiAtMjkxbDQyNiAtMjkxek01MjEgNzU2bDMwMiAtMjA2bC0zMDIgLTIwN2wtMzAyIDIwN3pNNTIxIDMzbC0zNzYgMjQ4bC01MCAtNTJsNDI2IC0yOTFsNDI2IDI5MWwtNTEgNTN6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImxvY2syIiB1bmljb2RlPSImI3hlNjFlOyIgCmQ9Ik03NjkgNDQ4djEzNXYwcS0zIDEwNCAtNzcuNSAxNzYuNXQtMTc4LjUgNzIuNXQtMTc4LjUgLTcyLjV0LTc3LjUgLTE3NS41djB2LTEzNmgtMXEtMjcgMCAtNDUuNSAtMTguNXQtMTguNSAtNDUuNXYtMzg0cTAgLTI3IDE4LjUgLTQ1LjV0NDUuNSAtMTguNWg1MTJxMjcgMCA0NS41IDE4LjV0MTguNSA0NS41djM4NHEwIDI2IC0xOC41IDQ1dC00NC41IDE5ek0zMjEgNTgxdjBxMiA3OCA1OCAxMzIuNXQxMzQgNTQuNXQxMzQgLTU0LjUKdDU4IC0xMzIuNXYwdi0xMzNoLTM4NHYxMzN6TTc2OCAzMnEwIC0xMyAtOS41IC0yMi41dC0yMi41IC05LjVoLTQ0OHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41djMyMHEwIDEzIDkuNSAyMi41dDIyLjUgOS41aDQ0OHExMyAwIDIyLjUgLTkuNXQ5LjUgLTIyLjV2LTMyMHpNNTQ0IDIwNnY1MnEwIDEzIC05LjUgMjIuNXQtMjIuNSA5LjV0LTIyLjUgLTkuNXQtOS41IC0yMi41di01MnEtMjggLTE4IC0yOCAtNTFxMCAtMjUgMTcuNSAtNDIuNQp0NDIuNSAtMTcuNXQ0Mi41IDE3LjV0MTcuNSA0Mi41cTAgMzMgLTI4IDUxeiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJmaWxlcyIgdW5pY29kZT0iJiN4ZTYxZjsiIApkPSJNNzQ0IDQzNGgtMjYwcS0xMiAwIC0yMC41IC04LjV0LTguNSAtMjAuNXQ4LjUgLTIwLjV0MjAuNSAtOC41aDI2MHExMiAwIDIwLjUgOC41dDguNSAyMC41dC04LjUgMjAuNXQtMjAuNSA4LjV6TTc0NCAyOTBoLTI2MHEtMTIgMCAtMjAuNSAtOC41dC04LjUgLTIwLjV0OC41IC0yMC41dDIwLjUgLTguNWgyNjBxMTIgMCAyMC41IDguNXQ4LjUgMjAuNXQtOC41IDIwLjV0LTIwLjUgOC41ek03NDQgODM5aC0zNDdxLTQ1IDAgLTgwIC0zNS41CnQtMzUgLTgwLjVoLTM0cS00NSAwIC03OCAtMzV0LTMzIC04MHYtNTc4cTAgLTQ1IDM1IC04MC41dDgxIC0zNS41aDQzM3E0NiAwIDgxIDM1LjV0MzUgODAuNWgyOXE0NiAwIDgxIDM1LjV0MzUgNzkuNXY0MDV2NTd6TTY4NiAtMjhoLTQzM3EtMjMgMCAtNDAuNSAxOHQtMTcuNSA0MHY1NzhxMCAyMiAxNi41IDM5LjV0MzguNSAxNy41bDMyIDF2LTUyMXEwIC00NCAzNSAtNzkuNXQ4MCAtMzUuNWgzNDdxMCAtMjIgLTE3LjUgLTQwdC00MC41IC0xOHYwCnpNODg5IDE0NXEwIC0yMiAtMTcuNSAtMzkuNXQtNDAuNSAtMTcuNWgtNDM0cS0yMiAwIC0zOS41IDE3LjV0LTE3LjUgMzkuNXY1NzhxMCAyMyAxNy41IDQwLjV0MzkuNSAxNy41aDI4OXYtMTE2cTAgLTQ1IDM1IC04MHQ4MSAtMzVoODd2LTQwNXpNODAyIDYwOHEtMjEgMCAtMzkuNSAzMC41dC0xOC41IDU1LjV2ODZ2MGwxNDUgLTE3MmgtODd6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InRpbWVzY2lyY2xlIiB1bmljb2RlPSImI3hlNjBlOyIgCmQ9Ik02NTcgMTcxcTAgMTUgLTExIDI2bC0xMDQgMTAzbDEwNCAxMDNxMTEgMTEgMTEgMjZxMCAxNiAtMTEgMjZsLTUyIDUycS0xMSAxMSAtMjYgMTF0LTI2IC0xMWwtMTAzIC0xMDRsLTEwNCAxMDRxLTEwIDExIC0yNSAxMXEtMTYgMCAtMjcgLTExbC01MSAtNTJxLTExIC0xMCAtMTEgLTI2cTAgLTE1IDExIC0yNmwxMDMgLTEwM2wtMTAzIC0xMDNxLTExIC0xMSAtMTEgLTI2cTAgLTE2IDExIC0yNmw1MSAtNTJxMTEgLTExIDI3IC0xMQpxMTUgMCAyNSAxMWwxMDQgMTA0bDEwMyAtMTA0cTExIC0xMSAyNiAtMTF0MjYgMTFsNTIgNTJxMTEgMTAgMTEgMjZ6TTg3OCAzMDBxMCAtMTE5IC01OSAtMjIwdC0xNjAgLTE2MHQtMjIwLjUgLTU5dC0yMjAgNTl0LTE1OS41IDE2MHQtNTkgMjIwdDU5IDIyMHQxNTkuNSAxNjB0MjIwIDU5dDIyMC41IC01OXQxNjAgLTE2MHQ1OSAtMjIweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJlYXJ0aCIgdW5pY29kZT0iJiN4ZTYxYTsiIApkPSJNODc0IDY2MnEtNzMgNzMgLTE2NiAxMTEuNXQtMTk2IDM4LjV0LTE5NiAtMzguNXQtMTY2IC0xMTEuNXQtMTExLjUgLTE2NnQtMzguNSAtMTk2dDM4LjUgLTE5NnQxMTEuNSAtMTY2dDE2NiAtMTExLjV0MTk2IC0zOC41dDE5NiAzOC41dDE2NiAxMTEuNXQxMTEuNSAxNjZ0MzguNSAxOTZ0LTM4LjUgMTk2dC0xMTEuNSAxNjZ6TTk0MiA0NjZxLTcgMTIgLTIyIDE5LjV0LTQ2IDE4LjVxLTE2IDUgLTI4LjUgMjB0LTE4LjUgMjguNXQtMTUgNDEuNQpxLTggMjQgLTEzLjUgMzd0LTE3IDMxdC0yNS41IDI5cTEzMCAtODIgMTg2IC0yMjV6TTc5OCAyOTBxMiAtMTkgMi41IC0zNS41dC04LjUgLTM4LjV0LTI5IC00NXEtMTIgLTEzIC0yNiAtNTBxLTggLTIyIC0xMy41IC0zMy41dC0xNi41IC0yNnQtMjggLTIxdC00MSAtNi41cS03IDggLTEyIDM3cS00IDI0IC0xMCA5MHEtOCAxMTEgLTIxIDE2MHEtMjUgOTIgLTg0IDExMnEtMjYgOSAtNTUgOXEtMTQgMCAtMzkgLTNxLTE3IC0yIC0yNCAtMnYwCnEtOCAwIC0xMyAxLjV0LTEzIDEwLjV0LTE2IDI2cS0xMSAzMCAtMTAgNjMuNXQyMC41IDY5dDUzLjUgNTcuNXE1NSAzNyA4OSAzN3EyNyAwIDY5IC0yM3EzOSAtMjAgODEgLTIwcTggMCAyMiAxaDE2cTE4IDAgMzEgLTl0MjEuNSAtMjZ0MTkuNSAtNDhxOCAtMjQgMTMuNSAtMzcuNXQxNi41IC0zM3QyNyAtMzJ0MzcgLTE5LjVxMjIgLTggMzEgLTExcS05IC05IC0zNiAtMzRxLTIxIC0xOCAtMzAgLTI3cS0yMSAtMTkgLTI1LjUgLTQ2dDAuNSAtNDcKdjB6TTUxIDMwNHE4IC0xIDE4IC0zcTM0IC04IDQ4IC0xNXEtMyAtNiAtMTIgLTE4cS0yOCAtNDEgLTIyIC02NXE1IC0yMiAtNiAtNTZxLTI2IDc0IC0yNiAxNTN2MnYydjB6TTUxMiAtMTYxcS0xMjkgMCAtMjM4IDY2LjV0LTE2OCAxNzYuNXE0MCA3NiAyNyAxMzJxMCA1IDE0IDI0cTYgOCA5IDEyLjV0NyAxM3Q1LjUgMTQuNXQxIDE0LjV0LTQuNSAxNS41cS0xMiAyNiAtODAgNDFxLTEzIDMgLTMxIDZxMTQgMTEzIDc4IDIwNnQxNjQgMTQ2LjUKdDIxNiA1My41cTExOSAwIDIyMyAtNThxLTE5IDggLTQzIDhoLTE5cS0xMyAtMSAtMTkgLTFxLTI5IDAgLTU3IDE1cS01MyAyOCAtOTMgMjhxLTQ5IDAgLTExNyAtNDVxLTY0IC00MiAtODggLTExN3EtMjMgLTczIDUgLTEzNnEzMCAtNjkgODkgLTY5djBxMTAgMCAzMCAycTIyIDMgMzMgM3EyMCAwIDM4IC02cTM0IC0xMSA1MSAtNzdxMTIgLTQ0IDIwIC0xNTFxNiAtODAgMTMgLTExMHE2IC0yNiAxNyAtNDFxMTYgLTI0IDQxIC0yNApxNjggMCAxMDggNDRxMjEgMjQgNDEgNzdxMTEgMjggMTYgMzRxMjcgMzAgMzkuNSA2MS41dDExIDUzLjV0LTIuNSA0NHEtMyAyMSAtMS41IDMxLjV0OS41IDE4LjVxMTMgMTEgMzAgMjZxMzIgMjkgNDEgMzlxMjIgMjQgMTggNDR2MXEyNyAtNzUgMjcgLTE1NnEwIC05NCAtMzYuNSAtMTc5dC05OC41IC0xNDd0LTE0Ny41IC05OC41dC0xNzguNSAtMzYuNXYweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJtb3ZlIiB1bmljb2RlPSImI3hlNjBmOyIgCmQ9Ik0xMDA4IDMzMGwtMTU2IDE1NXEtMTQgMTQgLTMzLjUgMTR0LTMzIC0xMy41dC0xMy41IC0zM3QxNCAtMzMuNWw3NiAtNzZoLTMwM3YzMDlsNzYgLTc1cTE0IC0xNCAzMy41IC0xNHQzMyAxMy41dDEzLjUgMzN0LTE0IDMzLjVsLTE1NSAxNTVxLTE0IDE0IC0zMy41IDE0dC0zMi41IC0xNGwtMTU2IC0xNTVxLTE0IC0xNCAtMTQgLTMzLjV0MTMuNSAtMzN0MzMgLTEzLjV0MzMuNSAxM2w3NiA3NnYtMzA5aC0zMDRsNzYgNzYKcTE0IDE0IDE0IDMzLjV0LTEzLjUgMzN0LTMzIDEzLjV0LTMzLjUgLTE0bC0xNTYgLTE1NXEtMTMgLTE0IC0xMyAtMzMuNXQxMyAtMzIuNWwxNTYgLTE1NnExNCAtMTQgMzMuNSAtMTR0MzMgMTR0MTMuNSAzM3QtMTQgMzNsLTc2IDc2aDMwNHYtMzAzbC03NiA3NnEtMTQgMTQgLTMzLjUgMTR0LTMzIC0xMy41dC0xMy41IC0zM3QxNCAtMzMuNWwxNTUgLTE1NXExNCAtMTQgMzMuNSAtMTR0MzMuNSAxNGwxNTUgMTU1cTE0IDE0IDE0IDMzLjUKdC0xMy41IDMzdC0zMyAxMy41dC0zMy41IC0xNGwtNzYgLTc1djMwMmgzMDNsLTc2IC03NnEtMTQgLTE0IC0xNCAtMzN0MTMuNSAtMzN0MzMgLTE0dDMzLjUgMTRsMTU2IDE1NnExMyAxMyAxMyAzMi41dC0xMyAzMy41eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJkZWxldGUiIHVuaWNvZGU9IiYjeGU2MTA7IiAKZD0iTTkyNCA1NzNoLTE1NHYxMDVxMCAyOSAtMjAuNSA0OS41dC00OS41IDIwLjVoLTM3NnEtMjkgMCAtNDkuNSAtMjAuNXQtMjAuNSAtNDkuNXYtMTA1aC0xNTVxLTE0IDAgLTI0IC0xMHQtMTAgLTI0LjV0MTAgLTI0LjV0MjQgLTEwaDc5di01ODFxMCAtMjkgMjAuNSAtNDkuNXQ0OS41IC0yMC41aDUyOHEyOSAwIDQ5LjUgMjAuNXQyMC41IDQ5LjV2NTU4djB2MjNoNzhxMTUgMCAyNSAxMHQxMCAyNC41dC0xMCAyNC41dC0yNSAxMHoKTTQxMi41IC0xMHEtMTQuNSAwIC0yNC41IDEwdC0xMCAyNWwtMSAzNzJxMCAxNSAxMC41IDI1dDI1IDEwdDI0LjUgLTEwdDEwIC0yNXYtMzcycTAgLTE1IC0xMCAtMjV0LTI0LjUgLTEwek02MTEuNSAtMTBxLTE0LjUgMCAtMjQuNSAxMHQtMTAgMjV2MzcycTAgMTUgMTAgMjV0MjQuNSAxMHQyNC41IC0xMHQxMCAtMjVsMSAtMzcycTAgLTE1IC0xMC41IC0yNXQtMjUgLTEwek0zMjMgNjM1cTAgMTcgMTMgMzB0MzEgMTNoMjkwcTE4IDAgMzEgLTEzCnQxMyAtMzB2LTYyaC0zNzh2NjJ6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InJlZnJlc2giIHVuaWNvZGU9IiYjeGU2M2E7IiAKZD0iTTY3NiA2MXEtNzUgLTU0IC0xNjcgLTUycS0xMiAwIC0yNCAxcS0yIDAgLTUgMC41dC00IDAuNXEtMTMgMiAtMTggM3EtMSAwIC0xMSAycS0xMSAzIC0xNyA1cS0yIDAgLTUgMXQtNCAycS0xMiA0IC0xOSA3cS0xIDAgLTQgMnEtMTMgNiAtMjIgMTFoLTF2MHEtMzYgMjAgLTY1IDUwbC0xIDFxLTggOSAtMTcgMTlxLTEgMSAtMiAyLjVsLTEgMS41cS02MyA4MCAtNjMgMTgyaDY2cTMgMCA0LjUgMi41dC0wLjUgNS41bC0xMTEgMTcwCnEtMiAyIC00LjUgMnQtMy41IC0ybC0xMTIgLTE3MHEtMSAtMyAwIC01LjV0NCAtMi41aDY3cTAgLTExOSA2NiAtMjE3cTAgLTEgMC41IC0ydDEuNSAtMXEzIC01IDE0IC0xOHE0IC02IDUgLTdxOCAtMTAgMjEgLTI0cTEgMCAxLjUgLTFsMC41IC0xcTM4IC0zOSA4NSAtNjVxMiAtMSAyIC0ycTEyIC02IDI4IC0xM3ExIC0xIDMuNSAtMnQzLjUgLTFxMTAgLTQgMjQgLTlxMTAgLTQgMTIgLTRxOCAtMyAyMiAtNnExMSAtMyAxNSAtMwpxMCAtMSAyIC0xLjV0NCAtMC41cTQgMCAyMSAtM3ExIDAgMy41IC0wLjV0My41IC0wLjVxMjEgLTIgMzggLTJxMTE3IDAgMjE1IDcwcTE1IDExIDE4LjUgMjkuNXQtNy41IDM0LjV0LTI5LjUgMTl0LTMzLjUgLTh6TTg4OCAzMDBxMCAxMTkgLTY2IDIxN2wtMC41IDEuNXQtMS41IDEuNXEtNSA3IC0xNiAyMmwtMSAxbC0xIDFxLTU4IDcyIC0xNDEgMTA4bC0xLjUgMXQtMi41IDFxLTExIDUgLTI2IDEwcS0xIDAgLTQuNSAxLjV0LTUuNSAxLjUKcS04IDMgLTI0IDZxLTEgMSAtNS41IDJ0LTcuNSAxcS0xIDEgLTMgMS41dC00IDAuNXQtNSAwLjV0LTYuNSAxdC01LjUgMC41dC02IDF0LTcgMXEtMTMgMSAtMzAgMWwtMiAwLjV0LTMgMC41aC0wLjVoLTAuNXEtMTE4IDAgLTIxNSAtNzBxLTE1IC0xMSAtMTguNSAtMjkuNXQ3LjUgLTM0dDI5LjUgLTE5dDMzLjUgNy41cTc1IDUzIDE2NiA1M3ExMyAtMSAyNSAtMnEyIDAgNC41IC0wLjV0My41IC0wLjVxMTEgLTEgMjAgLTNxMiAwIDkgLTIKcTExIC0zIDE5IC01cTEgMCAzIC0xdDMgLTFxMTIgLTQgMjIgLThsMC41IC0wLjV0MS41IC0wLjVxNjMgLTI4IDEwOCAtODJ2LTF2MHE2NSAtODEgNjUgLTE4NWgtNjZxLTMgMCAtNC41IC0yLjV0MC41IC00LjVsMTExIC0xNzFxMiAtMiA0LjUgLTJ0My41IDJsMTEyIDE3MXExIDIgMCA0LjV0LTQgMi41aC02N3YwdjB2MHoiIC8+CiAgICA8Z2x5cGggZ2x5cGgtbmFtZT0iZG9jIiB1bmljb2RlPSImI3hlNjA2OyIgaG9yaXotYWR2LXg9IjEyODEiIApkPSJNMTI4MCA0MjJ6TTQ5MiAtN3EyIC0xIDMuNSAtMnQ1LjUgLTUuNXQ1LjUgLTkuNXQtMS41IC0xMS41dC0xMiAtMTMuNWgtMTUxcS00IDAgLTEwLjUgMS41dC0yNC41IDkuNXQtMzIgMjAuNXQtMjYuNSAzOHQtMTUuNSA1OC41djM5N3YwcTAgNCAxIDEydDcuNSAyOC41dDE3IDM3dDMyIDMydDQ5LjUgMTkuNWgzNDFxNCAwIDEwLjUgLTEuNXQyNCAtMTAuNXQzMS41IC0yMnQyNi41IC00MHQxNC41IC02MnYtMTAydi0xNjB0MCAtNzUKcS0xIC00IC0yLjUgLTExLjV0LTExLjUgLTI5LjV0LTI0LjUgLTQzdC00MyAtNDh0LTY1LjUgLTQ5aC0yaC01aC03aC04LjVoLTcuNWgtNWgtMnEtMTUgNCAtMTUuNSAyNC41dDAuNSA4Ni41djBxMCAzIDEgOHQ2IDE4LjV0MTIuNSAyNC41dDIzLjUgMjEuNXQzNiAxNC41aDgxdjMyNnEwIDMgLTEgOC41dC01LjUgMjB0LTExLjUgMjUuNXQtMjEgMjEuNXQtMzIgMTIuNWgtMzMycS0zIDAgLTcuNSAtMXQtMTYuNSAtNnQtMjEgLTEzLjUKdC0xNy41IC0yNy41dC0xMC41IC00NHEtMSAtMjAzIC0xIC0zODZxMSAtMyAxLjUgLTl0NSAtMjF0MTEuNSAtMjYuNXQyMS41IC0yMi41dDM0LjUgLTEzaDE0NnpNNzM2IDEwNmgtNzBxLTQgLTEgLTkuNSAtMy41dC0xNi41IC0xNS41dC0xMiAtMzB2LTE2di0zMS41di0xNS41bDggLTFxNSAwIDM0IDI5cTM3IDM3IDY2IDg0ek02NTEgNDMwcTAgLTEwIC03LjUgLTE3LjV0LTE3LjUgLTcuNWgtMjIxcS0xMCAwIC0xNy41IDcuNXQtNy41IDE3LjV2MApxMCAxMSA3LjUgMTguNXQxNy41IDcuNWgyMjFxMTAgMCAxNy41IC03LjV0Ny41IC0xOC41djB6TTY1MiAyODJxMCAtMTEgLTcuNSAtMTguNXQtMTguNSAtNy41aC0yMjBxLTExIDAgLTE4LjUgNy41dC03LjUgMTguNXYwcTAgMTEgNy41IDE4LjV0MTguNSA3LjVoMjIwcTExIDAgMTguNSAtNy41dDcuNSAtMTguNXYwek01MjQgMTMzcTAgLTExIC03LjUgLTE5dC0xOC41IC04aC05MXEtMTEgMCAtMTkgOHQtOCAxOXYwcTAgMTEgOCAxOXQxOSA4aDkxCnExMSAwIDE4LjUgLTh0Ny41IC0xOXYweiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJsaW5lIiB1bmljb2RlPSImI3hlNjExOyIgCmQ9Ik05NjAgNTUycTAgLTE3IC0xMiAtMjkuNXQtMzAgLTEyLjVoLTgxMnEtMTggMCAtMzAgMTIuNXQtMTIgMjkuNXYwcTAgMTggMTIgMzB0MzAgMTJoODEycTE4IDAgMzAgLTEydDEyIC0zMHYwek05NjAgMzAwcTAgLTE3IC0xMiAtMjkuNXQtMzAgLTEyLjVoLTgxMnEtMTggMCAtMzAgMTIuNXQtMTIgMjkuNXYwcTAgMTcgMTIgMjkuNXQzMCAxMi41aDgxMnExOCAwIDMwIC0xMi41dDEyIC0yOS41djB6TTk2MCA0OHEwIC0xOCAtMTIgLTMwCnQtMzAgLTEyaC04MTJxLTE4IDAgLTMwIDEydC0xMiAzMHYwcTAgMTcgMTIgMjkuNXQzMCAxMi41aDgxMnExOCAwIDMwIC0xMi41dDEyIC0yOS41djB6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9ImZpbGUtYm94IiB1bmljb2RlPSImI3hlNjFiOyIgCmQ9Ik04MDQgNzcwbDUwIC00MzFsLTU3IC03bC00NSAzODZoLTQ4MGwtNDUgLTM4NmwtNTcgN2w1MCA0MzFoNTg0ek0zMTkgNjc0aDM4NnYtNDhoLTM4NnY0OHpNMzE5IDU3N2gzODZ2LTQ4aC0zODZ2NDh6TTMxOSA0ODFoMzg2di00OWgtMzg2djQ5ek0zMTkgMzg0aDM4NnYtNDhoLTM4NnY0OHpNODc0IDI4N2gtNzI0cS0xMCAwIC0xNSAtNi41dC0yIC0xNS41bDgyIC0yNDRxMyAtMTAgMTIgLTE2LjV0MTkgLTYuNWg1MzJxMTAgMCAxOSA2LjUKdDEyIDE2LjVsODIgMjQ0cTMgOSAtMiAxNS41dC0xNSA2LjV6TTYwOSAxOTFoLTE5NHY0OGgxOTR2LTQ4eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJzd2l0Y2hvbiIgdW5pY29kZT0iJiN4ZTYxNTsiIApkPSJNODMyIDg5NmgtNjQwcS04MCAwIC0xMzYgLTU2dC01NiAtMTM2di02NDBxMCAtNzkgNTYgLTEzNS41dDEzNiAtNTYuNWg2NDBxNzkgMCAxMzUuNSA1Ni41dDU2LjUgMTM1LjV2NjQwcTAgODAgLTU2LjUgMTM2dC0xMzUuNSA1NnpNMTYwIDBxLTEzIDAgLTIyLjUgOS41dC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNMTYwIDcwNHEtMTMgMCAtMjIuNSA5LjUKdC05LjUgMjIuNXQ5LjUgMjIuNXQyMi41IDkuNXQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNNzA0IDY0cTAgLTI3IC0xOC41IC00NS41dC00NS41IC0xOC41aC0yNTZxLTI3IDAgLTQ1LjUgMTguNXQtMTguNSA0NS41djY0MHEwIDI2IDE5IDQ1dDQ1IDE5aDI1NnEyNyAwIDQ1LjUgLTE4LjV0MTguNSAtNDUuNXYtNjQwek04NjQgMHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41dDkuNSAyMi41dDIyLjUgOS41CnQyMi41IC05LjV0OS41IC0yMi41dC05LjUgLTIyLjV0LTIyLjUgLTkuNXpNODY0IDcwNHEtMTMgMCAtMjIuNSA5LjV0LTkuNSAyMi41dDkuNSAyMi41dDIyLjUgOS41dDIyLjUgLTkuNXQ5LjUgLTIyLjV0LTkuNSAtMjIuNXQtMjIuNSAtOS41ek01NzYgNzA0aC0xMjhxLTI2IDAgLTQ1IC0xOXQtMTkgLTQ1di0xOTJxMCAtMjYgMTkgLTQ1dDQ1IC0xOWgxMjhxMjcgMCA0NS41IDE4LjV0MTguNSA0NS41djE5MnEwIDI3IC0xOC41IDQ1LjUKdC00NS41IDE4LjV6IiAvPgogICAgPGdseXBoIGdseXBoLW5hbWU9InN5c3NlcnZlciIgdW5pY29kZT0iJiN4ZTYwNTsiIApkPSJNNTE1IDE0NXEtMzYgMCAtNzEgLTEydC02NCAtNDF0LTM2IC02OWgzMzhxLTUgNTMgLTU3IDg3LjV0LTExMCAzNC41ek05NTUgMTU3cS0zIDI2NSAwIDUyOHEwIDM0IC0xMi41IDQ3dC00Ni41IDEzcS00NSAtMSAtMzg0IC0xdjBxLTMzOSAwIC0zOTAgMXEtMjggMCAtNDAuNSAtMTF0LTEyLjUgLTM5cTEgLTIzMSAwIC01NDRxMCAtMjggMTEuNSAtNDAuNXQzOS41IC0xMS41cTM1IDEgMTA3IDAuNXQxMDcgMC41cTI1IDEgNDggMTcKcTU2IDQwIDExNS41IDQ1dDExNi41IC0yOHE2MyAtMzcgMTUwIC0zNXE5NCAyIDEzMiAwcTMzIC0yIDQ2IDExdDEzIDQ3ek04OTIgMjEzaC03NjB2NDU2aDc2MHYtNDU2eiIgLz4KICAgIDxnbHlwaCBnbHlwaC1uYW1lPSJmaWxlIiB1bmljb2RlPSImI3hlNzdkOyIgCmQ9Ik02NDUgODA5aC0zNzJxLTQ0IDAgLTc1IC0zMXQtMzEgLTc1di02MzhxMCAtNDQgMzEgLTc1dDc1IC0zMWg0NzhxNDQgMCA3NSAzMXQzMSA3NXY1MzJ6TTY0MyA3MjZsMTI3IC0xMjdoLTEwNHEtOSAwIC0xNiA2LjV0LTcgMTYuNXYxMDR6TTc1MSAxOWgtNDc4cS0xOSAwIC0zMi41IDEzLjV0LTEzLjUgMzIuNXY2MzhxMCAxOSAxMy41IDMyLjV0MzIuNSAxMy41aDMxMHYtMTI3cTAgLTM0IDI0LjUgLTU4LjV0NTguNSAtMjQuNWgxMzF2LTQ3NApxMCAtMTkgLTEzLjUgLTMyLjV0LTMyLjUgLTEzLjV6TTY4MiAzODhoLTM0MHEtMTIgMCAtMjEgLTl0LTkgLTIxLjV0OSAtMjF0MjEgLTguNWgzNDBxMTIgMCAyMSA4LjV0OSAyMXQtOSAyMS41dC0yMSA5ek02ODIgMjMyaC0zNDBxLTEyIDAgLTIxIC05dC05IC0yMS41dDkgLTIxdDIxIC04LjVoMzQwcTEyIDAgMjEgOC41dDkgMjF0LTkgMjEuNXQtMjEgOXoiIC8+CiAgPC9mb250Pgo8L2RlZnM+PC9zdmc+Cg=="
  19052. /***/ }),
  19053. /* 135 */
  19054. /***/ (function(module, exports) {
  19055. module.exports = "data:application/x-font-ttf;base64,AAEAAAAQAQAABAAARkZUTXZHMeAAAAEMAAAAHEdERUYAUgAGAAABKAAAACBPUy8yV6halgAAAUgAAABWY21hcL2Ds2kAAAGgAAABqGN2dCANZf5MAAA0OAAAACRmcGdtMPeelQAANFwAAAmWZ2FzcAAAABAAADQwAAAACGdseWZJFyqxAAADSAAALDRoZWFkDijSuQAAL3wAAAA2aGhlYQjeBE8AAC+0AAAAJGhtdHh/CAn8AAAv2AAAAIxsb2Nho5yvDgAAMGQAAABMbWF4cAIkCrwAADCwAAAAIG5hbWUckFeqAAAw0AAAAihwb3N0xwSeMQAAMvgAAAE2cHJlcKW5vmYAAD30AAAAlQAAAAEAAAAAzD2izwAAAADVBMeIAAAAANUEx4gAAQAAAA4AAAAYAAAAAAACAAEAAwAkAAEABAAAAAIAAAABBAYB9AAFAAgCmQLMAAAAjwKZAswAAAHrADMBCQAAAgAGAwAAAAAAAAAAAAEQAAAAAAAAAAAAAABQZkVkAEAAeOd9A4D/gABcA4AA1AAAAAEAAAAAAAAAAAADAAAAAwAAABwAAQAAAAAAogADAAEAAAAcAAQAhgAAAA4ACAACAAYAAAB45hXmH+Y6533//wAAAAAAeOYA5hfmOud9//8AAP+LAAAAABnkGKcAAQAAAAAACgA0AAAAAAAAAAUADwARABIACAAjAB8ABgAHAA4AEwAUABUABAAaABwAHQAgABAACwAMACIACQAWABcAGwAhAA0ACgAYABkAAAEGAAABAAAAAAAAAAECAAAAAgAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUALP/hA7wDGAAWADAAOgBSAF4Bd0uwE1BYQEoCAQANDg0ADmYAAw4BDgNeAAEICAFcEAEJCAoGCV4RAQwGBAYMXgALBAtpDwEIAAYMCAZYAAoHBQIECwoEWRIBDg4NUQANDQoOQhtLsBdQWEBLAgEADQ4NAA5mAAMOAQ4DXgABCAgBXBABCQgKCAkKZhEBDAYEBgxeAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CG0uwGFBYQEwCAQANDg0ADmYAAw4BDgNeAAEICAFcEAEJCAoICQpmEQEMBgQGDARmAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CG0BOAgEADQ4NAA5mAAMOAQ4DAWYAAQgOAQhkEAEJCAoICQpmEQEMBgQGDARmAAsEC2kPAQgABgwIBlgACgcFAgQLCgRZEgEODg1RAA0NCg5CWVlZQChTUzs7MjEXF1NeU15bWDtSO1JLQzc1MToyOhcwFzBRETEYESgVQBMWKwEGKwEiDgIdASE1NCY1NC4CKwEVIQUVFBYUDgIjBiYrASchBysBIiciLgI9ARciBhQWMzI2NCYXBgcOAx4BOwYyNicuAScmJwE1ND4COwEyFh0BARkbGlMSJRwSA5ABChgnHoX+SgKiARUfIw4OHw4gLf5JLB0iFBkZIBMIdwwSEgwNEhKMCAYFCwQCBA8OJUNRUEAkFxYJBQkFBQb+pAUPGhW8HykCHwEMGScaTCkQHAQNIBsSYYg0Fzo6JRcJAQGAgAETGyAOpz8RGhERGhF8GhYTJA4QDQgYGg0jERMUAXfkCxgTDB0m4wAABwAA/ywEAAMsAA8AFwAfAC8ANwA/AE8AzkuwGlBYQDEIBgICAAECAVULBwIFBQBRDgEAAApBCgEEBANRDQkCAwMLQQ8BDAwDUQ0JAgMDCwNCG0uwLlBYQC8OAQALBwIFBAAFWQgGAgIAAQIBVQoBBAQDUQ0JAgMDC0EPAQwMA1ENCQIDAwsDQhtAMQ4BAAsHAgUEAAVZCgEEDAMETQ8BDA0JAgMCDANZCAYCAgEBAk0IBgICAgFRAAECAUVZWUAmQkACAEpHQE9CTz08OTg1NDEwLSolIh0cGRgVFBEQCgcADwIPEA4rASEiBhURFBYzITI2NRE0JgAiJjQ2MhYUAiImNDYyFhQBFAYjISImNRE0NjMhMhYVEiImNDYyFhQCIiY0NjIWFAEjIgYdARQWOwEyNj0BNCYDQP2AUHBwUAKAT3Fx/R4aExMaExMaExMaEwIAJRv/ABslJhoBABslrRoTExoTExoTExoT/sCAGiYlG4AbJSUDLHBQ/YBPcXFPAoBQcPyAExoTExoCrRMaExMa/W0bJSUbAoAaJiUb/UATGhMTGgKtExoTExr+rSYawBslJRvAGyUAAAAAAQA6/7gDlgLqAAkABrMEAAEmKwETBQcTJQUTJyUB6IQBKdcz/vf+9jPXASkC6f7zK9H+2IyMASjRKwAAAwBL/+ADtQMfAAwAGAAgAChAJQADAAUEAwVZAAICAFEAAAAKQQAEBAFRAAEBCwFCExMVFDUSBhQrJQEmIgcBBhcWMyEyNgE0NjIWFREUBiImNRYiJjQ2MhYUA6/+qyNvI/6sIhwdRwKiRzn+DxMaExMaEzQoHBwoHH8CYT8//Z8+MTBhAf8NExMN/uANExMN4BwoHBwoAAAFAEv/3wO1Ax8ACwAXACMAJAAsAEVAQiQBBwYBQAAFAAQGBQRZAAYABwMGB1kAAgIBUQABAQpBAAMDAFEIAQAACwBCAgAsKygnHx4ZGBQRDQwHBgALAgsJDisFISImNwE2MhcBFgYAIgcBBhYzITI2JwECIiY1ETQ2MhYVERQHBjQ2MhYUBiIDUf1eRzkiAVQjbyMBVSI5/nokEf6sERQjAqIjFBH+qxUaExMaEyAwHCgcHCghYj4CYT8//Z8/YQMAHv2eHiIiHgJi/j8TDQEgDRMTDf7gDYMUKBwcKBwAAAIAZv+SA5oCxgALACoAOEA1DAECBQFAAAMABQADBWYABQIABQJkAAAAAgQAAlkABAEBBE0ABAQBUQABBAFFFxkUKRUQBhQrACIOARQeATI+ATQmARQeAjMyPwE2NzIfAR4BBwMxBw4BLwEuAT8BPgEXAm/evW1tvd69bW3+TAoIDAQQXYoHCA0ILQcBB/o1BxYHlwgBCCMHFggCxW293r1tbb3evf6lAQoIB2ieCAEHLAgVCP74OQcBB44HFgglCAEIAAACAH8AIQOBAyMACwAXAGZLsDJQWEAkBwEFAAYABQZmBAECAwEDAgFmAAMAAQMBVQAGBgBSAAAACgZCG0AqBwEFAAYABQZmBAECAwEDAgFmAAAABgMABlcAAwIBA0sAAwMBUQABAwFFWUAKEREREREVFRAIFisAIg4BFB4BMj4BNCYDIzUjFSMRMxUzNTMCaNCxZ2ex0LFnZ4UyxDIyxDIDImex0bFnZ7HRsf4br68Bi7OzAAADAFX/LAOrAywAEgAaADMAcUAOMxsCAwIREAkHBAEAAkBLsBpQWEAdBgQIAwMAAAEDAFkAAQAFAQVWAAICB1EABwcKAkIbQCMABwACAwcCWQYECAMDAAABAwBZAAEFBQFNAAEBBVIABQEFRllAExMTMTAtKyYjHhwTGhMaGDgSCRErJTQ2MhYVFAcWFxQGKwEiJjU3JgM1NDYyFh0BJRUjIgYVERQWMyEyNjURNCYrATU0JiIGFQGrMkYyJwkJEw1ADRMSJ1ZkjmT+QEAkMjIkAqokMjIkQKLmopcjMjIjLxkyPA0TEw1uGQEZlkZkZEaWlpYyI/5VIzIyIwGrIzKWc6KicwAAAAADAA8AWQPxAqcADwAfACcANkAzAAEAAgUBAlkABQAEAwUEWQADAAADTQADAwBRBgEAAwBFAgAlJCEgHRoVEgoHAA8CDwcOKyUhIiY9ATQ2MyEyFh0BFAYTNCYjISIGHQEUFjMhMjY1BCImNDYyFhQC2f5OdKOjdAGydKOjZX9a/k5af39aAbJaf/3UiGBgiGBao3Mgc6OjcyBzowE2Wn5+WiBaf39akWGIYGCIAAAAAAMADwBZA/ECpwAPACAAKAA9QDogEAIEBQFAAAEAAgUBAlkABQAEAwUEWQADAAADTQADAwBRBgEAAwBFAgAmJSIhHRoVEgoHAA8CDwcOKyUhIiY9ATQ2MyEyFh0BFAYTNCYjISIGHQEUFjMhMjY9AQYiJjQ2MhYUAtn+TnSjo3QBsnSjo2Z/Wv5MWX9/WQG0Wn+xiGBgiGFao3Mgc6OjcyBzowE1Wn9/Wh9af39aH7BhiGBgiAAAAAACAAD/XwQAAwQAIQA1AFW1AwEDBAFAS7AaUFhAGgACAwEDAgFmAAMAAQMBVQAEBABRAAAACgRCG0AgAAIDAQMCAWYAAAAEAwAEWQADAgEDTQADAwFRAAEDAUVZtigsETgpBRMrLQEmJzY1NCYnJiMiBgcGFRQWFxY7ATI3MhYxBRY2PwE2JiUOASMmJy4BNTQ3PgEzMhceARUUA+P+8AIEJUVBaYpSmDdYRUJpiAF5ZAECARAbSBcGGAT+TChtO2JMLzJAJ207Y0svMgPjAgJPUVKYN1lGQWmKUpk3WEgD4xcJHQccSe4vMgE/J247Y0swMT8obTtjAAMAdP+gA4wCuAAPABkAHAAmQCMZAQACGxgCAQACQBwaAgE9AAIAAmgAAAEAaAABAV8SFxYDESslJyY0NwE2Mh8BFhQHAQYiATYyHwEWFA8BJwE3FwGAqQYGAXwGEAapBgb+hAYRATASMRJwEhI4xf33OMYDqQURBgF8BgapBhAG/oQGAqkSEnASMRI4xf0y/sYAAAADAGv/6wOVAxUACwAbACsATEuwLlBYQB0AAwAEBQMEWQACAgFRAAEBCkEABQUAUQAAAAsAQhtAGgADAAQFAwRZAAUAAAUAVQACAgFRAAEBCgJCWbc1NTU3FRAGFCsEIi4BND4BMh4BFAYDNCYrASIGHQEUFjsBMjY1FTQmKwEiBh0BFBY7ATI2NQJu3LpsbLrcumxs8QsHSgcLCwdKBwsLB0oHCwsHSgcLFGy63LpsbLrcugIFBwsLB0oICgoIgQgLCwjvBwsLBwAAAAABATIArgLWAlIAHAAnQCQABAMBBE0FAQMGAgIAAQMAWQAEBAFRAAEEAUUTIxMjIxMQBxUrASMVFAYiJj0BIyImNDY7ATU0NjIWHQEzMhYUBiMCu50PFhCdCw8PC50QFg+dCw8PCwFmngoQEAqeDxYPnQsPDwudDxYPAAAAAwBJASsDtQH2AAcADwAXACFAHgQCAgABAQBNBAICAAABUQUDAgEAAUUTExMTExAGFCsSIgYUFjI2NCQiBhQWMjY0JCIGFBYyNjTYUzs7UzwBFVQ7O1Q7ARZUOztUOwH1O1Q7O1Q7O1Q7O1Q7O1Q7O1QAAAAJAED/vgO/Az4ADwAfAC8APwBPAF8AbwB/AI8Ah0CEFAQTAhIFAAUDAgEGAAFZFwoWCBUFBgsJAgcMBgdZGhAZDhgFDA0NDE0aEBkOGAUMDA1REQ8CDQwNRYKAcnBiYFJQQkAyMCIgEhACAIqHgI+Cj3p3cH9yf2pnYG9ib1pXUF9SX0pHQE9CTzo3MD8yPyonIC8iLxoXEB8SHwoHAA8CDxsOKwEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgEjIgYdARQWOwEyNj0BNCYhIyIGHQEUFjsBMjY9ATQmISMiBh0BFBY7ATI2PQE0JgJZswwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgE8swwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgE8swwSEgyzDBISATyzDBISDLMMEhL9ZLMMEhIMswwSEgM+EgyzDBISDLMMEhIMswwSEgyzDBISDLMMEhIMswwS/rgSDLMNERENswwSEgyzDRERDbMMEhIMsw0REQ2zDBL+uBIMsw0REQ2zDBISDLMNERENswwSEgyzDRERDbMMEgALAED/awOgAmwABgAKAA4AEgAWABoAHgAiACYAKgAuAU20BQEPAT9LsApQWEBRAAAEAwQAA2YLCQIHBgEGB14SEAIODw5pAAUYAQQABQRXAAMABgcDBlcKCBcCBAEAEwwBE1cADAAVFAwVVwAWEQEPDhYPVwAUFA1PAA0NCw1CG0uwGFBYQFIAAAQDBAADZgsJAgcGAQYHAWYSEAIODw5pAAUYAQQABQRXAAMABgcDBlcKCBcCBAEAEwwBE1cADAAVFAwVVwAWEQEPDhYPVwAUFA1PAA0NCw1CG0BXAAAEAwQAA2YLCQIHBgEGBwFmEhACDg8OaQAFGAEEAAUEVwADAAYHAwZXCggXAgQBABMMARNXAAwAFRQMFVcAFAANFhQNVwAWDw8WSwAWFg9PEQEPFg9DWVlANgcHAAAuLSwrKikoJyYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsHCgcKCQgABgAGEREZECslESMRIxc3ARUjNSUhESEFMxUjNzMVIzczFSMFMxUjNzMVIzczFSMnMxUjJTMVIwMAQKDAwP2gwAEA/sABQP7AYGCAYGCAQED/AEBAYGBggGBg4EBAAQBAQGwBgP6AwMABwMDAQP7AgEBAQEBggGBAQEBA4GBAYAAAAAsAQP9sA6ECbAAGAAoADgASABYAGgAeACIAJgAqAC4BA7QFAREBP0uwClBYQFwHBQIDBANoFwICAQsKCwEKZg4MAgoVFQpcAAAUExQAE2YGAQQADwgED1cACAAREAgRVwAQAAkSEAlXABINAQsBEgtXABUYARQAFRRYABMWFhNLABMTFlAAFhMWRBtAXQcFAgMEA2gXAgIBCwoLAQpmDgwCChULChVkAAAUExQAE2YGAQQADwgED1cACAAREAgRVwAQAAkSEAlXABINAQsBEgtXABUYARQAFRRYABMWFhNLABMTFlAAFhMWRFlANicnAAAuLSwrJyonKikoJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcABgAGEREZECsBETMRMycHATMVIzczFSM3MxUjBTMVIzczFSM3MxUjJzMVIyUzFSMRFSM1JSERIQLAQKDAwP4gYGCAYGCAQED/AEBAYGBggGBg4EBAAQBAQMABAP7AAUABLP6AAYDAwAFAQEBAQGCAYEBAQEDgYEBg/uDAwED+wAACAFf/1wOpAykACwAXAJRLsB1QWEAmBAECAwUDAgVmBwEFBgMFBmQAAwMBUQABAQpBAAYGAFIAAAALAEIbS7AyUFhAJAQBAgMFAwIFZgcBBQYDBQZkAAEAAwIBA1cABgYAUgAAAAsAQhtAKQQBAgMFAwIFZgcBBQYDBQZkAAEAAwIBA1cABgAABksABgYAUgAABgBGWVlAChERERERFRUQCBYrBCIuATQ+ATIeARQGAyM1IxUjFTMVMzUzAnPmxHJyxObEcnJjqlSqqlSqKXLE5sRycsTmxAFhqqpUqqoAAAMAQAAAA8EC4AAjAEAATABLQEgJAQcALCscGwQFBgJABwEAPgkCAQMACggCBwMAB1kAAwAGBQMGWQAFBAQFTQAFBQRRAAQFBEVDQUlGQUxDTCZlNTVnFREiCxYrATQmKwEwIjEGBwYwIwYHBgcGBwYjKgEjISIGFRMUFjMhMjY1JxQGIyEiJjUDNDYzIToBMzI2NzY3NjczMhYdAiUhMjY0JiMhIgYUFgPBOSe6AgYEAQEFAxIRAwEEFwENAf5gKDggOCgCgCg4QBMN/YANEyATDQGgAQ0BIy8HAgIIBagNE/z/AaANExMN/mANExMCgCg4AQEBAwMRRwwCETkp/mIoODgmAg0TFA4Bng0TIh8ECyIOEw0CASMTGhMTGhMAAAQAX//BA7MDSQAFAAkADQATAA1AChMRDAoJBwUDBCYrLQEHCQEnNwkCEQ0BJQElBwkBJwIJ/ogyAaoBqjMz/lb+VgGqAS7+0v7SAS7+iDIBqgGqM8L3NP7dASM1bAEj/t3+3QHxzs/P/fv4NP7dASM1AAAABAC//8ADQANAABkAIwAzAEMAV0BUISAbGgkIAgEIAQQ7NAIJCAJAAAAABAEABFkFCgMDAQAHCAEHWQAIAAkGCAlZAAYCAgZNAAYGAlIAAgYCRgAAQD84NzEuKSYjIh4dABkAGTUkJAsRKwE1MS4BIyIGBzEVIyIGFREUFjMhMjY1ETQmJTE+ATIWFzEVIQEUBiMhIiY1ETQ2MyEyFhUHNTQmIgYdAQYVFBYyNjU0AwEDlWholQMBGyUlGwIAGyUl/iYCcJxwAv6AAb8TDf5ADRMTDQHADRPgExoTHCMyIwHAh2iRkWeIJRv+gBslJRsBgBomhU5tbU6F/mANExMNAUANExMNkjQNExMNNBIhGSMjGSEABgCJ/6oDswNIAAsAFwAuAEAAUgBZAIFAflcBBQ0uAQ4PAkAABAANBQQNWQAFAAkPBQlZEgEPAA4ADw5ZEAEAAAECAAFZEQECAAMMAgNZAAwKAQcIDAdZCwEIBgYITQsBCAgGUQAGCAZFVFMODAIAU1lUWVJQTUtGQ0A/PTs4NjEvKigmIx4cGhgUEQwXDhcIBQALAgsTDisBISIGFBYzITI2NCYHISIGFBYzITI2NCYDISIGFSMiBhURFBYzITI2NTMyNjURNQEhIiY1ETQ2MzcRFBYzIRQGIzcUBiMhIiY1ETQ2MyEVFBY7ASciJj0BMRcC6P78DBERDAEEDBERDP78DBERDAEEDBERDP6lLUYiLUJGLgGxLkYdLkb++/5PFyMhFiBGLQFbIxfLIxf+ThYjIxYBIUYuV1cVJZEBshEYEREYEZARGBERGBECJUctRi39vi1HRy1HLAGVOf2FJBYCQhYjAf33LEcWJK0WIyMWAkIXI3QtRjo9GVasAAAAAgAA/3UDbgLjACsANwAvQCwkGQ4DBAIAAUAABQEBAAIFAFkDAQIEBAJNAwECAgRRAAQCBEUVFyQuJCoGFCslNC8BNzY1NC8BJiMiDwEnJiMiDwEGFRQfAQcGFRQfARYzMj8BFxYzMj8BNhIUDgEiLgE0PgEyFgKRC2hoCws0Cw8PC2doCg8QCzMLC2dnCwszCxAPCmhnCw8PCzQL3XbK78l2dsnvyqsPC2dnCw8QCjQLC2hoCws0ChAPC2dnCw8QCjQLC2hoCws0CgEI7sp2dsruynZ2AAAABf///ywEAAMsAA8AHABcAGwAwwGuQBuEAQYLGwEHBrpVEAMDB7F+cnBsZ2FdCAIOBEBLsAtQWEBBAA0ABgcNBlkMAQsIAQcDCwdZAAMAEA4DEFkFAQQPAQ4CBA5ZEgEJAAEJAVUACgoAUQAAAApBAAICEVEAERELEUIbS7AMUFhAOwANAAYHDQZZDAELCAEHAwsHWQUEAgMQDwIOAgMOWRIBCQABCQFVAAoKAFEAAAAKQQACAhFRABERCxFCG0uwGlBYQEEADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkSAQkAAQkBVQAKCgBRAAAACkEAAgIRUQAREQsRQhtLsCZQWEA/AAAACg0AClkADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkSAQkAAQkBVQACAhFRABERCxFCG0BGAAAACg0AClkADQAGBw0GWQwBCwgBBwMLB1kAAwAQDgMQWQUBBA8BDgIEDlkAAgARCQIRWRIBCQEBCU0SAQkJAVEAAQkBRVlZWVlAJsPCqKacmpiXlpWPjYuJiIWDgW5tSkdGREJAODc2NTMxKCcXEhMQKwAuASIOAhQeAjI+AjQnLgEnLgInLgInFgMeAQYHBgcOAyMmJyYnJicmJyYjIgcGIzEiLgEnJj4BNzYzMhcWMzI3MjMyFx4BFx4DFxYXBgcGBw4BFyUWFxYXBgcGFxYHJjU8ATUBIiYnNic0Nz4DJicmJyYnPgIzMhcmIyIjBiMiJyYjIgcGBwYXFjMxMjc2MzIXFhcWFxYXFhcWMzI3Njc2Nz4BJicmNjc2NzY3Nic0MRYVFA4CIwOzkrrOupJNTZK6zrqSTVIHHh8QGQwJCAsXDoJYAgESFAwOCAsWIhgHBQQGCA0ZOxodDhkRBwgKEAgLAiciNyIbKicqCA4KBhINDRELCAsWIBUWCQkbFQkVCQX9FQgKIg4DCRwGBQsaAc2B2jsoDQ4GBggDAQQMRA0SDoDIdHdoExgICw0GHRw1KDFEQBgXHB47ChQWCxQSIhEMCAYHBgsQGUQoFRQLBRsZAwEDAwgNESAJFgQbSXyrXQJNkk1NkrrOupJNTZK6zj8MDwsFHhscGBokC1L+wRMhLBcNJRYXHQ0IHRhCbzFcFAkDAgMSER5DRxYlFxQBCQkiHxgbJxkHCAMJGRIJEzYUDgECCAcGDCkYFiJKTwECAf4vhW5MOAUTCAkRDBEHGg8DA3G6azoIAQ8cLSpLST9FAgMGC0Isa1AeGg8YLBg1HAYePywWFRUICw8dChgUAUtRXqp8SQAAAAEAAv8sA/4DLABLAKRADBoJAgIDQC8CCgkCQEuwGlBYQDcEAQIDAAMCAGYGAQABAwABZA0BBwgJCAcJZgsBCQoICQpkBQEBDAEIBwEIWAAKCgNRAAMDCgpCG0A8BAECAwADAgBmBgEAAQMAAWQNAQcICQgHCWYLAQkKCAkKZAADAgoDTQUBAQwBCAcBCFgAAwMKUQAKAwpFWUAVR0ZCQT49ODcyMRQXFBMVFRMUEg4XKwEnJiIGFB8BIREXFjI2NC8BJiIPAQYUFjI/AREhNzY0JiIPAQYUHwEWMjY0LwEhEScmIgYUHwEWMj8BNjQmIg8BESEHBhQWMj8BNjQD8JwOJxsOTP7RTA4nGw6bDicNnA4bJw5M/tBMDhsnDpwNDZwOJxsOTAEwTA4nGw6bDicOmw4bJw5MAS9MDhsnDpwNAUqbDhsnDkwBNUsOGycOmw4Omw4nGw1M/stMDicbDpsOJw2cDhwmDkz+0UwOGycOmw4Omw4nGw5LAS5MDiYcDpwNJwAEAED/bAPAAuwAIQAtADkAQwBVQFIbGgIHAwFAAAEACgABClkFAQMHAANNCwIMAwAJAQcGAAdZCAEGBAQGTQgBBgYEUQAEBgRFAQBDQj88NTQvLikoIyIeHBcUEQ8MCgcEACEBIQ0OKwEjNTQmIyEiBh0BIyIGFBY7AREUFjMhMjY1ETE1MzI2NCYAIiY1AzQ2MhYVERQWIiY1ETQ2MhYVExQBNDYzITIWHQEhA5yaKR3+iB0pmw4UFA5PKR0CEB0pTg8UFP4AHRQBFR0Usx0UFB0UAf68GhIBIhIa/oYCPWkdKSkdaRQdFP27HSkpHQIuFxQdFP25FA8BdA8UFA/+jA8UFA8BdA8UFA/+jA8CcREaGhE+AAAAAgBB/6wDvwKsAGAAvgNNQBylASUjqgEIEzMBCidDAQwABEC+vWEDJhYBBgI/S7ALUFhArhkYAhcaFRoXFWYWARUUGhUUZAAUHxoUH2QAIh8jHyIjZiQBIyUfIyVkACUTHyUTZAATCB8TCGQACAcfCAdkCQEHJh8HJmQoASYnHyYnZAAnCh8nCmQACgYfCgZkAAYLHwYLZAALBR8LBWQABQQfBQRkAAQDHwQDZAADAB8DAGQADQwODA0OZg8BDhAMDhBkHh0cGwQaISACHyIaH1kCAQIAEhECEAAQVgAMDAsMQhtLsAxQWECuGRgCFxoVGhcVZhYBFRQaFRRkABQfGhQfZAAiHyMfIiNmJAEjJR8jJWQAJRMfJRNkABMIHxMIZAAIBx8IB2QJAQcmHwcmZCgBJicfJidkACcKHycKZAAKBh8KBmQABgsfBgtkAAsFHwsFZAAFBB8FBGQABAMfBANkAAMAHwMAZAANDA4MDQ5mEA8CDhEMDhFkHh0cGwQaISACHyIaH1kCAQIAEgERABFWAAwMCwxCG0uwFlBYQK4ZGAIXGhUaFxVmFgEVFBoVFGQAFB8aFB9kACIfIx8iI2YkASMlHyMlZAAlEx8lE2QAEwgfEwhkAAgHHwgHZAkBByYfByZkKAEmJx8mJ2QAJwofJwpkAAoGHwoGZAAGCx8GC2QACwUfCwVkAAUEHwUEZAAEAx8EA2QAAwAfAwBkAA0MDgwNDmYPAQ4QDA4QZB4dHBsEGiEgAh8iGh9ZAgECABIRAhAAEFYADAwLDEIbQLoZGAIXGhUaFxVmFgEVFBoVFGQAFB8aFB9kACIfIx8iI2YkASMlHyMlZAAlEx8lE2QAEwgfEwhkAAgHHwgHZAkBByYfByZkKAEmJx8mJ2QAJwofJwpkAAoGHwoGZAAGCx8GC2QACwUfCwVkAAUEHwUEZAAEAx8EA2QAAwAfAwBkAAwADQAMDWYADQ4ADQ5kDwEOEAAOEGQeHRwbBBohIAIfIhofWQIBAgAMEABNAgECAAAQUhIRAhAAEEZZWVlAS7y6trWxr6ino6KhoJ2cmpmYl5WUjYyLiomIhoWEg4KAfnx6eXV0c3Jwb2ZlW1lYV1ZVVFJQT0xLSEc9PDY1MS8ULBQUExIRESEpFyslBiciJyImIyYnIicmJyImJyYnIicmJzAjMSYnMCcmJy4BMSY1MzI2LwEmIg8BBhY7ARQXFBYzFhcWFxYXMhYxFhcWFRYXHgEzFhcWMxYXFjMUFjMyFzIWMxYzMjc+AS4BNzQnMCYjJicwJjEmJzAmIyYnIiYjJicuASMuASMiLgEjIiYjJiMwJiMwIjEiBw4BHgE3NjMWFzIWMxYXMhcWFzIWMxYXMBYzFhcUMDEWFSMiBh8BFjI/ATYmKwE5AQKkS1wMDAIGAQ0FAQoLBgIGAQwHAQMNCQEkHQEICQECP0IDAwJvAgUBcAECA0NCAQEDCwQBCA0BASYvAgwQAQUBCg4KAggOCwQEAgQRAQUBFRF1Yg8HFiXFQgEBBQsCOlMDAQsPAQcCCBABCQMBBAICBgcCAggDDREEAQF2YQ8HFiUPS1sNDAIFAQsJAgcLCAEEAQwKAQE/LUFCAwMCbwIFAXABAgNDPTYCAQECAQIDAgIBBAMCBgUUHgEJCgEDUGYFA6oCAqoDBXdiAQIFDQYBCg4CJxoBAQYHAQIEBQQDAwMBAQMBAkYLJSAG5HdiAwcPAkgkAgUFAwMDAQIBAQEBAgEBRgslHwcLNQEBAQECAgMCAgQEARw2AVFoBQKrAgKrAgUABgDo/84FAQJeAAAAUgBgAHAAgACQAMlAKEoREAMJBHBpaGEABQgJgHl4cQQKC5CJiIEiBQYDXFhMNDMOBgUGBUBLsBxQWEA1AAEABAkBBFkACQAICwkIWQALAAoNCwpZAA0DBg1NAAMMAQYFAwZZBw4CBQUAUQIBAAALAEIbQDwAAQAECQEEWQAJAAgLCQhZAAsACg0LClkADQMGDU0AAwwBBgUDBlkHDgIFAAAFTQcOAgUFAFECAQAFAEVZQCABAY6LhoN+e3ZzbmtmY15dVFMBUgFSRUM7OjApLicPECsJAR4DBgcjIi4DJzQRMTQ+AzchMh4DFxwCNQ4EBzAqBCsBLgE3MTQ+AzczETQuAycwISIOAwcGFR4EFyUjDgIHMBwBMRcyNzYDFAYrASImNTE0NjsBMhYVFxQGKwEiJjUxNDY7ATIWFQcUBisBIiY1MTQ2OwEyFhUFAPzsAgMIAwYJlwQNJBwZAwINFSscAVUEDSMcGQIBAxQdOSUEBggJBgICDwEBAgoPIBRRAgkOHBL+tAMJGBIRAgEBAQkOHRQBhkYECxYBCAUdJTgPCt0KDw8K3QoPAQ8L3AsPDwvcCw+ADwtbCxAQC1sLDwGm/lMBAgkKDQcDEBkzIU0BQAQQKSEfBAMSGjYjEqiYAQQPLCo2FgQpQgMKGxYVBAFGAwsdFhUCAgoRJhnLtwMMHhcWAnEBBRoRIB8BHSUBcwoPDwoLDw8LlAsPDwsLDw8LlQsQEAsLEBALAAMAPwAFA8ECUwAPAB8ALwBCQD8PCAcABAABHxgXEAQCAy8oJyAEBAUDQAABAAADAQBZAAMAAgUDAlkABQQEBU0ABQUEUQAEBQRFNTU1NTUyBhQrARQGIyEiJjUxNDYzITIWHQEUBiMhIiY1MTQ2MyEyFh0BFAYjISImNTE0NjMhMhYVA8AYEvzUEhgYEgMsEhgYEvzUEhgYEgMsEhgYEvzUEhgYEgMsEhgCKBEZGRESGBgS/BEZGRERGRkR/BIYGBIRGRkRAAAABwCF//0DewMDAAcACwAPABMAFwAnACsAyLYGAQIJCAFAS7AbUFhARg4BAQABaAAJCAoKCV4AAAACAwACVwADAAQFAwRXAAUABgcFBlcABwAICQcIVw8BCgANDAoNWAAMCwsMSwAMDAtRAAsMC0UbQEcOAQEAAWgACQgKCAkKZgAAAAIDAAJXAAMABAUDBFcABQAGBwUGVwAHAAgJBwhXDwEKAA0MCg1YAAwLCwxLAAwMC1EACwwLRVlAJRoYAAArKikoIh8YJxonFxYVFBMSERAPDg0MCwoJCAAHAAcTEA8rARMHAyEDJxMXIRUhFSEVIRUhFSEVIRUhBSEiBh8BHgEzITI2PwE2JgUjNTMDJDI5Lf4gLTkyYwGC/n4Bgv5+AYL+fgGC/n4CK/0sCgoDUgMSCgIUChIDUgMK/u3CwgMC/lEHAYL+fgcBr2AwMTAwMTAwMQ0J9AoNDQr0CQ1gMAAAAAAHAAD/gAQAA4AADwAXAB8ALwA3AD8ATwBaQFcOAQALBwIFBAAFWQANAwQNTQ8MCgMECQEDAgQDWQgGAgIBAQJNCAYCAgIBUQABAgFFQkACAEpHQE9CTz08OTg1NDEwLSolIh0cGRgVFBEQCgcADwIPEA4rASEiBhURFBYzITI2NRE0JgAiJjQ2MhYUAiImNDYyFhQBFAYjISImNRE0NjMhMhYVEiImNDYyFhQCIiY0NjIWFAUjIgYdARQWOwEyNj0BNCYDQP2AUHBwUAKAT3Fx/R4aExMaExMaExMaEwIAJRv/ABslJhoBABslrRoTExoTExoTExoT/sCAGiYmGoAbJSUDgHBQ/YBPcXFPAoBQcPyAExoTExoCrRMaExMa/W0bJSUbAoAaJiUb/UATGhMTGgKtExoTExoTJhrAGiYlG8AbJQADAEQAFwO8AukABwAoACwAPUA6AwECAAcGAgdXCAEABAEATQAGBQEEAQYEWQgBAAABTwABAAFDAQAsKyopJyMeGRMQDwwFBAAHAQcJDislIg4BByEuASUCEzQmIwYhMSAnIgYVFgMUFjc2Fjc2Nz4BFxY3NhcWNichESECAyRGOgcBUgVoAX4DAxkiLf6t/q0zHBkBARccI5AjGRc4dzk/V14mIRo//QgC+JEYOig1RQwBCQEHIhoBARYc5/7HHBkBAQEBARAoCiElAgICAhpaAcgAAAUApv/WA1oDKgANABMAJQAxAD0A1EAKDgECBA0BBQICQEuwHVBYQDAAAgAFBgIFWQsBBgAHCAYHWQwBCAAJAwgJWQAEBABRAAAACkEKAQMDAVEAAQELAUIbS7AyUFhALgAAAAQCAARZAAIABQYCBVkLAQYABwgGB1kMAQgACQMICVkKAQMDAVEAAQELAUIbQDQAAAAEAgAEWQACAAUGAgVZCwEGAAcIBgdZDAEIAAkDCAlZCgEDAQEDTQoBAwMBUQABAwFFWVlAHzQyKCYWFDo3Mj00PS4rJjEoMSIgHRsUJRYlJTUgDRErASEiBhURFBYzITI2NREnFyMiJjUTISImNRE0NjMhFRQWOwERFAYDISIGFBYzITI2NCYHISIGFBYzITI2NCYChf6MLD4+LAHeLD7Wf2gJDmz+IhMbGxMBNjEigxtY/qwMEhIMAVQMEhIM/qwMEhIMAVQMEhIDKT4s/YIsPj4sAhSBfw0K/aUbEwJ+Ext/IjH+JhMbAXESGRERGRKcEhkRERkSAAEAAAABAADFmT0qXw889QALBAAAAAAA1QTHiAAAAADVBMeI////LAUBA4AAAAAIAAIAAAAAAAAAAQAAA4D/LABcBQH//wAABQEAAQAAAAAAAAAAAAAAAAAAACEEAAAAAAAAAAFVAAAD6QAsBAAAAAQAADoEAABLBAAASwQAAGYEAAB/BAAAVQQAAA8EAAAPBAAAAAQAAHQEAABrBAABMgQAAEkEAABABAAAQAQAAEAEAABXBAAAQAQAAF8EAAC/BAAAiQQAAAAEAAAABAAAAgQAAEAEAABBBQEA6AQAAD8AhQAAAEQApgAAAAAAAAAAATwCGgI4AoQC9ANWA7AENASMBOgFZAWuBhQGUgaMB4gIfAlKCboKSgqECw4Lzgw6DigO6g92EhYTMhOWFEgU6hVUFhoAAQAAACUAxAALAAAAAAACAFIAYABsAAABNQmWAAAAAAAAAAwAlgABAAAAAAABAAgAAAABAAAAAAACAAYACAABAAAAAAADACMADgABAAAAAAAEAAgAMQABAAAAAAAFAEUAOQABAAAAAAAGAAgAfgADAAEECQABABAAhgADAAEECQACAAwAlgADAAEECQADAEYAogADAAEECQAEABAA6AADAAEECQAFAIoA+AADAAEECQAGABABgmljb25mb250TWVkaXVtRm9udEZvcmdlIDIuMCA6IGljb25mb250IDogMS00LTIwMTdpY29uZm9udFZlcnNpb24gMS4wOyB0dGZhdXRvaGludCAodjAuOTQpIC1sIDggLXIgNTAgLUcgMjAwIC14IDE0IC13ICJHIiAtZiAtc2ljb25mb250AGkAYwBvAG4AZgBvAG4AdABNAGUAZABpAHUAbQBGAG8AbgB0AEYAbwByAGcAZQAgADIALgAwACAAOgAgAGkAYwBvAG4AZgBvAG4AdAAgADoAIAAxAC0ANAAtADIAMAAxADcAaQBjAG8AbgBmAG8AbgB0AFYAZQByAHMAaQBvAG4AIAAxAC4AMAA7ACAAdAB0AGYAYQB1AHQAbwBoAGkAbgB0ACAAKAB2ADAALgA5ADQAKQAgAC0AbAAgADgAIAAtAHIAIAA1ADAAIAAtAEcAIAAyADAAMAAgAC0AeAAgADEANAAgAC0AdwAgACIARwAiACAALQBmACAALQBzAGkAYwBvAG4AZgBvAG4AdAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUAAAABAAIAWwECAQMBBAEFAQYASwEHAQgBCQEKAQsBDAENAQ4BDwEQAREBEgETARQBFQEWARcBGAEZARoBGwEcAR0BHgEfASABIQlzd2l0Y2hvZmYEaWNvbgh3YXJuZmlsbAR3YXJuAm9rBGxvY2sDb2ZmAm9uBnNlYXJjaARlZGl0BGluZm8FYWRkLXMEbW9yZQRncmlkCG1vdmVkb3duBm1vdmV1cANhZGQGZm9sZGVyBWdyb3VwBWxvY2syBWZpbGVzC3RpbWVzY2lyY2xlBWVhcnRoBG1vdmUGZGVsZXRlB3JlZnJlc2gDZG9jBGxpbmUIZmlsZS1ib3gIc3dpdGNob24Jc3lzc2VydmVyBGZpbGUAAAABAAH//wAPAAAAAAAAAAAAAAAAAAAAAAAyADIDGP/hA4D/LAMY/+EDgP8ssAAssCBgZi2wASwgZCCwwFCwBCZasARFW1ghIyEbilggsFBQWCGwQFkbILA4UFghsDhZWSCwCkVhZLAoUFghsApFILAwUFghsDBZGyCwwFBYIGYgiophILAKUFhgGyCwIFBYIbAKYBsgsDZQWCGwNmAbYFlZWRuwACtZWSOwAFBYZVlZLbACLCBFILAEJWFkILAFQ1BYsAUjQrAGI0IbISFZsAFgLbADLCMhIyEgZLEFYkIgsAYjQrIKAAIqISCwBkMgiiCKsAArsTAFJYpRWGBQG2FSWVgjWSEgsEBTWLAAKxshsEBZI7AAUFhlWS2wBCywCCNCsAcjQrAAI0KwAEOwB0NRWLAIQyuyAAEAQ2BCsBZlHFktsAUssABDIEUgsAJFY7ABRWJgRC2wBiywAEMgRSCwACsjsQQEJWAgRYojYSBkILAgUFghsAAbsDBQWLAgG7BAWVkjsABQWGVZsAMlI2FERC2wByyxBQVFsAFhRC2wCCywAWAgILAKQ0qwAFBYILAKI0JZsAtDSrAAUlggsAsjQlktsAksILgEAGIguAQAY4ojYbAMQ2AgimAgsAwjQiMtsAosS1RYsQcBRFkksA1lI3gtsAssS1FYS1NYsQcBRFkbIVkksBNlI3gtsAwssQANQ1VYsQ0NQ7ABYUKwCStZsABDsAIlQrIAAQBDYEKxCgIlQrELAiVCsAEWIyCwAyVQWLAAQ7AEJUKKiiCKI2GwCCohI7ABYSCKI2GwCCohG7AAQ7ACJUKwAiVhsAgqIVmwCkNHsAtDR2CwgGIgsAJFY7ABRWJgsQAAEyNEsAFDsAA+sgEBAUNgQi2wDSyxAAVFVFgAsA0jQiBgsAFhtQ4OAQAMAEJCimCxDAQrsGsrGyJZLbAOLLEADSstsA8ssQENKy2wECyxAg0rLbARLLEDDSstsBIssQQNKy2wEyyxBQ0rLbAULLEGDSstsBUssQcNKy2wFiyxCA0rLbAXLLEJDSstsBgssAcrsQAFRVRYALANI0IgYLABYbUODgEADABCQopgsQwEK7BrKxsiWS2wGSyxABgrLbAaLLEBGCstsBsssQIYKy2wHCyxAxgrLbAdLLEEGCstsB4ssQUYKy2wHyyxBhgrLbAgLLEHGCstsCEssQgYKy2wIiyxCRgrLbAjLCBgsA5gIEMjsAFgQ7ACJbACJVFYIyA8sAFgI7ASZRwbISFZLbAkLLAjK7AjKi2wJSwgIEcgILACRWOwAUViYCNhOCMgilVYIEcgILACRWOwAUViYCNhOBshWS2wJiyxAAVFVFgAsAEWsCUqsAEVMBsiWS2wJyywByuxAAVFVFgAsAEWsCUqsAEVMBsiWS2wKCwgNbABYC2wKSwAsANFY7ABRWKwACuwAkVjsAFFYrAAK7AAFrQAAAAAAEQ+IzixKAEVKi2wKiwgPCBHILACRWOwAUViYLAAQ2E4LbArLC4XPC2wLCwgPCBHILACRWOwAUViYLAAQ2GwAUNjOC2wLSyxAgAWJSAuIEewACNCsAIlSYqKRyNHI2EgWGIbIVmwASNCsiwBARUUKi2wLiywABawBCWwBCVHI0cjYbAGRStlii4jICA8ijgtsC8ssAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgsAlDIIojRyNHI2EjRmCwBEOwgGJgILAAKyCKimEgsAJDYGQjsANDYWRQWLACQ2EbsANDYFmwAyWwgGJhIyAgsAQmI0ZhOBsjsAlDRrACJbAJQ0cjRyNhYCCwBEOwgGJgIyCwACsjsARDYLAAK7AFJWGwBSWwgGKwBCZhILAEJWBkI7ADJWBkUFghGyMhWSMgILAEJiNGYThZLbAwLLAAFiAgILAFJiAuRyNHI2EjPDgtsDEssAAWILAJI0IgICBGI0ewACsjYTgtsDIssAAWsAMlsAIlRyNHI2GwAFRYLiA8IyEbsAIlsAIlRyNHI2EgsAUlsAQlRyNHI2GwBiWwBSVJsAIlYbABRWMjIFhiGyFZY7ABRWJgIy4jICA8ijgjIVktsDMssAAWILAJQyAuRyNHI2EgYLAgYGawgGIjICA8ijgtsDQsIyAuRrACJUZSWCA8WS6xJAEUKy2wNSwjIC5GsAIlRlBYIDxZLrEkARQrLbA2LCMgLkawAiVGUlggPFkjIC5GsAIlRlBYIDxZLrEkARQrLbA3LLAuKyMgLkawAiVGUlggPFkusSQBFCstsDgssC8riiAgPLAEI0KKOCMgLkawAiVGUlggPFkusSQBFCuwBEMusCQrLbA5LLAAFrAEJbAEJiAuRyNHI2GwBkUrIyA8IC4jOLEkARQrLbA6LLEJBCVCsAAWsAQlsAQlIC5HI0cjYSCwBCNCsAZFKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgR7AEQ7CAYmAgsAArIIqKYSCwAkNgZCOwA0NhZFBYsAJDYRuwA0NgWbADJbCAYmGwAiVGYTgjIDwjOBshICBGI0ewACsjYTghWbEkARQrLbA7LLAuKy6xJAEUKy2wPCywLyshIyAgPLAEI0IjOLEkARQrsARDLrAkKy2wPSywABUgR7AAI0KyAAEBFRQTLrAqKi2wPiywABUgR7AAI0KyAAEBFRQTLrAqKi2wPyyxAAEUE7ArKi2wQCywLSotsEEssAAWRSMgLiBGiiNhOLEkARQrLbBCLLAJI0KwQSstsEMssgAAOistsEQssgABOistsEUssgEAOistsEYssgEBOistsEcssgAAOystsEgssgABOystsEkssgEAOystsEossgEBOystsEsssgAANystsEwssgABNystsE0ssgEANystsE4ssgEBNystsE8ssgAAOSstsFAssgABOSstsFEssgEAOSstsFIssgEBOSstsFMssgAAPCstsFQssgABPCstsFUssgEAPCstsFYssgEBPCstsFcssgAAOCstsFgssgABOCstsFkssgEAOCstsFossgEBOCstsFsssDArLrEkARQrLbBcLLAwK7A0Ky2wXSywMCuwNSstsF4ssAAWsDArsDYrLbBfLLAxKy6xJAEUKy2wYCywMSuwNCstsGEssDErsDUrLbBiLLAxK7A2Ky2wYyywMisusSQBFCstsGQssDIrsDQrLbBlLLAyK7A1Ky2wZiywMiuwNistsGcssDMrLrEkARQrLbBoLLAzK7A0Ky2waSywMyuwNSstsGossDMrsDYrLbBrLCuwCGWwAyRQeLABFTAtAABLuADIUlixAQGOWbkIAAgAYyCwASNEILADI3CwDkUgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbABRWMjYrACI0SzCgkFBCuzCgsFBCuzDg8FBCtZsgQoCUVSRLMKDQYEK7EGAUSxJAGIUViwQIhYsQYDRLEmAYhRWLgEAIhYsQYBRFlZWVm4Af+FsASNsQUARAAAAA=="
  19056. /***/ }),
  19057. /* 136 */
  19058. /***/ (function(module, exports) {
  19059. module.exports = "data:application/font-woff;base64,d09GRgABAAAAACUAABAAAAAAPjwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABbAAAABoAAAAcdkcx4EdERUYAAAGIAAAAHQAAACAAUgAET1MvMgAAAagAAABHAAAAVleoWpZjbWFwAAAB8AAAAF8AAAFq0CrRwmN2dCAAAAJQAAAAGAAAACQNZf5MZnBnbQAAAmgAAAT8AAAJljD3npVnYXNwAAAHZAAAAAgAAAAIAAAAEGdseWYAAAdsAAAZzAAALDRJFSqwaGVhZAAAITgAAAAvAAAANg480rloaGVhAAAhaAAAAB4AAAAkCN4EOmhtdHgAACGIAAAAUAAAAGIvjQWEbG9jYQAAIdgAAABMAAAATKhUsOBtYXhwAAAiJAAAACAAAAAgAiQEc25hbWUAACJEAAABPwAAAjrsQmpTcG9zdAAAI4QAAADiAAABNthrgtNwcmVwAAAkaAAAAJUAAACVpbm+ZnicY2BgYGQAgjO2i86D6KssxztgNABJ+wbMAAB4nGNgZGBg4ANiCQYQYGJgBEIVIGYB8xgABdYAVwAAAHicY2BkYWP8wsDKwME0k+kMAwNDP4RmfM1gzMjJwMDEwMbMAAOMAgwIEJDmmsLgwFDxvJa54X8DQwxzA8MVkBqQHAANXgzlAHicY2BgYGaAYBkGRgYQSAHyGMF8FgYPIM3HwMHAxMAGZFU8E30m/8zqee3//2CVFc8YnonD+P+7pVikmCVfSiyHmoMEGIG6YYKMTECCCV0Bug7qAWbaGU0SAADKrRKBAHicY2BAA0YMRswS/x8yN/zXgdEAQh4Ht3icnVVpd9NGFJW8ZE/aksRQRNsxE6c0GpmwBQMuBCmyC+niQGgl6CInMV34A3zsZ/2ap9Ce04/8tN47XhJaek7bHEvvvpk7b9N7E3GMqOx5IK5RR0pe96Sy/lQq8bOkrutenijp9ZK6bKeekhZRK02VzMX9I7lEdS5WskmwScbrXqKeqzzvg9JLMqwoSyLaItrKvCxNU08cP021OL1kkKaBlIyCnUqjjxCqUS+Rqg5lSodevZ6KmwVSNhrxqKOiehAq7hzPOaWNOmCkcpXDXLFZbeR7Sdbz+o/SRKfY236cYMNj9CNXgVSMzMD2NB6HTyTT0V4iM5F/7LhOlIVSG1wAr2qwx6BK8aG48UG2E8jUeM3xdVGpNDIV57rPstksHY+VEOXB39ihlBu6v4Oz06aoVmNx+8AzBjkplCh6SBaADlOZp/YI2jy0QGaN+qPiHPB1CC+yEGUqz5Qs6FAHMmd295Ni2t1J12RxoF8GMm9295Ldx8NFr471Zbu+YApnMXqSFIuLEdyHMuunTLvUCEcZF3PAxTxe4ta0QsjIAoxKI8xRW/ie2ahrnB1jb3Qej9VTZNJF/N1Mfj04qVjhOMt6R9xInLvHruvCVSCLCKca7yeOLOpQZbD6+9KS6yw4YZhnxULFlxe+dxH5LzFuP5B3TOFSvmuKEuV7pihTnjFFhXIZhaVcMcUU5aoppilrppihPGuKWcpzRqb9f+n7ffg+hzPn4ZvSg2/KC/BN+QF8U34I35QfwTelgm/KOnxTXoRvSm3gbSlTEaqYsXT47SVataFqOTO4wD4PZM2I9kVvBNIwSnXVSSl1v6VV/iT566LHY+uTkro1aWyIu7pps/j4dMZvbl0y6oadq0+MI+WhPXT12DShU/vN4d/OXd0qLrmriGrDqDYimASANui3AvFN82w7EPOWXXz8QzAC1M+pNVRTde3UlRoP8ryruxie5MDjiGOgjeuursBLE1NWQ/PhZykyFfuDvKmVauewdflkWzWHNqTC2yL2lWScpu295FVJlZX3qrRePp+GIXp6FteEtmzdyaQSoVEzzvHwripF2ZGWctQ/QueXor4HnHF2QevDMe5E3UG1Nex0+PlmI2sLJoamtL0ToGQsXRVjUeVZnGN0DWsdb9wSnq6nJxbxKTaZj8JKdX2Uj24jzSt2WWbRqEp1dJf2WeyrNv0yO2hYHWc/aao27uphW40qUj1Vvga0B3ZW3fhQDys+6qBRVTXb6NrIYzQua8Z/DMhiXPnrRqsm0+/glmqnzWLNXUFz35gs904vb73JfivnppGm/1ajLSOX/RyO+W0R4N85KHZT1kC9NWmIcQHZCxgu1UTnDs3dxiDiOvsfndP9b83CIDmrbY3ZPPXh6ukokjtMeZxlm1nW9SjNUbSTxD5FYqvDicFNjeFYbsoGBuTuP6zfwz3griyLD7xtJIC4z9rEqJ7q4O4eVyM07Cu5DxiZY8e5DbAD4BLE5ti1Kx0Au9Il5w7AZ+QQPCCH4CE5BLvk3AT4nByCL8gh+JIcgq/IuQXQI4dgjxyCR+QQPCanDbBPDsETcgi+JofgG3JaAAk5BCk5BE/JIXhmZHNS5m+pyHWg7yy6AfS97RooW1B+MHJlws6oWHbfIrIPLCL10MjVCfWIiqUOLCL1uUWk/mjk2oT6ExVL/dkiUn+xiNQXxpeZgZTXei95Rwd/Aiu+rH4AAQAB//8AD3iczXoJdBvHmWb9VX03uoFGNxo3QQAEQIonQICkRItsUSZli6QlUpIpyLYsyQxFbyRbPmJvMn4WfShREk9iZ2M7h+P12jllO5bjJJNVDjOeZCbHm2Q8L7uZ3TeZ9T7Pm528l51k3s5s8nbM5v4FkDKlOD4ymQNo1NH1199Vf9X//99fDSKSrtX/yb7GYsQlfWQLmSUH4fbJs/bu/d5OCsQwDWIuEGaCyQ4SUBS4OgSqoknqQQsCkiAFDhJd0K8PgkKkgCLtJ5osUkHXhHoYTNOYIYahmWPJybNR5Dj5OhwVVVt4iyxjyHLqzbEUFt4UT++Ki9jBAvIzQZn/7RjW63Wvfc+e4eFKORrdc3DPwav2D88Oz05uH6yVt1S2RPuifTNWOWa1Rzzb7QSpE3ImTUO2Vi3Wqj20EyJZMeK4jknzUrETSlkZKUq5HroVojnJcfsrA9ViVJJN1gLDUmWg1AOlYglq1RE6DBU3DRBPJvaEC6kwux+0WKnllL+TPg6RTN40M2Zrt395VzrnxOOttnJ7IBwOGOHwfYok6gIVgmZh+8xury3qqqIqipL/STGYiHwt00EzEIiXElMdoZRgtCbDh09Xo1u2FKIqwNIS2MlW8zOjVsLC646Ea7eZIUOJJYy8ZTtw+1/pMTuQLr5MCJAtq19hD9KfEpVIzwkEcHq2KNsF0S4V4G/uhY4f9/u/9P9v/4+hg/7U/z+dL/p/ft990P5iJyGMHFv9Gfswc4hOkqSTTE2e7cGtkMYGQWRCnVAKMwRA20ZEkcwQgnS4tonz7SLBa995MjpW/4NarTYYCUlOp5DrgeoIVFrAkVgVR5WT0uC4KM6BWuSiOr3hL84dO3aOJ3+nyztl/aLEabZhQsXGLUXTlLsUXVd+zqs4MBzSTuhkX4J/IDIJkijJei0CpTgqMs1zAjMiwz0J4zb/8AGG+cLjurddlP85brM9l0Bk7/Dw3mFwm9k/DDfyDRc+UyXe6vPseTaCT8yQXjJKdpFryY3kJPkgeY93ryPYNCwS/lyJQD2quUpElHSVygFJridCcTMmBgwjML1WDBgzVpAaAWP87qWbTxw5NLt7zKv05VrDIUre956lD979wXfdfuLkzSf/3dFDNx658cDc7mtnr925w9s1tmvLYN9oZXRTqbU315uIhjLhjIZSoMGk2Qn5V+W8FarF7BvU/7npaf05riA8gUvOF1fmX+vub0nARpr5b0r8r2BmWJbRvPFrpTdqJ5QcXf0P7KP026gPm8iQVwsAFcHDPSgSJi4QkeI1jxuECoTWiQAgTBNB4EoiwHg07nQ0NITkTHBaoDLCxei00P7KKAwMVjLQAjIryyb0Qg+MwghE6Y1/+fXjx7/OE39KUwJC6Jr3yYqhdMsg/7+a7MoPK6DkZVeh325SYeJ/CjRFXnxUAblLiSj+rzYj8QeQpoC0XF/GSZR9Fe2GTNpJF9nqbWFAiSxReU4BHDOZJpKI45WEOtYJ7EJTA9uBdHVu6ijlW+J2KBgQBYJMVbOzgFORsz1QoHa1mJey5dZSToq4zHEHB/AaxDlgFnUHSlkrS1nbxBYZZsVFuJOxeK7bf9p/uj8VB4im8vfn49Gh2zePzh0sZhOjKwr91QOxLe218QCoIOcSAG7qf/l/zInxE2rXsgWKn8QB+A4hEvnp6g9FQq9B0c+SQ+QEWSL3k+967TutEFOFE9cvHiaioi6989/fJGj6/e89fVdOlNjV+6eq/aYkSqI3eTaF9q+GMxVUQPumEkVXlTous2boWp0YTDKmCQuAJDKpLpuUm0W0Kk27eMlb6IeGc/rV/iIZr3utAB94/7vvufP3brvlhrcvXHfwmr17YBZmx7cPb+nr6CkFQ50qtDBJzud6WKlqlasjbDBbaWHRFK2Zgty3SejE/TLYuN9vVZGoL5szmSxFWoRoIW9SuS8F5WhlcIA53EEWa+XqAPdukehFdfmiukhe+RllCpPUhwWjLRVn1Ih0pmCfYORTcQrMSW8uCJKiSpQGAagWbHVmqGqmwv4XmRoLWxSXSjXTDrx7QtBdUMR0YSio/UQLNhII6n+hBxvJUlC/Sg+FMAnCp/09QFXNkFko3p+dBk8IdWQzAgsnBvLhz34EhGDXpgFX6BhjWtKNCDDB9LQboVSzivHv/wELtERdehOICas1A+kC3MKfxh/zYZ7w34P8SfyHujC5+hL7EsuQAImRVtLuFbguC0zkLrDh+NAFNhUYdBiz7YhTC6MGF6CYk0GKuv3ZygBUB1BWliOh5Nxckdcc9oz/ZP7GvP9ULpXeQR/fsdkP2gkbr2p7KtWeOkkPj46u/MeRct9hWDVs2/Bf4ulLKd7Kfevk6v9ojEtHj5Ynbain495YG8gSWhuRCJKIm00iMu6Kjc6aMTKjNHclRX1tL2Va4jHHMgKyRHSqo76K2VxxEAYqUXAlwqfQmEEJKI7dWpuHLDWmIOXYzMrBHZtzsBdnAvtym/13tVn+U5aTp4/nHct/MtKYUWtfY9TZIyPNSY0eZqRl5dGWXK6FHvFHbQNa12Z4j9OYPLdBt64+xu6jX0H/GScpUvTycSA0GUOVoF4qQWEr2lq6yFHOIk7t2nDUZVZnoVSs8sFnwHVw6Lm1YhBKMBiFpc9JEtwhhSTM/XslC/rC5fCJcHjo2yu/HPoj9jnR4s3YGuLN9HNhbCzz1or/Rw2E460eY4/RYyhXjZgkjHg+QVpIjhTR1vfA9BdFCMLo5FkNLQXuDIEJhC1wpy6BJB9EX20GzeuJGAMBd9AczlHC5ZnTlChFm2oHwJ7DXRZxApE54loQNN3gHHEcYxcCXd1YR+OzFzOGhX8yZ2/un8jUIYbrGMg8GHQniesGd+FT3OB2xOYDMoKwnm7uG9pLxUJbPpdtzbSkU8lEPBZ1I44dtkJB0wjosiZrKkJ9IllWPNRZsPJWPjoIkXytgJ5B7I/kB9d+G8sl/BXwx4j32PLyymPLQPxl8PzlQ4eW8PK8VeJ5hxqVlzwPsHIMlvyl5WVYXl5GMqTA9qVDPHvpkHfoTawzw3W21tf5aoxJmMAWo6hjuqaDtmAGqBaJaFcT4tgOsRcklF9QEVDiCrFCijVHQkQNh9Q5EjbQZIT1ORKJgYOS3E9s17UniW27u4lru5cmvWtem72uReZ/B/xxdUql5uqUNpVwgV5vfXBx5POrA1a/1V+S4Q1WxVpbPbrMV8dv/Y2LsrZs0OUvAV8c76Jl8V9qrBbq/Nzqj9nnWEfD7n148mwa16AoAGWIpcUFGdBri9I82rl1iydJ6PCbbnjybAWp236dGggCcTa3kdbreB0yxBOTa8QSmcBNrln8E4mEFPfC6CZfy0fykf5If62f3vLX37r55m/x5Loze8/g1dGsYQKHef0MQcRFVrtQEbsakQqPHAYbscMPJs8mcOxlReKRC4V9utxACCZwB6SBILAZQ6WM6duCEAisVxifNA/cepGQd0FVrp/n8XrdvPKGHkgYYMI0kvB2GmANHujPp3necC4UxlEOxTGPkmbgsfWSzUO1armve1Mhl07FYxHHCjVDjxCGHlnEgJbTcC3oVYpkzSnStRxFl882HQ6SuJHwxe0XhQ7MW1nafeLEbrq066abVloaXqd5UVJIrpJkoZgATJ/e0IK6nygWkkvJQoF1ndi9wrvuosjmlaUGAX26ka0cR4IkbdCueBtb/KeLiWXeiAmPMzGUXH0Hu4G+jPHyIOn1utriJhNQ1OiQMdhEZFdHHC0IdBozKswQgQrjkWhbT9smDhiqvTA4UMO0mM+hw2qkUsTJoEvnqctjgGgjHQg7JqztMpc+oC8u6nqV45aji1owpPfr+tGjOmahoLZ4lN+v6j+57Xs//+5tt3335997MshbgyGtqjc7aqFfuwPK337vttu+xxPCPSxb7WIruCcnySe9QEKllHm9VFOp19yVg1xVUDcI2iICjMC8AbKC5kJd0EHlRzrzKIAAKDIo+4mmsRnUT03juPiNe2KrxqY39MeuM0RjGuLiyI6JsW0jW4cGK2Un6tiRiO2EzWgnCg8D9gxkrSiP2lGiXJQYwY+ClR0cqDarKNJGY9ZaI+ftzUYrKzfJB6rsF4+YpaQ55b84xfOPmyXjETNZwht/OsXzRwyjSQB96wT44wTQu0YAO9du1CZ5/nGTEyWNKf/7G1imis1nvEpgTkLPlFlMIYcSEci21ePsefozkiXdZDPZTvZ5s8kElRnuLkA3BVpdBCYTNq2jfhKMiBD8YXgmCYI0jZnE95skjAPZPjZ6CW6zno72fK4lFXWsYECTBZKFrMHPBGoYpWW5duX5occwnNfScq1xFIaqWmNrONA9jwltB5qqmoYse+RjHWn/dLrj46bjmLs60jSU7rgi6Dg+QaAfSTvPpR0HS/7XEmHIhRP+u+nW69MdHenr8e7KV3mJ9kR5+T8jcrsVOwb9+3h6vkxvshIJa6RxtuMRiS3T2bVzljFvNIhuSiCQiUVDAmW97aVWQRAZlxJhQOrYhaJZryOmEcRpIopcMKIwXuOfCiriuu0pr0/o9esRthwLv/KjcCwWZl08fe0ybbficatxjxf47xVe4wWuY1Ahn6f/hc4g1i15bYjGQMBNzxqmmuGoz58R2Hk7n7dDcgTXKsIjiq24UkUejtX4SqShnyPzPP3qJ4Ju6BNc+z8RcoONAiw8qoVC2qPBtTpSBBsyDJED7Bf00w0ZlsiA10+4uQIuJBwJjyQYkk03ogdUVEbG0ay2ZVvTiUi4adNlDPSzfCyvCsle30hrG0hYt+H/zb/i1ieeuBW+gOnbTh7wrzhw8uQB+MKBkys/On3o0OlDB564pfWWJxoJDBy4884DrZzggcO8kVw0XozI+PlEa4gKYkMT3mjYxUIu+1aGvRWjiNcY9wKOe6p+8mQdvnjg5LN8ZIc3DrvGR5xpJGfPj5v79iX07UsX+fYD3twGX0sMJhjTqJNMUIFR4bV97b+QnxV/V362mGj42aXfxs/a6Gb5Xe5mKVkiWbbEcg38t7CG6BChIRATpQXuTlBosICLDQz2rSM6TUJns+k1yBDAYVwz1wB2k2uokSGUuQDRbTyNayI6q4noFv/02aNHn+XJqcq3Knix3NFnX+T3XnzWTz7zDLz/ueeaNoqwb9KXME73yBSZ9C5D84zRdyopiBL1ZCAjKj6faArac7TaPNTip0EXm6jt2y6f2Da1far4tlrtaMTK6W4n8OPyvlxZkqW+PCb8m98EfAejTW6ue2ltkRlf5C1oHwYG+RftRJoWstymc3LHZd/cXDpHJQFAZGELDVAUDPAPtQ+1DrXTpfYhzzZWlgy7FeP1x7Al3ytTqoifNexXVuGxRgB/CFNOCQCMWTsC1Nrc4R9pHxoqUsNGzPKoYecygp4zbYNCvrm4GHmSa1dfYM+xy1FtVWIQmxieZlsBTZVFJhQ7u0FWoTSoUsuAAhR4har+6QqcgTP9/f6V/pVY6vH/zP8zTNduv/DLqv8TdGbHIO//BEt/94Mf/nDlH3/VvEn4+cmrODtFribHyB/C573kvSDpSXSd5/aFGJOfvfPmE8eOHr5GoaaAUEfHrbYNxyfJhlQPgK6AzPTGaoVMFkL3KwTBpIJZD4NKQMXdp2nrJ0SUWjPEsnSLA/IAMhr+dUYiuqtQkJqUvTGLxO9qLEVkNMrvG4SfRr4FhhvYeBNvhQMqsYWLyTkBqNOYqVztVB5B8BjiD1/47Kcf+dhHHn7owQ/+/vvfe/rUPXfdcHznjolLx7whBMj95fZSNGyHOjESz5nUaaGVEVrlb+V6KL9c1gJcDUyWL5bWvvkcakU5x9/cjSDI7q9wHD1YwbwFoi0s6kYbPSBacJvlqCsXa5dADXLF0kCpOjjCmpxGKPZBdnkpn2uy5bT95UqT6foXmQ80jraxT1PZkEkZg2mT5tlzHzr3g3Mfmp5uZrNySyYUD6iKHjXv3k8h7ARMRXdzMVkUJMWIDyfSZtySFS2k6LSUG8wlMVBXTE0KG4alI2VrxFXVZESNqOJKRNFyJlNTkqgn4E/u+u/D7YYpSQqqcuBSI2wufefW2xftmKIbUjpVay9f6sWiqZZhzXF1J5yzAgrORg/FL22POLqYjKOJZIphtaqukLz8jievodPnR82z0UBQF1uSqViiTZ/1v2lnu6IGyi9tKOnY2I3lqx2VUbQjLdt3uIWog4ucy8SSpbisMDUeVu0BtAdUkaVAR8zN7dyFTs3vPXXD1JBoK6oVsOREkLGbzr19iwLBVPemyctHxymT9LGut+9uSQRjXbFaSmoZ7XIjEUUPprWYA5MzB8/ccXnDz55a9dnvYVQho5cIoj2JIqrpJN/5sgRUVQBVOYm7fsLEoAwWiapomnqQx2+IDOfWXmDOoYWQZBE9g0wUVVbmgqARI6AZ+0lA1wOTJBDQZ4ge0MeT3o5XGfG31781p7pXSMQI4QdlKKpSonTx8QtykO1QsBNsmWVZyY5mIxd8RTTj/BURt/oYuxTFfK2ftVU2d/ut3Zsr18Hd/p0bf7RzpQuDsVkW1qijhbGg+f/7hRcY9Wdk3i7DM4f6yn2Ny1D/XjMM7e9V41Dfeqx7LVtlGDeQGtn3JdwrAqyFgwlykRMWhKbpEdBStJJXXa+AEqo3XO/0Btf75fYua6hDtNHuo/JhOMIVTeJBMGoWApHBilsW3cYECyagkvcg8kVda2hzxGEv+7+gQmF82/Xvm/3I4P7xsetPwzvncXuFkpdFpZjgT7UfHz4y1VvxSseHr5vsrbCXKd01g7T1Cd7no4P7L2MvR9W0nLr8b3srMFq6Acn6yqPY7Tqc0T6MhZ9EvxEmCdJPbvLM/iRl1AqpssCPppsiSEuCgqizCd0Bw3/xSrSX8gyRZY2iFPK4lJTJtH4BnSjCNEYC4izvMFH3bNtGXNdZzLek0FEmYkNh1eosNOItR3bXX80MFtka8i9E8hfCvU6UDMa2EXiyMlEpqapteIYdLl05/4F53/PaKpU2eoan3uN//fjD+Uol3xuvXMI9+Q1xiD80MT8/8dBDD1Xy/j7eBk/mKw/d8vjjt/D1F8jy6jLzMKyKI6rpx3h0ztubbU0mVIWCAsJwFTWNepwScJFFDdeXyOgS6kQhqqSodYJoVppGgIaxG5UoehBvdGiw3NOBq92SRrbxWlubbuEUyj08FpXLF8+uUObnH9FyJHsxjJUb007z4xOM8WtV3HEPLi4+yKABMRGfFvwiPfHICeovwfOIWzw+Z1g27JdQzqk8znX5PYsPPHD0dCHpc9yaBISlp644fvyKUw2MY0Cjx4eqPK2Gs/F8Pp5FaPne1TOIY3Y0sGkPYr1ZXNW7vDvnQDR6wAyiPARiiILBAxQ1KKroAoPEJEGzHuLvUTHUq1uYsgBldRLQQFYCcl0HBW34NGaKNEMkRRrfu8cMULKnvrc+u3t6cmK7N7p1eGig3LupnW+VRMyxAlEzqoj8jY7dDAKaUqsW5Q1lxkHiRpn2c7nWYF2Sg437KNrBjeKN8GigxGOmcpT+jf9KwLIC6F8wvaD8qe6JXPfYRA882zOR7pnw/9HfFc1n3daJbrgqH/1+Pupf4ebzLmQneubmIoUH4AtWzMLr/mZGCzu6J7pXvtG9Y0f3ji54cPPKqTaXjrl5WPll1w637WnemY5F87d2T2zZGr/yqYZN2rb6FHuePkUOkW+waS/1KSjkz4Bi94NW2g4BInjf+PphVnRBoqNNOPf5eIxGE5FENLLgou1IRJx54mQSTmae5DL5TC6/0Ab5QiZfmCcFO1Ow54mtZGxlnihyRpHnEcYXM3Jxvh0tVaZYmiclLVPS5jHcyGjSPJH0jKTPE13M6OI8gvmMKMyj0csIbB4NSYaReXQEZsAwFxAZhQJmaJ6fuwuJbCvN5BKZOsW9ELZoiISu5F4isI4d/62MmoNVK2BarzVssIj16qjdf0OjfrOy9s79aw84gGg6YCwQw8Rrno+bvOa4AyEyzXMSmm1OYYLj6Mmvnfvyl5595rOfeeLx//TYJx752Ec/8vCDH/79+97/vveefvepe++5e+nOO971znfcesvNJ25ceNtV9f1zV+7bO7t719TkZTu2XjJQK/c6XQ6HH1a2I9pZkEo5VHr0toh7sVBqFvryZUxK3AeXi9x+rJ21oolwomg9mngYHTZmERf9M7/T+PE/1mFDP8fKI/zPCdVSH2ffV+QcGw8qNnx7nlt//sNqHhsw2M0hVG/hON5tcIhWomuFPp44fYi08xwJNU5w0QluBvrJyasDASqBIYKmS1gIyMAMFdrSoKhAR8cYozdSEU4AZdvHMHzVBVAMgGIvDYQAO5kaVUxdEKhgYTViveNIUHYL30ZSUadb9jDQgyBTJQQqom30bDw2ZoaFwfRthzllcPIqI4AP4C9YMTQSAM07jHZvu+DBWwf4QQ+WKAWBUUl0WkDVgO1eENkZSs8w8fYjQEVDwvHQUgL4i1oqiAJD74rYiU7ohVbpr24/wuQgvayNiiJv4H+x4Ak2ZmS91qjxJwgCpAZgZlGkT1K8RPRJn1n9MauzjkYMXiBlspX8yNMQpgsGiJRjG/62rQ8NrShRER2ThC5dkjHYQ5/OuE9fR3rbcNBs/T8Ra+/dejgYoBzx/cb+F/Tyqm+qA058er0fa7yEylQr7UXX2TJY2Vrd2tNZLLeXc63ppFNwC4Vaq2FddCpWiuLeqtkXOjjLkdhvcJv0lH9f18hIF/xl18h/Pbmomsf8nJ1M2jBQzt2T3O8/xf8QBnt5uqHMOka6Vu7m/ahz10lDW/lU0qZ32smTubJftJNwU5gfCocfaWb/Hw/i7E14nGNgZGBgAOLi6qdR8fw2XxnkWRhA4CrL8Q4E/V+HlYG5AcjlYGACiQIAKaUJ/wB4nGNgZGBgbvivwxDDCmQxMLAyMIBpJMADAD3VAiQAAHicY2GAAMZQBgbmlww6LAwMVkCcA8ReQOwAxOlA7MrKyPASSHsDYQmDAxCGg7UxMzgyODAaMQgAIQNDA1A8Hki3AnEowwGGTqDscgDQUgs8AAAAAAAAAAABPAFaAcAB+gL2A1gDwgTeBSoFmgXkBtgHpggWCPQJYAoiCq4LEgtQC6gMBAymDQANkA3KD7gQahDmEWoR9BK0FVQWGgABAAAAJQDEAAsAAAAAAAIAUgBgAGwAAAE1A00AAAAAeJx9j7tOw0AQRa/zUpAoIlqakWniYq215Yg8ShS7oqWPEjuxFGzJdh6/AB9AA99Ay+9xvVkaitjamTM7d+cB4BYfcNB+Doa4s9zBAJ7lLh5wttyj5ttyH0vnyfIAQ+eTSqd3w5uRedVyh/XvLXcRQ1vuUfNluY93/FgeYOS8IccaJQpkxjZAvi6LrCxIz0ixoeCAVwbpJj/Qx1bX+gpbSgQhfHYTzHn+17vcBlCIeELqAjyyDDvEZbVNJfS1zOWvKzFQkQp1QNGV2V7YuEJNSZtqG7QjLEgN/wwrTt0wt6PiMsYYRyp8zDiIx1hhTzs1VNFOzAoKiVlI2+hsakeGT7Qu866JMmNrjpJWdV4WEvh6IU2TrQ5Nucu5yvio/VnkidrLVFQlEy0qkVDTnSWIRJ3ETVxRmaj62rK/HwFYqgB4nH2NyW7DMAxEPTbl2E33fU976DGX/kY/oSdXomIhihhITtz+fS2g5xIgMYN5AxZl8f+8TYuiLD5RogJBocYMDVocYI5DHOEYJzjFGc5xgUtc4Ro3xQducYd7POART3jGAi94JaclkAtWaCORaRWdKWXdpp+UOO45VkZ0M3YxWOc9ZUFs3NBsZM9GxlBnsdtWnTFtGt2ge7F2PrgNJ+2i9kwZqA17Hpi8C6wmdJmqCSslNH+dUFvxhqNaRdltFXdx6JvpJS+/5LtOk9c9edFrlc+7ylGaRbaRU0/Z/QIgAUpiAABLuADIUlixAQGOWbkIAAgAYyCwASNEILADI3CwDkUgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbABRWMjYrACI0SzCgkFBCuzCgsFBCuzDg8FBCtZsgQoCUVSRLMKDQYEK7EGAUSxJAGIUViwQIhYsQYDRLEmAYhRWLgEAIhYsQYBRFlZWVm4Af+FsASNsQUARAAAAA=="
  19060. /***/ }),
  19061. /* 137 */
  19062. /***/ (function(module, exports, __webpack_require__) {
  19063. "use strict";
  19064. /**
  19065. * @author oldj
  19066. * @blog https://oldj.net
  19067. */
  19068. var m_ver = __webpack_require__(70).version;
  19069. module.exports = {
  19070. PORT: 50761,
  19071. version: m_ver.slice(0, 3).join('.'),
  19072. version_full: m_ver.join('.'),
  19073. url_download: 'https://github.com/oldj/SwitchHosts/releases'
  19074. };
  19075. /***/ }),
  19076. /* 138 */
  19077. /***/ (function(module, exports, __webpack_require__) {
  19078. "use strict";
  19079. /**
  19080. * @author oldj
  19081. * @blog https://oldj.net
  19082. */
  19083. module.exports = function (v) {
  19084. return 'v' + v.slice(0, 3).join('.') + (' (' + v[3] + ')');
  19085. };
  19086. /***/ }),
  19087. /* 139 */
  19088. /***/ (function(module, exports, __webpack_require__) {
  19089. "use strict";
  19090. /**
  19091. * @author oldj
  19092. * @blog https://oldj.net
  19093. */
  19094. module.exports = function () {
  19095. return new Date().getTime() + '-' + Math.floor(Math.random() * 1e6);
  19096. };
  19097. /***/ }),
  19098. /* 140 */
  19099. /***/ (function(module, exports, __webpack_require__) {
  19100. "use strict";
  19101. // custom mode
  19102. Object.defineProperty(exports, "__esModule", {
  19103. value: true
  19104. });
  19105. exports.default = function () {
  19106. _codemirror2.default.defineMode('hosts', function () {
  19107. function tokenBase(stream) {
  19108. if (stream.eatSpace()) return null;
  19109. var sol = stream.sol();
  19110. var ch = stream.next();
  19111. var s = stream.string;
  19112. if (ch === '#') {
  19113. stream.skipToEnd();
  19114. return 'comment';
  19115. }
  19116. if (!s.match(/^\s*([\d\.]+|[\da-f:\.%lo]+)\s+\w/i)) {
  19117. return 'error';
  19118. }
  19119. if (sol && ch.match(/[\w\.:%]/)) {
  19120. stream.eatWhile(/[\w\.:%]/);
  19121. return 'ip';
  19122. }
  19123. return null;
  19124. }
  19125. function tokenize(stream, state) {
  19126. return (state.tokens[0] || tokenBase)(stream, state);
  19127. }
  19128. return {
  19129. startState: function startState() {
  19130. return { tokens: [] };
  19131. },
  19132. token: function token(stream, state) {
  19133. return tokenize(stream, state);
  19134. },
  19135. lineComment: '#'
  19136. };
  19137. });
  19138. //CodeMirror.defineMIME('text/x-hosts', 'hosts');
  19139. };
  19140. var _codemirror = __webpack_require__(67);
  19141. var _codemirror2 = _interopRequireDefault(_codemirror);
  19142. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19143. /***/ }),
  19144. /* 141 */
  19145. /***/ (function(module, exports, __webpack_require__) {
  19146. "use strict";
  19147. /**
  19148. * @author oldj
  19149. * @blog https://oldj.net
  19150. */
  19151. Object.defineProperty(exports, "__esModule", {
  19152. value: true
  19153. });
  19154. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  19155. var _react = __webpack_require__(7);
  19156. var _react2 = _interopRequireDefault(_react);
  19157. var _classnames = __webpack_require__(16);
  19158. var _classnames2 = _interopRequireDefault(_classnames);
  19159. var _editor = __webpack_require__(142);
  19160. var _editor2 = _interopRequireDefault(_editor);
  19161. __webpack_require__(106);
  19162. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19163. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19164. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  19165. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  19166. var Content = function (_React$Component) {
  19167. _inherits(Content, _React$Component);
  19168. function Content(props) {
  19169. _classCallCheck(this, Content);
  19170. var _this = _possibleConstructorReturn(this, (Content.__proto__ || Object.getPrototypeOf(Content)).call(this, props));
  19171. _this.state = {
  19172. is_loading: _this.props.current.is_loading
  19173. };
  19174. return _this;
  19175. }
  19176. _createClass(Content, [{
  19177. key: 'setValue',
  19178. value: function setValue(v) {
  19179. this.props.setHostsContent(v);
  19180. }
  19181. }, {
  19182. key: 'render',
  19183. value: function render() {
  19184. var _props = this.props,
  19185. current = _props.current,
  19186. lang = _props.lang;
  19187. return _react2.default.createElement(
  19188. 'div',
  19189. { id: 'sh-content' },
  19190. _react2.default.createElement(
  19191. 'div',
  19192. { className: 'inform' },
  19193. _react2.default.createElement(
  19194. 'span',
  19195. {
  19196. className: (0, _classnames2.default)({
  19197. loading: 1,
  19198. show: this.state.is_loading
  19199. })
  19200. },
  19201. 'loading...'
  19202. ),
  19203. _react2.default.createElement('i', {
  19204. className: (0, _classnames2.default)({
  19205. show: current.where === 'remote',
  19206. iconfont: 1,
  19207. 'icon-earth': 1
  19208. }),
  19209. title: lang.remote_hosts
  19210. }),
  19211. _react2.default.createElement('i', {
  19212. className: (0, _classnames2.default)({
  19213. show: this.props.readonly,
  19214. iconfont: 1,
  19215. 'icon-lock2': 1
  19216. }),
  19217. title: lang.readonly
  19218. })
  19219. ),
  19220. _react2.default.createElement(
  19221. 'div',
  19222. { className: (0, _classnames2.default)({
  19223. errorMessage: 1,
  19224. show: !!this.props.current.error
  19225. }) },
  19226. this.props.current.error
  19227. ),
  19228. _react2.default.createElement(_editor2.default, {
  19229. readonly: this.props.readonly,
  19230. code: this.props.current.content || '',
  19231. setValue: this.setValue.bind(this)
  19232. })
  19233. );
  19234. }
  19235. }]);
  19236. return Content;
  19237. }(_react2.default.Component);
  19238. exports.default = Content;
  19239. /***/ }),
  19240. /* 142 */
  19241. /***/ (function(module, exports, __webpack_require__) {
  19242. "use strict";
  19243. /**
  19244. * @author oldj
  19245. * @blog http://oldj.net
  19246. */
  19247. Object.defineProperty(exports, "__esModule", {
  19248. value: true
  19249. });
  19250. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  19251. var _react = __webpack_require__(7);
  19252. var _react2 = _interopRequireDefault(_react);
  19253. var _codemirror = __webpack_require__(67);
  19254. var _codemirror2 = _interopRequireDefault(_codemirror);
  19255. __webpack_require__(243);
  19256. var _classnames = __webpack_require__(16);
  19257. var _classnames2 = _interopRequireDefault(_classnames);
  19258. var _kw = __webpack_require__(71);
  19259. var _kw2 = _interopRequireDefault(_kw);
  19260. var _Agent = __webpack_require__(4);
  19261. var _Agent2 = _interopRequireDefault(_Agent);
  19262. __webpack_require__(118);
  19263. __webpack_require__(107);
  19264. var _cm_hl = __webpack_require__(140);
  19265. var _cm_hl2 = _interopRequireDefault(_cm_hl);
  19266. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19267. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19268. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  19269. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  19270. // import '../../../node_modules/codemirror/addon/comment/comment'
  19271. (0, _cm_hl2.default)();
  19272. var Editor = function (_React$Component) {
  19273. _inherits(Editor, _React$Component);
  19274. function Editor(props) {
  19275. _classCallCheck(this, Editor);
  19276. var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));
  19277. _this.codemirror = null;
  19278. _this.marks = [];
  19279. _this.kw = '';
  19280. _this.state = {};
  19281. _Agent2.default.on('search', function (kw) {
  19282. _this.kw = kw;
  19283. _this.highlightKeyword();
  19284. });
  19285. return _this;
  19286. }
  19287. _createClass(Editor, [{
  19288. key: 'highlightKeyword',
  19289. value: function highlightKeyword() {
  19290. var _this2 = this;
  19291. while (this.marks.length > 0) {
  19292. this.marks.shift().clear();
  19293. }
  19294. var code = this.props.code;
  19295. var pos = _kw2.default.findPositions(this.kw, code) || [];
  19296. // this.codemirror.markText({line: 6, ch: 16}, {line: 6, ch: 22}, {className: 'cm-hl'});
  19297. pos.map(function (p) {
  19298. _this2.marks.push(_this2.codemirror.markText(p[0], p[1], { className: 'cm-hl' }));
  19299. });
  19300. }
  19301. }, {
  19302. key: 'setValue',
  19303. value: function setValue(v) {
  19304. this.props.setValue(v);
  19305. }
  19306. }, {
  19307. key: 'toComment',
  19308. value: function toComment() {
  19309. var doc = this.codemirror.getDoc();
  19310. var cur = doc.getCursor();
  19311. var line = cur.line;
  19312. var info = doc.lineInfo(line);
  19313. this.codemirror.toggleComment({
  19314. line: line,
  19315. cur: 0
  19316. }, {
  19317. line: line,
  19318. cur: info.text.length
  19319. });
  19320. }
  19321. }, {
  19322. key: 'componentDidMount',
  19323. value: function componentDidMount() {
  19324. var _this3 = this;
  19325. // console.log(this.cnt_node, this.cnt_node.value);
  19326. this.codemirror = _codemirror2.default.fromTextArea(this.cnt_node, {
  19327. lineNumbers: true,
  19328. readOnly: true,
  19329. mode: 'hosts'
  19330. });
  19331. this.codemirror.setSize('100%', '100%');
  19332. this.codemirror.on('change', function (a) {
  19333. var v = a.getDoc().getValue();
  19334. _this3.setValue(v);
  19335. });
  19336. this.codemirror.on('gutterClick', function (cm, n) {
  19337. if (_this3.props.readonly === true) return;
  19338. var info = cm.lineInfo(n);
  19339. //cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker());
  19340. var ln = info.text;
  19341. if (/^\s*$/.test(ln)) return;
  19342. var new_ln = void 0;
  19343. if (/^#/.test(ln)) {
  19344. new_ln = ln.replace(/^#\s*/, '');
  19345. } else {
  19346. new_ln = '# ' + ln;
  19347. }
  19348. _this3.codemirror.getDoc().replaceRange(new_ln, { line: info.line, ch: 0 }, {
  19349. line: info.line,
  19350. ch: ln.length
  19351. });
  19352. //app.caculateHosts();
  19353. });
  19354. _Agent2.default.on('to_comment', function () {
  19355. _this3.toComment();
  19356. });
  19357. }
  19358. }, {
  19359. key: 'componentWillReceiveProps',
  19360. value: function componentWillReceiveProps(next_props) {
  19361. var _this4 = this;
  19362. // console.log(next_props);
  19363. var cm = this.codemirror;
  19364. var v = cm.getDoc().getValue();
  19365. if (v !== next_props.code) {
  19366. cm.getDoc().setValue(next_props.code);
  19367. }
  19368. cm.setOption('readOnly', next_props.readonly);
  19369. setTimeout(function () {
  19370. _this4.highlightKeyword();
  19371. }, 100);
  19372. }
  19373. }, {
  19374. key: 'render',
  19375. value: function render() {
  19376. var _this5 = this;
  19377. return _react2.default.createElement(
  19378. 'div',
  19379. {
  19380. id: 'sh-editor',
  19381. className: (0, _classnames2.default)({
  19382. readonly: this.props.readonly
  19383. }) },
  19384. _react2.default.createElement('textarea', {
  19385. ref: function ref(c) {
  19386. return _this5.cnt_node = c;
  19387. },
  19388. defaultValue: this.props.code || ''
  19389. })
  19390. );
  19391. }
  19392. }]);
  19393. return Editor;
  19394. }(_react2.default.Component);
  19395. exports.default = Editor;
  19396. /***/ }),
  19397. /* 143 */
  19398. /***/ (function(module, exports, __webpack_require__) {
  19399. "use strict";
  19400. /**
  19401. * @author oldj
  19402. * @blog https://oldj.net
  19403. */
  19404. Object.defineProperty(exports, "__esModule", {
  19405. value: true
  19406. });
  19407. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  19408. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  19409. var _react = __webpack_require__(7);
  19410. var _react2 = _interopRequireDefault(_react);
  19411. var _frame = __webpack_require__(47);
  19412. var _frame2 = _interopRequireDefault(_frame);
  19413. var _classnames = __webpack_require__(16);
  19414. var _classnames2 = _interopRequireDefault(_classnames);
  19415. var _group = __webpack_require__(144);
  19416. var _group2 = _interopRequireDefault(_group);
  19417. var _Agent = __webpack_require__(4);
  19418. var _Agent2 = _interopRequireDefault(_Agent);
  19419. var _makeId = __webpack_require__(139);
  19420. var _makeId2 = _interopRequireDefault(_makeId);
  19421. __webpack_require__(108);
  19422. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19423. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19424. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  19425. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  19426. var EditPrompt = function (_React$Component) {
  19427. _inherits(EditPrompt, _React$Component);
  19428. function EditPrompt(props) {
  19429. _classCallCheck(this, EditPrompt);
  19430. var _this = _possibleConstructorReturn(this, (EditPrompt.__proto__ || Object.getPrototypeOf(EditPrompt)).call(this, props));
  19431. _this.state = {
  19432. show: false,
  19433. is_add: true,
  19434. where: 'local',
  19435. title: '',
  19436. url: '',
  19437. last_refresh: null,
  19438. refresh_interval: 0,
  19439. is_loading: false,
  19440. include: []
  19441. };
  19442. _this.current_hosts = null;
  19443. return _this;
  19444. }
  19445. _createClass(EditPrompt, [{
  19446. key: 'tryToFocus',
  19447. value: function tryToFocus() {
  19448. var el = this.refs.body && this.refs.body.querySelector('input[type=text]');
  19449. el && el.focus();
  19450. }
  19451. }, {
  19452. key: 'clear',
  19453. value: function clear() {
  19454. this.setState({
  19455. where: 'local',
  19456. title: '',
  19457. url: '',
  19458. last_refresh: null,
  19459. refresh_interval: 0
  19460. });
  19461. }
  19462. }, {
  19463. key: 'componentDidMount',
  19464. value: function componentDidMount() {
  19465. var _this2 = this;
  19466. _Agent2.default.on('add_hosts', function () {
  19467. _this2.setState({
  19468. show: true,
  19469. is_add: true
  19470. });
  19471. setTimeout(function () {
  19472. _this2.tryToFocus();
  19473. }, 100);
  19474. });
  19475. _Agent2.default.on('edit_hosts', function (hosts) {
  19476. _this2.current_hosts = hosts;
  19477. var include = hosts.include || [];
  19478. include = Array.from(new Set(include));
  19479. _this2.setState({
  19480. id: hosts.id,
  19481. show: true,
  19482. is_add: false,
  19483. where: hosts.where || 'local',
  19484. title: hosts.title || '',
  19485. url: hosts.url || '',
  19486. last_refresh: hosts.last_refresh || null,
  19487. refresh_interval: hosts.refresh_interval || 0,
  19488. include: include
  19489. });
  19490. setTimeout(function () {
  19491. _this2.tryToFocus();
  19492. }, 100);
  19493. });
  19494. _Agent2.default.on('loading_done', function (old_hosts, data) {
  19495. if (old_hosts === _this2.current_hosts) {
  19496. _this2.setState({
  19497. last_refresh: data.last_refresh,
  19498. is_loading: false
  19499. });
  19500. _Agent2.default.emit('host_refreshed', data, _this2.current_hosts);
  19501. }
  19502. });
  19503. _Agent2.default.on('list_updated', function (list) {
  19504. var hosts = list.find(function (i) {
  19505. return i.id === _this2.state.id;
  19506. });
  19507. if (hosts) {
  19508. _this2.setState({
  19509. last_refresh: hosts.last_refresh
  19510. });
  19511. }
  19512. });
  19513. }
  19514. }, {
  19515. key: 'onOK',
  19516. value: function onOK() {
  19517. this.setState({
  19518. title: (this.state.title || '').replace(/^\s+|\s+$/g, ''),
  19519. url: (this.state.url || '').replace(/^\s+|\s+$/g, '')
  19520. });
  19521. if (this.state.title === '') {
  19522. this.refs.title.focus();
  19523. return false;
  19524. }
  19525. if (this.state.where === 'remote' && this.state.url === '') {
  19526. this.refs.url.focus();
  19527. return false;
  19528. }
  19529. var new_id = (0, _makeId2.default)();
  19530. var data = Object.assign({}, this.current_hosts, this.state, this.state.is_add ? {
  19531. id: new_id,
  19532. content: '# ' + this.state.title,
  19533. on: false
  19534. } : {});
  19535. if (!data.id) data.id = new_id;
  19536. if (this.state.is_add) {
  19537. this.props.justAdd(new_id);
  19538. }
  19539. delete data['is_add'];
  19540. _Agent2.default.emit('update_hosts', data);
  19541. this.setState({
  19542. show: false
  19543. });
  19544. this.clear();
  19545. }
  19546. }, {
  19547. key: 'onCancel',
  19548. value: function onCancel() {
  19549. this.setState({
  19550. show: false
  19551. });
  19552. this.clear();
  19553. }
  19554. }, {
  19555. key: 'confirmDel',
  19556. value: function confirmDel() {
  19557. var lang = this.props.lang;
  19558. if (!confirm(lang.confirm_del)) return;
  19559. _Agent2.default.emit('del_hosts', this.current_hosts);
  19560. this.setState({
  19561. show: false
  19562. });
  19563. this.clear();
  19564. }
  19565. }, {
  19566. key: 'updateInclude',
  19567. value: function updateInclude(include) {
  19568. this.setState({ include: include });
  19569. }
  19570. }, {
  19571. key: 'getRefreshOptions',
  19572. value: function getRefreshOptions() {
  19573. var lang = this.props.lang;
  19574. var k = [[0, '' + lang.never], [1, '1 ' + lang.hour], [24, '24 ' + lang.hours], [168, '7 ' + lang.days]];
  19575. if (_Agent2.default.IS_DEV) {
  19576. k.splice(1, 0, [0.002778, '10s (for DEV)']); // dev test only
  19577. }
  19578. return k.map(function (_ref, idx) {
  19579. var _ref2 = _slicedToArray(_ref, 2),
  19580. v = _ref2[0],
  19581. n = _ref2[1];
  19582. return _react2.default.createElement(
  19583. 'option',
  19584. { value: v, key: idx },
  19585. n
  19586. );
  19587. });
  19588. }
  19589. }, {
  19590. key: 'getEditOperations',
  19591. value: function getEditOperations() {
  19592. if (this.state.is_add) return null;
  19593. var lang = this.props.lang;
  19594. return _react2.default.createElement(
  19595. 'div',
  19596. null,
  19597. _react2.default.createElement(
  19598. 'div',
  19599. { className: 'ln' },
  19600. _react2.default.createElement(
  19601. 'a',
  19602. { href: '#', className: 'del',
  19603. onClick: this.confirmDel.bind(this)
  19604. },
  19605. _react2.default.createElement('i', { className: 'iconfont icon-delete' }),
  19606. _react2.default.createElement(
  19607. 'span',
  19608. null,
  19609. lang.del_hosts
  19610. )
  19611. )
  19612. )
  19613. );
  19614. }
  19615. }, {
  19616. key: 'refresh',
  19617. value: function refresh() {
  19618. var _this3 = this;
  19619. if (this.state.is_loading) return;
  19620. _Agent2.default.emit('check_hosts_refresh', this.current_hosts);
  19621. this.setState({
  19622. is_loading: true
  19623. }, function () {
  19624. setTimeout(function () {
  19625. _this3.setState({
  19626. is_loading: false
  19627. });
  19628. }, 1000);
  19629. });
  19630. }
  19631. }, {
  19632. key: 'renderGroup',
  19633. value: function renderGroup() {
  19634. if (this.state.where !== 'group') return null;
  19635. return _react2.default.createElement(_group2.default, {
  19636. list: this.props.list,
  19637. include: this.state.include,
  19638. updateInclude: this.updateInclude.bind(this)
  19639. });
  19640. }
  19641. }, {
  19642. key: 'renderRemoteInputs',
  19643. value: function renderRemoteInputs() {
  19644. var _this4 = this;
  19645. if (this.state.where !== 'remote') return null;
  19646. var lang = this.props.lang;
  19647. return _react2.default.createElement(
  19648. 'div',
  19649. { className: 'remote-ipts' },
  19650. _react2.default.createElement(
  19651. 'div',
  19652. { className: 'ln' },
  19653. _react2.default.createElement(
  19654. 'div',
  19655. { className: 'title' },
  19656. lang.url
  19657. ),
  19658. _react2.default.createElement(
  19659. 'div',
  19660. { className: 'cnt' },
  19661. _react2.default.createElement('input', {
  19662. type: 'text',
  19663. ref: 'url',
  19664. value: this.state.url,
  19665. placeholder: 'http://',
  19666. onChange: function onChange(e) {
  19667. return _this4.setState({ url: e.target.value });
  19668. },
  19669. onKeyDown: function onKeyDown(e) {
  19670. return e.keyCode === 13 && _this4.onOK() || e.keyCode === 27 && _this4.onCancel();
  19671. }
  19672. })
  19673. )
  19674. ),
  19675. _react2.default.createElement(
  19676. 'div',
  19677. { className: 'ln' },
  19678. _react2.default.createElement(
  19679. 'div',
  19680. { className: 'title' },
  19681. lang.auto_refresh
  19682. ),
  19683. _react2.default.createElement(
  19684. 'div',
  19685. { className: 'cnt' },
  19686. _react2.default.createElement(
  19687. 'select',
  19688. {
  19689. value: this.state.refresh_interval,
  19690. onChange: function onChange(e) {
  19691. return _this4.setState({ refresh_interval: parseFloat(e.target.value) || 0 });
  19692. }
  19693. },
  19694. this.getRefreshOptions()
  19695. ),
  19696. _react2.default.createElement('i', {
  19697. className: (0, _classnames2.default)({
  19698. iconfont: 1,
  19699. 'icon-refresh': 1,
  19700. 'invisible': !this.current_hosts || this.state.url !== this.current_hosts.url,
  19701. 'loading': this.state.is_loading
  19702. }),
  19703. title: lang.refresh,
  19704. onClick: function onClick() {
  19705. return _this4.refresh();
  19706. }
  19707. }),
  19708. _react2.default.createElement(
  19709. 'span',
  19710. { className: 'last-refresh' },
  19711. lang.last_refresh,
  19712. this.state.last_refresh || 'N/A'
  19713. )
  19714. )
  19715. )
  19716. );
  19717. }
  19718. }, {
  19719. key: 'body',
  19720. value: function body() {
  19721. var _this5 = this;
  19722. var lang = this.props.lang;
  19723. return _react2.default.createElement(
  19724. 'div',
  19725. { ref: 'body' },
  19726. _react2.default.createElement(
  19727. 'div',
  19728. { className: 'ln' },
  19729. _react2.default.createElement('input', { id: 'ipt-local', type: 'radio', name: 'where', value: 'local',
  19730. checked: this.state.where === 'local',
  19731. onChange: function onChange(e) {
  19732. return _this5.setState({ where: e.target.value });
  19733. }
  19734. }),
  19735. _react2.default.createElement(
  19736. 'label',
  19737. { htmlFor: 'ipt-local' },
  19738. lang.where_local
  19739. ),
  19740. _react2.default.createElement('input', { id: 'ipt-remote', type: 'radio', name: 'where', value: 'remote',
  19741. checked: this.state.where === 'remote',
  19742. onChange: function onChange(e) {
  19743. return _this5.setState({ where: e.target.value });
  19744. }
  19745. }),
  19746. _react2.default.createElement(
  19747. 'label',
  19748. { htmlFor: 'ipt-remote' },
  19749. lang.where_remote
  19750. ),
  19751. _react2.default.createElement('input', { id: 'ipt-group', type: 'radio', name: 'where', value: 'group',
  19752. checked: this.state.where === 'group',
  19753. onChange: function onChange(e) {
  19754. return _this5.setState({ where: e.target.value });
  19755. }
  19756. }),
  19757. _react2.default.createElement(
  19758. 'label',
  19759. { htmlFor: 'ipt-group' },
  19760. lang.where_group
  19761. )
  19762. ),
  19763. _react2.default.createElement(
  19764. 'div',
  19765. { className: 'ln' },
  19766. _react2.default.createElement(
  19767. 'div',
  19768. { className: 'title' },
  19769. lang.host_title
  19770. ),
  19771. _react2.default.createElement(
  19772. 'div',
  19773. { className: 'cnt' },
  19774. _react2.default.createElement('input', {
  19775. type: 'text',
  19776. ref: 'title',
  19777. name: 'text',
  19778. value: this.state.title,
  19779. onChange: function onChange(e) {
  19780. return _this5.setState({ title: e.target.value });
  19781. },
  19782. onKeyDown: function onKeyDown(e) {
  19783. return e.keyCode === 13 && _this5.onOK() || e.keyCode === 27 && _this5.onCancel();
  19784. }
  19785. })
  19786. )
  19787. ),
  19788. this.renderRemoteInputs(),
  19789. this.renderGroup(),
  19790. this.getEditOperations()
  19791. );
  19792. }
  19793. }, {
  19794. key: 'render',
  19795. value: function render() {
  19796. var _this6 = this;
  19797. var lang = this.props.lang;
  19798. return _react2.default.createElement(_frame2.default, {
  19799. show: this.state.show,
  19800. head: lang[this.state.is_add ? 'add_hosts' : 'edit_hosts'],
  19801. body: this.body(),
  19802. onOK: function onOK() {
  19803. return _this6.onOK();
  19804. },
  19805. onCancel: function onCancel() {
  19806. return _this6.onCancel();
  19807. },
  19808. lang: this.props.lang
  19809. });
  19810. }
  19811. }]);
  19812. return EditPrompt;
  19813. }(_react2.default.Component);
  19814. exports.default = EditPrompt;
  19815. /***/ }),
  19816. /* 144 */
  19817. /***/ (function(module, exports, __webpack_require__) {
  19818. "use strict";
  19819. /**
  19820. * @author oldj
  19821. * @blog https://oldj.net
  19822. */
  19823. Object.defineProperty(exports, "__esModule", {
  19824. value: true
  19825. });
  19826. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  19827. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  19828. var _react = __webpack_require__(7);
  19829. var _react2 = _interopRequireDefault(_react);
  19830. var _classnames = __webpack_require__(16);
  19831. var _classnames2 = _interopRequireDefault(_classnames);
  19832. var _sortablejs = __webpack_require__(76);
  19833. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  19834. var _listToArray = __webpack_require__(72);
  19835. var _listToArray2 = _interopRequireDefault(_listToArray);
  19836. __webpack_require__(110);
  19837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19838. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19839. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  19840. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  19841. var Group = function (_React$Component) {
  19842. _inherits(Group, _React$Component);
  19843. function Group(props) {
  19844. _classCallCheck(this, Group);
  19845. var _this = _possibleConstructorReturn(this, (Group.__proto__ || Object.getPrototypeOf(Group)).call(this, props));
  19846. _this.state = {
  19847. list: [],
  19848. include: []
  19849. };
  19850. _this.current_hosts = null;
  19851. _this.ids = [];
  19852. return _this;
  19853. }
  19854. _createClass(Group, [{
  19855. key: 'makeItem',
  19856. value: function makeItem(item) {
  19857. if (!item) {
  19858. return null;
  19859. }
  19860. var attrs = {
  19861. 'data-id': item.id || ''
  19862. };
  19863. return _react2.default.createElement(
  19864. 'div',
  19865. _extends({ className: 'hosts-item' }, attrs),
  19866. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  19867. 'iconfont': 1,
  19868. 'item-icon': 1,
  19869. 'icon-file': item.where !== 'group',
  19870. 'icon-files': item.where === 'group'
  19871. })
  19872. }),
  19873. _react2.default.createElement(
  19874. 'span',
  19875. null,
  19876. item.title || 'untitled'
  19877. )
  19878. );
  19879. }
  19880. }, {
  19881. key: 'makeList',
  19882. value: function makeList() {
  19883. var _this2 = this;
  19884. var include = this.state.include;
  19885. var items = this.state.list.filter(function (item) {
  19886. return item.where !== 'group' && !include.includes(item.id);
  19887. }).map(function (item) {
  19888. return _this2.makeItem(item);
  19889. });
  19890. return _react2.default.createElement(
  19891. 'div',
  19892. { id: 'hosts-group-valid' },
  19893. _react2.default.createElement(
  19894. 'div',
  19895. { ref: 'group_valid', className: 'hosts-group-list' },
  19896. items
  19897. )
  19898. );
  19899. }
  19900. }, {
  19901. key: 'currentList',
  19902. value: function currentList() {
  19903. var _this3 = this;
  19904. var list = this.state.list;
  19905. var items = this.state.include.map(function (id) {
  19906. return list.find(function (item) {
  19907. return item.id === id;
  19908. });
  19909. }).map(function (item) {
  19910. return _this3.makeItem(item);
  19911. });
  19912. return _react2.default.createElement(
  19913. 'div',
  19914. { id: 'hosts-group-current' },
  19915. _react2.default.createElement(
  19916. 'div',
  19917. { ref: 'group_current', className: 'hosts-group-list' },
  19918. items
  19919. )
  19920. );
  19921. }
  19922. }, {
  19923. key: 'getCurrentListFromDOM',
  19924. value: function getCurrentListFromDOM() {
  19925. var updateInclude = this.props.updateInclude;
  19926. var nodes = this.refs.group_current.getElementsByClassName('hosts-item');
  19927. nodes = (0, _listToArray2.default)(nodes);
  19928. var ids = nodes.map(function (item) {
  19929. return item.getAttribute('data-id');
  19930. });
  19931. this.ids = ids;
  19932. updateInclude(ids);
  19933. }
  19934. }, {
  19935. key: 'componentWillMount',
  19936. value: function componentWillMount() {
  19937. this.setState({
  19938. list: this.props.list,
  19939. include: this.props.include
  19940. });
  19941. }
  19942. }, {
  19943. key: 'componentDidMount',
  19944. value: function componentDidMount() {
  19945. var _this4 = this;
  19946. _sortablejs2.default.create(this.refs.group_valid, {
  19947. group: 'sorting',
  19948. animation: 150,
  19949. sort: false
  19950. });
  19951. _sortablejs2.default.create(this.refs.group_current, {
  19952. group: 'sorting',
  19953. animation: 150,
  19954. sort: true,
  19955. onSort: function onSort() {
  19956. _this4.getCurrentListFromDOM();
  19957. }
  19958. });
  19959. }
  19960. }, {
  19961. key: 'render',
  19962. value: function render() {
  19963. return _react2.default.createElement(
  19964. 'div',
  19965. { id: 'hosts-group' },
  19966. this.makeList(),
  19967. _react2.default.createElement('div', { className: 'arrow' }),
  19968. this.currentList()
  19969. );
  19970. }
  19971. }]);
  19972. return Group;
  19973. }(_react2.default.Component);
  19974. exports.default = Group;
  19975. /***/ }),
  19976. /* 145 */
  19977. /***/ (function(module, exports, __webpack_require__) {
  19978. "use strict";
  19979. /**
  19980. * @author oldj
  19981. * @blog http://oldj.net
  19982. */
  19983. Object.defineProperty(exports, "__esModule", {
  19984. value: true
  19985. });
  19986. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  19987. var _react = __webpack_require__(7);
  19988. var _react2 = _interopRequireDefault(_react);
  19989. var _frame = __webpack_require__(47);
  19990. var _frame2 = _interopRequireDefault(_frame);
  19991. var _classnames = __webpack_require__(16);
  19992. var _classnames2 = _interopRequireDefault(_classnames);
  19993. var _Agent = __webpack_require__(4);
  19994. var _Agent2 = _interopRequireDefault(_Agent);
  19995. var _version = __webpack_require__(70);
  19996. var _formatVersion = __webpack_require__(138);
  19997. var _formatVersion2 = _interopRequireDefault(_formatVersion);
  19998. __webpack_require__(111);
  19999. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20000. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20001. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  20002. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20003. var pref_keys = ['after_cmd', 'auto_launch', 'choice_mode', 'hide_at_launch', 'is_dock_icon_hidden', 'user_language'];
  20004. var PreferencesPrompt = function (_React$Component) {
  20005. _inherits(PreferencesPrompt, _React$Component);
  20006. function PreferencesPrompt(props) {
  20007. _classCallCheck(this, PreferencesPrompt);
  20008. var _this = _possibleConstructorReturn(this, (PreferencesPrompt.__proto__ || Object.getPrototypeOf(PreferencesPrompt)).call(this, props));
  20009. _this.state = {
  20010. show: false,
  20011. user_language: '',
  20012. after_cmd: '',
  20013. choice_mode: '',
  20014. auto_launch: false,
  20015. hide_at_launch: false,
  20016. lang_list: [],
  20017. update_found: false // 发现新版本
  20018. };
  20019. _Agent2.default.pact('getLangList').then(function (lang_list) {
  20020. return _this.setState({ lang_list: lang_list });
  20021. });
  20022. return _this;
  20023. }
  20024. _createClass(PreferencesPrompt, [{
  20025. key: 'componentDidMount',
  20026. value: function componentDidMount() {
  20027. var _this2 = this;
  20028. _Agent2.default.on('show_preferences', function () {
  20029. _Agent2.default.pact('getPref').then(function (pref) {
  20030. _this2.setState(Object.assign({}, pref, { show: true }));
  20031. });
  20032. });
  20033. _Agent2.default.on('update_found', function (v) {
  20034. console.log(v);
  20035. _this2.setState({
  20036. update_found: true
  20037. });
  20038. });
  20039. }
  20040. }, {
  20041. key: 'onOK',
  20042. value: function onOK() {
  20043. var _this3 = this;
  20044. this.setState({
  20045. show: false
  20046. }, function () {
  20047. var prefs = {};
  20048. var d = _this3.state;
  20049. pref_keys.map(function (k) {
  20050. if (d.hasOwnProperty(k)) {
  20051. prefs[k] = d[k];
  20052. }
  20053. });
  20054. _Agent2.default.pact('setPref', prefs).then(function () {
  20055. setTimeout(function () {
  20056. _Agent2.default.pact('relaunch');
  20057. }, 200);
  20058. });
  20059. });
  20060. }
  20061. }, {
  20062. key: 'onCancel',
  20063. value: function onCancel() {
  20064. this.setState({
  20065. show: false
  20066. });
  20067. }
  20068. }, {
  20069. key: 'getLanguageOptions',
  20070. value: function getLanguageOptions() {
  20071. return this.state.lang_list.map(function (_ref, idx) {
  20072. var key = _ref.key,
  20073. name = _ref.name;
  20074. return _react2.default.createElement(
  20075. 'option',
  20076. { value: key, key: idx },
  20077. name
  20078. );
  20079. });
  20080. }
  20081. }, {
  20082. key: 'updateLangKey',
  20083. value: function updateLangKey(v) {
  20084. this.setState({ user_language: v });
  20085. }
  20086. }, {
  20087. key: 'updateChoiceMode',
  20088. value: function updateChoiceMode(v) {
  20089. this.setState({
  20090. choice_mode: v
  20091. });
  20092. }
  20093. }, {
  20094. key: 'updateAfterCmd',
  20095. value: function updateAfterCmd(v) {
  20096. this.setState({
  20097. after_cmd: v
  20098. });
  20099. }
  20100. }, {
  20101. key: 'updateAutoLaunch',
  20102. value: function updateAutoLaunch(v) {
  20103. this.setState({
  20104. auto_launch: v
  20105. });
  20106. // todo set auto launch
  20107. }
  20108. }, {
  20109. key: 'updateMinimizeAtLaunch',
  20110. value: function updateMinimizeAtLaunch(v) {
  20111. this.setState({
  20112. hide_at_launch: v
  20113. });
  20114. }
  20115. }, {
  20116. key: 'prefLanguage',
  20117. value: function prefLanguage() {
  20118. var _this4 = this;
  20119. var lang = this.props.lang;
  20120. return _react2.default.createElement(
  20121. 'div',
  20122. { className: 'ln' },
  20123. _react2.default.createElement(
  20124. 'div',
  20125. { className: 'title' },
  20126. lang.language
  20127. ),
  20128. _react2.default.createElement(
  20129. 'div',
  20130. { className: 'cnt' },
  20131. _react2.default.createElement(
  20132. 'select',
  20133. {
  20134. value: this.state.user_language || '',
  20135. onChange: function onChange(e) {
  20136. return _this4.updateLangKey(e.target.value);
  20137. }
  20138. },
  20139. this.getLanguageOptions()
  20140. ),
  20141. _react2.default.createElement(
  20142. 'div',
  20143. {
  20144. className: 'inform' },
  20145. lang.should_restart_after_change_language
  20146. )
  20147. )
  20148. );
  20149. }
  20150. }, {
  20151. key: 'prefChoiceMode',
  20152. value: function prefChoiceMode() {
  20153. var _this5 = this;
  20154. var lang = this.props.lang;
  20155. return _react2.default.createElement(
  20156. 'div',
  20157. { className: 'ln' },
  20158. _react2.default.createElement(
  20159. 'div',
  20160. { className: 'title' },
  20161. lang.pref_choice_mode
  20162. ),
  20163. _react2.default.createElement(
  20164. 'div',
  20165. { className: 'cnt' },
  20166. _react2.default.createElement('input', { type: 'radio', id: 'pref-choice-mode-single', name: 'choice_mode',
  20167. value: 'single',
  20168. defaultChecked: this.state.choice_mode === 'single',
  20169. onChange: function onChange(e) {
  20170. return _this5.updateChoiceMode(e.target.value);
  20171. }
  20172. }),
  20173. _react2.default.createElement(
  20174. 'label',
  20175. {
  20176. htmlFor: 'pref-choice-mode-single' },
  20177. lang.pref_choice_mode_single
  20178. ),
  20179. _react2.default.createElement('input', { type: 'radio', id: 'pref-choice-mode-multiple', name: 'choice_mode',
  20180. value: 'multiple',
  20181. defaultChecked: this.state.choice_mode === 'multiple',
  20182. onChange: function onChange(e) {
  20183. return _this5.updateChoiceMode(e.target.value);
  20184. }
  20185. }),
  20186. _react2.default.createElement(
  20187. 'label',
  20188. {
  20189. htmlFor: 'pref-choice-mode-multiple' },
  20190. lang.pref_choice_mode_multiple
  20191. )
  20192. )
  20193. );
  20194. }
  20195. }, {
  20196. key: 'prefAfterCmd',
  20197. value: function prefAfterCmd() {
  20198. var _this6 = this;
  20199. var lang = this.props.lang;
  20200. return _react2.default.createElement(
  20201. 'div',
  20202. { className: 'ln' },
  20203. _react2.default.createElement(
  20204. 'div',
  20205. { className: 'title' },
  20206. lang.pref_after_cmd
  20207. ),
  20208. _react2.default.createElement(
  20209. 'div',
  20210. { className: 'cnt' },
  20211. _react2.default.createElement(
  20212. 'div',
  20213. { className: 'inform' },
  20214. lang.pref_after_cmd_info
  20215. ),
  20216. _react2.default.createElement('textarea', {
  20217. name: '',
  20218. defaultValue: this.state.after_cmd,
  20219. placeholder: lang.pref_after_cmd_placeholder,
  20220. onChange: function onChange(e) {
  20221. return _this6.updateAfterCmd(e.target.value);
  20222. }
  20223. })
  20224. )
  20225. );
  20226. }
  20227. }, {
  20228. key: 'prefAutoLaunch',
  20229. value: function prefAutoLaunch() {
  20230. var _this7 = this;
  20231. var lang = this.props.lang;
  20232. return _react2.default.createElement(
  20233. 'div',
  20234. { className: 'ln' },
  20235. _react2.default.createElement(
  20236. 'div',
  20237. { className: 'title' },
  20238. lang.auto_launch
  20239. ),
  20240. _react2.default.createElement(
  20241. 'div',
  20242. { className: 'cnt' },
  20243. _react2.default.createElement('input', { type: 'checkbox', name: '',
  20244. defaultChecked: this.state.auto_launch,
  20245. onChange: function onChange(e) {
  20246. return _this7.updateAutoLaunch(e.target.checked);
  20247. }
  20248. })
  20249. )
  20250. );
  20251. }
  20252. }, {
  20253. key: 'prefMinimizeAtLaunch',
  20254. value: function prefMinimizeAtLaunch() {
  20255. var _this8 = this;
  20256. var lang = this.props.lang;
  20257. return _react2.default.createElement(
  20258. 'div',
  20259. { className: 'ln' },
  20260. _react2.default.createElement(
  20261. 'div',
  20262. { className: 'title' },
  20263. lang.hide_at_launch
  20264. ),
  20265. _react2.default.createElement(
  20266. 'div',
  20267. { className: 'cnt' },
  20268. _react2.default.createElement('input', { type: 'checkbox', name: '',
  20269. defaultChecked: this.state.hide_at_launch,
  20270. onChange: function onChange(e) {
  20271. return _this8.updateMinimizeAtLaunch(e.target.checked);
  20272. }
  20273. })
  20274. )
  20275. );
  20276. }
  20277. }, {
  20278. key: 'body',
  20279. value: function body() {
  20280. return _react2.default.createElement(
  20281. 'div',
  20282. { ref: 'body' },
  20283. _react2.default.createElement(
  20284. 'div',
  20285. {
  20286. className: (0, _classnames2.default)('current-version', { 'update-found': this.state.update_found }) },
  20287. _react2.default.createElement(
  20288. 'a',
  20289. { href: '#',
  20290. onClick: PreferencesPrompt.openDownloadPage },
  20291. (0, _formatVersion2.default)(_version.version)
  20292. )
  20293. ),
  20294. this.prefLanguage(),
  20295. this.prefChoiceMode(),
  20296. this.prefAfterCmd(),
  20297. this.prefMinimizeAtLaunch()
  20298. );
  20299. }
  20300. }, {
  20301. key: 'render',
  20302. value: function render() {
  20303. var _this9 = this;
  20304. var lang = this.props.lang;
  20305. return _react2.default.createElement(_frame2.default, {
  20306. show: this.state.show,
  20307. head: lang.preferences,
  20308. body: this.body(),
  20309. onOK: function onOK() {
  20310. return _this9.onOK();
  20311. },
  20312. onCancel: function onCancel() {
  20313. return _this9.onCancel();
  20314. },
  20315. cancel_title: lang.cancel,
  20316. ok_title: lang.set_and_relaunch_app
  20317. });
  20318. }
  20319. }], [{
  20320. key: 'openDownloadPage',
  20321. value: function openDownloadPage() {
  20322. _Agent2.default.pact('openUrl', __webpack_require__(137).url_download);
  20323. }
  20324. }]);
  20325. return PreferencesPrompt;
  20326. }(_react2.default.Component);
  20327. exports.default = PreferencesPrompt;
  20328. /***/ }),
  20329. /* 146 */
  20330. /***/ (function(module, exports, __webpack_require__) {
  20331. "use strict";
  20332. /**
  20333. * @author oldj
  20334. * @blog http://oldj.net
  20335. */
  20336. Object.defineProperty(exports, "__esModule", {
  20337. value: true
  20338. });
  20339. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20340. var _react = __webpack_require__(7);
  20341. var _react2 = _interopRequireDefault(_react);
  20342. var _Agent = __webpack_require__(4);
  20343. var _Agent2 = _interopRequireDefault(_Agent);
  20344. var _frame = __webpack_require__(47);
  20345. var _frame2 = _interopRequireDefault(_frame);
  20346. __webpack_require__(112);
  20347. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20348. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20349. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  20350. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20351. var SudoPrompt = function (_React$Component) {
  20352. _inherits(SudoPrompt, _React$Component);
  20353. function SudoPrompt(props) {
  20354. _classCallCheck(this, SudoPrompt);
  20355. var _this = _possibleConstructorReturn(this, (SudoPrompt.__proto__ || Object.getPrototypeOf(SudoPrompt)).call(this, props));
  20356. _this.onSuccess = null;
  20357. _this.state = {
  20358. show: false,
  20359. pswd: ''
  20360. };
  20361. return _this;
  20362. }
  20363. _createClass(SudoPrompt, [{
  20364. key: 'componentDidMount',
  20365. value: function componentDidMount() {
  20366. var _this2 = this;
  20367. _Agent2.default.on('sudo_prompt', function (success) {
  20368. _this2.setState({ show: true });
  20369. _this2.onSuccess = success;
  20370. setTimeout(function () {
  20371. var el = _this2.refs.body;
  20372. el && el.querySelector('input').focus();
  20373. }, 100);
  20374. });
  20375. }
  20376. }, {
  20377. key: 'onOK',
  20378. value: function onOK() {
  20379. var pswd = this.refs.pswd.value;
  20380. if (!pswd) {
  20381. var el = this.refs.body;
  20382. el && el.querySelector('input').focus();
  20383. return;
  20384. }
  20385. this.setState({
  20386. show: false,
  20387. pswd: pswd
  20388. });
  20389. _Agent2.default.emit('sudo_pswd', pswd);
  20390. if (typeof this.onSuccess === 'function') {
  20391. this.onSuccess(pswd);
  20392. }
  20393. this.onSuccess = null;
  20394. }
  20395. }, {
  20396. key: 'onCancel',
  20397. value: function onCancel() {
  20398. _Agent2.default.emit('sudo_cancel');
  20399. this.setState({
  20400. show: false
  20401. });
  20402. this.onSuccess = null;
  20403. }
  20404. }, {
  20405. key: 'body',
  20406. value: function body() {
  20407. var _this3 = this;
  20408. var lang = this.props.lang;
  20409. return _react2.default.createElement(
  20410. 'div',
  20411. { ref: 'body' },
  20412. _react2.default.createElement(
  20413. 'div',
  20414. { className: 'ln' },
  20415. _react2.default.createElement(
  20416. 'div',
  20417. { className: 'title' },
  20418. lang.sudo_pswd
  20419. ),
  20420. _react2.default.createElement(
  20421. 'div',
  20422. { className: 'cnt' },
  20423. _react2.default.createElement('input', {
  20424. type: 'password',
  20425. ref: 'pswd',
  20426. onKeyDown: function onKeyDown(e) {
  20427. return e.keyCode === 13 && _this3.onOK() || e.keyCode === 27 && _this3.onCancel();
  20428. }
  20429. })
  20430. )
  20431. )
  20432. );
  20433. }
  20434. }, {
  20435. key: 'render',
  20436. value: function render() {
  20437. var _this4 = this;
  20438. var lang = this.props.lang;
  20439. return _react2.default.createElement(_frame2.default, {
  20440. show: this.state.show,
  20441. head: lang.input_sudo_pswd,
  20442. body: this.body(),
  20443. onOK: function onOK() {
  20444. return _this4.onOK();
  20445. },
  20446. onCancel: function onCancel() {
  20447. return _this4.onCancel();
  20448. },
  20449. lang: lang
  20450. });
  20451. }
  20452. }]);
  20453. return SudoPrompt;
  20454. }(_react2.default.Component);
  20455. exports.default = SudoPrompt;
  20456. /***/ }),
  20457. /* 147 */
  20458. /***/ (function(module, exports, __webpack_require__) {
  20459. "use strict";
  20460. /**
  20461. * @author oldj
  20462. * @blog http://oldj.net
  20463. */
  20464. var _react = __webpack_require__(7);
  20465. var _react2 = _interopRequireDefault(_react);
  20466. var _reactDom = __webpack_require__(103);
  20467. var _reactDom2 = _interopRequireDefault(_reactDom);
  20468. var _app = __webpack_require__(102);
  20469. var _app2 = _interopRequireDefault(_app);
  20470. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20471. _reactDom2.default.render(_react2.default.createElement(_app2.default, null), document.getElementById('app'));
  20472. /***/ }),
  20473. /* 148 */
  20474. /***/ (function(module, exports, __webpack_require__) {
  20475. "use strict";
  20476. /**
  20477. * @author oldj
  20478. * @blog https://oldj.net
  20479. */
  20480. Object.defineProperty(exports, "__esModule", {
  20481. value: true
  20482. });
  20483. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20484. var _react = __webpack_require__(7);
  20485. var _react2 = _interopRequireDefault(_react);
  20486. var _classnames = __webpack_require__(16);
  20487. var _classnames2 = _interopRequireDefault(_classnames);
  20488. var _Agent = __webpack_require__(4);
  20489. var _Agent2 = _interopRequireDefault(_Agent);
  20490. __webpack_require__(113);
  20491. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20492. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20493. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  20494. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20495. var Buttons = function (_React$Component) {
  20496. _inherits(Buttons, _React$Component);
  20497. function Buttons(props) {
  20498. _classCallCheck(this, Buttons);
  20499. var _this = _possibleConstructorReturn(this, (Buttons.__proto__ || Object.getPrototypeOf(Buttons)).call(this, props));
  20500. _this.state = {
  20501. top_toggle_on: true,
  20502. search_on: false
  20503. };
  20504. _this.on_ids = [];
  20505. return _this;
  20506. }
  20507. _createClass(Buttons, [{
  20508. key: 'btnToggle',
  20509. value: function btnToggle() {
  20510. var _this2 = this;
  20511. var doToggle = function doToggle() {
  20512. var on = !_this2.state.top_toggle_on;
  20513. _Agent2.default.emit('top_toggle', on, _this2.on_ids, function (e) {
  20514. if (e) {
  20515. console.log(e);
  20516. return;
  20517. }
  20518. _this2.setState({
  20519. top_toggle_on: on
  20520. }, function () {
  20521. if (_this2.state.top_toggle_on) {
  20522. _this2.on_ids = [];
  20523. }
  20524. });
  20525. });
  20526. };
  20527. if (this.state.top_toggle_on) {
  20528. _Agent2.default.emit('get_on_hosts', function (ids) {
  20529. _this2.on_ids = ids;
  20530. doToggle();
  20531. });
  20532. } else {
  20533. doToggle();
  20534. }
  20535. }
  20536. }, {
  20537. key: 'btnSearch',
  20538. value: function btnSearch() {
  20539. var _this3 = this;
  20540. this.setState({
  20541. search_on: !this.state.search_on
  20542. }, function () {
  20543. _Agent2.default.emit(_this3.state.search_on ? 'search_on' : 'search_off');
  20544. });
  20545. }
  20546. }, {
  20547. key: 'cancelSearch',
  20548. value: function cancelSearch() {
  20549. this.setState({
  20550. search_on: false
  20551. }, function () {
  20552. _Agent2.default.emit('search_off');
  20553. });
  20554. }
  20555. }, {
  20556. key: 'componentDidMount',
  20557. value: function componentDidMount() {
  20558. var _this4 = this;
  20559. _Agent2.default.on('to_search', function () {
  20560. _this4.btnSearch();
  20561. });
  20562. _Agent2.default.on('esc', function () {
  20563. if (_this4.state.search_on) {
  20564. _this4.btnSearch();
  20565. }
  20566. });
  20567. }
  20568. }, {
  20569. key: 'render',
  20570. value: function render() {
  20571. var _this5 = this;
  20572. return _react2.default.createElement(
  20573. 'div',
  20574. { id: 'sh-buttons' },
  20575. _react2.default.createElement(
  20576. 'div',
  20577. { className: 'left' },
  20578. _react2.default.createElement(
  20579. 'a',
  20580. {
  20581. className: 'btn-add',
  20582. href: '#',
  20583. onClick: function onClick() {
  20584. return Buttons.btnAdd();
  20585. }
  20586. },
  20587. '+'
  20588. )
  20589. ),
  20590. _react2.default.createElement(
  20591. 'div',
  20592. { className: 'right' },
  20593. _react2.default.createElement('i', {
  20594. className: (0, _classnames2.default)({
  20595. iconfont: 1,
  20596. 'icon-search': 1,
  20597. 'on': this.state.search_on
  20598. }),
  20599. onClick: function onClick() {
  20600. return _this5.btnSearch();
  20601. }
  20602. }),
  20603. _react2.default.createElement('i', {
  20604. className: (0, _classnames2.default)({
  20605. iconfont: 1,
  20606. 'icon-switchon': this.state.top_toggle_on,
  20607. 'icon-switchoff': !this.state.top_toggle_on
  20608. }),
  20609. onClick: function onClick() {
  20610. return _this5.btnToggle();
  20611. }
  20612. })
  20613. )
  20614. );
  20615. }
  20616. }], [{
  20617. key: 'btnAdd',
  20618. value: function btnAdd() {
  20619. _Agent2.default.emit('add_hosts');
  20620. }
  20621. }]);
  20622. return Buttons;
  20623. }(_react2.default.Component);
  20624. exports.default = Buttons;
  20625. /***/ }),
  20626. /* 149 */
  20627. /***/ (function(module, exports, __webpack_require__) {
  20628. "use strict";
  20629. /**
  20630. * @author oldj
  20631. * @blog https://oldj.net
  20632. */
  20633. Object.defineProperty(exports, "__esModule", {
  20634. value: true
  20635. });
  20636. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  20637. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20638. var _react = __webpack_require__(7);
  20639. var _react2 = _interopRequireDefault(_react);
  20640. var _classnames = __webpack_require__(16);
  20641. var _classnames2 = _interopRequireDefault(_classnames);
  20642. var _Agent = __webpack_require__(4);
  20643. var _Agent2 = _interopRequireDefault(_Agent);
  20644. var _isInViewport = __webpack_require__(155);
  20645. var _isInViewport2 = _interopRequireDefault(_isInViewport);
  20646. __webpack_require__(114);
  20647. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20648. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20649. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  20650. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20651. var ListItem = function (_React$Component) {
  20652. _inherits(ListItem, _React$Component);
  20653. function ListItem(props) {
  20654. _classCallCheck(this, ListItem);
  20655. var _this = _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).call(this, props));
  20656. _this.is_sys = !!_this.props.sys;
  20657. _this.state = {};
  20658. return _this;
  20659. }
  20660. _createClass(ListItem, [{
  20661. key: 'getTitle',
  20662. value: function getTitle() {
  20663. var lang = this.props.lang;
  20664. return this.is_sys ? lang.sys_host_title : this.props.data.title || lang.untitled;
  20665. }
  20666. }, {
  20667. key: 'beSelected',
  20668. value: function beSelected() {
  20669. this.props.setCurrent(this.props.data);
  20670. }
  20671. }, {
  20672. key: 'toggle',
  20673. value: function toggle() {
  20674. _Agent2.default.emit('toggle_hosts', Object.assign({}, this.props.data));
  20675. }
  20676. }, {
  20677. key: 'toEdit',
  20678. value: function toEdit() {
  20679. _Agent2.default.emit('edit_hosts', Object.assign({}, this.props.data));
  20680. }
  20681. }, {
  20682. key: 'componentDidMount',
  20683. value: function componentDidMount() {
  20684. var _props = this.props,
  20685. just_added_id = _props.just_added_id,
  20686. data = _props.data;
  20687. //Agent.on('select_hosts', id => {
  20688. // if (id && id === this.props.data.id) {
  20689. // this.beSelected()
  20690. // this.el && this.el.scrollIntoView()
  20691. // }
  20692. //})
  20693. if (!this.el) {
  20694. return;
  20695. }
  20696. var el = this.el;
  20697. if (just_added_id === data.id && !(0, _isInViewport2.default)(el)) {
  20698. el.scrollIntoView();
  20699. this.props.justAdd(null);
  20700. }
  20701. }
  20702. }, {
  20703. key: 'render',
  20704. value: function render() {
  20705. var _this2 = this;
  20706. var _props2 = this.props,
  20707. data = _props2.data,
  20708. sys = _props2.sys,
  20709. current = _props2.current,
  20710. show = _props2.show;
  20711. if (!data) return null;
  20712. var is_selected = data.id === current.id || data.is_sys && current.is_sys;
  20713. var attrs = {
  20714. 'data-id': data.id || ''
  20715. };
  20716. return _react2.default.createElement(
  20717. 'div',
  20718. _extends({ className: (0, _classnames2.default)({
  20719. 'list-item': 1
  20720. //, 'hidden': !this.isMatched()
  20721. , 'sys-hosts': sys,
  20722. 'selected': is_selected,
  20723. 'hidden': show === false
  20724. }),
  20725. onClick: this.beSelected.bind(this),
  20726. ref: function ref(el) {
  20727. return _this2.el = el;
  20728. }
  20729. }, attrs),
  20730. sys ? null : _react2.default.createElement(
  20731. 'div',
  20732. { className: 'item-buttons' },
  20733. _react2.default.createElement('i', {
  20734. className: 'iconfont icon-edit',
  20735. onClick: this.toEdit.bind(this)
  20736. }),
  20737. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  20738. 'switch': 1,
  20739. 'iconfont': 1,
  20740. 'icon-on': data.on,
  20741. 'icon-off': !data.on
  20742. }),
  20743. onClick: this.toggle.bind(this)
  20744. })
  20745. ),
  20746. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  20747. 'iconfont': 1,
  20748. 'item-icon': 1,
  20749. 'icon-warn': !!data.error,
  20750. 'icon-file': !sys && !data.error && data.where !== 'group',
  20751. 'icon-files': data.where === 'group',
  20752. 'icon-sysserver': sys && !data.error
  20753. }),
  20754. title: data.error || ''
  20755. }),
  20756. _react2.default.createElement(
  20757. 'span',
  20758. null,
  20759. this.getTitle()
  20760. )
  20761. );
  20762. }
  20763. }]);
  20764. return ListItem;
  20765. }(_react2.default.Component);
  20766. exports.default = ListItem;
  20767. /***/ }),
  20768. /* 150 */
  20769. /***/ (function(module, exports, __webpack_require__) {
  20770. "use strict";
  20771. /**
  20772. * @author oldj
  20773. * @blog https://oldj.net
  20774. */
  20775. Object.defineProperty(exports, "__esModule", {
  20776. value: true
  20777. });
  20778. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  20779. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20780. var _react = __webpack_require__(7);
  20781. var _react2 = _interopRequireDefault(_react);
  20782. var _listItem = __webpack_require__(149);
  20783. var _listItem2 = _interopRequireDefault(_listItem);
  20784. var _sortablejs = __webpack_require__(76);
  20785. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  20786. var _listToArray = __webpack_require__(72);
  20787. var _listToArray2 = _interopRequireDefault(_listToArray);
  20788. var _Agent = __webpack_require__(4);
  20789. var _Agent2 = _interopRequireDefault(_Agent);
  20790. var _kw = __webpack_require__(71);
  20791. __webpack_require__(115);
  20792. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20793. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20794. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  20795. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20796. var List = function (_React$Component) {
  20797. _inherits(List, _React$Component);
  20798. function List(props) {
  20799. _classCallCheck(this, List);
  20800. var _this = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, props));
  20801. _this.state = {
  20802. kw: ''
  20803. };
  20804. _Agent2.default.on('search', function (kw) {
  20805. _this.setState({ kw: kw });
  20806. });
  20807. return _this;
  20808. }
  20809. _createClass(List, [{
  20810. key: 'customItems',
  20811. value: function customItems() {
  20812. var _this2 = this;
  20813. var kw = this.state.kw;
  20814. function match(kw, item) {
  20815. return (0, _kw.findPositions)(kw, item.content).length > 0 || (0, _kw.findPositions)(kw, item.title).length > 0;
  20816. }
  20817. return this.props.list.map(function (item, idx) {
  20818. var show = true;
  20819. if (kw && !match(kw, item)) {
  20820. show = false;
  20821. }
  20822. return _react2.default.createElement(_listItem2.default, _extends({
  20823. data: item,
  20824. idx: idx,
  20825. key: 'hosts-' + idx + Math.random(),
  20826. show: show
  20827. }, _this2.props));
  20828. });
  20829. }
  20830. }, {
  20831. key: 'getCurrentListFromDOM',
  20832. value: function getCurrentListFromDOM() {
  20833. var nodes = this.refs.items.getElementsByClassName('list-item');
  20834. nodes = (0, _listToArray2.default)(nodes);
  20835. var ids = nodes.map(function (el) {
  20836. return el.getAttribute('data-id');
  20837. });
  20838. _Agent2.default.emit('sort', ids);
  20839. }
  20840. }, {
  20841. key: 'componentDidMount',
  20842. value: function componentDidMount() {
  20843. var _this3 = this;
  20844. _sortablejs2.default.create(this.refs.items, {
  20845. group: 'list-sorting',
  20846. sort: true,
  20847. animation: 150,
  20848. onStart: function onStart() {
  20849. _Agent2.default.emit('drag_start');
  20850. },
  20851. onSort: function onSort() {
  20852. _this3.getCurrentListFromDOM();
  20853. _Agent2.default.emit('drag_end');
  20854. //console.log(evt)
  20855. //console.log(evt.item)
  20856. //console.log(evt.oldIndex, evt.newIndex)
  20857. }
  20858. });
  20859. }
  20860. }, {
  20861. key: 'render',
  20862. value: function render() {
  20863. return _react2.default.createElement(
  20864. 'div',
  20865. { id: 'sh-list' },
  20866. _react2.default.createElement(_listItem2.default, _extends({
  20867. data: this.props.sys_hosts
  20868. }, this.props, {
  20869. sys: '1' })),
  20870. _react2.default.createElement(
  20871. 'div',
  20872. { ref: 'items', className: 'custom-items' },
  20873. this.customItems()
  20874. )
  20875. );
  20876. }
  20877. }]);
  20878. return List;
  20879. }(_react2.default.Component);
  20880. exports.default = List;
  20881. /***/ }),
  20882. /* 151 */
  20883. /***/ (function(module, exports, __webpack_require__) {
  20884. "use strict";
  20885. /**
  20886. * @author oldj
  20887. * @blog http://oldj.net
  20888. */
  20889. Object.defineProperty(exports, "__esModule", {
  20890. value: true
  20891. });
  20892. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20893. var _react = __webpack_require__(7);
  20894. var _react2 = _interopRequireDefault(_react);
  20895. var _buttons = __webpack_require__(148);
  20896. var _buttons2 = _interopRequireDefault(_buttons);
  20897. var _searchbar = __webpack_require__(152);
  20898. var _searchbar2 = _interopRequireDefault(_searchbar);
  20899. var _list = __webpack_require__(150);
  20900. var _list2 = _interopRequireDefault(_list);
  20901. __webpack_require__(116);
  20902. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20903. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20904. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  20905. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20906. var Panel = function (_React$Component) {
  20907. _inherits(Panel, _React$Component);
  20908. function Panel() {
  20909. _classCallCheck(this, Panel);
  20910. return _possibleConstructorReturn(this, (Panel.__proto__ || Object.getPrototypeOf(Panel)).apply(this, arguments));
  20911. }
  20912. _createClass(Panel, [{
  20913. key: 'render',
  20914. value: function render() {
  20915. return _react2.default.createElement(
  20916. 'div',
  20917. { id: 'panel' },
  20918. _react2.default.createElement(_list2.default, this.props),
  20919. _react2.default.createElement(_searchbar2.default, null),
  20920. _react2.default.createElement(_buttons2.default, null)
  20921. );
  20922. }
  20923. }]);
  20924. return Panel;
  20925. }(_react2.default.Component);
  20926. exports.default = Panel;
  20927. /***/ }),
  20928. /* 152 */
  20929. /***/ (function(module, exports, __webpack_require__) {
  20930. "use strict";
  20931. /**
  20932. * @author oldj
  20933. * @blog http://oldj.net
  20934. */
  20935. Object.defineProperty(exports, "__esModule", {
  20936. value: true
  20937. });
  20938. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20939. var _react = __webpack_require__(7);
  20940. var _react2 = _interopRequireDefault(_react);
  20941. var _Agent = __webpack_require__(4);
  20942. var _Agent2 = _interopRequireDefault(_Agent);
  20943. __webpack_require__(117);
  20944. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20945. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20946. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  20947. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20948. var SearchBar = function (_React$Component) {
  20949. _inherits(SearchBar, _React$Component);
  20950. function SearchBar(props) {
  20951. _classCallCheck(this, SearchBar);
  20952. var _this = _possibleConstructorReturn(this, (SearchBar.__proto__ || Object.getPrototypeOf(SearchBar)).call(this, props));
  20953. _this.state = {
  20954. show: false,
  20955. keyword: ''
  20956. };
  20957. _this._t = null;
  20958. _Agent2.default.on('search_on', function () {
  20959. _this.setState({
  20960. show: true
  20961. }, function () {
  20962. setTimeout(function () {
  20963. _this.refs.keyword.focus();
  20964. }, 100);
  20965. });
  20966. });
  20967. _Agent2.default.on('search_off', function () {
  20968. _this.clearSearch();
  20969. });
  20970. return _this;
  20971. }
  20972. _createClass(SearchBar, [{
  20973. key: 'clearSearch',
  20974. value: function clearSearch() {
  20975. this.setState({
  20976. show: false,
  20977. keyword: ''
  20978. });
  20979. _Agent2.default.emit('search', '');
  20980. }
  20981. }, {
  20982. key: 'doSearch',
  20983. value: function doSearch(kw) {
  20984. this.setState({
  20985. keyword: kw
  20986. });
  20987. clearTimeout(this._t);
  20988. this._t = setTimeout(function () {
  20989. _Agent2.default.emit('search', kw);
  20990. }, 300);
  20991. }
  20992. }, {
  20993. key: 'render',
  20994. value: function render() {
  20995. var _this2 = this;
  20996. if (!this.state.show) {
  20997. return null;
  20998. }
  20999. return _react2.default.createElement(
  21000. 'div',
  21001. { id: 'sh-searchbar' },
  21002. _react2.default.createElement('input', {
  21003. ref: 'keyword',
  21004. type: 'text',
  21005. placeholder: 'keyword',
  21006. value: this.state.keyword,
  21007. onChange: function onChange(e) {
  21008. return _this2.doSearch(e.target.value);
  21009. },
  21010. onKeyDown: function onKeyDown(e) {
  21011. return e.keyCode === 27 && SearchBar.onCancel();
  21012. }
  21013. })
  21014. );
  21015. }
  21016. }], [{
  21017. key: 'onCancel',
  21018. value: function onCancel() {
  21019. _Agent2.default.emit('cancel_search');
  21020. }
  21021. }]);
  21022. return SearchBar;
  21023. }(_react2.default.Component);
  21024. exports.default = SearchBar;
  21025. /***/ }),
  21026. /* 153 */
  21027. /***/ (function(module, exports, __webpack_require__) {
  21028. var map = {
  21029. "./check_hosts_refresh": 37,
  21030. "./check_hosts_refresh.js": 37,
  21031. "./del_hosts": 38,
  21032. "./del_hosts.js": 38,
  21033. "./esc": 39,
  21034. "./esc.js": 39,
  21035. "./get_on_hosts": 40,
  21036. "./get_on_hosts.js": 40,
  21037. "./index": 29,
  21038. "./index.js": 29,
  21039. "./list_updated": 17,
  21040. "./list_updated.js": 17,
  21041. "./reload": 41,
  21042. "./reload.js": 41,
  21043. "./save": 30,
  21044. "./save.js": 30,
  21045. "./sort": 42,
  21046. "./sort.js": 42,
  21047. "./sudo_cancel": 43,
  21048. "./sudo_cancel.js": 43,
  21049. "./sudo_pswd": 44,
  21050. "./sudo_pswd.js": 44,
  21051. "./toggle_hosts": 45,
  21052. "./toggle_hosts.js": 45,
  21053. "./top_toggle": 46,
  21054. "./top_toggle.js": 46,
  21055. "./update_hosts": 31,
  21056. "./update_hosts.js": 31
  21057. };
  21058. function webpackContext(req) {
  21059. return __webpack_require__(webpackContextResolve(req));
  21060. };
  21061. function webpackContextResolve(req) {
  21062. var id = map[req];
  21063. if(!(id + 1)) // check for number or string
  21064. throw new Error("Cannot find module '" + req + "'.");
  21065. return id;
  21066. };
  21067. webpackContext.keys = function webpackContextKeys() {
  21068. return Object.keys(map);
  21069. };
  21070. webpackContext.resolve = webpackContextResolve;
  21071. module.exports = webpackContext;
  21072. webpackContext.id = 153;
  21073. /***/ }),
  21074. /* 154 */
  21075. /***/ (function(module, exports, __webpack_require__) {
  21076. var map = {
  21077. "./check_hosts_refresh.js": 37,
  21078. "./del_hosts.js": 38,
  21079. "./esc.js": 39,
  21080. "./get_on_hosts.js": 40,
  21081. "./index.js": 29,
  21082. "./list_updated.js": 17,
  21083. "./reload.js": 41,
  21084. "./save.js": 30,
  21085. "./sort.js": 42,
  21086. "./sudo_cancel.js": 43,
  21087. "./sudo_pswd.js": 44,
  21088. "./toggle_hosts.js": 45,
  21089. "./top_toggle.js": 46,
  21090. "./update_hosts.js": 31
  21091. };
  21092. function webpackContext(req) {
  21093. return __webpack_require__(webpackContextResolve(req));
  21094. };
  21095. function webpackContextResolve(req) {
  21096. var id = map[req];
  21097. if(!(id + 1)) // check for number or string
  21098. throw new Error("Cannot find module '" + req + "'.");
  21099. return id;
  21100. };
  21101. webpackContext.keys = function webpackContextKeys() {
  21102. return Object.keys(map);
  21103. };
  21104. webpackContext.resolve = webpackContextResolve;
  21105. module.exports = webpackContext;
  21106. webpackContext.id = 154;
  21107. /***/ }),
  21108. /* 155 */
  21109. /***/ (function(module, exports, __webpack_require__) {
  21110. "use strict";
  21111. /**
  21112. * @author oldj
  21113. * @blog https://oldj.net
  21114. */
  21115. module.exports = (element) => {
  21116. let rect = element.getBoundingClientRect()
  21117. let docEl = document.documentElement
  21118. return (
  21119. rect.top >= 0 &&
  21120. rect.left >= 0 &&
  21121. rect.bottom <= (window.innerHeight || docEl.clientHeight) &&
  21122. rect.right <= (window.innerWidth || docEl.clientWidth)
  21123. )
  21124. }
  21125. /***/ }),
  21126. /* 156 */
  21127. /***/ (function(module, exports, __webpack_require__) {
  21128. "use strict";
  21129. /**
  21130. * Copyright (c) 2013-present, Facebook, Inc.
  21131. * All rights reserved.
  21132. *
  21133. * This source code is licensed under the BSD-style license found in the
  21134. * LICENSE file in the root directory of this source tree. An additional grant
  21135. * of patent rights can be found in the PATENTS file in the same directory.
  21136. *
  21137. * @typechecks
  21138. */
  21139. var _hyphenPattern = /-(.)/g;
  21140. /**
  21141. * Camelcases a hyphenated string, for example:
  21142. *
  21143. * > camelize('background-color')
  21144. * < "backgroundColor"
  21145. *
  21146. * @param {string} string
  21147. * @return {string}
  21148. */
  21149. function camelize(string) {
  21150. return string.replace(_hyphenPattern, function (_, character) {
  21151. return character.toUpperCase();
  21152. });
  21153. }
  21154. module.exports = camelize;
  21155. /***/ }),
  21156. /* 157 */
  21157. /***/ (function(module, exports, __webpack_require__) {
  21158. "use strict";
  21159. /**
  21160. * Copyright (c) 2013-present, Facebook, Inc.
  21161. * All rights reserved.
  21162. *
  21163. * This source code is licensed under the BSD-style license found in the
  21164. * LICENSE file in the root directory of this source tree. An additional grant
  21165. * of patent rights can be found in the PATENTS file in the same directory.
  21166. *
  21167. * @typechecks
  21168. */
  21169. var camelize = __webpack_require__(156);
  21170. var msPattern = /^-ms-/;
  21171. /**
  21172. * Camelcases a hyphenated CSS property name, for example:
  21173. *
  21174. * > camelizeStyleName('background-color')
  21175. * < "backgroundColor"
  21176. * > camelizeStyleName('-moz-transition')
  21177. * < "MozTransition"
  21178. * > camelizeStyleName('-ms-transition')
  21179. * < "msTransition"
  21180. *
  21181. * As Andi Smith suggests
  21182. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  21183. * is converted to lowercase `ms`.
  21184. *
  21185. * @param {string} string
  21186. * @return {string}
  21187. */
  21188. function camelizeStyleName(string) {
  21189. return camelize(string.replace(msPattern, 'ms-'));
  21190. }
  21191. module.exports = camelizeStyleName;
  21192. /***/ }),
  21193. /* 158 */
  21194. /***/ (function(module, exports, __webpack_require__) {
  21195. "use strict";
  21196. /**
  21197. * Copyright (c) 2013-present, Facebook, Inc.
  21198. * All rights reserved.
  21199. *
  21200. * This source code is licensed under the BSD-style license found in the
  21201. * LICENSE file in the root directory of this source tree. An additional grant
  21202. * of patent rights can be found in the PATENTS file in the same directory.
  21203. *
  21204. *
  21205. */
  21206. var isTextNode = __webpack_require__(166);
  21207. /*eslint-disable no-bitwise */
  21208. /**
  21209. * Checks if a given DOM node contains or is another DOM node.
  21210. */
  21211. function containsNode(outerNode, innerNode) {
  21212. if (!outerNode || !innerNode) {
  21213. return false;
  21214. } else if (outerNode === innerNode) {
  21215. return true;
  21216. } else if (isTextNode(outerNode)) {
  21217. return false;
  21218. } else if (isTextNode(innerNode)) {
  21219. return containsNode(outerNode, innerNode.parentNode);
  21220. } else if ('contains' in outerNode) {
  21221. return outerNode.contains(innerNode);
  21222. } else if (outerNode.compareDocumentPosition) {
  21223. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  21224. } else {
  21225. return false;
  21226. }
  21227. }
  21228. module.exports = containsNode;
  21229. /***/ }),
  21230. /* 159 */
  21231. /***/ (function(module, exports, __webpack_require__) {
  21232. "use strict";
  21233. /**
  21234. * Copyright (c) 2013-present, Facebook, Inc.
  21235. * All rights reserved.
  21236. *
  21237. * This source code is licensed under the BSD-style license found in the
  21238. * LICENSE file in the root directory of this source tree. An additional grant
  21239. * of patent rights can be found in the PATENTS file in the same directory.
  21240. *
  21241. * @typechecks
  21242. */
  21243. var invariant = __webpack_require__(0);
  21244. /**
  21245. * Convert array-like objects to arrays.
  21246. *
  21247. * This API assumes the caller knows the contents of the data type. For less
  21248. * well defined inputs use createArrayFromMixed.
  21249. *
  21250. * @param {object|function|filelist} obj
  21251. * @return {array}
  21252. */
  21253. function toArray(obj) {
  21254. var length = obj.length;
  21255. // Some browsers builtin objects can report typeof 'function' (e.g. NodeList
  21256. // in old versions of Safari).
  21257. !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? false ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
  21258. !(typeof length === 'number') ? false ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
  21259. !(length === 0 || length - 1 in obj) ? false ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
  21260. !(typeof obj.callee !== 'function') ? false ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0;
  21261. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  21262. // without method will throw during the slice call and skip straight to the
  21263. // fallback.
  21264. if (obj.hasOwnProperty) {
  21265. try {
  21266. return Array.prototype.slice.call(obj);
  21267. } catch (e) {
  21268. // IE < 9 does not support Array#slice on collections objects
  21269. }
  21270. }
  21271. // Fall back to copying key by key. This assumes all keys have a value,
  21272. // so will not preserve sparsely populated inputs.
  21273. var ret = Array(length);
  21274. for (var ii = 0; ii < length; ii++) {
  21275. ret[ii] = obj[ii];
  21276. }
  21277. return ret;
  21278. }
  21279. /**
  21280. * Perform a heuristic test to determine if an object is "array-like".
  21281. *
  21282. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  21283. * Joshu replied: "Mu."
  21284. *
  21285. * This function determines if its argument has "array nature": it returns
  21286. * true if the argument is an actual array, an `arguments' object, or an
  21287. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  21288. *
  21289. * It will return false for other array-like objects like Filelist.
  21290. *
  21291. * @param {*} obj
  21292. * @return {boolean}
  21293. */
  21294. function hasArrayNature(obj) {
  21295. return (
  21296. // not null/false
  21297. !!obj && (
  21298. // arrays are objects, NodeLists are functions in Safari
  21299. typeof obj == 'object' || typeof obj == 'function') &&
  21300. // quacks like an array
  21301. 'length' in obj &&
  21302. // not window
  21303. !('setInterval' in obj) &&
  21304. // no DOM node should be considered an array-like
  21305. // a 'select' element has 'length' and 'item' properties on IE8
  21306. typeof obj.nodeType != 'number' && (
  21307. // a real array
  21308. Array.isArray(obj) ||
  21309. // arguments
  21310. 'callee' in obj ||
  21311. // HTMLCollection/NodeList
  21312. 'item' in obj)
  21313. );
  21314. }
  21315. /**
  21316. * Ensure that the argument is an array by wrapping it in an array if it is not.
  21317. * Creates a copy of the argument if it is already an array.
  21318. *
  21319. * This is mostly useful idiomatically:
  21320. *
  21321. * var createArrayFromMixed = require('createArrayFromMixed');
  21322. *
  21323. * function takesOneOrMoreThings(things) {
  21324. * things = createArrayFromMixed(things);
  21325. * ...
  21326. * }
  21327. *
  21328. * This allows you to treat `things' as an array, but accept scalars in the API.
  21329. *
  21330. * If you need to convert an array-like object, like `arguments`, into an array
  21331. * use toArray instead.
  21332. *
  21333. * @param {*} obj
  21334. * @return {array}
  21335. */
  21336. function createArrayFromMixed(obj) {
  21337. if (!hasArrayNature(obj)) {
  21338. return [obj];
  21339. } else if (Array.isArray(obj)) {
  21340. return obj.slice();
  21341. } else {
  21342. return toArray(obj);
  21343. }
  21344. }
  21345. module.exports = createArrayFromMixed;
  21346. /***/ }),
  21347. /* 160 */
  21348. /***/ (function(module, exports, __webpack_require__) {
  21349. "use strict";
  21350. /**
  21351. * Copyright (c) 2013-present, Facebook, Inc.
  21352. * All rights reserved.
  21353. *
  21354. * This source code is licensed under the BSD-style license found in the
  21355. * LICENSE file in the root directory of this source tree. An additional grant
  21356. * of patent rights can be found in the PATENTS file in the same directory.
  21357. *
  21358. * @typechecks
  21359. */
  21360. /*eslint-disable fb-www/unsafe-html*/
  21361. var ExecutionEnvironment = __webpack_require__(9);
  21362. var createArrayFromMixed = __webpack_require__(159);
  21363. var getMarkupWrap = __webpack_require__(161);
  21364. var invariant = __webpack_require__(0);
  21365. /**
  21366. * Dummy container used to render all markup.
  21367. */
  21368. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  21369. /**
  21370. * Pattern used by `getNodeName`.
  21371. */
  21372. var nodeNamePattern = /^\s*<(\w+)/;
  21373. /**
  21374. * Extracts the `nodeName` of the first element in a string of markup.
  21375. *
  21376. * @param {string} markup String of markup.
  21377. * @return {?string} Node name of the supplied markup.
  21378. */
  21379. function getNodeName(markup) {
  21380. var nodeNameMatch = markup.match(nodeNamePattern);
  21381. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  21382. }
  21383. /**
  21384. * Creates an array containing the nodes rendered from the supplied markup. The
  21385. * optionally supplied `handleScript` function will be invoked once for each
  21386. * <script> element that is rendered. If no `handleScript` function is supplied,
  21387. * an exception is thrown if any <script> elements are rendered.
  21388. *
  21389. * @param {string} markup A string of valid HTML markup.
  21390. * @param {?function} handleScript Invoked once for each rendered <script>.
  21391. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  21392. */
  21393. function createNodesFromMarkup(markup, handleScript) {
  21394. var node = dummyNode;
  21395. !!!dummyNode ? false ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
  21396. var nodeName = getNodeName(markup);
  21397. var wrap = nodeName && getMarkupWrap(nodeName);
  21398. if (wrap) {
  21399. node.innerHTML = wrap[1] + markup + wrap[2];
  21400. var wrapDepth = wrap[0];
  21401. while (wrapDepth--) {
  21402. node = node.lastChild;
  21403. }
  21404. } else {
  21405. node.innerHTML = markup;
  21406. }
  21407. var scripts = node.getElementsByTagName('script');
  21408. if (scripts.length) {
  21409. !handleScript ? false ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
  21410. createArrayFromMixed(scripts).forEach(handleScript);
  21411. }
  21412. var nodes = Array.from(node.childNodes);
  21413. while (node.lastChild) {
  21414. node.removeChild(node.lastChild);
  21415. }
  21416. return nodes;
  21417. }
  21418. module.exports = createNodesFromMarkup;
  21419. /***/ }),
  21420. /* 161 */
  21421. /***/ (function(module, exports, __webpack_require__) {
  21422. "use strict";
  21423. /**
  21424. * Copyright (c) 2013-present, Facebook, Inc.
  21425. * All rights reserved.
  21426. *
  21427. * This source code is licensed under the BSD-style license found in the
  21428. * LICENSE file in the root directory of this source tree. An additional grant
  21429. * of patent rights can be found in the PATENTS file in the same directory.
  21430. *
  21431. */
  21432. /*eslint-disable fb-www/unsafe-html */
  21433. var ExecutionEnvironment = __webpack_require__(9);
  21434. var invariant = __webpack_require__(0);
  21435. /**
  21436. * Dummy container used to detect which wraps are necessary.
  21437. */
  21438. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  21439. /**
  21440. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  21441. * so we wrap them, render the wrapped nodes, then extract the desired node.
  21442. *
  21443. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  21444. */
  21445. var shouldWrap = {};
  21446. var selectWrap = [1, '<select multiple="true">', '</select>'];
  21447. var tableWrap = [1, '<table>', '</table>'];
  21448. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  21449. var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
  21450. var markupWrap = {
  21451. '*': [1, '?<div>', '</div>'],
  21452. 'area': [1, '<map>', '</map>'],
  21453. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  21454. 'legend': [1, '<fieldset>', '</fieldset>'],
  21455. 'param': [1, '<object>', '</object>'],
  21456. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  21457. 'optgroup': selectWrap,
  21458. 'option': selectWrap,
  21459. 'caption': tableWrap,
  21460. 'colgroup': tableWrap,
  21461. 'tbody': tableWrap,
  21462. 'tfoot': tableWrap,
  21463. 'thead': tableWrap,
  21464. 'td': trWrap,
  21465. 'th': trWrap
  21466. };
  21467. // Initialize the SVG elements since we know they'll always need to be wrapped
  21468. // consistently. If they are created inside a <div> they will be initialized in
  21469. // the wrong namespace (and will not display).
  21470. var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
  21471. svgElements.forEach(function (nodeName) {
  21472. markupWrap[nodeName] = svgWrap;
  21473. shouldWrap[nodeName] = true;
  21474. });
  21475. /**
  21476. * Gets the markup wrap configuration for the supplied `nodeName`.
  21477. *
  21478. * NOTE: This lazily detects which wraps are necessary for the current browser.
  21479. *
  21480. * @param {string} nodeName Lowercase `nodeName`.
  21481. * @return {?array} Markup wrap configuration, if applicable.
  21482. */
  21483. function getMarkupWrap(nodeName) {
  21484. !!!dummyNode ? false ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
  21485. if (!markupWrap.hasOwnProperty(nodeName)) {
  21486. nodeName = '*';
  21487. }
  21488. if (!shouldWrap.hasOwnProperty(nodeName)) {
  21489. if (nodeName === '*') {
  21490. dummyNode.innerHTML = '<link />';
  21491. } else {
  21492. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  21493. }
  21494. shouldWrap[nodeName] = !dummyNode.firstChild;
  21495. }
  21496. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  21497. }
  21498. module.exports = getMarkupWrap;
  21499. /***/ }),
  21500. /* 162 */
  21501. /***/ (function(module, exports, __webpack_require__) {
  21502. "use strict";
  21503. /**
  21504. * Copyright (c) 2013-present, Facebook, Inc.
  21505. * All rights reserved.
  21506. *
  21507. * This source code is licensed under the BSD-style license found in the
  21508. * LICENSE file in the root directory of this source tree. An additional grant
  21509. * of patent rights can be found in the PATENTS file in the same directory.
  21510. *
  21511. * @typechecks
  21512. */
  21513. /**
  21514. * Gets the scroll position of the supplied element or window.
  21515. *
  21516. * The return values are unbounded, unlike `getScrollPosition`. This means they
  21517. * may be negative or exceed the element boundaries (which is possible using
  21518. * inertial scrolling).
  21519. *
  21520. * @param {DOMWindow|DOMElement} scrollable
  21521. * @return {object} Map with `x` and `y` keys.
  21522. */
  21523. function getUnboundedScrollPosition(scrollable) {
  21524. if (scrollable.Window && scrollable instanceof scrollable.Window) {
  21525. return {
  21526. x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
  21527. y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
  21528. };
  21529. }
  21530. return {
  21531. x: scrollable.scrollLeft,
  21532. y: scrollable.scrollTop
  21533. };
  21534. }
  21535. module.exports = getUnboundedScrollPosition;
  21536. /***/ }),
  21537. /* 163 */
  21538. /***/ (function(module, exports, __webpack_require__) {
  21539. "use strict";
  21540. /**
  21541. * Copyright (c) 2013-present, Facebook, Inc.
  21542. * All rights reserved.
  21543. *
  21544. * This source code is licensed under the BSD-style license found in the
  21545. * LICENSE file in the root directory of this source tree. An additional grant
  21546. * of patent rights can be found in the PATENTS file in the same directory.
  21547. *
  21548. * @typechecks
  21549. */
  21550. var _uppercasePattern = /([A-Z])/g;
  21551. /**
  21552. * Hyphenates a camelcased string, for example:
  21553. *
  21554. * > hyphenate('backgroundColor')
  21555. * < "background-color"
  21556. *
  21557. * For CSS style names, use `hyphenateStyleName` instead which works properly
  21558. * with all vendor prefixes, including `ms`.
  21559. *
  21560. * @param {string} string
  21561. * @return {string}
  21562. */
  21563. function hyphenate(string) {
  21564. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  21565. }
  21566. module.exports = hyphenate;
  21567. /***/ }),
  21568. /* 164 */
  21569. /***/ (function(module, exports, __webpack_require__) {
  21570. "use strict";
  21571. /**
  21572. * Copyright (c) 2013-present, Facebook, Inc.
  21573. * All rights reserved.
  21574. *
  21575. * This source code is licensed under the BSD-style license found in the
  21576. * LICENSE file in the root directory of this source tree. An additional grant
  21577. * of patent rights can be found in the PATENTS file in the same directory.
  21578. *
  21579. * @typechecks
  21580. */
  21581. var hyphenate = __webpack_require__(163);
  21582. var msPattern = /^ms-/;
  21583. /**
  21584. * Hyphenates a camelcased CSS property name, for example:
  21585. *
  21586. * > hyphenateStyleName('backgroundColor')
  21587. * < "background-color"
  21588. * > hyphenateStyleName('MozTransition')
  21589. * < "-moz-transition"
  21590. * > hyphenateStyleName('msTransition')
  21591. * < "-ms-transition"
  21592. *
  21593. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  21594. * is converted to `-ms-`.
  21595. *
  21596. * @param {string} string
  21597. * @return {string}
  21598. */
  21599. function hyphenateStyleName(string) {
  21600. return hyphenate(string).replace(msPattern, '-ms-');
  21601. }
  21602. module.exports = hyphenateStyleName;
  21603. /***/ }),
  21604. /* 165 */
  21605. /***/ (function(module, exports, __webpack_require__) {
  21606. "use strict";
  21607. /**
  21608. * Copyright (c) 2013-present, Facebook, Inc.
  21609. * All rights reserved.
  21610. *
  21611. * This source code is licensed under the BSD-style license found in the
  21612. * LICENSE file in the root directory of this source tree. An additional grant
  21613. * of patent rights can be found in the PATENTS file in the same directory.
  21614. *
  21615. * @typechecks
  21616. */
  21617. /**
  21618. * @param {*} object The object to check.
  21619. * @return {boolean} Whether or not the object is a DOM node.
  21620. */
  21621. function isNode(object) {
  21622. var doc = object ? object.ownerDocument || object : document;
  21623. var defaultView = doc.defaultView || window;
  21624. return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
  21625. }
  21626. module.exports = isNode;
  21627. /***/ }),
  21628. /* 166 */
  21629. /***/ (function(module, exports, __webpack_require__) {
  21630. "use strict";
  21631. /**
  21632. * Copyright (c) 2013-present, Facebook, Inc.
  21633. * All rights reserved.
  21634. *
  21635. * This source code is licensed under the BSD-style license found in the
  21636. * LICENSE file in the root directory of this source tree. An additional grant
  21637. * of patent rights can be found in the PATENTS file in the same directory.
  21638. *
  21639. * @typechecks
  21640. */
  21641. var isNode = __webpack_require__(165);
  21642. /**
  21643. * @param {*} object The object to check.
  21644. * @return {boolean} Whether or not the object is a DOM text node.
  21645. */
  21646. function isTextNode(object) {
  21647. return isNode(object) && object.nodeType == 3;
  21648. }
  21649. module.exports = isTextNode;
  21650. /***/ }),
  21651. /* 167 */
  21652. /***/ (function(module, exports, __webpack_require__) {
  21653. "use strict";
  21654. /**
  21655. * Copyright (c) 2013-present, Facebook, Inc.
  21656. * All rights reserved.
  21657. *
  21658. * This source code is licensed under the BSD-style license found in the
  21659. * LICENSE file in the root directory of this source tree. An additional grant
  21660. * of patent rights can be found in the PATENTS file in the same directory.
  21661. *
  21662. *
  21663. * @typechecks static-only
  21664. */
  21665. /**
  21666. * Memoizes the return value of a function that accepts one string argument.
  21667. */
  21668. function memoizeStringOnly(callback) {
  21669. var cache = {};
  21670. return function (string) {
  21671. if (!cache.hasOwnProperty(string)) {
  21672. cache[string] = callback.call(this, string);
  21673. }
  21674. return cache[string];
  21675. };
  21676. }
  21677. module.exports = memoizeStringOnly;
  21678. /***/ }),
  21679. /* 168 */
  21680. /***/ (function(module, exports, __webpack_require__) {
  21681. "use strict";
  21682. /**
  21683. * Copyright 2013-present, Facebook, Inc.
  21684. * All rights reserved.
  21685. *
  21686. * This source code is licensed under the BSD-style license found in the
  21687. * LICENSE file in the root directory of this source tree. An additional grant
  21688. * of patent rights can be found in the PATENTS file in the same directory.
  21689. *
  21690. */
  21691. var ARIADOMPropertyConfig = {
  21692. Properties: {
  21693. // Global States and Properties
  21694. 'aria-current': 0, // state
  21695. 'aria-details': 0,
  21696. 'aria-disabled': 0, // state
  21697. 'aria-hidden': 0, // state
  21698. 'aria-invalid': 0, // state
  21699. 'aria-keyshortcuts': 0,
  21700. 'aria-label': 0,
  21701. 'aria-roledescription': 0,
  21702. // Widget Attributes
  21703. 'aria-autocomplete': 0,
  21704. 'aria-checked': 0,
  21705. 'aria-expanded': 0,
  21706. 'aria-haspopup': 0,
  21707. 'aria-level': 0,
  21708. 'aria-modal': 0,
  21709. 'aria-multiline': 0,
  21710. 'aria-multiselectable': 0,
  21711. 'aria-orientation': 0,
  21712. 'aria-placeholder': 0,
  21713. 'aria-pressed': 0,
  21714. 'aria-readonly': 0,
  21715. 'aria-required': 0,
  21716. 'aria-selected': 0,
  21717. 'aria-sort': 0,
  21718. 'aria-valuemax': 0,
  21719. 'aria-valuemin': 0,
  21720. 'aria-valuenow': 0,
  21721. 'aria-valuetext': 0,
  21722. // Live Region Attributes
  21723. 'aria-atomic': 0,
  21724. 'aria-busy': 0,
  21725. 'aria-live': 0,
  21726. 'aria-relevant': 0,
  21727. // Drag-and-Drop Attributes
  21728. 'aria-dropeffect': 0,
  21729. 'aria-grabbed': 0,
  21730. // Relationship Attributes
  21731. 'aria-activedescendant': 0,
  21732. 'aria-colcount': 0,
  21733. 'aria-colindex': 0,
  21734. 'aria-colspan': 0,
  21735. 'aria-controls': 0,
  21736. 'aria-describedby': 0,
  21737. 'aria-errormessage': 0,
  21738. 'aria-flowto': 0,
  21739. 'aria-labelledby': 0,
  21740. 'aria-owns': 0,
  21741. 'aria-posinset': 0,
  21742. 'aria-rowcount': 0,
  21743. 'aria-rowindex': 0,
  21744. 'aria-rowspan': 0,
  21745. 'aria-setsize': 0
  21746. },
  21747. DOMAttributeNames: {},
  21748. DOMPropertyNames: {}
  21749. };
  21750. module.exports = ARIADOMPropertyConfig;
  21751. /***/ }),
  21752. /* 169 */
  21753. /***/ (function(module, exports, __webpack_require__) {
  21754. "use strict";
  21755. /**
  21756. * Copyright 2013-present, Facebook, Inc.
  21757. * All rights reserved.
  21758. *
  21759. * This source code is licensed under the BSD-style license found in the
  21760. * LICENSE file in the root directory of this source tree. An additional grant
  21761. * of patent rights can be found in the PATENTS file in the same directory.
  21762. *
  21763. */
  21764. var ReactDOMComponentTree = __webpack_require__(5);
  21765. var focusNode = __webpack_require__(74);
  21766. var AutoFocusUtils = {
  21767. focusDOMComponent: function () {
  21768. focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
  21769. }
  21770. };
  21771. module.exports = AutoFocusUtils;
  21772. /***/ }),
  21773. /* 170 */
  21774. /***/ (function(module, exports, __webpack_require__) {
  21775. "use strict";
  21776. /**
  21777. * Copyright 2013-present Facebook, Inc.
  21778. * All rights reserved.
  21779. *
  21780. * This source code is licensed under the BSD-style license found in the
  21781. * LICENSE file in the root directory of this source tree. An additional grant
  21782. * of patent rights can be found in the PATENTS file in the same directory.
  21783. *
  21784. */
  21785. var EventPropagators = __webpack_require__(26);
  21786. var ExecutionEnvironment = __webpack_require__(9);
  21787. var FallbackCompositionState = __webpack_require__(176);
  21788. var SyntheticCompositionEvent = __webpack_require__(213);
  21789. var SyntheticInputEvent = __webpack_require__(216);
  21790. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  21791. var START_KEYCODE = 229;
  21792. var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
  21793. var documentMode = null;
  21794. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  21795. documentMode = document.documentMode;
  21796. }
  21797. // Webkit offers a very useful `textInput` event that can be used to
  21798. // directly represent `beforeInput`. The IE `textinput` event is not as
  21799. // useful, so we don't use it.
  21800. var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
  21801. // In IE9+, we have access to composition events, but the data supplied
  21802. // by the native compositionend event may be incorrect. Japanese ideographic
  21803. // spaces, for instance (\u3000) are not recorded correctly.
  21804. var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
  21805. /**
  21806. * Opera <= 12 includes TextEvent in window, but does not fire
  21807. * text input events. Rely on keypress instead.
  21808. */
  21809. function isPresto() {
  21810. var opera = window.opera;
  21811. return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
  21812. }
  21813. var SPACEBAR_CODE = 32;
  21814. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  21815. // Events and their corresponding property names.
  21816. var eventTypes = {
  21817. beforeInput: {
  21818. phasedRegistrationNames: {
  21819. bubbled: 'onBeforeInput',
  21820. captured: 'onBeforeInputCapture'
  21821. },
  21822. dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
  21823. },
  21824. compositionEnd: {
  21825. phasedRegistrationNames: {
  21826. bubbled: 'onCompositionEnd',
  21827. captured: 'onCompositionEndCapture'
  21828. },
  21829. dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21830. },
  21831. compositionStart: {
  21832. phasedRegistrationNames: {
  21833. bubbled: 'onCompositionStart',
  21834. captured: 'onCompositionStartCapture'
  21835. },
  21836. dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21837. },
  21838. compositionUpdate: {
  21839. phasedRegistrationNames: {
  21840. bubbled: 'onCompositionUpdate',
  21841. captured: 'onCompositionUpdateCapture'
  21842. },
  21843. dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21844. }
  21845. };
  21846. // Track whether we've ever handled a keypress on the space key.
  21847. var hasSpaceKeypress = false;
  21848. /**
  21849. * Return whether a native keypress event is assumed to be a command.
  21850. * This is required because Firefox fires `keypress` events for key commands
  21851. * (cut, copy, select-all, etc.) even though no character is inserted.
  21852. */
  21853. function isKeypressCommand(nativeEvent) {
  21854. return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  21855. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  21856. !(nativeEvent.ctrlKey && nativeEvent.altKey);
  21857. }
  21858. /**
  21859. * Translate native top level events into event types.
  21860. *
  21861. * @param {string} topLevelType
  21862. * @return {object}
  21863. */
  21864. function getCompositionEventType(topLevelType) {
  21865. switch (topLevelType) {
  21866. case 'topCompositionStart':
  21867. return eventTypes.compositionStart;
  21868. case 'topCompositionEnd':
  21869. return eventTypes.compositionEnd;
  21870. case 'topCompositionUpdate':
  21871. return eventTypes.compositionUpdate;
  21872. }
  21873. }
  21874. /**
  21875. * Does our fallback best-guess model think this event signifies that
  21876. * composition has begun?
  21877. *
  21878. * @param {string} topLevelType
  21879. * @param {object} nativeEvent
  21880. * @return {boolean}
  21881. */
  21882. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  21883. return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
  21884. }
  21885. /**
  21886. * Does our fallback mode think that this event is the end of composition?
  21887. *
  21888. * @param {string} topLevelType
  21889. * @param {object} nativeEvent
  21890. * @return {boolean}
  21891. */
  21892. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  21893. switch (topLevelType) {
  21894. case 'topKeyUp':
  21895. // Command keys insert or clear IME input.
  21896. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
  21897. case 'topKeyDown':
  21898. // Expect IME keyCode on each keydown. If we get any other
  21899. // code we must have exited earlier.
  21900. return nativeEvent.keyCode !== START_KEYCODE;
  21901. case 'topKeyPress':
  21902. case 'topMouseDown':
  21903. case 'topBlur':
  21904. // Events are not possible without cancelling IME.
  21905. return true;
  21906. default:
  21907. return false;
  21908. }
  21909. }
  21910. /**
  21911. * Google Input Tools provides composition data via a CustomEvent,
  21912. * with the `data` property populated in the `detail` object. If this
  21913. * is available on the event object, use it. If not, this is a plain
  21914. * composition event and we have nothing special to extract.
  21915. *
  21916. * @param {object} nativeEvent
  21917. * @return {?string}
  21918. */
  21919. function getDataFromCustomEvent(nativeEvent) {
  21920. var detail = nativeEvent.detail;
  21921. if (typeof detail === 'object' && 'data' in detail) {
  21922. return detail.data;
  21923. }
  21924. return null;
  21925. }
  21926. // Track the current IME composition fallback object, if any.
  21927. var currentComposition = null;
  21928. /**
  21929. * @return {?object} A SyntheticCompositionEvent.
  21930. */
  21931. function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  21932. var eventType;
  21933. var fallbackData;
  21934. if (canUseCompositionEvent) {
  21935. eventType = getCompositionEventType(topLevelType);
  21936. } else if (!currentComposition) {
  21937. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  21938. eventType = eventTypes.compositionStart;
  21939. }
  21940. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  21941. eventType = eventTypes.compositionEnd;
  21942. }
  21943. if (!eventType) {
  21944. return null;
  21945. }
  21946. if (useFallbackCompositionData) {
  21947. // The current composition is stored statically and must not be
  21948. // overwritten while composition continues.
  21949. if (!currentComposition && eventType === eventTypes.compositionStart) {
  21950. currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
  21951. } else if (eventType === eventTypes.compositionEnd) {
  21952. if (currentComposition) {
  21953. fallbackData = currentComposition.getData();
  21954. }
  21955. }
  21956. }
  21957. var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
  21958. if (fallbackData) {
  21959. // Inject data generated from fallback path into the synthetic event.
  21960. // This matches the property of native CompositionEventInterface.
  21961. event.data = fallbackData;
  21962. } else {
  21963. var customData = getDataFromCustomEvent(nativeEvent);
  21964. if (customData !== null) {
  21965. event.data = customData;
  21966. }
  21967. }
  21968. EventPropagators.accumulateTwoPhaseDispatches(event);
  21969. return event;
  21970. }
  21971. /**
  21972. * @param {string} topLevelType Record from `EventConstants`.
  21973. * @param {object} nativeEvent Native browser event.
  21974. * @return {?string} The string corresponding to this `beforeInput` event.
  21975. */
  21976. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  21977. switch (topLevelType) {
  21978. case 'topCompositionEnd':
  21979. return getDataFromCustomEvent(nativeEvent);
  21980. case 'topKeyPress':
  21981. /**
  21982. * If native `textInput` events are available, our goal is to make
  21983. * use of them. However, there is a special case: the spacebar key.
  21984. * In Webkit, preventing default on a spacebar `textInput` event
  21985. * cancels character insertion, but it *also* causes the browser
  21986. * to fall back to its default spacebar behavior of scrolling the
  21987. * page.
  21988. *
  21989. * Tracking at:
  21990. * https://code.google.com/p/chromium/issues/detail?id=355103
  21991. *
  21992. * To avoid this issue, use the keypress event as if no `textInput`
  21993. * event is available.
  21994. */
  21995. var which = nativeEvent.which;
  21996. if (which !== SPACEBAR_CODE) {
  21997. return null;
  21998. }
  21999. hasSpaceKeypress = true;
  22000. return SPACEBAR_CHAR;
  22001. case 'topTextInput':
  22002. // Record the characters to be added to the DOM.
  22003. var chars = nativeEvent.data;
  22004. // If it's a spacebar character, assume that we have already handled
  22005. // it at the keypress level and bail immediately. Android Chrome
  22006. // doesn't give us keycodes, so we need to blacklist it.
  22007. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  22008. return null;
  22009. }
  22010. return chars;
  22011. default:
  22012. // For other native event types, do nothing.
  22013. return null;
  22014. }
  22015. }
  22016. /**
  22017. * For browsers that do not provide the `textInput` event, extract the
  22018. * appropriate string to use for SyntheticInputEvent.
  22019. *
  22020. * @param {string} topLevelType Record from `EventConstants`.
  22021. * @param {object} nativeEvent Native browser event.
  22022. * @return {?string} The fallback string for this `beforeInput` event.
  22023. */
  22024. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  22025. // If we are currently composing (IME) and using a fallback to do so,
  22026. // try to extract the composed characters from the fallback object.
  22027. // If composition event is available, we extract a string only at
  22028. // compositionevent, otherwise extract it at fallback events.
  22029. if (currentComposition) {
  22030. if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  22031. var chars = currentComposition.getData();
  22032. FallbackCompositionState.release(currentComposition);
  22033. currentComposition = null;
  22034. return chars;
  22035. }
  22036. return null;
  22037. }
  22038. switch (topLevelType) {
  22039. case 'topPaste':
  22040. // If a paste event occurs after a keypress, throw out the input
  22041. // chars. Paste events should not lead to BeforeInput events.
  22042. return null;
  22043. case 'topKeyPress':
  22044. /**
  22045. * As of v27, Firefox may fire keypress events even when no character
  22046. * will be inserted. A few possibilities:
  22047. *
  22048. * - `which` is `0`. Arrow keys, Esc key, etc.
  22049. *
  22050. * - `which` is the pressed key code, but no char is available.
  22051. * Ex: 'AltGr + d` in Polish. There is no modified character for
  22052. * this key combination and no character is inserted into the
  22053. * document, but FF fires the keypress for char code `100` anyway.
  22054. * No `input` event will occur.
  22055. *
  22056. * - `which` is the pressed key code, but a command combination is
  22057. * being used. Ex: `Cmd+C`. No character is inserted, and no
  22058. * `input` event will occur.
  22059. */
  22060. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  22061. return String.fromCharCode(nativeEvent.which);
  22062. }
  22063. return null;
  22064. case 'topCompositionEnd':
  22065. return useFallbackCompositionData ? null : nativeEvent.data;
  22066. default:
  22067. return null;
  22068. }
  22069. }
  22070. /**
  22071. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  22072. * `textInput` or fallback behavior.
  22073. *
  22074. * @return {?object} A SyntheticInputEvent.
  22075. */
  22076. function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22077. var chars;
  22078. if (canUseTextInputEvent) {
  22079. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  22080. } else {
  22081. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  22082. }
  22083. // If no characters are being inserted, no BeforeInput event should
  22084. // be fired.
  22085. if (!chars) {
  22086. return null;
  22087. }
  22088. var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
  22089. event.data = chars;
  22090. EventPropagators.accumulateTwoPhaseDispatches(event);
  22091. return event;
  22092. }
  22093. /**
  22094. * Create an `onBeforeInput` event to match
  22095. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  22096. *
  22097. * This event plugin is based on the native `textInput` event
  22098. * available in Chrome, Safari, Opera, and IE. This event fires after
  22099. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  22100. *
  22101. * `beforeInput` is spec'd but not implemented in any browsers, and
  22102. * the `input` event does not provide any useful information about what has
  22103. * actually been added, contrary to the spec. Thus, `textInput` is the best
  22104. * available event to identify the characters that have actually been inserted
  22105. * into the target node.
  22106. *
  22107. * This plugin is also responsible for emitting `composition` events, thus
  22108. * allowing us to share composition fallback code for both `beforeInput` and
  22109. * `composition` event types.
  22110. */
  22111. var BeforeInputEventPlugin = {
  22112. eventTypes: eventTypes,
  22113. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22114. return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
  22115. }
  22116. };
  22117. module.exports = BeforeInputEventPlugin;
  22118. /***/ }),
  22119. /* 171 */
  22120. /***/ (function(module, exports, __webpack_require__) {
  22121. "use strict";
  22122. /**
  22123. * Copyright 2013-present, Facebook, Inc.
  22124. * All rights reserved.
  22125. *
  22126. * This source code is licensed under the BSD-style license found in the
  22127. * LICENSE file in the root directory of this source tree. An additional grant
  22128. * of patent rights can be found in the PATENTS file in the same directory.
  22129. *
  22130. */
  22131. var CSSProperty = __webpack_require__(77);
  22132. var ExecutionEnvironment = __webpack_require__(9);
  22133. var ReactInstrumentation = __webpack_require__(11);
  22134. var camelizeStyleName = __webpack_require__(157);
  22135. var dangerousStyleValue = __webpack_require__(222);
  22136. var hyphenateStyleName = __webpack_require__(164);
  22137. var memoizeStringOnly = __webpack_require__(167);
  22138. var warning = __webpack_require__(1);
  22139. var processStyleName = memoizeStringOnly(function (styleName) {
  22140. return hyphenateStyleName(styleName);
  22141. });
  22142. var hasShorthandPropertyBug = false;
  22143. var styleFloatAccessor = 'cssFloat';
  22144. if (ExecutionEnvironment.canUseDOM) {
  22145. var tempStyle = document.createElement('div').style;
  22146. try {
  22147. // IE8 throws "Invalid argument." if resetting shorthand style properties.
  22148. tempStyle.font = '';
  22149. } catch (e) {
  22150. hasShorthandPropertyBug = true;
  22151. }
  22152. // IE8 only supports accessing cssFloat (standard) as styleFloat
  22153. if (document.documentElement.style.cssFloat === undefined) {
  22154. styleFloatAccessor = 'styleFloat';
  22155. }
  22156. }
  22157. if (false) {
  22158. // 'msTransform' is correct, but the other prefixes should be capitalized
  22159. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  22160. // style values shouldn't contain a semicolon
  22161. var badStyleValueWithSemicolonPattern = /;\s*$/;
  22162. var warnedStyleNames = {};
  22163. var warnedStyleValues = {};
  22164. var warnedForNaNValue = false;
  22165. var warnHyphenatedStyleName = function (name, owner) {
  22166. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  22167. return;
  22168. }
  22169. warnedStyleNames[name] = true;
  22170. process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
  22171. };
  22172. var warnBadVendoredStyleName = function (name, owner) {
  22173. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  22174. return;
  22175. }
  22176. warnedStyleNames[name] = true;
  22177. process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
  22178. };
  22179. var warnStyleValueWithSemicolon = function (name, value, owner) {
  22180. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  22181. return;
  22182. }
  22183. warnedStyleValues[value] = true;
  22184. process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
  22185. };
  22186. var warnStyleValueIsNaN = function (name, value, owner) {
  22187. if (warnedForNaNValue) {
  22188. return;
  22189. }
  22190. warnedForNaNValue = true;
  22191. process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
  22192. };
  22193. var checkRenderMessage = function (owner) {
  22194. if (owner) {
  22195. var name = owner.getName();
  22196. if (name) {
  22197. return ' Check the render method of `' + name + '`.';
  22198. }
  22199. }
  22200. return '';
  22201. };
  22202. /**
  22203. * @param {string} name
  22204. * @param {*} value
  22205. * @param {ReactDOMComponent} component
  22206. */
  22207. var warnValidStyle = function (name, value, component) {
  22208. var owner;
  22209. if (component) {
  22210. owner = component._currentElement._owner;
  22211. }
  22212. if (name.indexOf('-') > -1) {
  22213. warnHyphenatedStyleName(name, owner);
  22214. } else if (badVendoredStyleNamePattern.test(name)) {
  22215. warnBadVendoredStyleName(name, owner);
  22216. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  22217. warnStyleValueWithSemicolon(name, value, owner);
  22218. }
  22219. if (typeof value === 'number' && isNaN(value)) {
  22220. warnStyleValueIsNaN(name, value, owner);
  22221. }
  22222. };
  22223. }
  22224. /**
  22225. * Operations for dealing with CSS properties.
  22226. */
  22227. var CSSPropertyOperations = {
  22228. /**
  22229. * Serializes a mapping of style properties for use as inline styles:
  22230. *
  22231. * > createMarkupForStyles({width: '200px', height: 0})
  22232. * "width:200px;height:0;"
  22233. *
  22234. * Undefined values are ignored so that declarative programming is easier.
  22235. * The result should be HTML-escaped before insertion into the DOM.
  22236. *
  22237. * @param {object} styles
  22238. * @param {ReactDOMComponent} component
  22239. * @return {?string}
  22240. */
  22241. createMarkupForStyles: function (styles, component) {
  22242. var serialized = '';
  22243. for (var styleName in styles) {
  22244. if (!styles.hasOwnProperty(styleName)) {
  22245. continue;
  22246. }
  22247. var styleValue = styles[styleName];
  22248. if (false) {
  22249. warnValidStyle(styleName, styleValue, component);
  22250. }
  22251. if (styleValue != null) {
  22252. serialized += processStyleName(styleName) + ':';
  22253. serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
  22254. }
  22255. }
  22256. return serialized || null;
  22257. },
  22258. /**
  22259. * Sets the value for multiple styles on a node. If a value is specified as
  22260. * '' (empty string), the corresponding style property will be unset.
  22261. *
  22262. * @param {DOMElement} node
  22263. * @param {object} styles
  22264. * @param {ReactDOMComponent} component
  22265. */
  22266. setValueForStyles: function (node, styles, component) {
  22267. if (false) {
  22268. ReactInstrumentation.debugTool.onHostOperation({
  22269. instanceID: component._debugID,
  22270. type: 'update styles',
  22271. payload: styles
  22272. });
  22273. }
  22274. var style = node.style;
  22275. for (var styleName in styles) {
  22276. if (!styles.hasOwnProperty(styleName)) {
  22277. continue;
  22278. }
  22279. if (false) {
  22280. warnValidStyle(styleName, styles[styleName], component);
  22281. }
  22282. var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
  22283. if (styleName === 'float' || styleName === 'cssFloat') {
  22284. styleName = styleFloatAccessor;
  22285. }
  22286. if (styleValue) {
  22287. style[styleName] = styleValue;
  22288. } else {
  22289. var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
  22290. if (expansion) {
  22291. // Shorthand property that IE8 won't like unsetting, so unset each
  22292. // component to placate it
  22293. for (var individualStyleName in expansion) {
  22294. style[individualStyleName] = '';
  22295. }
  22296. } else {
  22297. style[styleName] = '';
  22298. }
  22299. }
  22300. }
  22301. }
  22302. };
  22303. module.exports = CSSPropertyOperations;
  22304. /***/ }),
  22305. /* 172 */
  22306. /***/ (function(module, exports, __webpack_require__) {
  22307. "use strict";
  22308. /**
  22309. * Copyright 2013-present, Facebook, Inc.
  22310. * All rights reserved.
  22311. *
  22312. * This source code is licensed under the BSD-style license found in the
  22313. * LICENSE file in the root directory of this source tree. An additional grant
  22314. * of patent rights can be found in the PATENTS file in the same directory.
  22315. *
  22316. */
  22317. var EventPluginHub = __webpack_require__(25);
  22318. var EventPropagators = __webpack_require__(26);
  22319. var ExecutionEnvironment = __webpack_require__(9);
  22320. var ReactDOMComponentTree = __webpack_require__(5);
  22321. var ReactUpdates = __webpack_require__(12);
  22322. var SyntheticEvent = __webpack_require__(13);
  22323. var getEventTarget = __webpack_require__(61);
  22324. var isEventSupported = __webpack_require__(62);
  22325. var isTextInputElement = __webpack_require__(94);
  22326. var eventTypes = {
  22327. change: {
  22328. phasedRegistrationNames: {
  22329. bubbled: 'onChange',
  22330. captured: 'onChangeCapture'
  22331. },
  22332. dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
  22333. }
  22334. };
  22335. /**
  22336. * For IE shims
  22337. */
  22338. var activeElement = null;
  22339. var activeElementInst = null;
  22340. var activeElementValue = null;
  22341. var activeElementValueProp = null;
  22342. /**
  22343. * SECTION: handle `change` event
  22344. */
  22345. function shouldUseChangeEvent(elem) {
  22346. var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  22347. return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
  22348. }
  22349. var doesChangeEventBubble = false;
  22350. if (ExecutionEnvironment.canUseDOM) {
  22351. // See `handleChange` comment below
  22352. doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8);
  22353. }
  22354. function manualDispatchChangeEvent(nativeEvent) {
  22355. var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
  22356. EventPropagators.accumulateTwoPhaseDispatches(event);
  22357. // If change and propertychange bubbled, we'd just bind to it like all the
  22358. // other events and have it go through ReactBrowserEventEmitter. Since it
  22359. // doesn't, we manually listen for the events and so we have to enqueue and
  22360. // process the abstract event manually.
  22361. //
  22362. // Batching is necessary here in order to ensure that all event handlers run
  22363. // before the next rerender (including event handlers attached to ancestor
  22364. // elements instead of directly on the input). Without this, controlled
  22365. // components don't work properly in conjunction with event bubbling because
  22366. // the component is rerendered and the value reverted before all the event
  22367. // handlers can run. See https://github.com/facebook/react/issues/708.
  22368. ReactUpdates.batchedUpdates(runEventInBatch, event);
  22369. }
  22370. function runEventInBatch(event) {
  22371. EventPluginHub.enqueueEvents(event);
  22372. EventPluginHub.processEventQueue(false);
  22373. }
  22374. function startWatchingForChangeEventIE8(target, targetInst) {
  22375. activeElement = target;
  22376. activeElementInst = targetInst;
  22377. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  22378. }
  22379. function stopWatchingForChangeEventIE8() {
  22380. if (!activeElement) {
  22381. return;
  22382. }
  22383. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  22384. activeElement = null;
  22385. activeElementInst = null;
  22386. }
  22387. function getTargetInstForChangeEvent(topLevelType, targetInst) {
  22388. if (topLevelType === 'topChange') {
  22389. return targetInst;
  22390. }
  22391. }
  22392. function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
  22393. if (topLevelType === 'topFocus') {
  22394. // stopWatching() should be a noop here but we call it just in case we
  22395. // missed a blur event somehow.
  22396. stopWatchingForChangeEventIE8();
  22397. startWatchingForChangeEventIE8(target, targetInst);
  22398. } else if (topLevelType === 'topBlur') {
  22399. stopWatchingForChangeEventIE8();
  22400. }
  22401. }
  22402. /**
  22403. * SECTION: handle `input` event
  22404. */
  22405. var isInputEventSupported = false;
  22406. if (ExecutionEnvironment.canUseDOM) {
  22407. // IE9 claims to support the input event but fails to trigger it when
  22408. // deleting text, so we ignore its input events.
  22409. // IE10+ fire input events to often, such when a placeholder
  22410. // changes or when an input with a placeholder is focused.
  22411. isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11);
  22412. }
  22413. /**
  22414. * (For IE <=11) Replacement getter/setter for the `value` property that gets
  22415. * set on the active element.
  22416. */
  22417. var newValueProp = {
  22418. get: function () {
  22419. return activeElementValueProp.get.call(this);
  22420. },
  22421. set: function (val) {
  22422. // Cast to a string so we can do equality checks.
  22423. activeElementValue = '' + val;
  22424. activeElementValueProp.set.call(this, val);
  22425. }
  22426. };
  22427. /**
  22428. * (For IE <=11) Starts tracking propertychange events on the passed-in element
  22429. * and override the value property so that we can distinguish user events from
  22430. * value changes in JS.
  22431. */
  22432. function startWatchingForValueChange(target, targetInst) {
  22433. activeElement = target;
  22434. activeElementInst = targetInst;
  22435. activeElementValue = target.value;
  22436. activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
  22437. // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
  22438. // on DOM elements
  22439. Object.defineProperty(activeElement, 'value', newValueProp);
  22440. if (activeElement.attachEvent) {
  22441. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  22442. } else {
  22443. activeElement.addEventListener('propertychange', handlePropertyChange, false);
  22444. }
  22445. }
  22446. /**
  22447. * (For IE <=11) Removes the event listeners from the currently-tracked element,
  22448. * if any exists.
  22449. */
  22450. function stopWatchingForValueChange() {
  22451. if (!activeElement) {
  22452. return;
  22453. }
  22454. // delete restores the original property definition
  22455. delete activeElement.value;
  22456. if (activeElement.detachEvent) {
  22457. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  22458. } else {
  22459. activeElement.removeEventListener('propertychange', handlePropertyChange, false);
  22460. }
  22461. activeElement = null;
  22462. activeElementInst = null;
  22463. activeElementValue = null;
  22464. activeElementValueProp = null;
  22465. }
  22466. /**
  22467. * (For IE <=11) Handles a propertychange event, sending a `change` event if
  22468. * the value of the active element has changed.
  22469. */
  22470. function handlePropertyChange(nativeEvent) {
  22471. if (nativeEvent.propertyName !== 'value') {
  22472. return;
  22473. }
  22474. var value = nativeEvent.srcElement.value;
  22475. if (value === activeElementValue) {
  22476. return;
  22477. }
  22478. activeElementValue = value;
  22479. manualDispatchChangeEvent(nativeEvent);
  22480. }
  22481. /**
  22482. * If a `change` event should be fired, returns the target's ID.
  22483. */
  22484. function getTargetInstForInputEvent(topLevelType, targetInst) {
  22485. if (topLevelType === 'topInput') {
  22486. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  22487. // what we want so fall through here and trigger an abstract event
  22488. return targetInst;
  22489. }
  22490. }
  22491. function handleEventsForInputEventIE(topLevelType, target, targetInst) {
  22492. if (topLevelType === 'topFocus') {
  22493. // In IE8, we can capture almost all .value changes by adding a
  22494. // propertychange handler and looking for events with propertyName
  22495. // equal to 'value'
  22496. // In IE9-11, propertychange fires for most input events but is buggy and
  22497. // doesn't fire when text is deleted, but conveniently, selectionchange
  22498. // appears to fire in all of the remaining cases so we catch those and
  22499. // forward the event if the value has changed
  22500. // In either case, we don't want to call the event handler if the value
  22501. // is changed from JS so we redefine a setter for `.value` that updates
  22502. // our activeElementValue variable, allowing us to ignore those changes
  22503. //
  22504. // stopWatching() should be a noop here but we call it just in case we
  22505. // missed a blur event somehow.
  22506. stopWatchingForValueChange();
  22507. startWatchingForValueChange(target, targetInst);
  22508. } else if (topLevelType === 'topBlur') {
  22509. stopWatchingForValueChange();
  22510. }
  22511. }
  22512. // For IE8 and IE9.
  22513. function getTargetInstForInputEventIE(topLevelType, targetInst) {
  22514. if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
  22515. // On the selectionchange event, the target is just document which isn't
  22516. // helpful for us so just check activeElement instead.
  22517. //
  22518. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  22519. // propertychange on the first input event after setting `value` from a
  22520. // script and fires only keydown, keypress, keyup. Catching keyup usually
  22521. // gets it and catching keydown lets us fire an event for the first
  22522. // keystroke if user does a key repeat (it'll be a little delayed: right
  22523. // before the second keystroke). Other input methods (e.g., paste) seem to
  22524. // fire selectionchange normally.
  22525. if (activeElement && activeElement.value !== activeElementValue) {
  22526. activeElementValue = activeElement.value;
  22527. return activeElementInst;
  22528. }
  22529. }
  22530. }
  22531. /**
  22532. * SECTION: handle `click` event
  22533. */
  22534. function shouldUseClickEvent(elem) {
  22535. // Use the `click` event to detect changes to checkbox and radio inputs.
  22536. // This approach works across all browsers, whereas `change` does not fire
  22537. // until `blur` in IE8.
  22538. return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
  22539. }
  22540. function getTargetInstForClickEvent(topLevelType, targetInst) {
  22541. if (topLevelType === 'topClick') {
  22542. return targetInst;
  22543. }
  22544. }
  22545. /**
  22546. * This plugin creates an `onChange` event that normalizes change events
  22547. * across form elements. This event fires at a time when it's possible to
  22548. * change the element's value without seeing a flicker.
  22549. *
  22550. * Supported elements are:
  22551. * - input (see `isTextInputElement`)
  22552. * - textarea
  22553. * - select
  22554. */
  22555. var ChangeEventPlugin = {
  22556. eventTypes: eventTypes,
  22557. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22558. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  22559. var getTargetInstFunc, handleEventFunc;
  22560. if (shouldUseChangeEvent(targetNode)) {
  22561. if (doesChangeEventBubble) {
  22562. getTargetInstFunc = getTargetInstForChangeEvent;
  22563. } else {
  22564. handleEventFunc = handleEventsForChangeEventIE8;
  22565. }
  22566. } else if (isTextInputElement(targetNode)) {
  22567. if (isInputEventSupported) {
  22568. getTargetInstFunc = getTargetInstForInputEvent;
  22569. } else {
  22570. getTargetInstFunc = getTargetInstForInputEventIE;
  22571. handleEventFunc = handleEventsForInputEventIE;
  22572. }
  22573. } else if (shouldUseClickEvent(targetNode)) {
  22574. getTargetInstFunc = getTargetInstForClickEvent;
  22575. }
  22576. if (getTargetInstFunc) {
  22577. var inst = getTargetInstFunc(topLevelType, targetInst);
  22578. if (inst) {
  22579. var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
  22580. event.type = 'change';
  22581. EventPropagators.accumulateTwoPhaseDispatches(event);
  22582. return event;
  22583. }
  22584. }
  22585. if (handleEventFunc) {
  22586. handleEventFunc(topLevelType, targetNode, targetInst);
  22587. }
  22588. }
  22589. };
  22590. module.exports = ChangeEventPlugin;
  22591. /***/ }),
  22592. /* 173 */
  22593. /***/ (function(module, exports, __webpack_require__) {
  22594. "use strict";
  22595. /**
  22596. * Copyright 2013-present, Facebook, Inc.
  22597. * All rights reserved.
  22598. *
  22599. * This source code is licensed under the BSD-style license found in the
  22600. * LICENSE file in the root directory of this source tree. An additional grant
  22601. * of patent rights can be found in the PATENTS file in the same directory.
  22602. *
  22603. */
  22604. var _prodInvariant = __webpack_require__(2);
  22605. var DOMLazyTree = __webpack_require__(18);
  22606. var ExecutionEnvironment = __webpack_require__(9);
  22607. var createNodesFromMarkup = __webpack_require__(160);
  22608. var emptyFunction = __webpack_require__(10);
  22609. var invariant = __webpack_require__(0);
  22610. var Danger = {
  22611. /**
  22612. * Replaces a node with a string of markup at its current position within its
  22613. * parent. The markup must render into a single root node.
  22614. *
  22615. * @param {DOMElement} oldChild Child node to replace.
  22616. * @param {string} markup Markup to render in place of the child node.
  22617. * @internal
  22618. */
  22619. dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
  22620. !ExecutionEnvironment.canUseDOM ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('56') : void 0;
  22621. !markup ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
  22622. !(oldChild.nodeName !== 'HTML') ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the <html> node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString().') : _prodInvariant('58') : void 0;
  22623. if (typeof markup === 'string') {
  22624. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  22625. oldChild.parentNode.replaceChild(newChild, oldChild);
  22626. } else {
  22627. DOMLazyTree.replaceChildWithTree(oldChild, markup);
  22628. }
  22629. }
  22630. };
  22631. module.exports = Danger;
  22632. /***/ }),
  22633. /* 174 */
  22634. /***/ (function(module, exports, __webpack_require__) {
  22635. "use strict";
  22636. /**
  22637. * Copyright 2013-present, Facebook, Inc.
  22638. * All rights reserved.
  22639. *
  22640. * This source code is licensed under the BSD-style license found in the
  22641. * LICENSE file in the root directory of this source tree. An additional grant
  22642. * of patent rights can be found in the PATENTS file in the same directory.
  22643. *
  22644. */
  22645. /**
  22646. * Module that is injectable into `EventPluginHub`, that specifies a
  22647. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  22648. * plugins, without having to package every one of them. This is better than
  22649. * having plugins be ordered in the same order that they are injected because
  22650. * that ordering would be influenced by the packaging order.
  22651. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  22652. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  22653. */
  22654. var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
  22655. module.exports = DefaultEventPluginOrder;
  22656. /***/ }),
  22657. /* 175 */
  22658. /***/ (function(module, exports, __webpack_require__) {
  22659. "use strict";
  22660. /**
  22661. * Copyright 2013-present, Facebook, Inc.
  22662. * All rights reserved.
  22663. *
  22664. * This source code is licensed under the BSD-style license found in the
  22665. * LICENSE file in the root directory of this source tree. An additional grant
  22666. * of patent rights can be found in the PATENTS file in the same directory.
  22667. *
  22668. */
  22669. var EventPropagators = __webpack_require__(26);
  22670. var ReactDOMComponentTree = __webpack_require__(5);
  22671. var SyntheticMouseEvent = __webpack_require__(33);
  22672. var eventTypes = {
  22673. mouseEnter: {
  22674. registrationName: 'onMouseEnter',
  22675. dependencies: ['topMouseOut', 'topMouseOver']
  22676. },
  22677. mouseLeave: {
  22678. registrationName: 'onMouseLeave',
  22679. dependencies: ['topMouseOut', 'topMouseOver']
  22680. }
  22681. };
  22682. var EnterLeaveEventPlugin = {
  22683. eventTypes: eventTypes,
  22684. /**
  22685. * For almost every interaction we care about, there will be both a top-level
  22686. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  22687. * we do not extract duplicate events. However, moving the mouse into the
  22688. * browser from outside will not fire a `mouseout` event. In this case, we use
  22689. * the `mouseover` top-level event.
  22690. */
  22691. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22692. if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  22693. return null;
  22694. }
  22695. if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
  22696. // Must not be a mouse in or mouse out - ignoring.
  22697. return null;
  22698. }
  22699. var win;
  22700. if (nativeEventTarget.window === nativeEventTarget) {
  22701. // `nativeEventTarget` is probably a window object.
  22702. win = nativeEventTarget;
  22703. } else {
  22704. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  22705. var doc = nativeEventTarget.ownerDocument;
  22706. if (doc) {
  22707. win = doc.defaultView || doc.parentWindow;
  22708. } else {
  22709. win = window;
  22710. }
  22711. }
  22712. var from;
  22713. var to;
  22714. if (topLevelType === 'topMouseOut') {
  22715. from = targetInst;
  22716. var related = nativeEvent.relatedTarget || nativeEvent.toElement;
  22717. to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
  22718. } else {
  22719. // Moving to a node from outside the window.
  22720. from = null;
  22721. to = targetInst;
  22722. }
  22723. if (from === to) {
  22724. // Nothing pertains to our managed components.
  22725. return null;
  22726. }
  22727. var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
  22728. var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
  22729. var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
  22730. leave.type = 'mouseleave';
  22731. leave.target = fromNode;
  22732. leave.relatedTarget = toNode;
  22733. var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
  22734. enter.type = 'mouseenter';
  22735. enter.target = toNode;
  22736. enter.relatedTarget = fromNode;
  22737. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
  22738. return [leave, enter];
  22739. }
  22740. };
  22741. module.exports = EnterLeaveEventPlugin;
  22742. /***/ }),
  22743. /* 176 */
  22744. /***/ (function(module, exports, __webpack_require__) {
  22745. "use strict";
  22746. /**
  22747. * Copyright 2013-present, Facebook, Inc.
  22748. * All rights reserved.
  22749. *
  22750. * This source code is licensed under the BSD-style license found in the
  22751. * LICENSE file in the root directory of this source tree. An additional grant
  22752. * of patent rights can be found in the PATENTS file in the same directory.
  22753. *
  22754. */
  22755. var _assign = __webpack_require__(3);
  22756. var PooledClass = __webpack_require__(15);
  22757. var getTextContentAccessor = __webpack_require__(92);
  22758. /**
  22759. * This helper class stores information about text content of a target node,
  22760. * allowing comparison of content before and after a given event.
  22761. *
  22762. * Identify the node where selection currently begins, then observe
  22763. * both its text content and its current position in the DOM. Since the
  22764. * browser may natively replace the target node during composition, we can
  22765. * use its position to find its replacement.
  22766. *
  22767. * @param {DOMEventTarget} root
  22768. */
  22769. function FallbackCompositionState(root) {
  22770. this._root = root;
  22771. this._startText = this.getText();
  22772. this._fallbackText = null;
  22773. }
  22774. _assign(FallbackCompositionState.prototype, {
  22775. destructor: function () {
  22776. this._root = null;
  22777. this._startText = null;
  22778. this._fallbackText = null;
  22779. },
  22780. /**
  22781. * Get current text of input.
  22782. *
  22783. * @return {string}
  22784. */
  22785. getText: function () {
  22786. if ('value' in this._root) {
  22787. return this._root.value;
  22788. }
  22789. return this._root[getTextContentAccessor()];
  22790. },
  22791. /**
  22792. * Determine the differing substring between the initially stored
  22793. * text content and the current content.
  22794. *
  22795. * @return {string}
  22796. */
  22797. getData: function () {
  22798. if (this._fallbackText) {
  22799. return this._fallbackText;
  22800. }
  22801. var start;
  22802. var startValue = this._startText;
  22803. var startLength = startValue.length;
  22804. var end;
  22805. var endValue = this.getText();
  22806. var endLength = endValue.length;
  22807. for (start = 0; start < startLength; start++) {
  22808. if (startValue[start] !== endValue[start]) {
  22809. break;
  22810. }
  22811. }
  22812. var minEnd = startLength - start;
  22813. for (end = 1; end <= minEnd; end++) {
  22814. if (startValue[startLength - end] !== endValue[endLength - end]) {
  22815. break;
  22816. }
  22817. }
  22818. var sliceTail = end > 1 ? 1 - end : undefined;
  22819. this._fallbackText = endValue.slice(start, sliceTail);
  22820. return this._fallbackText;
  22821. }
  22822. });
  22823. PooledClass.addPoolingTo(FallbackCompositionState);
  22824. module.exports = FallbackCompositionState;
  22825. /***/ }),
  22826. /* 177 */
  22827. /***/ (function(module, exports, __webpack_require__) {
  22828. "use strict";
  22829. /**
  22830. * Copyright 2013-present, Facebook, Inc.
  22831. * All rights reserved.
  22832. *
  22833. * This source code is licensed under the BSD-style license found in the
  22834. * LICENSE file in the root directory of this source tree. An additional grant
  22835. * of patent rights can be found in the PATENTS file in the same directory.
  22836. *
  22837. */
  22838. var DOMProperty = __webpack_require__(19);
  22839. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  22840. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  22841. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  22842. var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  22843. var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  22844. var HTMLDOMPropertyConfig = {
  22845. isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
  22846. Properties: {
  22847. /**
  22848. * Standard Properties
  22849. */
  22850. accept: 0,
  22851. acceptCharset: 0,
  22852. accessKey: 0,
  22853. action: 0,
  22854. allowFullScreen: HAS_BOOLEAN_VALUE,
  22855. allowTransparency: 0,
  22856. alt: 0,
  22857. // specifies target context for links with `preload` type
  22858. as: 0,
  22859. async: HAS_BOOLEAN_VALUE,
  22860. autoComplete: 0,
  22861. // autoFocus is polyfilled/normalized by AutoFocusUtils
  22862. // autoFocus: HAS_BOOLEAN_VALUE,
  22863. autoPlay: HAS_BOOLEAN_VALUE,
  22864. capture: HAS_BOOLEAN_VALUE,
  22865. cellPadding: 0,
  22866. cellSpacing: 0,
  22867. charSet: 0,
  22868. challenge: 0,
  22869. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22870. cite: 0,
  22871. classID: 0,
  22872. className: 0,
  22873. cols: HAS_POSITIVE_NUMERIC_VALUE,
  22874. colSpan: 0,
  22875. content: 0,
  22876. contentEditable: 0,
  22877. contextMenu: 0,
  22878. controls: HAS_BOOLEAN_VALUE,
  22879. coords: 0,
  22880. crossOrigin: 0,
  22881. data: 0, // For `<object />` acts as `src`.
  22882. dateTime: 0,
  22883. 'default': HAS_BOOLEAN_VALUE,
  22884. defer: HAS_BOOLEAN_VALUE,
  22885. dir: 0,
  22886. disabled: HAS_BOOLEAN_VALUE,
  22887. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  22888. draggable: 0,
  22889. encType: 0,
  22890. form: 0,
  22891. formAction: 0,
  22892. formEncType: 0,
  22893. formMethod: 0,
  22894. formNoValidate: HAS_BOOLEAN_VALUE,
  22895. formTarget: 0,
  22896. frameBorder: 0,
  22897. headers: 0,
  22898. height: 0,
  22899. hidden: HAS_BOOLEAN_VALUE,
  22900. high: 0,
  22901. href: 0,
  22902. hrefLang: 0,
  22903. htmlFor: 0,
  22904. httpEquiv: 0,
  22905. icon: 0,
  22906. id: 0,
  22907. inputMode: 0,
  22908. integrity: 0,
  22909. is: 0,
  22910. keyParams: 0,
  22911. keyType: 0,
  22912. kind: 0,
  22913. label: 0,
  22914. lang: 0,
  22915. list: 0,
  22916. loop: HAS_BOOLEAN_VALUE,
  22917. low: 0,
  22918. manifest: 0,
  22919. marginHeight: 0,
  22920. marginWidth: 0,
  22921. max: 0,
  22922. maxLength: 0,
  22923. media: 0,
  22924. mediaGroup: 0,
  22925. method: 0,
  22926. min: 0,
  22927. minLength: 0,
  22928. // Caution; `option.selected` is not updated if `select.multiple` is
  22929. // disabled with `removeAttribute`.
  22930. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22931. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22932. name: 0,
  22933. nonce: 0,
  22934. noValidate: HAS_BOOLEAN_VALUE,
  22935. open: HAS_BOOLEAN_VALUE,
  22936. optimum: 0,
  22937. pattern: 0,
  22938. placeholder: 0,
  22939. playsInline: HAS_BOOLEAN_VALUE,
  22940. poster: 0,
  22941. preload: 0,
  22942. profile: 0,
  22943. radioGroup: 0,
  22944. readOnly: HAS_BOOLEAN_VALUE,
  22945. referrerPolicy: 0,
  22946. rel: 0,
  22947. required: HAS_BOOLEAN_VALUE,
  22948. reversed: HAS_BOOLEAN_VALUE,
  22949. role: 0,
  22950. rows: HAS_POSITIVE_NUMERIC_VALUE,
  22951. rowSpan: HAS_NUMERIC_VALUE,
  22952. sandbox: 0,
  22953. scope: 0,
  22954. scoped: HAS_BOOLEAN_VALUE,
  22955. scrolling: 0,
  22956. seamless: HAS_BOOLEAN_VALUE,
  22957. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22958. shape: 0,
  22959. size: HAS_POSITIVE_NUMERIC_VALUE,
  22960. sizes: 0,
  22961. span: HAS_POSITIVE_NUMERIC_VALUE,
  22962. spellCheck: 0,
  22963. src: 0,
  22964. srcDoc: 0,
  22965. srcLang: 0,
  22966. srcSet: 0,
  22967. start: HAS_NUMERIC_VALUE,
  22968. step: 0,
  22969. style: 0,
  22970. summary: 0,
  22971. tabIndex: 0,
  22972. target: 0,
  22973. title: 0,
  22974. // Setting .type throws on non-<input> tags
  22975. type: 0,
  22976. useMap: 0,
  22977. value: 0,
  22978. width: 0,
  22979. wmode: 0,
  22980. wrap: 0,
  22981. /**
  22982. * RDFa Properties
  22983. */
  22984. about: 0,
  22985. datatype: 0,
  22986. inlist: 0,
  22987. prefix: 0,
  22988. // property is also supported for OpenGraph in meta tags.
  22989. property: 0,
  22990. resource: 0,
  22991. 'typeof': 0,
  22992. vocab: 0,
  22993. /**
  22994. * Non-standard Properties
  22995. */
  22996. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  22997. // keyboard hints.
  22998. autoCapitalize: 0,
  22999. autoCorrect: 0,
  23000. // autoSave allows WebKit/Blink to persist values of input fields on page reloads
  23001. autoSave: 0,
  23002. // color is for Safari mask-icon link
  23003. color: 0,
  23004. // itemProp, itemScope, itemType are for
  23005. // Microdata support. See http://schema.org/docs/gs.html
  23006. itemProp: 0,
  23007. itemScope: HAS_BOOLEAN_VALUE,
  23008. itemType: 0,
  23009. // itemID and itemRef are for Microdata support as well but
  23010. // only specified in the WHATWG spec document. See
  23011. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  23012. itemID: 0,
  23013. itemRef: 0,
  23014. // results show looking glass icon and recent searches on input
  23015. // search fields in WebKit/Blink
  23016. results: 0,
  23017. // IE-only attribute that specifies security restrictions on an iframe
  23018. // as an alternative to the sandbox attribute on IE<10
  23019. security: 0,
  23020. // IE-only attribute that controls focus behavior
  23021. unselectable: 0
  23022. },
  23023. DOMAttributeNames: {
  23024. acceptCharset: 'accept-charset',
  23025. className: 'class',
  23026. htmlFor: 'for',
  23027. httpEquiv: 'http-equiv'
  23028. },
  23029. DOMPropertyNames: {}
  23030. };
  23031. module.exports = HTMLDOMPropertyConfig;
  23032. /***/ }),
  23033. /* 178 */
  23034. /***/ (function(module, exports, __webpack_require__) {
  23035. "use strict";
  23036. /* WEBPACK VAR INJECTION */(function(process) {/**
  23037. * Copyright 2014-present, Facebook, Inc.
  23038. * All rights reserved.
  23039. *
  23040. * This source code is licensed under the BSD-style license found in the
  23041. * LICENSE file in the root directory of this source tree. An additional grant
  23042. * of patent rights can be found in the PATENTS file in the same directory.
  23043. *
  23044. */
  23045. var ReactReconciler = __webpack_require__(20);
  23046. var instantiateReactComponent = __webpack_require__(93);
  23047. var KeyEscapeUtils = __webpack_require__(53);
  23048. var shouldUpdateReactComponent = __webpack_require__(63);
  23049. var traverseAllChildren = __webpack_require__(96);
  23050. var warning = __webpack_require__(1);
  23051. var ReactComponentTreeHook;
  23052. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  23053. // Temporary hack.
  23054. // Inline requires don't work well with Jest:
  23055. // https://github.com/facebook/react/issues/7240
  23056. // Remove the inline requires when we don't need them anymore:
  23057. // https://github.com/facebook/react/pull/7178
  23058. ReactComponentTreeHook = __webpack_require__(97);
  23059. }
  23060. function instantiateChild(childInstances, child, name, selfDebugID) {
  23061. // We found a component instance.
  23062. var keyUnique = childInstances[name] === undefined;
  23063. if (false) {
  23064. if (!ReactComponentTreeHook) {
  23065. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  23066. }
  23067. if (!keyUnique) {
  23068. process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
  23069. }
  23070. }
  23071. if (child != null && keyUnique) {
  23072. childInstances[name] = instantiateReactComponent(child, true);
  23073. }
  23074. }
  23075. /**
  23076. * ReactChildReconciler provides helpers for initializing or updating a set of
  23077. * children. Its output is suitable for passing it onto ReactMultiChild which
  23078. * does diffed reordering and insertion.
  23079. */
  23080. var ReactChildReconciler = {
  23081. /**
  23082. * Generates a "mount image" for each of the supplied children. In the case
  23083. * of `ReactDOMComponent`, a mount image is a string of markup.
  23084. *
  23085. * @param {?object} nestedChildNodes Nested child maps.
  23086. * @return {?object} A set of child instances.
  23087. * @internal
  23088. */
  23089. instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots
  23090. ) {
  23091. if (nestedChildNodes == null) {
  23092. return null;
  23093. }
  23094. var childInstances = {};
  23095. if (false) {
  23096. traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
  23097. return instantiateChild(childInsts, child, name, selfDebugID);
  23098. }, childInstances);
  23099. } else {
  23100. traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
  23101. }
  23102. return childInstances;
  23103. },
  23104. /**
  23105. * Updates the rendered children and returns a new set of children.
  23106. *
  23107. * @param {?object} prevChildren Previously initialized set of children.
  23108. * @param {?object} nextChildren Flat child element maps.
  23109. * @param {ReactReconcileTransaction} transaction
  23110. * @param {object} context
  23111. * @return {?object} A new set of child instances.
  23112. * @internal
  23113. */
  23114. updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots
  23115. ) {
  23116. // We currently don't have a way to track moves here but if we use iterators
  23117. // instead of for..in we can zip the iterators and check if an item has
  23118. // moved.
  23119. // TODO: If nothing has changed, return the prevChildren object so that we
  23120. // can quickly bailout if nothing has changed.
  23121. if (!nextChildren && !prevChildren) {
  23122. return;
  23123. }
  23124. var name;
  23125. var prevChild;
  23126. for (name in nextChildren) {
  23127. if (!nextChildren.hasOwnProperty(name)) {
  23128. continue;
  23129. }
  23130. prevChild = prevChildren && prevChildren[name];
  23131. var prevElement = prevChild && prevChild._currentElement;
  23132. var nextElement = nextChildren[name];
  23133. if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
  23134. ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
  23135. nextChildren[name] = prevChild;
  23136. } else {
  23137. if (prevChild) {
  23138. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  23139. ReactReconciler.unmountComponent(prevChild, false);
  23140. }
  23141. // The child must be instantiated before it's mounted.
  23142. var nextChildInstance = instantiateReactComponent(nextElement, true);
  23143. nextChildren[name] = nextChildInstance;
  23144. // Creating mount image now ensures refs are resolved in right order
  23145. // (see https://github.com/facebook/react/pull/7101 for explanation).
  23146. var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID);
  23147. mountImages.push(nextChildMountImage);
  23148. }
  23149. }
  23150. // Unmount children that are no longer present.
  23151. for (name in prevChildren) {
  23152. if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
  23153. prevChild = prevChildren[name];
  23154. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  23155. ReactReconciler.unmountComponent(prevChild, false);
  23156. }
  23157. }
  23158. },
  23159. /**
  23160. * Unmounts all rendered children. This should be used to clean up children
  23161. * when this component is unmounted.
  23162. *
  23163. * @param {?object} renderedChildren Previously initialized set of children.
  23164. * @internal
  23165. */
  23166. unmountChildren: function (renderedChildren, safely) {
  23167. for (var name in renderedChildren) {
  23168. if (renderedChildren.hasOwnProperty(name)) {
  23169. var renderedChild = renderedChildren[name];
  23170. ReactReconciler.unmountComponent(renderedChild, safely);
  23171. }
  23172. }
  23173. }
  23174. };
  23175. module.exports = ReactChildReconciler;
  23176. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(68)))
  23177. /***/ }),
  23178. /* 179 */
  23179. /***/ (function(module, exports, __webpack_require__) {
  23180. "use strict";
  23181. /**
  23182. * Copyright 2013-present, Facebook, Inc.
  23183. * All rights reserved.
  23184. *
  23185. * This source code is licensed under the BSD-style license found in the
  23186. * LICENSE file in the root directory of this source tree. An additional grant
  23187. * of patent rights can be found in the PATENTS file in the same directory.
  23188. *
  23189. */
  23190. var DOMChildrenOperations = __webpack_require__(49);
  23191. var ReactDOMIDOperations = __webpack_require__(186);
  23192. /**
  23193. * Abstracts away all functionality of the reconciler that requires knowledge of
  23194. * the browser context. TODO: These callers should be refactored to avoid the
  23195. * need for this injection.
  23196. */
  23197. var ReactComponentBrowserEnvironment = {
  23198. processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  23199. replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup
  23200. };
  23201. module.exports = ReactComponentBrowserEnvironment;
  23202. /***/ }),
  23203. /* 180 */
  23204. /***/ (function(module, exports, __webpack_require__) {
  23205. "use strict";
  23206. /**
  23207. * Copyright 2013-present, Facebook, Inc.
  23208. * All rights reserved.
  23209. *
  23210. * This source code is licensed under the BSD-style license found in the
  23211. * LICENSE file in the root directory of this source tree. An additional grant
  23212. * of patent rights can be found in the PATENTS file in the same directory.
  23213. *
  23214. */
  23215. var _prodInvariant = __webpack_require__(2),
  23216. _assign = __webpack_require__(3);
  23217. var React = __webpack_require__(21);
  23218. var ReactComponentEnvironment = __webpack_require__(55);
  23219. var ReactCurrentOwner = __webpack_require__(14);
  23220. var ReactErrorUtils = __webpack_require__(56);
  23221. var ReactInstanceMap = __webpack_require__(27);
  23222. var ReactInstrumentation = __webpack_require__(11);
  23223. var ReactNodeTypes = __webpack_require__(87);
  23224. var ReactReconciler = __webpack_require__(20);
  23225. if (false) {
  23226. var checkReactTypeSpec = require('./checkReactTypeSpec');
  23227. }
  23228. var emptyObject = __webpack_require__(24);
  23229. var invariant = __webpack_require__(0);
  23230. var shallowEqual = __webpack_require__(48);
  23231. var shouldUpdateReactComponent = __webpack_require__(63);
  23232. var warning = __webpack_require__(1);
  23233. var CompositeTypes = {
  23234. ImpureClass: 0,
  23235. PureClass: 1,
  23236. StatelessFunctional: 2
  23237. };
  23238. function StatelessComponent(Component) {}
  23239. StatelessComponent.prototype.render = function () {
  23240. var Component = ReactInstanceMap.get(this)._currentElement.type;
  23241. var element = Component(this.props, this.context, this.updater);
  23242. warnIfInvalidElement(Component, element);
  23243. return element;
  23244. };
  23245. function warnIfInvalidElement(Component, element) {
  23246. if (false) {
  23247. process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || React.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
  23248. process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
  23249. }
  23250. }
  23251. function shouldConstruct(Component) {
  23252. return !!(Component.prototype && Component.prototype.isReactComponent);
  23253. }
  23254. function isPureComponent(Component) {
  23255. return !!(Component.prototype && Component.prototype.isPureReactComponent);
  23256. }
  23257. // Separated into a function to contain deoptimizations caused by try/finally.
  23258. function measureLifeCyclePerf(fn, debugID, timerType) {
  23259. if (debugID === 0) {
  23260. // Top-level wrappers (see ReactMount) and empty components (see
  23261. // ReactDOMEmptyComponent) are invisible to hooks and devtools.
  23262. // Both are implementation details that should go away in the future.
  23263. return fn();
  23264. }
  23265. ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
  23266. try {
  23267. return fn();
  23268. } finally {
  23269. ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
  23270. }
  23271. }
  23272. /**
  23273. * ------------------ The Life-Cycle of a Composite Component ------------------
  23274. *
  23275. * - constructor: Initialization of state. The instance is now retained.
  23276. * - componentWillMount
  23277. * - render
  23278. * - [children's constructors]
  23279. * - [children's componentWillMount and render]
  23280. * - [children's componentDidMount]
  23281. * - componentDidMount
  23282. *
  23283. * Update Phases:
  23284. * - componentWillReceiveProps (only called if parent updated)
  23285. * - shouldComponentUpdate
  23286. * - componentWillUpdate
  23287. * - render
  23288. * - [children's constructors or receive props phases]
  23289. * - componentDidUpdate
  23290. *
  23291. * - componentWillUnmount
  23292. * - [children's componentWillUnmount]
  23293. * - [children destroyed]
  23294. * - (destroyed): The instance is now blank, released by React and ready for GC.
  23295. *
  23296. * -----------------------------------------------------------------------------
  23297. */
  23298. /**
  23299. * An incrementing ID assigned to each component when it is mounted. This is
  23300. * used to enforce the order in which `ReactUpdates` updates dirty components.
  23301. *
  23302. * @private
  23303. */
  23304. var nextMountID = 1;
  23305. /**
  23306. * @lends {ReactCompositeComponent.prototype}
  23307. */
  23308. var ReactCompositeComponent = {
  23309. /**
  23310. * Base constructor for all composite component.
  23311. *
  23312. * @param {ReactElement} element
  23313. * @final
  23314. * @internal
  23315. */
  23316. construct: function (element) {
  23317. this._currentElement = element;
  23318. this._rootNodeID = 0;
  23319. this._compositeType = null;
  23320. this._instance = null;
  23321. this._hostParent = null;
  23322. this._hostContainerInfo = null;
  23323. // See ReactUpdateQueue
  23324. this._updateBatchNumber = null;
  23325. this._pendingElement = null;
  23326. this._pendingStateQueue = null;
  23327. this._pendingReplaceState = false;
  23328. this._pendingForceUpdate = false;
  23329. this._renderedNodeType = null;
  23330. this._renderedComponent = null;
  23331. this._context = null;
  23332. this._mountOrder = 0;
  23333. this._topLevelWrapper = null;
  23334. // See ReactUpdates and ReactUpdateQueue.
  23335. this._pendingCallbacks = null;
  23336. // ComponentWillUnmount shall only be called once
  23337. this._calledComponentWillUnmount = false;
  23338. if (false) {
  23339. this._warnedAboutRefsInRender = false;
  23340. }
  23341. },
  23342. /**
  23343. * Initializes the component, renders markup, and registers event listeners.
  23344. *
  23345. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  23346. * @param {?object} hostParent
  23347. * @param {?object} hostContainerInfo
  23348. * @param {?object} context
  23349. * @return {?string} Rendered markup to be inserted into the DOM.
  23350. * @final
  23351. * @internal
  23352. */
  23353. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  23354. var _this = this;
  23355. this._context = context;
  23356. this._mountOrder = nextMountID++;
  23357. this._hostParent = hostParent;
  23358. this._hostContainerInfo = hostContainerInfo;
  23359. var publicProps = this._currentElement.props;
  23360. var publicContext = this._processContext(context);
  23361. var Component = this._currentElement.type;
  23362. var updateQueue = transaction.getUpdateQueue();
  23363. // Initialize the public class
  23364. var doConstruct = shouldConstruct(Component);
  23365. var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
  23366. var renderedElement;
  23367. // Support functional components
  23368. if (!doConstruct && (inst == null || inst.render == null)) {
  23369. renderedElement = inst;
  23370. warnIfInvalidElement(Component, renderedElement);
  23371. !(inst === null || inst === false || React.isValidElement(inst)) ? false ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0;
  23372. inst = new StatelessComponent(Component);
  23373. this._compositeType = CompositeTypes.StatelessFunctional;
  23374. } else {
  23375. if (isPureComponent(Component)) {
  23376. this._compositeType = CompositeTypes.PureClass;
  23377. } else {
  23378. this._compositeType = CompositeTypes.ImpureClass;
  23379. }
  23380. }
  23381. if (false) {
  23382. // This will throw later in _renderValidatedComponent, but add an early
  23383. // warning now to help debugging
  23384. if (inst.render == null) {
  23385. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0;
  23386. }
  23387. var propsMutated = inst.props !== publicProps;
  23388. var componentName = Component.displayName || Component.name || 'Component';
  23389. process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) : void 0;
  23390. }
  23391. // These should be set up in the constructor, but as a convenience for
  23392. // simpler class abstractions, we set them up after the fact.
  23393. inst.props = publicProps;
  23394. inst.context = publicContext;
  23395. inst.refs = emptyObject;
  23396. inst.updater = updateQueue;
  23397. this._instance = inst;
  23398. // Store a reference from the instance back to the internal representation
  23399. ReactInstanceMap.set(inst, this);
  23400. if (false) {
  23401. // Since plain JS classes are defined without any special initialization
  23402. // logic, we can not catch common errors early. Therefore, we have to
  23403. // catch them here, at initialization time, instead.
  23404. process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
  23405. process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0;
  23406. process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
  23407. process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
  23408. process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0;
  23409. process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0;
  23410. process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
  23411. }
  23412. var initialState = inst.state;
  23413. if (initialState === undefined) {
  23414. inst.state = initialState = null;
  23415. }
  23416. !(typeof initialState === 'object' && !Array.isArray(initialState)) ? false ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0;
  23417. this._pendingStateQueue = null;
  23418. this._pendingReplaceState = false;
  23419. this._pendingForceUpdate = false;
  23420. var markup;
  23421. if (inst.unstable_handleError) {
  23422. markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23423. } else {
  23424. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23425. }
  23426. if (inst.componentDidMount) {
  23427. if (false) {
  23428. transaction.getReactMountReady().enqueue(function () {
  23429. measureLifeCyclePerf(function () {
  23430. return inst.componentDidMount();
  23431. }, _this._debugID, 'componentDidMount');
  23432. });
  23433. } else {
  23434. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  23435. }
  23436. }
  23437. return markup;
  23438. },
  23439. _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
  23440. if (false) {
  23441. ReactCurrentOwner.current = this;
  23442. try {
  23443. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  23444. } finally {
  23445. ReactCurrentOwner.current = null;
  23446. }
  23447. } else {
  23448. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  23449. }
  23450. },
  23451. _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
  23452. var Component = this._currentElement.type;
  23453. if (doConstruct) {
  23454. if (false) {
  23455. return measureLifeCyclePerf(function () {
  23456. return new Component(publicProps, publicContext, updateQueue);
  23457. }, this._debugID, 'ctor');
  23458. } else {
  23459. return new Component(publicProps, publicContext, updateQueue);
  23460. }
  23461. }
  23462. // This can still be an instance in case of factory components
  23463. // but we'll count this as time spent rendering as the more common case.
  23464. if (false) {
  23465. return measureLifeCyclePerf(function () {
  23466. return Component(publicProps, publicContext, updateQueue);
  23467. }, this._debugID, 'render');
  23468. } else {
  23469. return Component(publicProps, publicContext, updateQueue);
  23470. }
  23471. },
  23472. performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  23473. var markup;
  23474. var checkpoint = transaction.checkpoint();
  23475. try {
  23476. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23477. } catch (e) {
  23478. // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
  23479. transaction.rollback(checkpoint);
  23480. this._instance.unstable_handleError(e);
  23481. if (this._pendingStateQueue) {
  23482. this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
  23483. }
  23484. checkpoint = transaction.checkpoint();
  23485. this._renderedComponent.unmountComponent(true);
  23486. transaction.rollback(checkpoint);
  23487. // Try again - we've informed the component about the error, so they can render an error message this time.
  23488. // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
  23489. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23490. }
  23491. return markup;
  23492. },
  23493. performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  23494. var inst = this._instance;
  23495. var debugID = 0;
  23496. if (false) {
  23497. debugID = this._debugID;
  23498. }
  23499. if (inst.componentWillMount) {
  23500. if (false) {
  23501. measureLifeCyclePerf(function () {
  23502. return inst.componentWillMount();
  23503. }, debugID, 'componentWillMount');
  23504. } else {
  23505. inst.componentWillMount();
  23506. }
  23507. // When mounting, calls to `setState` by `componentWillMount` will set
  23508. // `this._pendingStateQueue` without triggering a re-render.
  23509. if (this._pendingStateQueue) {
  23510. inst.state = this._processPendingState(inst.props, inst.context);
  23511. }
  23512. }
  23513. // If not a stateless component, we now render
  23514. if (renderedElement === undefined) {
  23515. renderedElement = this._renderValidatedComponent();
  23516. }
  23517. var nodeType = ReactNodeTypes.getType(renderedElement);
  23518. this._renderedNodeType = nodeType;
  23519. var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  23520. );
  23521. this._renderedComponent = child;
  23522. var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
  23523. if (false) {
  23524. if (debugID !== 0) {
  23525. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  23526. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  23527. }
  23528. }
  23529. return markup;
  23530. },
  23531. getHostNode: function () {
  23532. return ReactReconciler.getHostNode(this._renderedComponent);
  23533. },
  23534. /**
  23535. * Releases any resources allocated by `mountComponent`.
  23536. *
  23537. * @final
  23538. * @internal
  23539. */
  23540. unmountComponent: function (safely) {
  23541. if (!this._renderedComponent) {
  23542. return;
  23543. }
  23544. var inst = this._instance;
  23545. if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
  23546. inst._calledComponentWillUnmount = true;
  23547. if (safely) {
  23548. var name = this.getName() + '.componentWillUnmount()';
  23549. ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
  23550. } else {
  23551. if (false) {
  23552. measureLifeCyclePerf(function () {
  23553. return inst.componentWillUnmount();
  23554. }, this._debugID, 'componentWillUnmount');
  23555. } else {
  23556. inst.componentWillUnmount();
  23557. }
  23558. }
  23559. }
  23560. if (this._renderedComponent) {
  23561. ReactReconciler.unmountComponent(this._renderedComponent, safely);
  23562. this._renderedNodeType = null;
  23563. this._renderedComponent = null;
  23564. this._instance = null;
  23565. }
  23566. // Reset pending fields
  23567. // Even if this component is scheduled for another update in ReactUpdates,
  23568. // it would still be ignored because these fields are reset.
  23569. this._pendingStateQueue = null;
  23570. this._pendingReplaceState = false;
  23571. this._pendingForceUpdate = false;
  23572. this._pendingCallbacks = null;
  23573. this._pendingElement = null;
  23574. // These fields do not really need to be reset since this object is no
  23575. // longer accessible.
  23576. this._context = null;
  23577. this._rootNodeID = 0;
  23578. this._topLevelWrapper = null;
  23579. // Delete the reference from the instance to this internal representation
  23580. // which allow the internals to be properly cleaned up even if the user
  23581. // leaks a reference to the public instance.
  23582. ReactInstanceMap.remove(inst);
  23583. // Some existing components rely on inst.props even after they've been
  23584. // destroyed (in event handlers).
  23585. // TODO: inst.props = null;
  23586. // TODO: inst.state = null;
  23587. // TODO: inst.context = null;
  23588. },
  23589. /**
  23590. * Filters the context object to only contain keys specified in
  23591. * `contextTypes`
  23592. *
  23593. * @param {object} context
  23594. * @return {?object}
  23595. * @private
  23596. */
  23597. _maskContext: function (context) {
  23598. var Component = this._currentElement.type;
  23599. var contextTypes = Component.contextTypes;
  23600. if (!contextTypes) {
  23601. return emptyObject;
  23602. }
  23603. var maskedContext = {};
  23604. for (var contextName in contextTypes) {
  23605. maskedContext[contextName] = context[contextName];
  23606. }
  23607. return maskedContext;
  23608. },
  23609. /**
  23610. * Filters the context object to only contain keys specified in
  23611. * `contextTypes`, and asserts that they are valid.
  23612. *
  23613. * @param {object} context
  23614. * @return {?object}
  23615. * @private
  23616. */
  23617. _processContext: function (context) {
  23618. var maskedContext = this._maskContext(context);
  23619. if (false) {
  23620. var Component = this._currentElement.type;
  23621. if (Component.contextTypes) {
  23622. this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
  23623. }
  23624. }
  23625. return maskedContext;
  23626. },
  23627. /**
  23628. * @param {object} currentContext
  23629. * @return {object}
  23630. * @private
  23631. */
  23632. _processChildContext: function (currentContext) {
  23633. var Component = this._currentElement.type;
  23634. var inst = this._instance;
  23635. var childContext;
  23636. if (inst.getChildContext) {
  23637. if (false) {
  23638. ReactInstrumentation.debugTool.onBeginProcessingChildContext();
  23639. try {
  23640. childContext = inst.getChildContext();
  23641. } finally {
  23642. ReactInstrumentation.debugTool.onEndProcessingChildContext();
  23643. }
  23644. } else {
  23645. childContext = inst.getChildContext();
  23646. }
  23647. }
  23648. if (childContext) {
  23649. !(typeof Component.childContextTypes === 'object') ? false ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0;
  23650. if (false) {
  23651. this._checkContextTypes(Component.childContextTypes, childContext, 'childContext');
  23652. }
  23653. for (var name in childContext) {
  23654. !(name in Component.childContextTypes) ? false ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0;
  23655. }
  23656. return _assign({}, currentContext, childContext);
  23657. }
  23658. return currentContext;
  23659. },
  23660. /**
  23661. * Assert that the context types are valid
  23662. *
  23663. * @param {object} typeSpecs Map of context field to a ReactPropType
  23664. * @param {object} values Runtime values that need to be type-checked
  23665. * @param {string} location e.g. "prop", "context", "child context"
  23666. * @private
  23667. */
  23668. _checkContextTypes: function (typeSpecs, values, location) {
  23669. if (false) {
  23670. checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
  23671. }
  23672. },
  23673. receiveComponent: function (nextElement, transaction, nextContext) {
  23674. var prevElement = this._currentElement;
  23675. var prevContext = this._context;
  23676. this._pendingElement = null;
  23677. this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
  23678. },
  23679. /**
  23680. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  23681. * is set, update the component.
  23682. *
  23683. * @param {ReactReconcileTransaction} transaction
  23684. * @internal
  23685. */
  23686. performUpdateIfNecessary: function (transaction) {
  23687. if (this._pendingElement != null) {
  23688. ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
  23689. } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  23690. this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
  23691. } else {
  23692. this._updateBatchNumber = null;
  23693. }
  23694. },
  23695. /**
  23696. * Perform an update to a mounted component. The componentWillReceiveProps and
  23697. * shouldComponentUpdate methods are called, then (assuming the update isn't
  23698. * skipped) the remaining update lifecycle methods are called and the DOM
  23699. * representation is updated.
  23700. *
  23701. * By default, this implements React's rendering and reconciliation algorithm.
  23702. * Sophisticated clients may wish to override this.
  23703. *
  23704. * @param {ReactReconcileTransaction} transaction
  23705. * @param {ReactElement} prevParentElement
  23706. * @param {ReactElement} nextParentElement
  23707. * @internal
  23708. * @overridable
  23709. */
  23710. updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
  23711. var inst = this._instance;
  23712. !(inst != null) ? false ? invariant(false, 'Attempted to update component `%s` that has already been unmounted (or failed to mount).', this.getName() || 'ReactCompositeComponent') : _prodInvariant('136', this.getName() || 'ReactCompositeComponent') : void 0;
  23713. var willReceive = false;
  23714. var nextContext;
  23715. // Determine if the context has changed or not
  23716. if (this._context === nextUnmaskedContext) {
  23717. nextContext = inst.context;
  23718. } else {
  23719. nextContext = this._processContext(nextUnmaskedContext);
  23720. willReceive = true;
  23721. }
  23722. var prevProps = prevParentElement.props;
  23723. var nextProps = nextParentElement.props;
  23724. // Not a simple state update but a props update
  23725. if (prevParentElement !== nextParentElement) {
  23726. willReceive = true;
  23727. }
  23728. // An update here will schedule an update but immediately set
  23729. // _pendingStateQueue which will ensure that any state updates gets
  23730. // immediately reconciled instead of waiting for the next batch.
  23731. if (willReceive && inst.componentWillReceiveProps) {
  23732. if (false) {
  23733. measureLifeCyclePerf(function () {
  23734. return inst.componentWillReceiveProps(nextProps, nextContext);
  23735. }, this._debugID, 'componentWillReceiveProps');
  23736. } else {
  23737. inst.componentWillReceiveProps(nextProps, nextContext);
  23738. }
  23739. }
  23740. var nextState = this._processPendingState(nextProps, nextContext);
  23741. var shouldUpdate = true;
  23742. if (!this._pendingForceUpdate) {
  23743. if (inst.shouldComponentUpdate) {
  23744. if (false) {
  23745. shouldUpdate = measureLifeCyclePerf(function () {
  23746. return inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  23747. }, this._debugID, 'shouldComponentUpdate');
  23748. } else {
  23749. shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  23750. }
  23751. } else {
  23752. if (this._compositeType === CompositeTypes.PureClass) {
  23753. shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState);
  23754. }
  23755. }
  23756. }
  23757. if (false) {
  23758. process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
  23759. }
  23760. this._updateBatchNumber = null;
  23761. if (shouldUpdate) {
  23762. this._pendingForceUpdate = false;
  23763. // Will set `this.props`, `this.state` and `this.context`.
  23764. this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
  23765. } else {
  23766. // If it's determined that a component should not update, we still want
  23767. // to set props and state but we shortcut the rest of the update.
  23768. this._currentElement = nextParentElement;
  23769. this._context = nextUnmaskedContext;
  23770. inst.props = nextProps;
  23771. inst.state = nextState;
  23772. inst.context = nextContext;
  23773. }
  23774. },
  23775. _processPendingState: function (props, context) {
  23776. var inst = this._instance;
  23777. var queue = this._pendingStateQueue;
  23778. var replace = this._pendingReplaceState;
  23779. this._pendingReplaceState = false;
  23780. this._pendingStateQueue = null;
  23781. if (!queue) {
  23782. return inst.state;
  23783. }
  23784. if (replace && queue.length === 1) {
  23785. return queue[0];
  23786. }
  23787. var nextState = _assign({}, replace ? queue[0] : inst.state);
  23788. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  23789. var partial = queue[i];
  23790. _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
  23791. }
  23792. return nextState;
  23793. },
  23794. /**
  23795. * Merges new props and state, notifies delegate methods of update and
  23796. * performs update.
  23797. *
  23798. * @param {ReactElement} nextElement Next element
  23799. * @param {object} nextProps Next public object to set as properties.
  23800. * @param {?object} nextState Next object to set as state.
  23801. * @param {?object} nextContext Next public object to set as context.
  23802. * @param {ReactReconcileTransaction} transaction
  23803. * @param {?object} unmaskedContext
  23804. * @private
  23805. */
  23806. _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
  23807. var _this2 = this;
  23808. var inst = this._instance;
  23809. var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
  23810. var prevProps;
  23811. var prevState;
  23812. var prevContext;
  23813. if (hasComponentDidUpdate) {
  23814. prevProps = inst.props;
  23815. prevState = inst.state;
  23816. prevContext = inst.context;
  23817. }
  23818. if (inst.componentWillUpdate) {
  23819. if (false) {
  23820. measureLifeCyclePerf(function () {
  23821. return inst.componentWillUpdate(nextProps, nextState, nextContext);
  23822. }, this._debugID, 'componentWillUpdate');
  23823. } else {
  23824. inst.componentWillUpdate(nextProps, nextState, nextContext);
  23825. }
  23826. }
  23827. this._currentElement = nextElement;
  23828. this._context = unmaskedContext;
  23829. inst.props = nextProps;
  23830. inst.state = nextState;
  23831. inst.context = nextContext;
  23832. this._updateRenderedComponent(transaction, unmaskedContext);
  23833. if (hasComponentDidUpdate) {
  23834. if (false) {
  23835. transaction.getReactMountReady().enqueue(function () {
  23836. measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate');
  23837. });
  23838. } else {
  23839. transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
  23840. }
  23841. }
  23842. },
  23843. /**
  23844. * Call the component's `render` method and update the DOM accordingly.
  23845. *
  23846. * @param {ReactReconcileTransaction} transaction
  23847. * @internal
  23848. */
  23849. _updateRenderedComponent: function (transaction, context) {
  23850. var prevComponentInstance = this._renderedComponent;
  23851. var prevRenderedElement = prevComponentInstance._currentElement;
  23852. var nextRenderedElement = this._renderValidatedComponent();
  23853. var debugID = 0;
  23854. if (false) {
  23855. debugID = this._debugID;
  23856. }
  23857. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  23858. ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
  23859. } else {
  23860. var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance);
  23861. ReactReconciler.unmountComponent(prevComponentInstance, false);
  23862. var nodeType = ReactNodeTypes.getType(nextRenderedElement);
  23863. this._renderedNodeType = nodeType;
  23864. var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  23865. );
  23866. this._renderedComponent = child;
  23867. var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID);
  23868. if (false) {
  23869. if (debugID !== 0) {
  23870. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  23871. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  23872. }
  23873. }
  23874. this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance);
  23875. }
  23876. },
  23877. /**
  23878. * Overridden in shallow rendering.
  23879. *
  23880. * @protected
  23881. */
  23882. _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) {
  23883. ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance);
  23884. },
  23885. /**
  23886. * @protected
  23887. */
  23888. _renderValidatedComponentWithoutOwnerOrContext: function () {
  23889. var inst = this._instance;
  23890. var renderedElement;
  23891. if (false) {
  23892. renderedElement = measureLifeCyclePerf(function () {
  23893. return inst.render();
  23894. }, this._debugID, 'render');
  23895. } else {
  23896. renderedElement = inst.render();
  23897. }
  23898. if (false) {
  23899. // We allow auto-mocks to proceed as if they're returning null.
  23900. if (renderedElement === undefined && inst.render._isMockFunction) {
  23901. // This is probably bad practice. Consider warning here and
  23902. // deprecating this convenience.
  23903. renderedElement = null;
  23904. }
  23905. }
  23906. return renderedElement;
  23907. },
  23908. /**
  23909. * @private
  23910. */
  23911. _renderValidatedComponent: function () {
  23912. var renderedElement;
  23913. if ("production" !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) {
  23914. ReactCurrentOwner.current = this;
  23915. try {
  23916. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  23917. } finally {
  23918. ReactCurrentOwner.current = null;
  23919. }
  23920. } else {
  23921. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  23922. }
  23923. !(
  23924. // TODO: An `isValidNode` function would probably be more appropriate
  23925. renderedElement === null || renderedElement === false || React.isValidElement(renderedElement)) ? false ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : _prodInvariant('109', this.getName() || 'ReactCompositeComponent') : void 0;
  23926. return renderedElement;
  23927. },
  23928. /**
  23929. * Lazily allocates the refs object and stores `component` as `ref`.
  23930. *
  23931. * @param {string} ref Reference name.
  23932. * @param {component} component Component to store as `ref`.
  23933. * @final
  23934. * @private
  23935. */
  23936. attachRef: function (ref, component) {
  23937. var inst = this.getPublicInstance();
  23938. !(inst != null) ? false ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
  23939. var publicComponentInstance = component.getPublicInstance();
  23940. if (false) {
  23941. var componentName = component && component.getName ? component.getName() : 'a component';
  23942. process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null || component._compositeType !== CompositeTypes.StatelessFunctional, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0;
  23943. }
  23944. var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
  23945. refs[ref] = publicComponentInstance;
  23946. },
  23947. /**
  23948. * Detaches a reference name.
  23949. *
  23950. * @param {string} ref Name to dereference.
  23951. * @final
  23952. * @private
  23953. */
  23954. detachRef: function (ref) {
  23955. var refs = this.getPublicInstance().refs;
  23956. delete refs[ref];
  23957. },
  23958. /**
  23959. * Get a text description of the component that can be used to identify it
  23960. * in error messages.
  23961. * @return {string} The name or null.
  23962. * @internal
  23963. */
  23964. getName: function () {
  23965. var type = this._currentElement.type;
  23966. var constructor = this._instance && this._instance.constructor;
  23967. return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
  23968. },
  23969. /**
  23970. * Get the publicly accessible representation of this component - i.e. what
  23971. * is exposed by refs and returned by render. Can be null for stateless
  23972. * components.
  23973. *
  23974. * @return {ReactComponent} the public component instance.
  23975. * @internal
  23976. */
  23977. getPublicInstance: function () {
  23978. var inst = this._instance;
  23979. if (this._compositeType === CompositeTypes.StatelessFunctional) {
  23980. return null;
  23981. }
  23982. return inst;
  23983. },
  23984. // Stub
  23985. _instantiateReactComponent: null
  23986. };
  23987. module.exports = ReactCompositeComponent;
  23988. /***/ }),
  23989. /* 181 */
  23990. /***/ (function(module, exports, __webpack_require__) {
  23991. "use strict";
  23992. /**
  23993. * Copyright 2013-present, Facebook, Inc.
  23994. * All rights reserved.
  23995. *
  23996. * This source code is licensed under the BSD-style license found in the
  23997. * LICENSE file in the root directory of this source tree. An additional grant
  23998. * of patent rights can be found in the PATENTS file in the same directory.
  23999. *
  24000. */
  24001. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  24002. var ReactDOMComponentTree = __webpack_require__(5);
  24003. var ReactDefaultInjection = __webpack_require__(194);
  24004. var ReactMount = __webpack_require__(86);
  24005. var ReactReconciler = __webpack_require__(20);
  24006. var ReactUpdates = __webpack_require__(12);
  24007. var ReactVersion = __webpack_require__(207);
  24008. var findDOMNode = __webpack_require__(223);
  24009. var getHostComponentFromComposite = __webpack_require__(91);
  24010. var renderSubtreeIntoContainer = __webpack_require__(231);
  24011. var warning = __webpack_require__(1);
  24012. ReactDefaultInjection.inject();
  24013. var ReactDOM = {
  24014. findDOMNode: findDOMNode,
  24015. render: ReactMount.render,
  24016. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  24017. version: ReactVersion,
  24018. /* eslint-disable camelcase */
  24019. unstable_batchedUpdates: ReactUpdates.batchedUpdates,
  24020. unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
  24021. };
  24022. // Inject the runtime into a devtools global hook regardless of browser.
  24023. // Allows for debugging when the hook is injected on the page.
  24024. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  24025. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  24026. ComponentTree: {
  24027. getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
  24028. getNodeFromInstance: function (inst) {
  24029. // inst is an internal instance (but could be a composite)
  24030. if (inst._renderedComponent) {
  24031. inst = getHostComponentFromComposite(inst);
  24032. }
  24033. if (inst) {
  24034. return ReactDOMComponentTree.getNodeFromInstance(inst);
  24035. } else {
  24036. return null;
  24037. }
  24038. }
  24039. },
  24040. Mount: ReactMount,
  24041. Reconciler: ReactReconciler
  24042. });
  24043. }
  24044. if (false) {
  24045. var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
  24046. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  24047. // First check if devtools is not installed
  24048. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  24049. // If we're in Chrome or Firefox, provide a download link if not installed.
  24050. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
  24051. // Firefox does not have the issue with devtools loaded over file://
  24052. var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
  24053. console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools');
  24054. }
  24055. }
  24056. var testFunc = function testFn() {};
  24057. process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
  24058. // If we're in IE8, check to see if we are in compatibility mode and provide
  24059. // information on preventing compatibility mode
  24060. var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
  24061. process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0;
  24062. var expectedFeatures = [
  24063. // shims
  24064. Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim];
  24065. for (var i = 0; i < expectedFeatures.length; i++) {
  24066. if (!expectedFeatures[i]) {
  24067. process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
  24068. break;
  24069. }
  24070. }
  24071. }
  24072. }
  24073. if (false) {
  24074. var ReactInstrumentation = require('./ReactInstrumentation');
  24075. var ReactDOMUnknownPropertyHook = require('./ReactDOMUnknownPropertyHook');
  24076. var ReactDOMNullInputValuePropHook = require('./ReactDOMNullInputValuePropHook');
  24077. var ReactDOMInvalidARIAHook = require('./ReactDOMInvalidARIAHook');
  24078. ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook);
  24079. ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook);
  24080. ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook);
  24081. }
  24082. module.exports = ReactDOM;
  24083. /***/ }),
  24084. /* 182 */
  24085. /***/ (function(module, exports, __webpack_require__) {
  24086. "use strict";
  24087. /**
  24088. * Copyright 2013-present, Facebook, Inc.
  24089. * All rights reserved.
  24090. *
  24091. * This source code is licensed under the BSD-style license found in the
  24092. * LICENSE file in the root directory of this source tree. An additional grant
  24093. * of patent rights can be found in the PATENTS file in the same directory.
  24094. *
  24095. */
  24096. /* global hasOwnProperty:true */
  24097. var _prodInvariant = __webpack_require__(2),
  24098. _assign = __webpack_require__(3);
  24099. var AutoFocusUtils = __webpack_require__(169);
  24100. var CSSPropertyOperations = __webpack_require__(171);
  24101. var DOMLazyTree = __webpack_require__(18);
  24102. var DOMNamespaces = __webpack_require__(50);
  24103. var DOMProperty = __webpack_require__(19);
  24104. var DOMPropertyOperations = __webpack_require__(79);
  24105. var EventPluginHub = __webpack_require__(25);
  24106. var EventPluginRegistry = __webpack_require__(51);
  24107. var ReactBrowserEventEmitter = __webpack_require__(32);
  24108. var ReactDOMComponentFlags = __webpack_require__(80);
  24109. var ReactDOMComponentTree = __webpack_require__(5);
  24110. var ReactDOMInput = __webpack_require__(187);
  24111. var ReactDOMOption = __webpack_require__(188);
  24112. var ReactDOMSelect = __webpack_require__(81);
  24113. var ReactDOMTextarea = __webpack_require__(191);
  24114. var ReactInstrumentation = __webpack_require__(11);
  24115. var ReactMultiChild = __webpack_require__(200);
  24116. var ReactServerRenderingTransaction = __webpack_require__(205);
  24117. var emptyFunction = __webpack_require__(10);
  24118. var escapeTextContentForBrowser = __webpack_require__(35);
  24119. var invariant = __webpack_require__(0);
  24120. var isEventSupported = __webpack_require__(62);
  24121. var shallowEqual = __webpack_require__(48);
  24122. var validateDOMNesting = __webpack_require__(64);
  24123. var warning = __webpack_require__(1);
  24124. var Flags = ReactDOMComponentFlags;
  24125. var deleteListener = EventPluginHub.deleteListener;
  24126. var getNode = ReactDOMComponentTree.getNodeFromInstance;
  24127. var listenTo = ReactBrowserEventEmitter.listenTo;
  24128. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  24129. // For quickly matching children type, to test if can be treated as content.
  24130. var CONTENT_TYPES = { 'string': true, 'number': true };
  24131. var STYLE = 'style';
  24132. var HTML = '__html';
  24133. var RESERVED_PROPS = {
  24134. children: null,
  24135. dangerouslySetInnerHTML: null,
  24136. suppressContentEditableWarning: null
  24137. };
  24138. // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
  24139. var DOC_FRAGMENT_TYPE = 11;
  24140. function getDeclarationErrorAddendum(internalInstance) {
  24141. if (internalInstance) {
  24142. var owner = internalInstance._currentElement._owner || null;
  24143. if (owner) {
  24144. var name = owner.getName();
  24145. if (name) {
  24146. return ' This DOM node was rendered by `' + name + '`.';
  24147. }
  24148. }
  24149. }
  24150. return '';
  24151. }
  24152. function friendlyStringify(obj) {
  24153. if (typeof obj === 'object') {
  24154. if (Array.isArray(obj)) {
  24155. return '[' + obj.map(friendlyStringify).join(', ') + ']';
  24156. } else {
  24157. var pairs = [];
  24158. for (var key in obj) {
  24159. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  24160. var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
  24161. pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
  24162. }
  24163. }
  24164. return '{' + pairs.join(', ') + '}';
  24165. }
  24166. } else if (typeof obj === 'string') {
  24167. return JSON.stringify(obj);
  24168. } else if (typeof obj === 'function') {
  24169. return '[function object]';
  24170. }
  24171. // Differs from JSON.stringify in that undefined because undefined and that
  24172. // inf and nan don't become null
  24173. return String(obj);
  24174. }
  24175. var styleMutationWarning = {};
  24176. function checkAndWarnForMutatedStyle(style1, style2, component) {
  24177. if (style1 == null || style2 == null) {
  24178. return;
  24179. }
  24180. if (shallowEqual(style1, style2)) {
  24181. return;
  24182. }
  24183. var componentName = component._tag;
  24184. var owner = component._currentElement._owner;
  24185. var ownerName;
  24186. if (owner) {
  24187. ownerName = owner.getName();
  24188. }
  24189. var hash = ownerName + '|' + componentName;
  24190. if (styleMutationWarning.hasOwnProperty(hash)) {
  24191. return;
  24192. }
  24193. styleMutationWarning[hash] = true;
  24194. false ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0;
  24195. }
  24196. /**
  24197. * @param {object} component
  24198. * @param {?object} props
  24199. */
  24200. function assertValidProps(component, props) {
  24201. if (!props) {
  24202. return;
  24203. }
  24204. // Note the use of `==` which checks for null or undefined.
  24205. if (voidElementTags[component._tag]) {
  24206. !(props.children == null && props.dangerouslySetInnerHTML == null) ? false ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('137', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0;
  24207. }
  24208. if (props.dangerouslySetInnerHTML != null) {
  24209. !(props.children == null) ? false ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0;
  24210. !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? false ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : _prodInvariant('61') : void 0;
  24211. }
  24212. if (false) {
  24213. process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0;
  24214. process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
  24215. process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0;
  24216. }
  24217. !(props.style == null || typeof props.style === 'object') ? false ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getDeclarationErrorAddendum(component)) : _prodInvariant('62', getDeclarationErrorAddendum(component)) : void 0;
  24218. }
  24219. function enqueuePutListener(inst, registrationName, listener, transaction) {
  24220. if (transaction instanceof ReactServerRenderingTransaction) {
  24221. return;
  24222. }
  24223. if (false) {
  24224. // IE8 has no API for event capturing and the `onScroll` event doesn't
  24225. // bubble.
  24226. process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
  24227. }
  24228. var containerInfo = inst._hostContainerInfo;
  24229. var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
  24230. var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
  24231. listenTo(registrationName, doc);
  24232. transaction.getReactMountReady().enqueue(putListener, {
  24233. inst: inst,
  24234. registrationName: registrationName,
  24235. listener: listener
  24236. });
  24237. }
  24238. function putListener() {
  24239. var listenerToPut = this;
  24240. EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
  24241. }
  24242. function inputPostMount() {
  24243. var inst = this;
  24244. ReactDOMInput.postMountWrapper(inst);
  24245. }
  24246. function textareaPostMount() {
  24247. var inst = this;
  24248. ReactDOMTextarea.postMountWrapper(inst);
  24249. }
  24250. function optionPostMount() {
  24251. var inst = this;
  24252. ReactDOMOption.postMountWrapper(inst);
  24253. }
  24254. var setAndValidateContentChildDev = emptyFunction;
  24255. if (false) {
  24256. setAndValidateContentChildDev = function (content) {
  24257. var hasExistingContent = this._contentDebugID != null;
  24258. var debugID = this._debugID;
  24259. // This ID represents the inlined child that has no backing instance:
  24260. var contentDebugID = -debugID;
  24261. if (content == null) {
  24262. if (hasExistingContent) {
  24263. ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
  24264. }
  24265. this._contentDebugID = null;
  24266. return;
  24267. }
  24268. validateDOMNesting(null, String(content), this, this._ancestorInfo);
  24269. this._contentDebugID = contentDebugID;
  24270. if (hasExistingContent) {
  24271. ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
  24272. ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID);
  24273. } else {
  24274. ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID);
  24275. ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
  24276. ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
  24277. }
  24278. };
  24279. }
  24280. // There are so many media events, it makes sense to just
  24281. // maintain a list rather than create a `trapBubbledEvent` for each
  24282. var mediaEvents = {
  24283. topAbort: 'abort',
  24284. topCanPlay: 'canplay',
  24285. topCanPlayThrough: 'canplaythrough',
  24286. topDurationChange: 'durationchange',
  24287. topEmptied: 'emptied',
  24288. topEncrypted: 'encrypted',
  24289. topEnded: 'ended',
  24290. topError: 'error',
  24291. topLoadedData: 'loadeddata',
  24292. topLoadedMetadata: 'loadedmetadata',
  24293. topLoadStart: 'loadstart',
  24294. topPause: 'pause',
  24295. topPlay: 'play',
  24296. topPlaying: 'playing',
  24297. topProgress: 'progress',
  24298. topRateChange: 'ratechange',
  24299. topSeeked: 'seeked',
  24300. topSeeking: 'seeking',
  24301. topStalled: 'stalled',
  24302. topSuspend: 'suspend',
  24303. topTimeUpdate: 'timeupdate',
  24304. topVolumeChange: 'volumechange',
  24305. topWaiting: 'waiting'
  24306. };
  24307. function trapBubbledEventsLocal() {
  24308. var inst = this;
  24309. // If a component renders to null or if another component fatals and causes
  24310. // the state of the tree to be corrupted, `node` here can be null.
  24311. !inst._rootNodeID ? false ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0;
  24312. var node = getNode(inst);
  24313. !node ? false ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0;
  24314. switch (inst._tag) {
  24315. case 'iframe':
  24316. case 'object':
  24317. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  24318. break;
  24319. case 'video':
  24320. case 'audio':
  24321. inst._wrapperState.listeners = [];
  24322. // Create listener for each media event
  24323. for (var event in mediaEvents) {
  24324. if (mediaEvents.hasOwnProperty(event)) {
  24325. inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node));
  24326. }
  24327. }
  24328. break;
  24329. case 'source':
  24330. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)];
  24331. break;
  24332. case 'img':
  24333. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  24334. break;
  24335. case 'form':
  24336. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)];
  24337. break;
  24338. case 'input':
  24339. case 'select':
  24340. case 'textarea':
  24341. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)];
  24342. break;
  24343. }
  24344. }
  24345. function postUpdateSelectWrapper() {
  24346. ReactDOMSelect.postUpdateWrapper(this);
  24347. }
  24348. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  24349. // those special-case tags.
  24350. var omittedCloseTags = {
  24351. 'area': true,
  24352. 'base': true,
  24353. 'br': true,
  24354. 'col': true,
  24355. 'embed': true,
  24356. 'hr': true,
  24357. 'img': true,
  24358. 'input': true,
  24359. 'keygen': true,
  24360. 'link': true,
  24361. 'meta': true,
  24362. 'param': true,
  24363. 'source': true,
  24364. 'track': true,
  24365. 'wbr': true
  24366. };
  24367. var newlineEatingTags = {
  24368. 'listing': true,
  24369. 'pre': true,
  24370. 'textarea': true
  24371. };
  24372. // For HTML, certain tags cannot have children. This has the same purpose as
  24373. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  24374. var voidElementTags = _assign({
  24375. 'menuitem': true
  24376. }, omittedCloseTags);
  24377. // We accept any tag to be rendered but since this gets injected into arbitrary
  24378. // HTML, we want to make sure that it's a safe tag.
  24379. // http://www.w3.org/TR/REC-xml/#NT-Name
  24380. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  24381. var validatedTagCache = {};
  24382. var hasOwnProperty = {}.hasOwnProperty;
  24383. function validateDangerousTag(tag) {
  24384. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  24385. !VALID_TAG_REGEX.test(tag) ? false ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0;
  24386. validatedTagCache[tag] = true;
  24387. }
  24388. }
  24389. function isCustomComponent(tagName, props) {
  24390. return tagName.indexOf('-') >= 0 || props.is != null;
  24391. }
  24392. var globalIdCounter = 1;
  24393. /**
  24394. * Creates a new React class that is idempotent and capable of containing other
  24395. * React components. It accepts event listeners and DOM properties that are
  24396. * valid according to `DOMProperty`.
  24397. *
  24398. * - Event listeners: `onClick`, `onMouseDown`, etc.
  24399. * - DOM properties: `className`, `name`, `title`, etc.
  24400. *
  24401. * The `style` property functions differently from the DOM API. It accepts an
  24402. * object mapping of style properties to values.
  24403. *
  24404. * @constructor ReactDOMComponent
  24405. * @extends ReactMultiChild
  24406. */
  24407. function ReactDOMComponent(element) {
  24408. var tag = element.type;
  24409. validateDangerousTag(tag);
  24410. this._currentElement = element;
  24411. this._tag = tag.toLowerCase();
  24412. this._namespaceURI = null;
  24413. this._renderedChildren = null;
  24414. this._previousStyle = null;
  24415. this._previousStyleCopy = null;
  24416. this._hostNode = null;
  24417. this._hostParent = null;
  24418. this._rootNodeID = 0;
  24419. this._domID = 0;
  24420. this._hostContainerInfo = null;
  24421. this._wrapperState = null;
  24422. this._topLevelWrapper = null;
  24423. this._flags = 0;
  24424. if (false) {
  24425. this._ancestorInfo = null;
  24426. setAndValidateContentChildDev.call(this, null);
  24427. }
  24428. }
  24429. ReactDOMComponent.displayName = 'ReactDOMComponent';
  24430. ReactDOMComponent.Mixin = {
  24431. /**
  24432. * Generates root tag markup then recurses. This method has side effects and
  24433. * is not idempotent.
  24434. *
  24435. * @internal
  24436. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24437. * @param {?ReactDOMComponent} the parent component instance
  24438. * @param {?object} info about the host container
  24439. * @param {object} context
  24440. * @return {string} The computed markup.
  24441. */
  24442. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  24443. this._rootNodeID = globalIdCounter++;
  24444. this._domID = hostContainerInfo._idCounter++;
  24445. this._hostParent = hostParent;
  24446. this._hostContainerInfo = hostContainerInfo;
  24447. var props = this._currentElement.props;
  24448. switch (this._tag) {
  24449. case 'audio':
  24450. case 'form':
  24451. case 'iframe':
  24452. case 'img':
  24453. case 'link':
  24454. case 'object':
  24455. case 'source':
  24456. case 'video':
  24457. this._wrapperState = {
  24458. listeners: null
  24459. };
  24460. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24461. break;
  24462. case 'input':
  24463. ReactDOMInput.mountWrapper(this, props, hostParent);
  24464. props = ReactDOMInput.getHostProps(this, props);
  24465. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24466. break;
  24467. case 'option':
  24468. ReactDOMOption.mountWrapper(this, props, hostParent);
  24469. props = ReactDOMOption.getHostProps(this, props);
  24470. break;
  24471. case 'select':
  24472. ReactDOMSelect.mountWrapper(this, props, hostParent);
  24473. props = ReactDOMSelect.getHostProps(this, props);
  24474. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24475. break;
  24476. case 'textarea':
  24477. ReactDOMTextarea.mountWrapper(this, props, hostParent);
  24478. props = ReactDOMTextarea.getHostProps(this, props);
  24479. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24480. break;
  24481. }
  24482. assertValidProps(this, props);
  24483. // We create tags in the namespace of their parent container, except HTML
  24484. // tags get no namespace.
  24485. var namespaceURI;
  24486. var parentTag;
  24487. if (hostParent != null) {
  24488. namespaceURI = hostParent._namespaceURI;
  24489. parentTag = hostParent._tag;
  24490. } else if (hostContainerInfo._tag) {
  24491. namespaceURI = hostContainerInfo._namespaceURI;
  24492. parentTag = hostContainerInfo._tag;
  24493. }
  24494. if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
  24495. namespaceURI = DOMNamespaces.html;
  24496. }
  24497. if (namespaceURI === DOMNamespaces.html) {
  24498. if (this._tag === 'svg') {
  24499. namespaceURI = DOMNamespaces.svg;
  24500. } else if (this._tag === 'math') {
  24501. namespaceURI = DOMNamespaces.mathml;
  24502. }
  24503. }
  24504. this._namespaceURI = namespaceURI;
  24505. if (false) {
  24506. var parentInfo;
  24507. if (hostParent != null) {
  24508. parentInfo = hostParent._ancestorInfo;
  24509. } else if (hostContainerInfo._tag) {
  24510. parentInfo = hostContainerInfo._ancestorInfo;
  24511. }
  24512. if (parentInfo) {
  24513. // parentInfo should always be present except for the top-level
  24514. // component when server rendering
  24515. validateDOMNesting(this._tag, null, this, parentInfo);
  24516. }
  24517. this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
  24518. }
  24519. var mountImage;
  24520. if (transaction.useCreateElement) {
  24521. var ownerDocument = hostContainerInfo._ownerDocument;
  24522. var el;
  24523. if (namespaceURI === DOMNamespaces.html) {
  24524. if (this._tag === 'script') {
  24525. // Create the script via .innerHTML so its "parser-inserted" flag is
  24526. // set to true and it does not execute
  24527. var div = ownerDocument.createElement('div');
  24528. var type = this._currentElement.type;
  24529. div.innerHTML = '<' + type + '></' + type + '>';
  24530. el = div.removeChild(div.firstChild);
  24531. } else if (props.is) {
  24532. el = ownerDocument.createElement(this._currentElement.type, props.is);
  24533. } else {
  24534. // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
  24535. // See discussion in https://github.com/facebook/react/pull/6896
  24536. // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  24537. el = ownerDocument.createElement(this._currentElement.type);
  24538. }
  24539. } else {
  24540. el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
  24541. }
  24542. ReactDOMComponentTree.precacheNode(this, el);
  24543. this._flags |= Flags.hasCachedChildNodes;
  24544. if (!this._hostParent) {
  24545. DOMPropertyOperations.setAttributeForRoot(el);
  24546. }
  24547. this._updateDOMProperties(null, props, transaction);
  24548. var lazyTree = DOMLazyTree(el);
  24549. this._createInitialChildren(transaction, props, context, lazyTree);
  24550. mountImage = lazyTree;
  24551. } else {
  24552. var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
  24553. var tagContent = this._createContentMarkup(transaction, props, context);
  24554. if (!tagContent && omittedCloseTags[this._tag]) {
  24555. mountImage = tagOpen + '/>';
  24556. } else {
  24557. mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
  24558. }
  24559. }
  24560. switch (this._tag) {
  24561. case 'input':
  24562. transaction.getReactMountReady().enqueue(inputPostMount, this);
  24563. if (props.autoFocus) {
  24564. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24565. }
  24566. break;
  24567. case 'textarea':
  24568. transaction.getReactMountReady().enqueue(textareaPostMount, this);
  24569. if (props.autoFocus) {
  24570. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24571. }
  24572. break;
  24573. case 'select':
  24574. if (props.autoFocus) {
  24575. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24576. }
  24577. break;
  24578. case 'button':
  24579. if (props.autoFocus) {
  24580. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24581. }
  24582. break;
  24583. case 'option':
  24584. transaction.getReactMountReady().enqueue(optionPostMount, this);
  24585. break;
  24586. }
  24587. return mountImage;
  24588. },
  24589. /**
  24590. * Creates markup for the open tag and all attributes.
  24591. *
  24592. * This method has side effects because events get registered.
  24593. *
  24594. * Iterating over object properties is faster than iterating over arrays.
  24595. * @see http://jsperf.com/obj-vs-arr-iteration
  24596. *
  24597. * @private
  24598. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24599. * @param {object} props
  24600. * @return {string} Markup of opening tag.
  24601. */
  24602. _createOpenTagMarkupAndPutListeners: function (transaction, props) {
  24603. var ret = '<' + this._currentElement.type;
  24604. for (var propKey in props) {
  24605. if (!props.hasOwnProperty(propKey)) {
  24606. continue;
  24607. }
  24608. var propValue = props[propKey];
  24609. if (propValue == null) {
  24610. continue;
  24611. }
  24612. if (registrationNameModules.hasOwnProperty(propKey)) {
  24613. if (propValue) {
  24614. enqueuePutListener(this, propKey, propValue, transaction);
  24615. }
  24616. } else {
  24617. if (propKey === STYLE) {
  24618. if (propValue) {
  24619. if (false) {
  24620. // See `_updateDOMProperties`. style block
  24621. this._previousStyle = propValue;
  24622. }
  24623. propValue = this._previousStyleCopy = _assign({}, props.style);
  24624. }
  24625. propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
  24626. }
  24627. var markup = null;
  24628. if (this._tag != null && isCustomComponent(this._tag, props)) {
  24629. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24630. markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
  24631. }
  24632. } else {
  24633. markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  24634. }
  24635. if (markup) {
  24636. ret += ' ' + markup;
  24637. }
  24638. }
  24639. }
  24640. // For static pages, no need to put React ID and checksum. Saves lots of
  24641. // bytes.
  24642. if (transaction.renderToStaticMarkup) {
  24643. return ret;
  24644. }
  24645. if (!this._hostParent) {
  24646. ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
  24647. }
  24648. ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
  24649. return ret;
  24650. },
  24651. /**
  24652. * Creates markup for the content between the tags.
  24653. *
  24654. * @private
  24655. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24656. * @param {object} props
  24657. * @param {object} context
  24658. * @return {string} Content markup.
  24659. */
  24660. _createContentMarkup: function (transaction, props, context) {
  24661. var ret = '';
  24662. // Intentional use of != to avoid catching zero/false.
  24663. var innerHTML = props.dangerouslySetInnerHTML;
  24664. if (innerHTML != null) {
  24665. if (innerHTML.__html != null) {
  24666. ret = innerHTML.__html;
  24667. }
  24668. } else {
  24669. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  24670. var childrenToUse = contentToUse != null ? null : props.children;
  24671. if (contentToUse != null) {
  24672. // TODO: Validate that text is allowed as a child of this node
  24673. ret = escapeTextContentForBrowser(contentToUse);
  24674. if (false) {
  24675. setAndValidateContentChildDev.call(this, contentToUse);
  24676. }
  24677. } else if (childrenToUse != null) {
  24678. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  24679. ret = mountImages.join('');
  24680. }
  24681. }
  24682. if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
  24683. // text/html ignores the first character in these tags if it's a newline
  24684. // Prefer to break application/xml over text/html (for now) by adding
  24685. // a newline specifically to get eaten by the parser. (Alternately for
  24686. // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
  24687. // \r is normalized out by HTMLTextAreaElement#value.)
  24688. // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
  24689. // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
  24690. // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
  24691. // See: Parsing of "textarea" "listing" and "pre" elements
  24692. // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
  24693. return '\n' + ret;
  24694. } else {
  24695. return ret;
  24696. }
  24697. },
  24698. _createInitialChildren: function (transaction, props, context, lazyTree) {
  24699. // Intentional use of != to avoid catching zero/false.
  24700. var innerHTML = props.dangerouslySetInnerHTML;
  24701. if (innerHTML != null) {
  24702. if (innerHTML.__html != null) {
  24703. DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
  24704. }
  24705. } else {
  24706. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  24707. var childrenToUse = contentToUse != null ? null : props.children;
  24708. // TODO: Validate that text is allowed as a child of this node
  24709. if (contentToUse != null) {
  24710. // Avoid setting textContent when the text is empty. In IE11 setting
  24711. // textContent on a text area will cause the placeholder to not
  24712. // show within the textarea until it has been focused and blurred again.
  24713. // https://github.com/facebook/react/issues/6731#issuecomment-254874553
  24714. if (contentToUse !== '') {
  24715. if (false) {
  24716. setAndValidateContentChildDev.call(this, contentToUse);
  24717. }
  24718. DOMLazyTree.queueText(lazyTree, contentToUse);
  24719. }
  24720. } else if (childrenToUse != null) {
  24721. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  24722. for (var i = 0; i < mountImages.length; i++) {
  24723. DOMLazyTree.queueChild(lazyTree, mountImages[i]);
  24724. }
  24725. }
  24726. }
  24727. },
  24728. /**
  24729. * Receives a next element and updates the component.
  24730. *
  24731. * @internal
  24732. * @param {ReactElement} nextElement
  24733. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24734. * @param {object} context
  24735. */
  24736. receiveComponent: function (nextElement, transaction, context) {
  24737. var prevElement = this._currentElement;
  24738. this._currentElement = nextElement;
  24739. this.updateComponent(transaction, prevElement, nextElement, context);
  24740. },
  24741. /**
  24742. * Updates a DOM component after it has already been allocated and
  24743. * attached to the DOM. Reconciles the root DOM node, then recurses.
  24744. *
  24745. * @param {ReactReconcileTransaction} transaction
  24746. * @param {ReactElement} prevElement
  24747. * @param {ReactElement} nextElement
  24748. * @internal
  24749. * @overridable
  24750. */
  24751. updateComponent: function (transaction, prevElement, nextElement, context) {
  24752. var lastProps = prevElement.props;
  24753. var nextProps = this._currentElement.props;
  24754. switch (this._tag) {
  24755. case 'input':
  24756. lastProps = ReactDOMInput.getHostProps(this, lastProps);
  24757. nextProps = ReactDOMInput.getHostProps(this, nextProps);
  24758. break;
  24759. case 'option':
  24760. lastProps = ReactDOMOption.getHostProps(this, lastProps);
  24761. nextProps = ReactDOMOption.getHostProps(this, nextProps);
  24762. break;
  24763. case 'select':
  24764. lastProps = ReactDOMSelect.getHostProps(this, lastProps);
  24765. nextProps = ReactDOMSelect.getHostProps(this, nextProps);
  24766. break;
  24767. case 'textarea':
  24768. lastProps = ReactDOMTextarea.getHostProps(this, lastProps);
  24769. nextProps = ReactDOMTextarea.getHostProps(this, nextProps);
  24770. break;
  24771. }
  24772. assertValidProps(this, nextProps);
  24773. this._updateDOMProperties(lastProps, nextProps, transaction);
  24774. this._updateDOMChildren(lastProps, nextProps, transaction, context);
  24775. switch (this._tag) {
  24776. case 'input':
  24777. // Update the wrapper around inputs *after* updating props. This has to
  24778. // happen after `_updateDOMProperties`. Otherwise HTML5 input validations
  24779. // raise warnings and prevent the new value from being assigned.
  24780. ReactDOMInput.updateWrapper(this);
  24781. break;
  24782. case 'textarea':
  24783. ReactDOMTextarea.updateWrapper(this);
  24784. break;
  24785. case 'select':
  24786. // <select> value update needs to occur after <option> children
  24787. // reconciliation
  24788. transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
  24789. break;
  24790. }
  24791. },
  24792. /**
  24793. * Reconciles the properties by detecting differences in property values and
  24794. * updating the DOM as necessary. This function is probably the single most
  24795. * critical path for performance optimization.
  24796. *
  24797. * TODO: Benchmark whether checking for changed values in memory actually
  24798. * improves performance (especially statically positioned elements).
  24799. * TODO: Benchmark the effects of putting this at the top since 99% of props
  24800. * do not change for a given reconciliation.
  24801. * TODO: Benchmark areas that can be improved with caching.
  24802. *
  24803. * @private
  24804. * @param {object} lastProps
  24805. * @param {object} nextProps
  24806. * @param {?DOMElement} node
  24807. */
  24808. _updateDOMProperties: function (lastProps, nextProps, transaction) {
  24809. var propKey;
  24810. var styleName;
  24811. var styleUpdates;
  24812. for (propKey in lastProps) {
  24813. if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
  24814. continue;
  24815. }
  24816. if (propKey === STYLE) {
  24817. var lastStyle = this._previousStyleCopy;
  24818. for (styleName in lastStyle) {
  24819. if (lastStyle.hasOwnProperty(styleName)) {
  24820. styleUpdates = styleUpdates || {};
  24821. styleUpdates[styleName] = '';
  24822. }
  24823. }
  24824. this._previousStyleCopy = null;
  24825. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  24826. if (lastProps[propKey]) {
  24827. // Only call deleteListener if there was a listener previously or
  24828. // else willDeleteListener gets called when there wasn't actually a
  24829. // listener (e.g., onClick={null})
  24830. deleteListener(this, propKey);
  24831. }
  24832. } else if (isCustomComponent(this._tag, lastProps)) {
  24833. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24834. DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey);
  24835. }
  24836. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  24837. DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
  24838. }
  24839. }
  24840. for (propKey in nextProps) {
  24841. var nextProp = nextProps[propKey];
  24842. var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
  24843. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
  24844. continue;
  24845. }
  24846. if (propKey === STYLE) {
  24847. if (nextProp) {
  24848. if (false) {
  24849. checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
  24850. this._previousStyle = nextProp;
  24851. }
  24852. nextProp = this._previousStyleCopy = _assign({}, nextProp);
  24853. } else {
  24854. this._previousStyleCopy = null;
  24855. }
  24856. if (lastProp) {
  24857. // Unset styles on `lastProp` but not on `nextProp`.
  24858. for (styleName in lastProp) {
  24859. if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  24860. styleUpdates = styleUpdates || {};
  24861. styleUpdates[styleName] = '';
  24862. }
  24863. }
  24864. // Update styles that changed since `lastProp`.
  24865. for (styleName in nextProp) {
  24866. if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  24867. styleUpdates = styleUpdates || {};
  24868. styleUpdates[styleName] = nextProp[styleName];
  24869. }
  24870. }
  24871. } else {
  24872. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  24873. styleUpdates = nextProp;
  24874. }
  24875. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  24876. if (nextProp) {
  24877. enqueuePutListener(this, propKey, nextProp, transaction);
  24878. } else if (lastProp) {
  24879. deleteListener(this, propKey);
  24880. }
  24881. } else if (isCustomComponent(this._tag, nextProps)) {
  24882. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24883. DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
  24884. }
  24885. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  24886. var node = getNode(this);
  24887. // If we're updating to null or undefined, we should remove the property
  24888. // from the DOM node instead of inadvertently setting to a string. This
  24889. // brings us in line with the same behavior we have on initial render.
  24890. if (nextProp != null) {
  24891. DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
  24892. } else {
  24893. DOMPropertyOperations.deleteValueForProperty(node, propKey);
  24894. }
  24895. }
  24896. }
  24897. if (styleUpdates) {
  24898. CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
  24899. }
  24900. },
  24901. /**
  24902. * Reconciles the children with the various properties that affect the
  24903. * children content.
  24904. *
  24905. * @param {object} lastProps
  24906. * @param {object} nextProps
  24907. * @param {ReactReconcileTransaction} transaction
  24908. * @param {object} context
  24909. */
  24910. _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
  24911. var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  24912. var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  24913. var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
  24914. var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
  24915. // Note the use of `!=` which checks for null or undefined.
  24916. var lastChildren = lastContent != null ? null : lastProps.children;
  24917. var nextChildren = nextContent != null ? null : nextProps.children;
  24918. // If we're switching from children to content/html or vice versa, remove
  24919. // the old content
  24920. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  24921. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  24922. if (lastChildren != null && nextChildren == null) {
  24923. this.updateChildren(null, transaction, context);
  24924. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  24925. this.updateTextContent('');
  24926. if (false) {
  24927. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  24928. }
  24929. }
  24930. if (nextContent != null) {
  24931. if (lastContent !== nextContent) {
  24932. this.updateTextContent('' + nextContent);
  24933. if (false) {
  24934. setAndValidateContentChildDev.call(this, nextContent);
  24935. }
  24936. }
  24937. } else if (nextHtml != null) {
  24938. if (lastHtml !== nextHtml) {
  24939. this.updateMarkup('' + nextHtml);
  24940. }
  24941. if (false) {
  24942. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  24943. }
  24944. } else if (nextChildren != null) {
  24945. if (false) {
  24946. setAndValidateContentChildDev.call(this, null);
  24947. }
  24948. this.updateChildren(nextChildren, transaction, context);
  24949. }
  24950. },
  24951. getHostNode: function () {
  24952. return getNode(this);
  24953. },
  24954. /**
  24955. * Destroys all event registrations for this instance. Does not remove from
  24956. * the DOM. That must be done by the parent.
  24957. *
  24958. * @internal
  24959. */
  24960. unmountComponent: function (safely) {
  24961. switch (this._tag) {
  24962. case 'audio':
  24963. case 'form':
  24964. case 'iframe':
  24965. case 'img':
  24966. case 'link':
  24967. case 'object':
  24968. case 'source':
  24969. case 'video':
  24970. var listeners = this._wrapperState.listeners;
  24971. if (listeners) {
  24972. for (var i = 0; i < listeners.length; i++) {
  24973. listeners[i].remove();
  24974. }
  24975. }
  24976. break;
  24977. case 'html':
  24978. case 'head':
  24979. case 'body':
  24980. /**
  24981. * Components like <html> <head> and <body> can't be removed or added
  24982. * easily in a cross-browser way, however it's valuable to be able to
  24983. * take advantage of React's reconciliation for styling and <title>
  24984. * management. So we just document it and throw in dangerous cases.
  24985. */
  24986. true ? false ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is impossible to unmount some top-level components (eg <html>, <head>, and <body>) reliably and efficiently. To fix this, have a single top-level component that never unmounts render these elements.', this._tag) : _prodInvariant('66', this._tag) : void 0;
  24987. break;
  24988. }
  24989. this.unmountChildren(safely);
  24990. ReactDOMComponentTree.uncacheNode(this);
  24991. EventPluginHub.deleteAllListeners(this);
  24992. this._rootNodeID = 0;
  24993. this._domID = 0;
  24994. this._wrapperState = null;
  24995. if (false) {
  24996. setAndValidateContentChildDev.call(this, null);
  24997. }
  24998. },
  24999. getPublicInstance: function () {
  25000. return getNode(this);
  25001. }
  25002. };
  25003. _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
  25004. module.exports = ReactDOMComponent;
  25005. /***/ }),
  25006. /* 183 */
  25007. /***/ (function(module, exports, __webpack_require__) {
  25008. "use strict";
  25009. /**
  25010. * Copyright 2013-present, Facebook, Inc.
  25011. * All rights reserved.
  25012. *
  25013. * This source code is licensed under the BSD-style license found in the
  25014. * LICENSE file in the root directory of this source tree. An additional grant
  25015. * of patent rights can be found in the PATENTS file in the same directory.
  25016. *
  25017. */
  25018. var validateDOMNesting = __webpack_require__(64);
  25019. var DOC_NODE_TYPE = 9;
  25020. function ReactDOMContainerInfo(topLevelWrapper, node) {
  25021. var info = {
  25022. _topLevelWrapper: topLevelWrapper,
  25023. _idCounter: 1,
  25024. _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
  25025. _node: node,
  25026. _tag: node ? node.nodeName.toLowerCase() : null,
  25027. _namespaceURI: node ? node.namespaceURI : null
  25028. };
  25029. if (false) {
  25030. info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
  25031. }
  25032. return info;
  25033. }
  25034. module.exports = ReactDOMContainerInfo;
  25035. /***/ }),
  25036. /* 184 */
  25037. /***/ (function(module, exports, __webpack_require__) {
  25038. "use strict";
  25039. /**
  25040. * Copyright 2014-present, Facebook, Inc.
  25041. * All rights reserved.
  25042. *
  25043. * This source code is licensed under the BSD-style license found in the
  25044. * LICENSE file in the root directory of this source tree. An additional grant
  25045. * of patent rights can be found in the PATENTS file in the same directory.
  25046. *
  25047. */
  25048. var _assign = __webpack_require__(3);
  25049. var DOMLazyTree = __webpack_require__(18);
  25050. var ReactDOMComponentTree = __webpack_require__(5);
  25051. var ReactDOMEmptyComponent = function (instantiate) {
  25052. // ReactCompositeComponent uses this:
  25053. this._currentElement = null;
  25054. // ReactDOMComponentTree uses these:
  25055. this._hostNode = null;
  25056. this._hostParent = null;
  25057. this._hostContainerInfo = null;
  25058. this._domID = 0;
  25059. };
  25060. _assign(ReactDOMEmptyComponent.prototype, {
  25061. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  25062. var domID = hostContainerInfo._idCounter++;
  25063. this._domID = domID;
  25064. this._hostParent = hostParent;
  25065. this._hostContainerInfo = hostContainerInfo;
  25066. var nodeValue = ' react-empty: ' + this._domID + ' ';
  25067. if (transaction.useCreateElement) {
  25068. var ownerDocument = hostContainerInfo._ownerDocument;
  25069. var node = ownerDocument.createComment(nodeValue);
  25070. ReactDOMComponentTree.precacheNode(this, node);
  25071. return DOMLazyTree(node);
  25072. } else {
  25073. if (transaction.renderToStaticMarkup) {
  25074. // Normally we'd insert a comment node, but since this is a situation
  25075. // where React won't take over (static pages), we can simply return
  25076. // nothing.
  25077. return '';
  25078. }
  25079. return '<!--' + nodeValue + '-->';
  25080. }
  25081. },
  25082. receiveComponent: function () {},
  25083. getHostNode: function () {
  25084. return ReactDOMComponentTree.getNodeFromInstance(this);
  25085. },
  25086. unmountComponent: function () {
  25087. ReactDOMComponentTree.uncacheNode(this);
  25088. }
  25089. });
  25090. module.exports = ReactDOMEmptyComponent;
  25091. /***/ }),
  25092. /* 185 */
  25093. /***/ (function(module, exports, __webpack_require__) {
  25094. "use strict";
  25095. /**
  25096. * Copyright 2013-present, Facebook, Inc.
  25097. * All rights reserved.
  25098. *
  25099. * This source code is licensed under the BSD-style license found in the
  25100. * LICENSE file in the root directory of this source tree. An additional grant
  25101. * of patent rights can be found in the PATENTS file in the same directory.
  25102. *
  25103. */
  25104. var ReactDOMFeatureFlags = {
  25105. useCreateElement: true,
  25106. useFiber: false
  25107. };
  25108. module.exports = ReactDOMFeatureFlags;
  25109. /***/ }),
  25110. /* 186 */
  25111. /***/ (function(module, exports, __webpack_require__) {
  25112. "use strict";
  25113. /**
  25114. * Copyright 2013-present, Facebook, Inc.
  25115. * All rights reserved.
  25116. *
  25117. * This source code is licensed under the BSD-style license found in the
  25118. * LICENSE file in the root directory of this source tree. An additional grant
  25119. * of patent rights can be found in the PATENTS file in the same directory.
  25120. *
  25121. */
  25122. var DOMChildrenOperations = __webpack_require__(49);
  25123. var ReactDOMComponentTree = __webpack_require__(5);
  25124. /**
  25125. * Operations used to process updates to DOM nodes.
  25126. */
  25127. var ReactDOMIDOperations = {
  25128. /**
  25129. * Updates a component's children by processing a series of updates.
  25130. *
  25131. * @param {array<object>} updates List of update configurations.
  25132. * @internal
  25133. */
  25134. dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
  25135. var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
  25136. DOMChildrenOperations.processUpdates(node, updates);
  25137. }
  25138. };
  25139. module.exports = ReactDOMIDOperations;
  25140. /***/ }),
  25141. /* 187 */
  25142. /***/ (function(module, exports, __webpack_require__) {
  25143. "use strict";
  25144. /**
  25145. * Copyright 2013-present, Facebook, Inc.
  25146. * All rights reserved.
  25147. *
  25148. * This source code is licensed under the BSD-style license found in the
  25149. * LICENSE file in the root directory of this source tree. An additional grant
  25150. * of patent rights can be found in the PATENTS file in the same directory.
  25151. *
  25152. */
  25153. var _prodInvariant = __webpack_require__(2),
  25154. _assign = __webpack_require__(3);
  25155. var DOMPropertyOperations = __webpack_require__(79);
  25156. var LinkedValueUtils = __webpack_require__(54);
  25157. var ReactDOMComponentTree = __webpack_require__(5);
  25158. var ReactUpdates = __webpack_require__(12);
  25159. var invariant = __webpack_require__(0);
  25160. var warning = __webpack_require__(1);
  25161. var didWarnValueLink = false;
  25162. var didWarnCheckedLink = false;
  25163. var didWarnValueDefaultValue = false;
  25164. var didWarnCheckedDefaultChecked = false;
  25165. var didWarnControlledToUncontrolled = false;
  25166. var didWarnUncontrolledToControlled = false;
  25167. function forceUpdateIfMounted() {
  25168. if (this._rootNodeID) {
  25169. // DOM component is still mounted; update
  25170. ReactDOMInput.updateWrapper(this);
  25171. }
  25172. }
  25173. function isControlled(props) {
  25174. var usesChecked = props.type === 'checkbox' || props.type === 'radio';
  25175. return usesChecked ? props.checked != null : props.value != null;
  25176. }
  25177. /**
  25178. * Implements an <input> host component that allows setting these optional
  25179. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  25180. *
  25181. * If `checked` or `value` are not supplied (or null/undefined), user actions
  25182. * that affect the checked state or value will trigger updates to the element.
  25183. *
  25184. * If they are supplied (and not null/undefined), the rendered element will not
  25185. * trigger updates to the element. Instead, the props must change in order for
  25186. * the rendered element to be updated.
  25187. *
  25188. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  25189. * with an empty value (or `defaultValue`).
  25190. *
  25191. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  25192. */
  25193. var ReactDOMInput = {
  25194. getHostProps: function (inst, props) {
  25195. var value = LinkedValueUtils.getValue(props);
  25196. var checked = LinkedValueUtils.getChecked(props);
  25197. var hostProps = _assign({
  25198. // Make sure we set .type before any other properties (setting .value
  25199. // before .type means .value is lost in IE11 and below)
  25200. type: undefined,
  25201. // Make sure we set .step before .value (setting .value before .step
  25202. // means .value is rounded on mount, based upon step precision)
  25203. step: undefined,
  25204. // Make sure we set .min & .max before .value (to ensure proper order
  25205. // in corner cases such as min or max deriving from value, e.g. Issue #7170)
  25206. min: undefined,
  25207. max: undefined
  25208. }, props, {
  25209. defaultChecked: undefined,
  25210. defaultValue: undefined,
  25211. value: value != null ? value : inst._wrapperState.initialValue,
  25212. checked: checked != null ? checked : inst._wrapperState.initialChecked,
  25213. onChange: inst._wrapperState.onChange
  25214. });
  25215. return hostProps;
  25216. },
  25217. mountWrapper: function (inst, props) {
  25218. if (false) {
  25219. LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
  25220. var owner = inst._currentElement._owner;
  25221. if (props.valueLink !== undefined && !didWarnValueLink) {
  25222. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  25223. didWarnValueLink = true;
  25224. }
  25225. if (props.checkedLink !== undefined && !didWarnCheckedLink) {
  25226. process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  25227. didWarnCheckedLink = true;
  25228. }
  25229. if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
  25230. process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
  25231. didWarnCheckedDefaultChecked = true;
  25232. }
  25233. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  25234. process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
  25235. didWarnValueDefaultValue = true;
  25236. }
  25237. }
  25238. var defaultValue = props.defaultValue;
  25239. inst._wrapperState = {
  25240. initialChecked: props.checked != null ? props.checked : props.defaultChecked,
  25241. initialValue: props.value != null ? props.value : defaultValue,
  25242. listeners: null,
  25243. onChange: _handleChange.bind(inst)
  25244. };
  25245. if (false) {
  25246. inst._wrapperState.controlled = isControlled(props);
  25247. }
  25248. },
  25249. updateWrapper: function (inst) {
  25250. var props = inst._currentElement.props;
  25251. if (false) {
  25252. var controlled = isControlled(props);
  25253. var owner = inst._currentElement._owner;
  25254. if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
  25255. process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
  25256. didWarnUncontrolledToControlled = true;
  25257. }
  25258. if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
  25259. process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
  25260. didWarnControlledToUncontrolled = true;
  25261. }
  25262. }
  25263. // TODO: Shouldn't this be getChecked(props)?
  25264. var checked = props.checked;
  25265. if (checked != null) {
  25266. DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
  25267. }
  25268. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25269. var value = LinkedValueUtils.getValue(props);
  25270. if (value != null) {
  25271. // Cast `value` to a string to ensure the value is set correctly. While
  25272. // browsers typically do this as necessary, jsdom doesn't.
  25273. var newValue = '' + value;
  25274. // To avoid side effects (such as losing text selection), only set value if changed
  25275. if (newValue !== node.value) {
  25276. node.value = newValue;
  25277. }
  25278. } else {
  25279. if (props.value == null && props.defaultValue != null) {
  25280. // In Chrome, assigning defaultValue to certain input types triggers input validation.
  25281. // For number inputs, the display value loses trailing decimal points. For email inputs,
  25282. // Chrome raises "The specified value <x> is not a valid email address".
  25283. //
  25284. // Here we check to see if the defaultValue has actually changed, avoiding these problems
  25285. // when the user is inputting text
  25286. //
  25287. // https://github.com/facebook/react/issues/7253
  25288. if (node.defaultValue !== '' + props.defaultValue) {
  25289. node.defaultValue = '' + props.defaultValue;
  25290. }
  25291. }
  25292. if (props.checked == null && props.defaultChecked != null) {
  25293. node.defaultChecked = !!props.defaultChecked;
  25294. }
  25295. }
  25296. },
  25297. postMountWrapper: function (inst) {
  25298. var props = inst._currentElement.props;
  25299. // This is in postMount because we need access to the DOM node, which is not
  25300. // available until after the component has mounted.
  25301. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25302. // Detach value from defaultValue. We won't do anything if we're working on
  25303. // submit or reset inputs as those values & defaultValues are linked. They
  25304. // are not resetable nodes so this operation doesn't matter and actually
  25305. // removes browser-default values (eg "Submit Query") when no value is
  25306. // provided.
  25307. switch (props.type) {
  25308. case 'submit':
  25309. case 'reset':
  25310. break;
  25311. case 'color':
  25312. case 'date':
  25313. case 'datetime':
  25314. case 'datetime-local':
  25315. case 'month':
  25316. case 'time':
  25317. case 'week':
  25318. // This fixes the no-show issue on iOS Safari and Android Chrome:
  25319. // https://github.com/facebook/react/issues/7233
  25320. node.value = '';
  25321. node.value = node.defaultValue;
  25322. break;
  25323. default:
  25324. node.value = node.value;
  25325. break;
  25326. }
  25327. // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
  25328. // this is needed to work around a chrome bug where setting defaultChecked
  25329. // will sometimes influence the value of checked (even after detachment).
  25330. // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
  25331. // We need to temporarily unset name to avoid disrupting radio button groups.
  25332. var name = node.name;
  25333. if (name !== '') {
  25334. node.name = '';
  25335. }
  25336. node.defaultChecked = !node.defaultChecked;
  25337. node.defaultChecked = !node.defaultChecked;
  25338. if (name !== '') {
  25339. node.name = name;
  25340. }
  25341. }
  25342. };
  25343. function _handleChange(event) {
  25344. var props = this._currentElement.props;
  25345. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  25346. // Here we use asap to wait until all updates have propagated, which
  25347. // is important when using controlled components within layers:
  25348. // https://github.com/facebook/react/issues/1698
  25349. ReactUpdates.asap(forceUpdateIfMounted, this);
  25350. var name = props.name;
  25351. if (props.type === 'radio' && name != null) {
  25352. var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
  25353. var queryRoot = rootNode;
  25354. while (queryRoot.parentNode) {
  25355. queryRoot = queryRoot.parentNode;
  25356. }
  25357. // If `rootNode.form` was non-null, then we could try `form.elements`,
  25358. // but that sometimes behaves strangely in IE8. We could also try using
  25359. // `form.getElementsByName`, but that will only return direct children
  25360. // and won't include inputs that use the HTML5 `form=` attribute. Since
  25361. // the input might not even be in a form, let's just use the global
  25362. // `querySelectorAll` to ensure we don't miss anything.
  25363. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  25364. for (var i = 0; i < group.length; i++) {
  25365. var otherNode = group[i];
  25366. if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  25367. continue;
  25368. }
  25369. // This will throw if radio buttons rendered by different copies of React
  25370. // and the same name are rendered into the same form (same as #1939).
  25371. // That's probably okay; we don't support it just as we don't support
  25372. // mixing React radio buttons with non-React ones.
  25373. var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
  25374. !otherInstance ? false ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0;
  25375. // If this is a controlled radio button group, forcing the input that
  25376. // was previously checked to update will cause it to be come re-checked
  25377. // as appropriate.
  25378. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  25379. }
  25380. }
  25381. return returnValue;
  25382. }
  25383. module.exports = ReactDOMInput;
  25384. /***/ }),
  25385. /* 188 */
  25386. /***/ (function(module, exports, __webpack_require__) {
  25387. "use strict";
  25388. /**
  25389. * Copyright 2013-present, Facebook, Inc.
  25390. * All rights reserved.
  25391. *
  25392. * This source code is licensed under the BSD-style license found in the
  25393. * LICENSE file in the root directory of this source tree. An additional grant
  25394. * of patent rights can be found in the PATENTS file in the same directory.
  25395. *
  25396. */
  25397. var _assign = __webpack_require__(3);
  25398. var React = __webpack_require__(21);
  25399. var ReactDOMComponentTree = __webpack_require__(5);
  25400. var ReactDOMSelect = __webpack_require__(81);
  25401. var warning = __webpack_require__(1);
  25402. var didWarnInvalidOptionChildren = false;
  25403. function flattenChildren(children) {
  25404. var content = '';
  25405. // Flatten children and warn if they aren't strings or numbers;
  25406. // invalid types are ignored.
  25407. React.Children.forEach(children, function (child) {
  25408. if (child == null) {
  25409. return;
  25410. }
  25411. if (typeof child === 'string' || typeof child === 'number') {
  25412. content += child;
  25413. } else if (!didWarnInvalidOptionChildren) {
  25414. didWarnInvalidOptionChildren = true;
  25415. false ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
  25416. }
  25417. });
  25418. return content;
  25419. }
  25420. /**
  25421. * Implements an <option> host component that warns when `selected` is set.
  25422. */
  25423. var ReactDOMOption = {
  25424. mountWrapper: function (inst, props, hostParent) {
  25425. // TODO (yungsters): Remove support for `selected` in <option>.
  25426. if (false) {
  25427. process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0;
  25428. }
  25429. // Look up whether this option is 'selected'
  25430. var selectValue = null;
  25431. if (hostParent != null) {
  25432. var selectParent = hostParent;
  25433. if (selectParent._tag === 'optgroup') {
  25434. selectParent = selectParent._hostParent;
  25435. }
  25436. if (selectParent != null && selectParent._tag === 'select') {
  25437. selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
  25438. }
  25439. }
  25440. // If the value is null (e.g., no specified value or after initial mount)
  25441. // or missing (e.g., for <datalist>), we don't change props.selected
  25442. var selected = null;
  25443. if (selectValue != null) {
  25444. var value;
  25445. if (props.value != null) {
  25446. value = props.value + '';
  25447. } else {
  25448. value = flattenChildren(props.children);
  25449. }
  25450. selected = false;
  25451. if (Array.isArray(selectValue)) {
  25452. // multiple
  25453. for (var i = 0; i < selectValue.length; i++) {
  25454. if ('' + selectValue[i] === value) {
  25455. selected = true;
  25456. break;
  25457. }
  25458. }
  25459. } else {
  25460. selected = '' + selectValue === value;
  25461. }
  25462. }
  25463. inst._wrapperState = { selected: selected };
  25464. },
  25465. postMountWrapper: function (inst) {
  25466. // value="" should make a value attribute (#6219)
  25467. var props = inst._currentElement.props;
  25468. if (props.value != null) {
  25469. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25470. node.setAttribute('value', props.value);
  25471. }
  25472. },
  25473. getHostProps: function (inst, props) {
  25474. var hostProps = _assign({ selected: undefined, children: undefined }, props);
  25475. // Read state only from initial mount because <select> updates value
  25476. // manually; we need the initial state only for server rendering
  25477. if (inst._wrapperState.selected != null) {
  25478. hostProps.selected = inst._wrapperState.selected;
  25479. }
  25480. var content = flattenChildren(props.children);
  25481. if (content) {
  25482. hostProps.children = content;
  25483. }
  25484. return hostProps;
  25485. }
  25486. };
  25487. module.exports = ReactDOMOption;
  25488. /***/ }),
  25489. /* 189 */
  25490. /***/ (function(module, exports, __webpack_require__) {
  25491. "use strict";
  25492. /**
  25493. * Copyright 2013-present, Facebook, Inc.
  25494. * All rights reserved.
  25495. *
  25496. * This source code is licensed under the BSD-style license found in the
  25497. * LICENSE file in the root directory of this source tree. An additional grant
  25498. * of patent rights can be found in the PATENTS file in the same directory.
  25499. *
  25500. */
  25501. var ExecutionEnvironment = __webpack_require__(9);
  25502. var getNodeForCharacterOffset = __webpack_require__(228);
  25503. var getTextContentAccessor = __webpack_require__(92);
  25504. /**
  25505. * While `isCollapsed` is available on the Selection object and `collapsed`
  25506. * is available on the Range object, IE11 sometimes gets them wrong.
  25507. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  25508. */
  25509. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  25510. return anchorNode === focusNode && anchorOffset === focusOffset;
  25511. }
  25512. /**
  25513. * Get the appropriate anchor and focus node/offset pairs for IE.
  25514. *
  25515. * The catch here is that IE's selection API doesn't provide information
  25516. * about whether the selection is forward or backward, so we have to
  25517. * behave as though it's always forward.
  25518. *
  25519. * IE text differs from modern selection in that it behaves as though
  25520. * block elements end with a new line. This means character offsets will
  25521. * differ between the two APIs.
  25522. *
  25523. * @param {DOMElement} node
  25524. * @return {object}
  25525. */
  25526. function getIEOffsets(node) {
  25527. var selection = document.selection;
  25528. var selectedRange = selection.createRange();
  25529. var selectedLength = selectedRange.text.length;
  25530. // Duplicate selection so we can move range without breaking user selection.
  25531. var fromStart = selectedRange.duplicate();
  25532. fromStart.moveToElementText(node);
  25533. fromStart.setEndPoint('EndToStart', selectedRange);
  25534. var startOffset = fromStart.text.length;
  25535. var endOffset = startOffset + selectedLength;
  25536. return {
  25537. start: startOffset,
  25538. end: endOffset
  25539. };
  25540. }
  25541. /**
  25542. * @param {DOMElement} node
  25543. * @return {?object}
  25544. */
  25545. function getModernOffsets(node) {
  25546. var selection = window.getSelection && window.getSelection();
  25547. if (!selection || selection.rangeCount === 0) {
  25548. return null;
  25549. }
  25550. var anchorNode = selection.anchorNode;
  25551. var anchorOffset = selection.anchorOffset;
  25552. var focusNode = selection.focusNode;
  25553. var focusOffset = selection.focusOffset;
  25554. var currentRange = selection.getRangeAt(0);
  25555. // In Firefox, range.startContainer and range.endContainer can be "anonymous
  25556. // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
  25557. // divs do not seem to expose properties, triggering a "Permission denied
  25558. // error" if any of its properties are accessed. The only seemingly possible
  25559. // way to avoid erroring is to access a property that typically works for
  25560. // non-anonymous divs and catch any error that may otherwise arise. See
  25561. // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  25562. try {
  25563. /* eslint-disable no-unused-expressions */
  25564. currentRange.startContainer.nodeType;
  25565. currentRange.endContainer.nodeType;
  25566. /* eslint-enable no-unused-expressions */
  25567. } catch (e) {
  25568. return null;
  25569. }
  25570. // If the node and offset values are the same, the selection is collapsed.
  25571. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  25572. // this value wrong.
  25573. var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
  25574. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  25575. var tempRange = currentRange.cloneRange();
  25576. tempRange.selectNodeContents(node);
  25577. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  25578. var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
  25579. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  25580. var end = start + rangeLength;
  25581. // Detect whether the selection is backward.
  25582. var detectionRange = document.createRange();
  25583. detectionRange.setStart(anchorNode, anchorOffset);
  25584. detectionRange.setEnd(focusNode, focusOffset);
  25585. var isBackward = detectionRange.collapsed;
  25586. return {
  25587. start: isBackward ? end : start,
  25588. end: isBackward ? start : end
  25589. };
  25590. }
  25591. /**
  25592. * @param {DOMElement|DOMTextNode} node
  25593. * @param {object} offsets
  25594. */
  25595. function setIEOffsets(node, offsets) {
  25596. var range = document.selection.createRange().duplicate();
  25597. var start, end;
  25598. if (offsets.end === undefined) {
  25599. start = offsets.start;
  25600. end = start;
  25601. } else if (offsets.start > offsets.end) {
  25602. start = offsets.end;
  25603. end = offsets.start;
  25604. } else {
  25605. start = offsets.start;
  25606. end = offsets.end;
  25607. }
  25608. range.moveToElementText(node);
  25609. range.moveStart('character', start);
  25610. range.setEndPoint('EndToStart', range);
  25611. range.moveEnd('character', end - start);
  25612. range.select();
  25613. }
  25614. /**
  25615. * In modern non-IE browsers, we can support both forward and backward
  25616. * selections.
  25617. *
  25618. * Note: IE10+ supports the Selection object, but it does not support
  25619. * the `extend` method, which means that even in modern IE, it's not possible
  25620. * to programmatically create a backward selection. Thus, for all IE
  25621. * versions, we use the old IE API to create our selections.
  25622. *
  25623. * @param {DOMElement|DOMTextNode} node
  25624. * @param {object} offsets
  25625. */
  25626. function setModernOffsets(node, offsets) {
  25627. if (!window.getSelection) {
  25628. return;
  25629. }
  25630. var selection = window.getSelection();
  25631. var length = node[getTextContentAccessor()].length;
  25632. var start = Math.min(offsets.start, length);
  25633. var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
  25634. // IE 11 uses modern selection, but doesn't support the extend method.
  25635. // Flip backward selections, so we can set with a single range.
  25636. if (!selection.extend && start > end) {
  25637. var temp = end;
  25638. end = start;
  25639. start = temp;
  25640. }
  25641. var startMarker = getNodeForCharacterOffset(node, start);
  25642. var endMarker = getNodeForCharacterOffset(node, end);
  25643. if (startMarker && endMarker) {
  25644. var range = document.createRange();
  25645. range.setStart(startMarker.node, startMarker.offset);
  25646. selection.removeAllRanges();
  25647. if (start > end) {
  25648. selection.addRange(range);
  25649. selection.extend(endMarker.node, endMarker.offset);
  25650. } else {
  25651. range.setEnd(endMarker.node, endMarker.offset);
  25652. selection.addRange(range);
  25653. }
  25654. }
  25655. }
  25656. var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
  25657. var ReactDOMSelection = {
  25658. /**
  25659. * @param {DOMElement} node
  25660. */
  25661. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  25662. /**
  25663. * @param {DOMElement|DOMTextNode} node
  25664. * @param {object} offsets
  25665. */
  25666. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  25667. };
  25668. module.exports = ReactDOMSelection;
  25669. /***/ }),
  25670. /* 190 */
  25671. /***/ (function(module, exports, __webpack_require__) {
  25672. "use strict";
  25673. /**
  25674. * Copyright 2013-present, Facebook, Inc.
  25675. * All rights reserved.
  25676. *
  25677. * This source code is licensed under the BSD-style license found in the
  25678. * LICENSE file in the root directory of this source tree. An additional grant
  25679. * of patent rights can be found in the PATENTS file in the same directory.
  25680. *
  25681. */
  25682. var _prodInvariant = __webpack_require__(2),
  25683. _assign = __webpack_require__(3);
  25684. var DOMChildrenOperations = __webpack_require__(49);
  25685. var DOMLazyTree = __webpack_require__(18);
  25686. var ReactDOMComponentTree = __webpack_require__(5);
  25687. var escapeTextContentForBrowser = __webpack_require__(35);
  25688. var invariant = __webpack_require__(0);
  25689. var validateDOMNesting = __webpack_require__(64);
  25690. /**
  25691. * Text nodes violate a couple assumptions that React makes about components:
  25692. *
  25693. * - When mounting text into the DOM, adjacent text nodes are merged.
  25694. * - Text nodes cannot be assigned a React root ID.
  25695. *
  25696. * This component is used to wrap strings between comment nodes so that they
  25697. * can undergo the same reconciliation that is applied to elements.
  25698. *
  25699. * TODO: Investigate representing React components in the DOM with text nodes.
  25700. *
  25701. * @class ReactDOMTextComponent
  25702. * @extends ReactComponent
  25703. * @internal
  25704. */
  25705. var ReactDOMTextComponent = function (text) {
  25706. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  25707. this._currentElement = text;
  25708. this._stringText = '' + text;
  25709. // ReactDOMComponentTree uses these:
  25710. this._hostNode = null;
  25711. this._hostParent = null;
  25712. // Properties
  25713. this._domID = 0;
  25714. this._mountIndex = 0;
  25715. this._closingComment = null;
  25716. this._commentNodes = null;
  25717. };
  25718. _assign(ReactDOMTextComponent.prototype, {
  25719. /**
  25720. * Creates the markup for this text node. This node is not intended to have
  25721. * any features besides containing text content.
  25722. *
  25723. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  25724. * @return {string} Markup for this text node.
  25725. * @internal
  25726. */
  25727. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  25728. if (false) {
  25729. var parentInfo;
  25730. if (hostParent != null) {
  25731. parentInfo = hostParent._ancestorInfo;
  25732. } else if (hostContainerInfo != null) {
  25733. parentInfo = hostContainerInfo._ancestorInfo;
  25734. }
  25735. if (parentInfo) {
  25736. // parentInfo should always be present except for the top-level
  25737. // component when server rendering
  25738. validateDOMNesting(null, this._stringText, this, parentInfo);
  25739. }
  25740. }
  25741. var domID = hostContainerInfo._idCounter++;
  25742. var openingValue = ' react-text: ' + domID + ' ';
  25743. var closingValue = ' /react-text ';
  25744. this._domID = domID;
  25745. this._hostParent = hostParent;
  25746. if (transaction.useCreateElement) {
  25747. var ownerDocument = hostContainerInfo._ownerDocument;
  25748. var openingComment = ownerDocument.createComment(openingValue);
  25749. var closingComment = ownerDocument.createComment(closingValue);
  25750. var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
  25751. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
  25752. if (this._stringText) {
  25753. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
  25754. }
  25755. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
  25756. ReactDOMComponentTree.precacheNode(this, openingComment);
  25757. this._closingComment = closingComment;
  25758. return lazyTree;
  25759. } else {
  25760. var escapedText = escapeTextContentForBrowser(this._stringText);
  25761. if (transaction.renderToStaticMarkup) {
  25762. // Normally we'd wrap this between comment nodes for the reasons stated
  25763. // above, but since this is a situation where React won't take over
  25764. // (static pages), we can simply return the text as it is.
  25765. return escapedText;
  25766. }
  25767. return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
  25768. }
  25769. },
  25770. /**
  25771. * Updates this component by updating the text content.
  25772. *
  25773. * @param {ReactText} nextText The next text content
  25774. * @param {ReactReconcileTransaction} transaction
  25775. * @internal
  25776. */
  25777. receiveComponent: function (nextText, transaction) {
  25778. if (nextText !== this._currentElement) {
  25779. this._currentElement = nextText;
  25780. var nextStringText = '' + nextText;
  25781. if (nextStringText !== this._stringText) {
  25782. // TODO: Save this as pending props and use performUpdateIfNecessary
  25783. // and/or updateComponent to do the actual update for consistency with
  25784. // other component types?
  25785. this._stringText = nextStringText;
  25786. var commentNodes = this.getHostNode();
  25787. DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
  25788. }
  25789. }
  25790. },
  25791. getHostNode: function () {
  25792. var hostNode = this._commentNodes;
  25793. if (hostNode) {
  25794. return hostNode;
  25795. }
  25796. if (!this._closingComment) {
  25797. var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
  25798. var node = openingComment.nextSibling;
  25799. while (true) {
  25800. !(node != null) ? false ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0;
  25801. if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
  25802. this._closingComment = node;
  25803. break;
  25804. }
  25805. node = node.nextSibling;
  25806. }
  25807. }
  25808. hostNode = [this._hostNode, this._closingComment];
  25809. this._commentNodes = hostNode;
  25810. return hostNode;
  25811. },
  25812. unmountComponent: function () {
  25813. this._closingComment = null;
  25814. this._commentNodes = null;
  25815. ReactDOMComponentTree.uncacheNode(this);
  25816. }
  25817. });
  25818. module.exports = ReactDOMTextComponent;
  25819. /***/ }),
  25820. /* 191 */
  25821. /***/ (function(module, exports, __webpack_require__) {
  25822. "use strict";
  25823. /**
  25824. * Copyright 2013-present, Facebook, Inc.
  25825. * All rights reserved.
  25826. *
  25827. * This source code is licensed under the BSD-style license found in the
  25828. * LICENSE file in the root directory of this source tree. An additional grant
  25829. * of patent rights can be found in the PATENTS file in the same directory.
  25830. *
  25831. */
  25832. var _prodInvariant = __webpack_require__(2),
  25833. _assign = __webpack_require__(3);
  25834. var LinkedValueUtils = __webpack_require__(54);
  25835. var ReactDOMComponentTree = __webpack_require__(5);
  25836. var ReactUpdates = __webpack_require__(12);
  25837. var invariant = __webpack_require__(0);
  25838. var warning = __webpack_require__(1);
  25839. var didWarnValueLink = false;
  25840. var didWarnValDefaultVal = false;
  25841. function forceUpdateIfMounted() {
  25842. if (this._rootNodeID) {
  25843. // DOM component is still mounted; update
  25844. ReactDOMTextarea.updateWrapper(this);
  25845. }
  25846. }
  25847. /**
  25848. * Implements a <textarea> host component that allows setting `value`, and
  25849. * `defaultValue`. This differs from the traditional DOM API because value is
  25850. * usually set as PCDATA children.
  25851. *
  25852. * If `value` is not supplied (or null/undefined), user actions that affect the
  25853. * value will trigger updates to the element.
  25854. *
  25855. * If `value` is supplied (and not null/undefined), the rendered element will
  25856. * not trigger updates to the element. Instead, the `value` prop must change in
  25857. * order for the rendered element to be updated.
  25858. *
  25859. * The rendered element will be initialized with an empty value, the prop
  25860. * `defaultValue` if specified, or the children content (deprecated).
  25861. */
  25862. var ReactDOMTextarea = {
  25863. getHostProps: function (inst, props) {
  25864. !(props.dangerouslySetInnerHTML == null) ? false ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0;
  25865. // Always set children to the same thing. In IE9, the selection range will
  25866. // get reset if `textContent` is mutated. We could add a check in setTextContent
  25867. // to only set the value if/when the value differs from the node value (which would
  25868. // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution.
  25869. // The value can be a boolean or object so that's why it's forced to be a string.
  25870. var hostProps = _assign({}, props, {
  25871. value: undefined,
  25872. defaultValue: undefined,
  25873. children: '' + inst._wrapperState.initialValue,
  25874. onChange: inst._wrapperState.onChange
  25875. });
  25876. return hostProps;
  25877. },
  25878. mountWrapper: function (inst, props) {
  25879. if (false) {
  25880. LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
  25881. if (props.valueLink !== undefined && !didWarnValueLink) {
  25882. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
  25883. didWarnValueLink = true;
  25884. }
  25885. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
  25886. process.env.NODE_ENV !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
  25887. didWarnValDefaultVal = true;
  25888. }
  25889. }
  25890. var value = LinkedValueUtils.getValue(props);
  25891. var initialValue = value;
  25892. // Only bother fetching default value if we're going to use it
  25893. if (value == null) {
  25894. var defaultValue = props.defaultValue;
  25895. // TODO (yungsters): Remove support for children content in <textarea>.
  25896. var children = props.children;
  25897. if (children != null) {
  25898. if (false) {
  25899. process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
  25900. }
  25901. !(defaultValue == null) ? false ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0;
  25902. if (Array.isArray(children)) {
  25903. !(children.length <= 1) ? false ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0;
  25904. children = children[0];
  25905. }
  25906. defaultValue = '' + children;
  25907. }
  25908. if (defaultValue == null) {
  25909. defaultValue = '';
  25910. }
  25911. initialValue = defaultValue;
  25912. }
  25913. inst._wrapperState = {
  25914. initialValue: '' + initialValue,
  25915. listeners: null,
  25916. onChange: _handleChange.bind(inst)
  25917. };
  25918. },
  25919. updateWrapper: function (inst) {
  25920. var props = inst._currentElement.props;
  25921. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25922. var value = LinkedValueUtils.getValue(props);
  25923. if (value != null) {
  25924. // Cast `value` to a string to ensure the value is set correctly. While
  25925. // browsers typically do this as necessary, jsdom doesn't.
  25926. var newValue = '' + value;
  25927. // To avoid side effects (such as losing text selection), only set value if changed
  25928. if (newValue !== node.value) {
  25929. node.value = newValue;
  25930. }
  25931. if (props.defaultValue == null) {
  25932. node.defaultValue = newValue;
  25933. }
  25934. }
  25935. if (props.defaultValue != null) {
  25936. node.defaultValue = props.defaultValue;
  25937. }
  25938. },
  25939. postMountWrapper: function (inst) {
  25940. // This is in postMount because we need access to the DOM node, which is not
  25941. // available until after the component has mounted.
  25942. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25943. var textContent = node.textContent;
  25944. // Only set node.value if textContent is equal to the expected
  25945. // initial value. In IE10/IE11 there is a bug where the placeholder attribute
  25946. // will populate textContent as well.
  25947. // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
  25948. if (textContent === inst._wrapperState.initialValue) {
  25949. node.value = textContent;
  25950. }
  25951. }
  25952. };
  25953. function _handleChange(event) {
  25954. var props = this._currentElement.props;
  25955. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  25956. ReactUpdates.asap(forceUpdateIfMounted, this);
  25957. return returnValue;
  25958. }
  25959. module.exports = ReactDOMTextarea;
  25960. /***/ }),
  25961. /* 192 */
  25962. /***/ (function(module, exports, __webpack_require__) {
  25963. "use strict";
  25964. /**
  25965. * Copyright 2015-present, Facebook, Inc.
  25966. * All rights reserved.
  25967. *
  25968. * This source code is licensed under the BSD-style license found in the
  25969. * LICENSE file in the root directory of this source tree. An additional grant
  25970. * of patent rights can be found in the PATENTS file in the same directory.
  25971. *
  25972. */
  25973. var _prodInvariant = __webpack_require__(2);
  25974. var invariant = __webpack_require__(0);
  25975. /**
  25976. * Return the lowest common ancestor of A and B, or null if they are in
  25977. * different trees.
  25978. */
  25979. function getLowestCommonAncestor(instA, instB) {
  25980. !('_hostNode' in instA) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  25981. !('_hostNode' in instB) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  25982. var depthA = 0;
  25983. for (var tempA = instA; tempA; tempA = tempA._hostParent) {
  25984. depthA++;
  25985. }
  25986. var depthB = 0;
  25987. for (var tempB = instB; tempB; tempB = tempB._hostParent) {
  25988. depthB++;
  25989. }
  25990. // If A is deeper, crawl up.
  25991. while (depthA - depthB > 0) {
  25992. instA = instA._hostParent;
  25993. depthA--;
  25994. }
  25995. // If B is deeper, crawl up.
  25996. while (depthB - depthA > 0) {
  25997. instB = instB._hostParent;
  25998. depthB--;
  25999. }
  26000. // Walk in lockstep until we find a match.
  26001. var depth = depthA;
  26002. while (depth--) {
  26003. if (instA === instB) {
  26004. return instA;
  26005. }
  26006. instA = instA._hostParent;
  26007. instB = instB._hostParent;
  26008. }
  26009. return null;
  26010. }
  26011. /**
  26012. * Return if A is an ancestor of B.
  26013. */
  26014. function isAncestor(instA, instB) {
  26015. !('_hostNode' in instA) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  26016. !('_hostNode' in instB) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  26017. while (instB) {
  26018. if (instB === instA) {
  26019. return true;
  26020. }
  26021. instB = instB._hostParent;
  26022. }
  26023. return false;
  26024. }
  26025. /**
  26026. * Return the parent instance of the passed-in instance.
  26027. */
  26028. function getParentInstance(inst) {
  26029. !('_hostNode' in inst) ? false ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
  26030. return inst._hostParent;
  26031. }
  26032. /**
  26033. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  26034. */
  26035. function traverseTwoPhase(inst, fn, arg) {
  26036. var path = [];
  26037. while (inst) {
  26038. path.push(inst);
  26039. inst = inst._hostParent;
  26040. }
  26041. var i;
  26042. for (i = path.length; i-- > 0;) {
  26043. fn(path[i], 'captured', arg);
  26044. }
  26045. for (i = 0; i < path.length; i++) {
  26046. fn(path[i], 'bubbled', arg);
  26047. }
  26048. }
  26049. /**
  26050. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  26051. * should would receive a `mouseEnter` or `mouseLeave` event.
  26052. *
  26053. * Does not invoke the callback on the nearest common ancestor because nothing
  26054. * "entered" or "left" that element.
  26055. */
  26056. function traverseEnterLeave(from, to, fn, argFrom, argTo) {
  26057. var common = from && to ? getLowestCommonAncestor(from, to) : null;
  26058. var pathFrom = [];
  26059. while (from && from !== common) {
  26060. pathFrom.push(from);
  26061. from = from._hostParent;
  26062. }
  26063. var pathTo = [];
  26064. while (to && to !== common) {
  26065. pathTo.push(to);
  26066. to = to._hostParent;
  26067. }
  26068. var i;
  26069. for (i = 0; i < pathFrom.length; i++) {
  26070. fn(pathFrom[i], 'bubbled', argFrom);
  26071. }
  26072. for (i = pathTo.length; i-- > 0;) {
  26073. fn(pathTo[i], 'captured', argTo);
  26074. }
  26075. }
  26076. module.exports = {
  26077. isAncestor: isAncestor,
  26078. getLowestCommonAncestor: getLowestCommonAncestor,
  26079. getParentInstance: getParentInstance,
  26080. traverseTwoPhase: traverseTwoPhase,
  26081. traverseEnterLeave: traverseEnterLeave
  26082. };
  26083. /***/ }),
  26084. /* 193 */
  26085. /***/ (function(module, exports, __webpack_require__) {
  26086. "use strict";
  26087. /**
  26088. * Copyright 2013-present, Facebook, Inc.
  26089. * All rights reserved.
  26090. *
  26091. * This source code is licensed under the BSD-style license found in the
  26092. * LICENSE file in the root directory of this source tree. An additional grant
  26093. * of patent rights can be found in the PATENTS file in the same directory.
  26094. *
  26095. */
  26096. var _assign = __webpack_require__(3);
  26097. var ReactUpdates = __webpack_require__(12);
  26098. var Transaction = __webpack_require__(34);
  26099. var emptyFunction = __webpack_require__(10);
  26100. var RESET_BATCHED_UPDATES = {
  26101. initialize: emptyFunction,
  26102. close: function () {
  26103. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  26104. }
  26105. };
  26106. var FLUSH_BATCHED_UPDATES = {
  26107. initialize: emptyFunction,
  26108. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  26109. };
  26110. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  26111. function ReactDefaultBatchingStrategyTransaction() {
  26112. this.reinitializeTransaction();
  26113. }
  26114. _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, {
  26115. getTransactionWrappers: function () {
  26116. return TRANSACTION_WRAPPERS;
  26117. }
  26118. });
  26119. var transaction = new ReactDefaultBatchingStrategyTransaction();
  26120. var ReactDefaultBatchingStrategy = {
  26121. isBatchingUpdates: false,
  26122. /**
  26123. * Call the provided function in a context within which calls to `setState`
  26124. * and friends are batched such that components aren't updated unnecessarily.
  26125. */
  26126. batchedUpdates: function (callback, a, b, c, d, e) {
  26127. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  26128. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  26129. // The code is written this way to avoid extra allocations
  26130. if (alreadyBatchingUpdates) {
  26131. return callback(a, b, c, d, e);
  26132. } else {
  26133. return transaction.perform(callback, null, a, b, c, d, e);
  26134. }
  26135. }
  26136. };
  26137. module.exports = ReactDefaultBatchingStrategy;
  26138. /***/ }),
  26139. /* 194 */
  26140. /***/ (function(module, exports, __webpack_require__) {
  26141. "use strict";
  26142. /**
  26143. * Copyright 2013-present, Facebook, Inc.
  26144. * All rights reserved.
  26145. *
  26146. * This source code is licensed under the BSD-style license found in the
  26147. * LICENSE file in the root directory of this source tree. An additional grant
  26148. * of patent rights can be found in the PATENTS file in the same directory.
  26149. *
  26150. */
  26151. var ARIADOMPropertyConfig = __webpack_require__(168);
  26152. var BeforeInputEventPlugin = __webpack_require__(170);
  26153. var ChangeEventPlugin = __webpack_require__(172);
  26154. var DefaultEventPluginOrder = __webpack_require__(174);
  26155. var EnterLeaveEventPlugin = __webpack_require__(175);
  26156. var HTMLDOMPropertyConfig = __webpack_require__(177);
  26157. var ReactComponentBrowserEnvironment = __webpack_require__(179);
  26158. var ReactDOMComponent = __webpack_require__(182);
  26159. var ReactDOMComponentTree = __webpack_require__(5);
  26160. var ReactDOMEmptyComponent = __webpack_require__(184);
  26161. var ReactDOMTreeTraversal = __webpack_require__(192);
  26162. var ReactDOMTextComponent = __webpack_require__(190);
  26163. var ReactDefaultBatchingStrategy = __webpack_require__(193);
  26164. var ReactEventListener = __webpack_require__(197);
  26165. var ReactInjection = __webpack_require__(198);
  26166. var ReactReconcileTransaction = __webpack_require__(203);
  26167. var SVGDOMPropertyConfig = __webpack_require__(208);
  26168. var SelectEventPlugin = __webpack_require__(209);
  26169. var SimpleEventPlugin = __webpack_require__(210);
  26170. var alreadyInjected = false;
  26171. function inject() {
  26172. if (alreadyInjected) {
  26173. // TODO: This is currently true because these injections are shared between
  26174. // the client and the server package. They should be built independently
  26175. // and not share any injection state. Then this problem will be solved.
  26176. return;
  26177. }
  26178. alreadyInjected = true;
  26179. ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
  26180. /**
  26181. * Inject modules for resolving DOM hierarchy and plugin ordering.
  26182. */
  26183. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  26184. ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
  26185. ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
  26186. /**
  26187. * Some important event plugins included by default (without having to require
  26188. * them).
  26189. */
  26190. ReactInjection.EventPluginHub.injectEventPluginsByName({
  26191. SimpleEventPlugin: SimpleEventPlugin,
  26192. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  26193. ChangeEventPlugin: ChangeEventPlugin,
  26194. SelectEventPlugin: SelectEventPlugin,
  26195. BeforeInputEventPlugin: BeforeInputEventPlugin
  26196. });
  26197. ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
  26198. ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
  26199. ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig);
  26200. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  26201. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  26202. ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
  26203. return new ReactDOMEmptyComponent(instantiate);
  26204. });
  26205. ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
  26206. ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  26207. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  26208. }
  26209. module.exports = {
  26210. inject: inject
  26211. };
  26212. /***/ }),
  26213. /* 195 */
  26214. /***/ (function(module, exports, __webpack_require__) {
  26215. "use strict";
  26216. /**
  26217. * Copyright 2014-present, Facebook, Inc.
  26218. * All rights reserved.
  26219. *
  26220. * This source code is licensed under the BSD-style license found in the
  26221. * LICENSE file in the root directory of this source tree. An additional grant
  26222. * of patent rights can be found in the PATENTS file in the same directory.
  26223. *
  26224. *
  26225. */
  26226. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  26227. // nor polyfill, then a plain number is used for performance.
  26228. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  26229. module.exports = REACT_ELEMENT_TYPE;
  26230. /***/ }),
  26231. /* 196 */
  26232. /***/ (function(module, exports, __webpack_require__) {
  26233. "use strict";
  26234. /**
  26235. * Copyright 2013-present, Facebook, Inc.
  26236. * All rights reserved.
  26237. *
  26238. * This source code is licensed under the BSD-style license found in the
  26239. * LICENSE file in the root directory of this source tree. An additional grant
  26240. * of patent rights can be found in the PATENTS file in the same directory.
  26241. *
  26242. */
  26243. var EventPluginHub = __webpack_require__(25);
  26244. function runEventQueueInBatch(events) {
  26245. EventPluginHub.enqueueEvents(events);
  26246. EventPluginHub.processEventQueue(false);
  26247. }
  26248. var ReactEventEmitterMixin = {
  26249. /**
  26250. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  26251. * opportunity to create `ReactEvent`s to be dispatched.
  26252. */
  26253. handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  26254. var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  26255. runEventQueueInBatch(events);
  26256. }
  26257. };
  26258. module.exports = ReactEventEmitterMixin;
  26259. /***/ }),
  26260. /* 197 */
  26261. /***/ (function(module, exports, __webpack_require__) {
  26262. "use strict";
  26263. /**
  26264. * Copyright 2013-present, Facebook, Inc.
  26265. * All rights reserved.
  26266. *
  26267. * This source code is licensed under the BSD-style license found in the
  26268. * LICENSE file in the root directory of this source tree. An additional grant
  26269. * of patent rights can be found in the PATENTS file in the same directory.
  26270. *
  26271. */
  26272. var _assign = __webpack_require__(3);
  26273. var EventListener = __webpack_require__(73);
  26274. var ExecutionEnvironment = __webpack_require__(9);
  26275. var PooledClass = __webpack_require__(15);
  26276. var ReactDOMComponentTree = __webpack_require__(5);
  26277. var ReactUpdates = __webpack_require__(12);
  26278. var getEventTarget = __webpack_require__(61);
  26279. var getUnboundedScrollPosition = __webpack_require__(162);
  26280. /**
  26281. * Find the deepest React component completely containing the root of the
  26282. * passed-in instance (for use when entire React trees are nested within each
  26283. * other). If React trees are not nested, returns null.
  26284. */
  26285. function findParent(inst) {
  26286. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  26287. // traversal, but caching is difficult to do correctly without using a
  26288. // mutation observer to listen for all DOM changes.
  26289. while (inst._hostParent) {
  26290. inst = inst._hostParent;
  26291. }
  26292. var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
  26293. var container = rootNode.parentNode;
  26294. return ReactDOMComponentTree.getClosestInstanceFromNode(container);
  26295. }
  26296. // Used to store ancestor hierarchy in top level callback
  26297. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  26298. this.topLevelType = topLevelType;
  26299. this.nativeEvent = nativeEvent;
  26300. this.ancestors = [];
  26301. }
  26302. _assign(TopLevelCallbackBookKeeping.prototype, {
  26303. destructor: function () {
  26304. this.topLevelType = null;
  26305. this.nativeEvent = null;
  26306. this.ancestors.length = 0;
  26307. }
  26308. });
  26309. PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
  26310. function handleTopLevelImpl(bookKeeping) {
  26311. var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
  26312. var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
  26313. // Loop through the hierarchy, in case there's any nested components.
  26314. // It's important that we build the array of ancestors before calling any
  26315. // event handlers, because event handlers can modify the DOM, leading to
  26316. // inconsistencies with ReactMount's node cache. See #1105.
  26317. var ancestor = targetInst;
  26318. do {
  26319. bookKeeping.ancestors.push(ancestor);
  26320. ancestor = ancestor && findParent(ancestor);
  26321. } while (ancestor);
  26322. for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  26323. targetInst = bookKeeping.ancestors[i];
  26324. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  26325. }
  26326. }
  26327. function scrollValueMonitor(cb) {
  26328. var scrollPosition = getUnboundedScrollPosition(window);
  26329. cb(scrollPosition);
  26330. }
  26331. var ReactEventListener = {
  26332. _enabled: true,
  26333. _handleTopLevel: null,
  26334. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  26335. setHandleTopLevel: function (handleTopLevel) {
  26336. ReactEventListener._handleTopLevel = handleTopLevel;
  26337. },
  26338. setEnabled: function (enabled) {
  26339. ReactEventListener._enabled = !!enabled;
  26340. },
  26341. isEnabled: function () {
  26342. return ReactEventListener._enabled;
  26343. },
  26344. /**
  26345. * Traps top-level events by using event bubbling.
  26346. *
  26347. * @param {string} topLevelType Record from `EventConstants`.
  26348. * @param {string} handlerBaseName Event name (e.g. "click").
  26349. * @param {object} element Element on which to attach listener.
  26350. * @return {?object} An object with a remove function which will forcefully
  26351. * remove the listener.
  26352. * @internal
  26353. */
  26354. trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
  26355. if (!element) {
  26356. return null;
  26357. }
  26358. return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  26359. },
  26360. /**
  26361. * Traps a top-level event by using event capturing.
  26362. *
  26363. * @param {string} topLevelType Record from `EventConstants`.
  26364. * @param {string} handlerBaseName Event name (e.g. "click").
  26365. * @param {object} element Element on which to attach listener.
  26366. * @return {?object} An object with a remove function which will forcefully
  26367. * remove the listener.
  26368. * @internal
  26369. */
  26370. trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
  26371. if (!element) {
  26372. return null;
  26373. }
  26374. return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  26375. },
  26376. monitorScrollValue: function (refresh) {
  26377. var callback = scrollValueMonitor.bind(null, refresh);
  26378. EventListener.listen(window, 'scroll', callback);
  26379. },
  26380. dispatchEvent: function (topLevelType, nativeEvent) {
  26381. if (!ReactEventListener._enabled) {
  26382. return;
  26383. }
  26384. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
  26385. try {
  26386. // Event queue being processed in the same cycle allows
  26387. // `preventDefault`.
  26388. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  26389. } finally {
  26390. TopLevelCallbackBookKeeping.release(bookKeeping);
  26391. }
  26392. }
  26393. };
  26394. module.exports = ReactEventListener;
  26395. /***/ }),
  26396. /* 198 */
  26397. /***/ (function(module, exports, __webpack_require__) {
  26398. "use strict";
  26399. /**
  26400. * Copyright 2013-present, Facebook, Inc.
  26401. * All rights reserved.
  26402. *
  26403. * This source code is licensed under the BSD-style license found in the
  26404. * LICENSE file in the root directory of this source tree. An additional grant
  26405. * of patent rights can be found in the PATENTS file in the same directory.
  26406. *
  26407. */
  26408. var DOMProperty = __webpack_require__(19);
  26409. var EventPluginHub = __webpack_require__(25);
  26410. var EventPluginUtils = __webpack_require__(52);
  26411. var ReactComponentEnvironment = __webpack_require__(55);
  26412. var ReactEmptyComponent = __webpack_require__(82);
  26413. var ReactBrowserEventEmitter = __webpack_require__(32);
  26414. var ReactHostComponent = __webpack_require__(84);
  26415. var ReactUpdates = __webpack_require__(12);
  26416. var ReactInjection = {
  26417. Component: ReactComponentEnvironment.injection,
  26418. DOMProperty: DOMProperty.injection,
  26419. EmptyComponent: ReactEmptyComponent.injection,
  26420. EventPluginHub: EventPluginHub.injection,
  26421. EventPluginUtils: EventPluginUtils.injection,
  26422. EventEmitter: ReactBrowserEventEmitter.injection,
  26423. HostComponent: ReactHostComponent.injection,
  26424. Updates: ReactUpdates.injection
  26425. };
  26426. module.exports = ReactInjection;
  26427. /***/ }),
  26428. /* 199 */
  26429. /***/ (function(module, exports, __webpack_require__) {
  26430. "use strict";
  26431. /**
  26432. * Copyright 2013-present, Facebook, Inc.
  26433. * All rights reserved.
  26434. *
  26435. * This source code is licensed under the BSD-style license found in the
  26436. * LICENSE file in the root directory of this source tree. An additional grant
  26437. * of patent rights can be found in the PATENTS file in the same directory.
  26438. *
  26439. */
  26440. var adler32 = __webpack_require__(221);
  26441. var TAG_END = /\/?>/;
  26442. var COMMENT_START = /^<\!\-\-/;
  26443. var ReactMarkupChecksum = {
  26444. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  26445. /**
  26446. * @param {string} markup Markup string
  26447. * @return {string} Markup string with checksum attribute attached
  26448. */
  26449. addChecksumToMarkup: function (markup) {
  26450. var checksum = adler32(markup);
  26451. // Add checksum (handle both parent tags, comments and self-closing tags)
  26452. if (COMMENT_START.test(markup)) {
  26453. return markup;
  26454. } else {
  26455. return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
  26456. }
  26457. },
  26458. /**
  26459. * @param {string} markup to use
  26460. * @param {DOMElement} element root React element
  26461. * @returns {boolean} whether or not the markup is the same
  26462. */
  26463. canReuseMarkup: function (markup, element) {
  26464. var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  26465. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  26466. var markupChecksum = adler32(markup);
  26467. return markupChecksum === existingChecksum;
  26468. }
  26469. };
  26470. module.exports = ReactMarkupChecksum;
  26471. /***/ }),
  26472. /* 200 */
  26473. /***/ (function(module, exports, __webpack_require__) {
  26474. "use strict";
  26475. /**
  26476. * Copyright 2013-present, Facebook, Inc.
  26477. * All rights reserved.
  26478. *
  26479. * This source code is licensed under the BSD-style license found in the
  26480. * LICENSE file in the root directory of this source tree. An additional grant
  26481. * of patent rights can be found in the PATENTS file in the same directory.
  26482. *
  26483. */
  26484. var _prodInvariant = __webpack_require__(2);
  26485. var ReactComponentEnvironment = __webpack_require__(55);
  26486. var ReactInstanceMap = __webpack_require__(27);
  26487. var ReactInstrumentation = __webpack_require__(11);
  26488. var ReactCurrentOwner = __webpack_require__(14);
  26489. var ReactReconciler = __webpack_require__(20);
  26490. var ReactChildReconciler = __webpack_require__(178);
  26491. var emptyFunction = __webpack_require__(10);
  26492. var flattenChildren = __webpack_require__(224);
  26493. var invariant = __webpack_require__(0);
  26494. /**
  26495. * Make an update for markup to be rendered and inserted at a supplied index.
  26496. *
  26497. * @param {string} markup Markup that renders into an element.
  26498. * @param {number} toIndex Destination index.
  26499. * @private
  26500. */
  26501. function makeInsertMarkup(markup, afterNode, toIndex) {
  26502. // NOTE: Null values reduce hidden classes.
  26503. return {
  26504. type: 'INSERT_MARKUP',
  26505. content: markup,
  26506. fromIndex: null,
  26507. fromNode: null,
  26508. toIndex: toIndex,
  26509. afterNode: afterNode
  26510. };
  26511. }
  26512. /**
  26513. * Make an update for moving an existing element to another index.
  26514. *
  26515. * @param {number} fromIndex Source index of the existing element.
  26516. * @param {number} toIndex Destination index of the element.
  26517. * @private
  26518. */
  26519. function makeMove(child, afterNode, toIndex) {
  26520. // NOTE: Null values reduce hidden classes.
  26521. return {
  26522. type: 'MOVE_EXISTING',
  26523. content: null,
  26524. fromIndex: child._mountIndex,
  26525. fromNode: ReactReconciler.getHostNode(child),
  26526. toIndex: toIndex,
  26527. afterNode: afterNode
  26528. };
  26529. }
  26530. /**
  26531. * Make an update for removing an element at an index.
  26532. *
  26533. * @param {number} fromIndex Index of the element to remove.
  26534. * @private
  26535. */
  26536. function makeRemove(child, node) {
  26537. // NOTE: Null values reduce hidden classes.
  26538. return {
  26539. type: 'REMOVE_NODE',
  26540. content: null,
  26541. fromIndex: child._mountIndex,
  26542. fromNode: node,
  26543. toIndex: null,
  26544. afterNode: null
  26545. };
  26546. }
  26547. /**
  26548. * Make an update for setting the markup of a node.
  26549. *
  26550. * @param {string} markup Markup that renders into an element.
  26551. * @private
  26552. */
  26553. function makeSetMarkup(markup) {
  26554. // NOTE: Null values reduce hidden classes.
  26555. return {
  26556. type: 'SET_MARKUP',
  26557. content: markup,
  26558. fromIndex: null,
  26559. fromNode: null,
  26560. toIndex: null,
  26561. afterNode: null
  26562. };
  26563. }
  26564. /**
  26565. * Make an update for setting the text content.
  26566. *
  26567. * @param {string} textContent Text content to set.
  26568. * @private
  26569. */
  26570. function makeTextContent(textContent) {
  26571. // NOTE: Null values reduce hidden classes.
  26572. return {
  26573. type: 'TEXT_CONTENT',
  26574. content: textContent,
  26575. fromIndex: null,
  26576. fromNode: null,
  26577. toIndex: null,
  26578. afterNode: null
  26579. };
  26580. }
  26581. /**
  26582. * Push an update, if any, onto the queue. Creates a new queue if none is
  26583. * passed and always returns the queue. Mutative.
  26584. */
  26585. function enqueue(queue, update) {
  26586. if (update) {
  26587. queue = queue || [];
  26588. queue.push(update);
  26589. }
  26590. return queue;
  26591. }
  26592. /**
  26593. * Processes any enqueued updates.
  26594. *
  26595. * @private
  26596. */
  26597. function processQueue(inst, updateQueue) {
  26598. ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
  26599. }
  26600. var setChildrenForInstrumentation = emptyFunction;
  26601. if (false) {
  26602. var getDebugID = function (inst) {
  26603. if (!inst._debugID) {
  26604. // Check for ART-like instances. TODO: This is silly/gross.
  26605. var internal;
  26606. if (internal = ReactInstanceMap.get(inst)) {
  26607. inst = internal;
  26608. }
  26609. }
  26610. return inst._debugID;
  26611. };
  26612. setChildrenForInstrumentation = function (children) {
  26613. var debugID = getDebugID(this);
  26614. // TODO: React Native empty components are also multichild.
  26615. // This means they still get into this method but don't have _debugID.
  26616. if (debugID !== 0) {
  26617. ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
  26618. return children[key]._debugID;
  26619. }) : []);
  26620. }
  26621. };
  26622. }
  26623. /**
  26624. * ReactMultiChild are capable of reconciling multiple children.
  26625. *
  26626. * @class ReactMultiChild
  26627. * @internal
  26628. */
  26629. var ReactMultiChild = {
  26630. /**
  26631. * Provides common functionality for components that must reconcile multiple
  26632. * children. This is used by `ReactDOMComponent` to mount, update, and
  26633. * unmount child components.
  26634. *
  26635. * @lends {ReactMultiChild.prototype}
  26636. */
  26637. Mixin: {
  26638. _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
  26639. if (false) {
  26640. var selfDebugID = getDebugID(this);
  26641. if (this._currentElement) {
  26642. try {
  26643. ReactCurrentOwner.current = this._currentElement._owner;
  26644. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
  26645. } finally {
  26646. ReactCurrentOwner.current = null;
  26647. }
  26648. }
  26649. }
  26650. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
  26651. },
  26652. _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
  26653. var nextChildren;
  26654. var selfDebugID = 0;
  26655. if (false) {
  26656. selfDebugID = getDebugID(this);
  26657. if (this._currentElement) {
  26658. try {
  26659. ReactCurrentOwner.current = this._currentElement._owner;
  26660. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  26661. } finally {
  26662. ReactCurrentOwner.current = null;
  26663. }
  26664. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26665. return nextChildren;
  26666. }
  26667. }
  26668. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  26669. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26670. return nextChildren;
  26671. },
  26672. /**
  26673. * Generates a "mount image" for each of the supplied children. In the case
  26674. * of `ReactDOMComponent`, a mount image is a string of markup.
  26675. *
  26676. * @param {?object} nestedChildren Nested child maps.
  26677. * @return {array} An array of mounted representations.
  26678. * @internal
  26679. */
  26680. mountChildren: function (nestedChildren, transaction, context) {
  26681. var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
  26682. this._renderedChildren = children;
  26683. var mountImages = [];
  26684. var index = 0;
  26685. for (var name in children) {
  26686. if (children.hasOwnProperty(name)) {
  26687. var child = children[name];
  26688. var selfDebugID = 0;
  26689. if (false) {
  26690. selfDebugID = getDebugID(this);
  26691. }
  26692. var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26693. child._mountIndex = index++;
  26694. mountImages.push(mountImage);
  26695. }
  26696. }
  26697. if (false) {
  26698. setChildrenForInstrumentation.call(this, children);
  26699. }
  26700. return mountImages;
  26701. },
  26702. /**
  26703. * Replaces any rendered children with a text content string.
  26704. *
  26705. * @param {string} nextContent String of content.
  26706. * @internal
  26707. */
  26708. updateTextContent: function (nextContent) {
  26709. var prevChildren = this._renderedChildren;
  26710. // Remove any rendered children.
  26711. ReactChildReconciler.unmountChildren(prevChildren, false);
  26712. for (var name in prevChildren) {
  26713. if (prevChildren.hasOwnProperty(name)) {
  26714. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  26715. }
  26716. }
  26717. // Set new text content.
  26718. var updates = [makeTextContent(nextContent)];
  26719. processQueue(this, updates);
  26720. },
  26721. /**
  26722. * Replaces any rendered children with a markup string.
  26723. *
  26724. * @param {string} nextMarkup String of markup.
  26725. * @internal
  26726. */
  26727. updateMarkup: function (nextMarkup) {
  26728. var prevChildren = this._renderedChildren;
  26729. // Remove any rendered children.
  26730. ReactChildReconciler.unmountChildren(prevChildren, false);
  26731. for (var name in prevChildren) {
  26732. if (prevChildren.hasOwnProperty(name)) {
  26733. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  26734. }
  26735. }
  26736. var updates = [makeSetMarkup(nextMarkup)];
  26737. processQueue(this, updates);
  26738. },
  26739. /**
  26740. * Updates the rendered children with new children.
  26741. *
  26742. * @param {?object} nextNestedChildrenElements Nested child element maps.
  26743. * @param {ReactReconcileTransaction} transaction
  26744. * @internal
  26745. */
  26746. updateChildren: function (nextNestedChildrenElements, transaction, context) {
  26747. // Hook used by React ART
  26748. this._updateChildren(nextNestedChildrenElements, transaction, context);
  26749. },
  26750. /**
  26751. * @param {?object} nextNestedChildrenElements Nested child element maps.
  26752. * @param {ReactReconcileTransaction} transaction
  26753. * @final
  26754. * @protected
  26755. */
  26756. _updateChildren: function (nextNestedChildrenElements, transaction, context) {
  26757. var prevChildren = this._renderedChildren;
  26758. var removedNodes = {};
  26759. var mountImages = [];
  26760. var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context);
  26761. if (!nextChildren && !prevChildren) {
  26762. return;
  26763. }
  26764. var updates = null;
  26765. var name;
  26766. // `nextIndex` will increment for each child in `nextChildren`, but
  26767. // `lastIndex` will be the last index visited in `prevChildren`.
  26768. var nextIndex = 0;
  26769. var lastIndex = 0;
  26770. // `nextMountIndex` will increment for each newly mounted child.
  26771. var nextMountIndex = 0;
  26772. var lastPlacedNode = null;
  26773. for (name in nextChildren) {
  26774. if (!nextChildren.hasOwnProperty(name)) {
  26775. continue;
  26776. }
  26777. var prevChild = prevChildren && prevChildren[name];
  26778. var nextChild = nextChildren[name];
  26779. if (prevChild === nextChild) {
  26780. updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
  26781. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  26782. prevChild._mountIndex = nextIndex;
  26783. } else {
  26784. if (prevChild) {
  26785. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  26786. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  26787. // The `removedNodes` loop below will actually remove the child.
  26788. }
  26789. // The child must be instantiated before it's mounted.
  26790. updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context));
  26791. nextMountIndex++;
  26792. }
  26793. nextIndex++;
  26794. lastPlacedNode = ReactReconciler.getHostNode(nextChild);
  26795. }
  26796. // Remove children that are no longer present.
  26797. for (name in removedNodes) {
  26798. if (removedNodes.hasOwnProperty(name)) {
  26799. updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
  26800. }
  26801. }
  26802. if (updates) {
  26803. processQueue(this, updates);
  26804. }
  26805. this._renderedChildren = nextChildren;
  26806. if (false) {
  26807. setChildrenForInstrumentation.call(this, nextChildren);
  26808. }
  26809. },
  26810. /**
  26811. * Unmounts all rendered children. This should be used to clean up children
  26812. * when this component is unmounted. It does not actually perform any
  26813. * backend operations.
  26814. *
  26815. * @internal
  26816. */
  26817. unmountChildren: function (safely) {
  26818. var renderedChildren = this._renderedChildren;
  26819. ReactChildReconciler.unmountChildren(renderedChildren, safely);
  26820. this._renderedChildren = null;
  26821. },
  26822. /**
  26823. * Moves a child component to the supplied index.
  26824. *
  26825. * @param {ReactComponent} child Component to move.
  26826. * @param {number} toIndex Destination index of the element.
  26827. * @param {number} lastIndex Last index visited of the siblings of `child`.
  26828. * @protected
  26829. */
  26830. moveChild: function (child, afterNode, toIndex, lastIndex) {
  26831. // If the index of `child` is less than `lastIndex`, then it needs to
  26832. // be moved. Otherwise, we do not need to move it because a child will be
  26833. // inserted or moved before `child`.
  26834. if (child._mountIndex < lastIndex) {
  26835. return makeMove(child, afterNode, toIndex);
  26836. }
  26837. },
  26838. /**
  26839. * Creates a child component.
  26840. *
  26841. * @param {ReactComponent} child Component to create.
  26842. * @param {string} mountImage Markup to insert.
  26843. * @protected
  26844. */
  26845. createChild: function (child, afterNode, mountImage) {
  26846. return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
  26847. },
  26848. /**
  26849. * Removes a child component.
  26850. *
  26851. * @param {ReactComponent} child Child to remove.
  26852. * @protected
  26853. */
  26854. removeChild: function (child, node) {
  26855. return makeRemove(child, node);
  26856. },
  26857. /**
  26858. * Mounts a child with the supplied name.
  26859. *
  26860. * NOTE: This is part of `updateChildren` and is here for readability.
  26861. *
  26862. * @param {ReactComponent} child Component to mount.
  26863. * @param {string} name Name of the child.
  26864. * @param {number} index Index at which to insert the child.
  26865. * @param {ReactReconcileTransaction} transaction
  26866. * @private
  26867. */
  26868. _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) {
  26869. child._mountIndex = index;
  26870. return this.createChild(child, afterNode, mountImage);
  26871. },
  26872. /**
  26873. * Unmounts a rendered child.
  26874. *
  26875. * NOTE: This is part of `updateChildren` and is here for readability.
  26876. *
  26877. * @param {ReactComponent} child Component to unmount.
  26878. * @private
  26879. */
  26880. _unmountChild: function (child, node) {
  26881. var update = this.removeChild(child, node);
  26882. child._mountIndex = null;
  26883. return update;
  26884. }
  26885. }
  26886. };
  26887. module.exports = ReactMultiChild;
  26888. /***/ }),
  26889. /* 201 */
  26890. /***/ (function(module, exports, __webpack_require__) {
  26891. "use strict";
  26892. /**
  26893. * Copyright 2013-present, Facebook, Inc.
  26894. * All rights reserved.
  26895. *
  26896. * This source code is licensed under the BSD-style license found in the
  26897. * LICENSE file in the root directory of this source tree. An additional grant
  26898. * of patent rights can be found in the PATENTS file in the same directory.
  26899. *
  26900. *
  26901. */
  26902. var _prodInvariant = __webpack_require__(2);
  26903. var invariant = __webpack_require__(0);
  26904. /**
  26905. * @param {?object} object
  26906. * @return {boolean} True if `object` is a valid owner.
  26907. * @final
  26908. */
  26909. function isValidOwner(object) {
  26910. return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
  26911. }
  26912. /**
  26913. * ReactOwners are capable of storing references to owned components.
  26914. *
  26915. * All components are capable of //being// referenced by owner components, but
  26916. * only ReactOwner components are capable of //referencing// owned components.
  26917. * The named reference is known as a "ref".
  26918. *
  26919. * Refs are available when mounted and updated during reconciliation.
  26920. *
  26921. * var MyComponent = React.createClass({
  26922. * render: function() {
  26923. * return (
  26924. * <div onClick={this.handleClick}>
  26925. * <CustomComponent ref="custom" />
  26926. * </div>
  26927. * );
  26928. * },
  26929. * handleClick: function() {
  26930. * this.refs.custom.handleClick();
  26931. * },
  26932. * componentDidMount: function() {
  26933. * this.refs.custom.initialize();
  26934. * }
  26935. * });
  26936. *
  26937. * Refs should rarely be used. When refs are used, they should only be done to
  26938. * control data that is not handled by React's data flow.
  26939. *
  26940. * @class ReactOwner
  26941. */
  26942. var ReactOwner = {
  26943. /**
  26944. * Adds a component by ref to an owner component.
  26945. *
  26946. * @param {ReactComponent} component Component to reference.
  26947. * @param {string} ref Name by which to refer to the component.
  26948. * @param {ReactOwner} owner Component on which to record the ref.
  26949. * @final
  26950. * @internal
  26951. */
  26952. addComponentAsRefTo: function (component, ref, owner) {
  26953. !isValidOwner(owner) ? false ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0;
  26954. owner.attachRef(ref, component);
  26955. },
  26956. /**
  26957. * Removes a component by ref from an owner component.
  26958. *
  26959. * @param {ReactComponent} component Component to dereference.
  26960. * @param {string} ref Name of the ref to remove.
  26961. * @param {ReactOwner} owner Component on which the ref is recorded.
  26962. * @final
  26963. * @internal
  26964. */
  26965. removeComponentAsRefFrom: function (component, ref, owner) {
  26966. !isValidOwner(owner) ? false ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0;
  26967. var ownerPublicInstance = owner.getPublicInstance();
  26968. // Check that `component`'s owner is still alive and that `component` is still the current ref
  26969. // because we do not want to detach the ref if another component stole it.
  26970. if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
  26971. owner.detachRef(ref);
  26972. }
  26973. }
  26974. };
  26975. module.exports = ReactOwner;
  26976. /***/ }),
  26977. /* 202 */
  26978. /***/ (function(module, exports, __webpack_require__) {
  26979. "use strict";
  26980. /**
  26981. * Copyright 2013-present, Facebook, Inc.
  26982. * All rights reserved.
  26983. *
  26984. * This source code is licensed under the BSD-style license found in the
  26985. * LICENSE file in the root directory of this source tree. An additional grant
  26986. * of patent rights can be found in the PATENTS file in the same directory.
  26987. *
  26988. *
  26989. */
  26990. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  26991. module.exports = ReactPropTypesSecret;
  26992. /***/ }),
  26993. /* 203 */
  26994. /***/ (function(module, exports, __webpack_require__) {
  26995. "use strict";
  26996. /**
  26997. * Copyright 2013-present, Facebook, Inc.
  26998. * All rights reserved.
  26999. *
  27000. * This source code is licensed under the BSD-style license found in the
  27001. * LICENSE file in the root directory of this source tree. An additional grant
  27002. * of patent rights can be found in the PATENTS file in the same directory.
  27003. *
  27004. */
  27005. var _assign = __webpack_require__(3);
  27006. var CallbackQueue = __webpack_require__(78);
  27007. var PooledClass = __webpack_require__(15);
  27008. var ReactBrowserEventEmitter = __webpack_require__(32);
  27009. var ReactInputSelection = __webpack_require__(85);
  27010. var ReactInstrumentation = __webpack_require__(11);
  27011. var Transaction = __webpack_require__(34);
  27012. var ReactUpdateQueue = __webpack_require__(57);
  27013. /**
  27014. * Ensures that, when possible, the selection range (currently selected text
  27015. * input) is not disturbed by performing the transaction.
  27016. */
  27017. var SELECTION_RESTORATION = {
  27018. /**
  27019. * @return {Selection} Selection information.
  27020. */
  27021. initialize: ReactInputSelection.getSelectionInformation,
  27022. /**
  27023. * @param {Selection} sel Selection information returned from `initialize`.
  27024. */
  27025. close: ReactInputSelection.restoreSelection
  27026. };
  27027. /**
  27028. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  27029. * high level DOM manipulations (like temporarily removing a text input from the
  27030. * DOM).
  27031. */
  27032. var EVENT_SUPPRESSION = {
  27033. /**
  27034. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  27035. * the reconciliation.
  27036. */
  27037. initialize: function () {
  27038. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  27039. ReactBrowserEventEmitter.setEnabled(false);
  27040. return currentlyEnabled;
  27041. },
  27042. /**
  27043. * @param {boolean} previouslyEnabled Enabled status of
  27044. * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
  27045. * restores the previous value.
  27046. */
  27047. close: function (previouslyEnabled) {
  27048. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  27049. }
  27050. };
  27051. /**
  27052. * Provides a queue for collecting `componentDidMount` and
  27053. * `componentDidUpdate` callbacks during the transaction.
  27054. */
  27055. var ON_DOM_READY_QUEUEING = {
  27056. /**
  27057. * Initializes the internal `onDOMReady` queue.
  27058. */
  27059. initialize: function () {
  27060. this.reactMountReady.reset();
  27061. },
  27062. /**
  27063. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  27064. */
  27065. close: function () {
  27066. this.reactMountReady.notifyAll();
  27067. }
  27068. };
  27069. /**
  27070. * Executed within the scope of the `Transaction` instance. Consider these as
  27071. * being member methods, but with an implied ordering while being isolated from
  27072. * each other.
  27073. */
  27074. var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
  27075. if (false) {
  27076. TRANSACTION_WRAPPERS.push({
  27077. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  27078. close: ReactInstrumentation.debugTool.onEndFlush
  27079. });
  27080. }
  27081. /**
  27082. * Currently:
  27083. * - The order that these are listed in the transaction is critical:
  27084. * - Suppresses events.
  27085. * - Restores selection range.
  27086. *
  27087. * Future:
  27088. * - Restore document/overflow scroll positions that were unintentionally
  27089. * modified via DOM insertions above the top viewport boundary.
  27090. * - Implement/integrate with customized constraint based layout system and keep
  27091. * track of which dimensions must be remeasured.
  27092. *
  27093. * @class ReactReconcileTransaction
  27094. */
  27095. function ReactReconcileTransaction(useCreateElement) {
  27096. this.reinitializeTransaction();
  27097. // Only server-side rendering really needs this option (see
  27098. // `ReactServerRendering`), but server-side uses
  27099. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  27100. // accessible and defaults to false when `ReactDOMComponent` and
  27101. // `ReactDOMTextComponent` checks it in `mountComponent`.`
  27102. this.renderToStaticMarkup = false;
  27103. this.reactMountReady = CallbackQueue.getPooled(null);
  27104. this.useCreateElement = useCreateElement;
  27105. }
  27106. var Mixin = {
  27107. /**
  27108. * @see Transaction
  27109. * @abstract
  27110. * @final
  27111. * @return {array<object>} List of operation wrap procedures.
  27112. * TODO: convert to array<TransactionWrapper>
  27113. */
  27114. getTransactionWrappers: function () {
  27115. return TRANSACTION_WRAPPERS;
  27116. },
  27117. /**
  27118. * @return {object} The queue to collect `onDOMReady` callbacks with.
  27119. */
  27120. getReactMountReady: function () {
  27121. return this.reactMountReady;
  27122. },
  27123. /**
  27124. * @return {object} The queue to collect React async events.
  27125. */
  27126. getUpdateQueue: function () {
  27127. return ReactUpdateQueue;
  27128. },
  27129. /**
  27130. * Save current transaction state -- if the return value from this method is
  27131. * passed to `rollback`, the transaction will be reset to that state.
  27132. */
  27133. checkpoint: function () {
  27134. // reactMountReady is the our only stateful wrapper
  27135. return this.reactMountReady.checkpoint();
  27136. },
  27137. rollback: function (checkpoint) {
  27138. this.reactMountReady.rollback(checkpoint);
  27139. },
  27140. /**
  27141. * `PooledClass` looks for this, and will invoke this before allowing this
  27142. * instance to be reused.
  27143. */
  27144. destructor: function () {
  27145. CallbackQueue.release(this.reactMountReady);
  27146. this.reactMountReady = null;
  27147. }
  27148. };
  27149. _assign(ReactReconcileTransaction.prototype, Transaction, Mixin);
  27150. PooledClass.addPoolingTo(ReactReconcileTransaction);
  27151. module.exports = ReactReconcileTransaction;
  27152. /***/ }),
  27153. /* 204 */
  27154. /***/ (function(module, exports, __webpack_require__) {
  27155. "use strict";
  27156. /**
  27157. * Copyright 2013-present, Facebook, Inc.
  27158. * All rights reserved.
  27159. *
  27160. * This source code is licensed under the BSD-style license found in the
  27161. * LICENSE file in the root directory of this source tree. An additional grant
  27162. * of patent rights can be found in the PATENTS file in the same directory.
  27163. *
  27164. *
  27165. */
  27166. var ReactOwner = __webpack_require__(201);
  27167. var ReactRef = {};
  27168. function attachRef(ref, component, owner) {
  27169. if (typeof ref === 'function') {
  27170. ref(component.getPublicInstance());
  27171. } else {
  27172. // Legacy ref
  27173. ReactOwner.addComponentAsRefTo(component, ref, owner);
  27174. }
  27175. }
  27176. function detachRef(ref, component, owner) {
  27177. if (typeof ref === 'function') {
  27178. ref(null);
  27179. } else {
  27180. // Legacy ref
  27181. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  27182. }
  27183. }
  27184. ReactRef.attachRefs = function (instance, element) {
  27185. if (element === null || typeof element !== 'object') {
  27186. return;
  27187. }
  27188. var ref = element.ref;
  27189. if (ref != null) {
  27190. attachRef(ref, instance, element._owner);
  27191. }
  27192. };
  27193. ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
  27194. // If either the owner or a `ref` has changed, make sure the newest owner
  27195. // has stored a reference to `this`, and the previous owner (if different)
  27196. // has forgotten the reference to `this`. We use the element instead
  27197. // of the public this.props because the post processing cannot determine
  27198. // a ref. The ref conceptually lives on the element.
  27199. // TODO: Should this even be possible? The owner cannot change because
  27200. // it's forbidden by shouldUpdateReactComponent. The ref can change
  27201. // if you swap the keys of but not the refs. Reconsider where this check
  27202. // is made. It probably belongs where the key checking and
  27203. // instantiateReactComponent is done.
  27204. var prevRef = null;
  27205. var prevOwner = null;
  27206. if (prevElement !== null && typeof prevElement === 'object') {
  27207. prevRef = prevElement.ref;
  27208. prevOwner = prevElement._owner;
  27209. }
  27210. var nextRef = null;
  27211. var nextOwner = null;
  27212. if (nextElement !== null && typeof nextElement === 'object') {
  27213. nextRef = nextElement.ref;
  27214. nextOwner = nextElement._owner;
  27215. }
  27216. return prevRef !== nextRef ||
  27217. // If owner changes but we have an unchanged function ref, don't update refs
  27218. typeof nextRef === 'string' && nextOwner !== prevOwner;
  27219. };
  27220. ReactRef.detachRefs = function (instance, element) {
  27221. if (element === null || typeof element !== 'object') {
  27222. return;
  27223. }
  27224. var ref = element.ref;
  27225. if (ref != null) {
  27226. detachRef(ref, instance, element._owner);
  27227. }
  27228. };
  27229. module.exports = ReactRef;
  27230. /***/ }),
  27231. /* 205 */
  27232. /***/ (function(module, exports, __webpack_require__) {
  27233. "use strict";
  27234. /**
  27235. * Copyright 2014-present, Facebook, Inc.
  27236. * All rights reserved.
  27237. *
  27238. * This source code is licensed under the BSD-style license found in the
  27239. * LICENSE file in the root directory of this source tree. An additional grant
  27240. * of patent rights can be found in the PATENTS file in the same directory.
  27241. *
  27242. */
  27243. var _assign = __webpack_require__(3);
  27244. var PooledClass = __webpack_require__(15);
  27245. var Transaction = __webpack_require__(34);
  27246. var ReactInstrumentation = __webpack_require__(11);
  27247. var ReactServerUpdateQueue = __webpack_require__(206);
  27248. /**
  27249. * Executed within the scope of the `Transaction` instance. Consider these as
  27250. * being member methods, but with an implied ordering while being isolated from
  27251. * each other.
  27252. */
  27253. var TRANSACTION_WRAPPERS = [];
  27254. if (false) {
  27255. TRANSACTION_WRAPPERS.push({
  27256. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  27257. close: ReactInstrumentation.debugTool.onEndFlush
  27258. });
  27259. }
  27260. var noopCallbackQueue = {
  27261. enqueue: function () {}
  27262. };
  27263. /**
  27264. * @class ReactServerRenderingTransaction
  27265. * @param {boolean} renderToStaticMarkup
  27266. */
  27267. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  27268. this.reinitializeTransaction();
  27269. this.renderToStaticMarkup = renderToStaticMarkup;
  27270. this.useCreateElement = false;
  27271. this.updateQueue = new ReactServerUpdateQueue(this);
  27272. }
  27273. var Mixin = {
  27274. /**
  27275. * @see Transaction
  27276. * @abstract
  27277. * @final
  27278. * @return {array} Empty list of operation wrap procedures.
  27279. */
  27280. getTransactionWrappers: function () {
  27281. return TRANSACTION_WRAPPERS;
  27282. },
  27283. /**
  27284. * @return {object} The queue to collect `onDOMReady` callbacks with.
  27285. */
  27286. getReactMountReady: function () {
  27287. return noopCallbackQueue;
  27288. },
  27289. /**
  27290. * @return {object} The queue to collect React async events.
  27291. */
  27292. getUpdateQueue: function () {
  27293. return this.updateQueue;
  27294. },
  27295. /**
  27296. * `PooledClass` looks for this, and will invoke this before allowing this
  27297. * instance to be reused.
  27298. */
  27299. destructor: function () {},
  27300. checkpoint: function () {},
  27301. rollback: function () {}
  27302. };
  27303. _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin);
  27304. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  27305. module.exports = ReactServerRenderingTransaction;
  27306. /***/ }),
  27307. /* 206 */
  27308. /***/ (function(module, exports, __webpack_require__) {
  27309. "use strict";
  27310. /**
  27311. * Copyright 2015-present, Facebook, Inc.
  27312. * All rights reserved.
  27313. *
  27314. * This source code is licensed under the BSD-style license found in the
  27315. * LICENSE file in the root directory of this source tree. An additional grant
  27316. * of patent rights can be found in the PATENTS file in the same directory.
  27317. *
  27318. *
  27319. */
  27320. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  27321. var ReactUpdateQueue = __webpack_require__(57);
  27322. var warning = __webpack_require__(1);
  27323. function warnNoop(publicInstance, callerName) {
  27324. if (false) {
  27325. var constructor = publicInstance.constructor;
  27326. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
  27327. }
  27328. }
  27329. /**
  27330. * This is the update queue used for server rendering.
  27331. * It delegates to ReactUpdateQueue while server rendering is in progress and
  27332. * switches to ReactNoopUpdateQueue after the transaction has completed.
  27333. * @class ReactServerUpdateQueue
  27334. * @param {Transaction} transaction
  27335. */
  27336. var ReactServerUpdateQueue = function () {
  27337. function ReactServerUpdateQueue(transaction) {
  27338. _classCallCheck(this, ReactServerUpdateQueue);
  27339. this.transaction = transaction;
  27340. }
  27341. /**
  27342. * Checks whether or not this composite component is mounted.
  27343. * @param {ReactClass} publicInstance The instance we want to test.
  27344. * @return {boolean} True if mounted, false otherwise.
  27345. * @protected
  27346. * @final
  27347. */
  27348. ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
  27349. return false;
  27350. };
  27351. /**
  27352. * Enqueue a callback that will be executed after all the pending updates
  27353. * have processed.
  27354. *
  27355. * @param {ReactClass} publicInstance The instance to use as `this` context.
  27356. * @param {?function} callback Called after state is updated.
  27357. * @internal
  27358. */
  27359. ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
  27360. if (this.transaction.isInTransaction()) {
  27361. ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
  27362. }
  27363. };
  27364. /**
  27365. * Forces an update. This should only be invoked when it is known with
  27366. * certainty that we are **not** in a DOM transaction.
  27367. *
  27368. * You may want to call this when you know that some deeper aspect of the
  27369. * component's state has changed but `setState` was not called.
  27370. *
  27371. * This will not invoke `shouldComponentUpdate`, but it will invoke
  27372. * `componentWillUpdate` and `componentDidUpdate`.
  27373. *
  27374. * @param {ReactClass} publicInstance The instance that should rerender.
  27375. * @internal
  27376. */
  27377. ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
  27378. if (this.transaction.isInTransaction()) {
  27379. ReactUpdateQueue.enqueueForceUpdate(publicInstance);
  27380. } else {
  27381. warnNoop(publicInstance, 'forceUpdate');
  27382. }
  27383. };
  27384. /**
  27385. * Replaces all of the state. Always use this or `setState` to mutate state.
  27386. * You should treat `this.state` as immutable.
  27387. *
  27388. * There is no guarantee that `this.state` will be immediately updated, so
  27389. * accessing `this.state` after calling this method may return the old value.
  27390. *
  27391. * @param {ReactClass} publicInstance The instance that should rerender.
  27392. * @param {object|function} completeState Next state.
  27393. * @internal
  27394. */
  27395. ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
  27396. if (this.transaction.isInTransaction()) {
  27397. ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
  27398. } else {
  27399. warnNoop(publicInstance, 'replaceState');
  27400. }
  27401. };
  27402. /**
  27403. * Sets a subset of the state. This only exists because _pendingState is
  27404. * internal. This provides a merging strategy that is not available to deep
  27405. * properties which is confusing. TODO: Expose pendingState or don't use it
  27406. * during the merge.
  27407. *
  27408. * @param {ReactClass} publicInstance The instance that should rerender.
  27409. * @param {object|function} partialState Next partial state to be merged with state.
  27410. * @internal
  27411. */
  27412. ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
  27413. if (this.transaction.isInTransaction()) {
  27414. ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
  27415. } else {
  27416. warnNoop(publicInstance, 'setState');
  27417. }
  27418. };
  27419. return ReactServerUpdateQueue;
  27420. }();
  27421. module.exports = ReactServerUpdateQueue;
  27422. /***/ }),
  27423. /* 207 */
  27424. /***/ (function(module, exports, __webpack_require__) {
  27425. "use strict";
  27426. /**
  27427. * Copyright 2013-present, Facebook, Inc.
  27428. * All rights reserved.
  27429. *
  27430. * This source code is licensed under the BSD-style license found in the
  27431. * LICENSE file in the root directory of this source tree. An additional grant
  27432. * of patent rights can be found in the PATENTS file in the same directory.
  27433. *
  27434. */
  27435. module.exports = '15.4.2';
  27436. /***/ }),
  27437. /* 208 */
  27438. /***/ (function(module, exports, __webpack_require__) {
  27439. "use strict";
  27440. /**
  27441. * Copyright 2013-present, Facebook, Inc.
  27442. * All rights reserved.
  27443. *
  27444. * This source code is licensed under the BSD-style license found in the
  27445. * LICENSE file in the root directory of this source tree. An additional grant
  27446. * of patent rights can be found in the PATENTS file in the same directory.
  27447. *
  27448. */
  27449. var NS = {
  27450. xlink: 'http://www.w3.org/1999/xlink',
  27451. xml: 'http://www.w3.org/XML/1998/namespace'
  27452. };
  27453. // We use attributes for everything SVG so let's avoid some duplication and run
  27454. // code instead.
  27455. // The following are all specified in the HTML config already so we exclude here.
  27456. // - class (as className)
  27457. // - color
  27458. // - height
  27459. // - id
  27460. // - lang
  27461. // - max
  27462. // - media
  27463. // - method
  27464. // - min
  27465. // - name
  27466. // - style
  27467. // - target
  27468. // - type
  27469. // - width
  27470. var ATTRS = {
  27471. accentHeight: 'accent-height',
  27472. accumulate: 0,
  27473. additive: 0,
  27474. alignmentBaseline: 'alignment-baseline',
  27475. allowReorder: 'allowReorder',
  27476. alphabetic: 0,
  27477. amplitude: 0,
  27478. arabicForm: 'arabic-form',
  27479. ascent: 0,
  27480. attributeName: 'attributeName',
  27481. attributeType: 'attributeType',
  27482. autoReverse: 'autoReverse',
  27483. azimuth: 0,
  27484. baseFrequency: 'baseFrequency',
  27485. baseProfile: 'baseProfile',
  27486. baselineShift: 'baseline-shift',
  27487. bbox: 0,
  27488. begin: 0,
  27489. bias: 0,
  27490. by: 0,
  27491. calcMode: 'calcMode',
  27492. capHeight: 'cap-height',
  27493. clip: 0,
  27494. clipPath: 'clip-path',
  27495. clipRule: 'clip-rule',
  27496. clipPathUnits: 'clipPathUnits',
  27497. colorInterpolation: 'color-interpolation',
  27498. colorInterpolationFilters: 'color-interpolation-filters',
  27499. colorProfile: 'color-profile',
  27500. colorRendering: 'color-rendering',
  27501. contentScriptType: 'contentScriptType',
  27502. contentStyleType: 'contentStyleType',
  27503. cursor: 0,
  27504. cx: 0,
  27505. cy: 0,
  27506. d: 0,
  27507. decelerate: 0,
  27508. descent: 0,
  27509. diffuseConstant: 'diffuseConstant',
  27510. direction: 0,
  27511. display: 0,
  27512. divisor: 0,
  27513. dominantBaseline: 'dominant-baseline',
  27514. dur: 0,
  27515. dx: 0,
  27516. dy: 0,
  27517. edgeMode: 'edgeMode',
  27518. elevation: 0,
  27519. enableBackground: 'enable-background',
  27520. end: 0,
  27521. exponent: 0,
  27522. externalResourcesRequired: 'externalResourcesRequired',
  27523. fill: 0,
  27524. fillOpacity: 'fill-opacity',
  27525. fillRule: 'fill-rule',
  27526. filter: 0,
  27527. filterRes: 'filterRes',
  27528. filterUnits: 'filterUnits',
  27529. floodColor: 'flood-color',
  27530. floodOpacity: 'flood-opacity',
  27531. focusable: 0,
  27532. fontFamily: 'font-family',
  27533. fontSize: 'font-size',
  27534. fontSizeAdjust: 'font-size-adjust',
  27535. fontStretch: 'font-stretch',
  27536. fontStyle: 'font-style',
  27537. fontVariant: 'font-variant',
  27538. fontWeight: 'font-weight',
  27539. format: 0,
  27540. from: 0,
  27541. fx: 0,
  27542. fy: 0,
  27543. g1: 0,
  27544. g2: 0,
  27545. glyphName: 'glyph-name',
  27546. glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  27547. glyphOrientationVertical: 'glyph-orientation-vertical',
  27548. glyphRef: 'glyphRef',
  27549. gradientTransform: 'gradientTransform',
  27550. gradientUnits: 'gradientUnits',
  27551. hanging: 0,
  27552. horizAdvX: 'horiz-adv-x',
  27553. horizOriginX: 'horiz-origin-x',
  27554. ideographic: 0,
  27555. imageRendering: 'image-rendering',
  27556. 'in': 0,
  27557. in2: 0,
  27558. intercept: 0,
  27559. k: 0,
  27560. k1: 0,
  27561. k2: 0,
  27562. k3: 0,
  27563. k4: 0,
  27564. kernelMatrix: 'kernelMatrix',
  27565. kernelUnitLength: 'kernelUnitLength',
  27566. kerning: 0,
  27567. keyPoints: 'keyPoints',
  27568. keySplines: 'keySplines',
  27569. keyTimes: 'keyTimes',
  27570. lengthAdjust: 'lengthAdjust',
  27571. letterSpacing: 'letter-spacing',
  27572. lightingColor: 'lighting-color',
  27573. limitingConeAngle: 'limitingConeAngle',
  27574. local: 0,
  27575. markerEnd: 'marker-end',
  27576. markerMid: 'marker-mid',
  27577. markerStart: 'marker-start',
  27578. markerHeight: 'markerHeight',
  27579. markerUnits: 'markerUnits',
  27580. markerWidth: 'markerWidth',
  27581. mask: 0,
  27582. maskContentUnits: 'maskContentUnits',
  27583. maskUnits: 'maskUnits',
  27584. mathematical: 0,
  27585. mode: 0,
  27586. numOctaves: 'numOctaves',
  27587. offset: 0,
  27588. opacity: 0,
  27589. operator: 0,
  27590. order: 0,
  27591. orient: 0,
  27592. orientation: 0,
  27593. origin: 0,
  27594. overflow: 0,
  27595. overlinePosition: 'overline-position',
  27596. overlineThickness: 'overline-thickness',
  27597. paintOrder: 'paint-order',
  27598. panose1: 'panose-1',
  27599. pathLength: 'pathLength',
  27600. patternContentUnits: 'patternContentUnits',
  27601. patternTransform: 'patternTransform',
  27602. patternUnits: 'patternUnits',
  27603. pointerEvents: 'pointer-events',
  27604. points: 0,
  27605. pointsAtX: 'pointsAtX',
  27606. pointsAtY: 'pointsAtY',
  27607. pointsAtZ: 'pointsAtZ',
  27608. preserveAlpha: 'preserveAlpha',
  27609. preserveAspectRatio: 'preserveAspectRatio',
  27610. primitiveUnits: 'primitiveUnits',
  27611. r: 0,
  27612. radius: 0,
  27613. refX: 'refX',
  27614. refY: 'refY',
  27615. renderingIntent: 'rendering-intent',
  27616. repeatCount: 'repeatCount',
  27617. repeatDur: 'repeatDur',
  27618. requiredExtensions: 'requiredExtensions',
  27619. requiredFeatures: 'requiredFeatures',
  27620. restart: 0,
  27621. result: 0,
  27622. rotate: 0,
  27623. rx: 0,
  27624. ry: 0,
  27625. scale: 0,
  27626. seed: 0,
  27627. shapeRendering: 'shape-rendering',
  27628. slope: 0,
  27629. spacing: 0,
  27630. specularConstant: 'specularConstant',
  27631. specularExponent: 'specularExponent',
  27632. speed: 0,
  27633. spreadMethod: 'spreadMethod',
  27634. startOffset: 'startOffset',
  27635. stdDeviation: 'stdDeviation',
  27636. stemh: 0,
  27637. stemv: 0,
  27638. stitchTiles: 'stitchTiles',
  27639. stopColor: 'stop-color',
  27640. stopOpacity: 'stop-opacity',
  27641. strikethroughPosition: 'strikethrough-position',
  27642. strikethroughThickness: 'strikethrough-thickness',
  27643. string: 0,
  27644. stroke: 0,
  27645. strokeDasharray: 'stroke-dasharray',
  27646. strokeDashoffset: 'stroke-dashoffset',
  27647. strokeLinecap: 'stroke-linecap',
  27648. strokeLinejoin: 'stroke-linejoin',
  27649. strokeMiterlimit: 'stroke-miterlimit',
  27650. strokeOpacity: 'stroke-opacity',
  27651. strokeWidth: 'stroke-width',
  27652. surfaceScale: 'surfaceScale',
  27653. systemLanguage: 'systemLanguage',
  27654. tableValues: 'tableValues',
  27655. targetX: 'targetX',
  27656. targetY: 'targetY',
  27657. textAnchor: 'text-anchor',
  27658. textDecoration: 'text-decoration',
  27659. textRendering: 'text-rendering',
  27660. textLength: 'textLength',
  27661. to: 0,
  27662. transform: 0,
  27663. u1: 0,
  27664. u2: 0,
  27665. underlinePosition: 'underline-position',
  27666. underlineThickness: 'underline-thickness',
  27667. unicode: 0,
  27668. unicodeBidi: 'unicode-bidi',
  27669. unicodeRange: 'unicode-range',
  27670. unitsPerEm: 'units-per-em',
  27671. vAlphabetic: 'v-alphabetic',
  27672. vHanging: 'v-hanging',
  27673. vIdeographic: 'v-ideographic',
  27674. vMathematical: 'v-mathematical',
  27675. values: 0,
  27676. vectorEffect: 'vector-effect',
  27677. version: 0,
  27678. vertAdvY: 'vert-adv-y',
  27679. vertOriginX: 'vert-origin-x',
  27680. vertOriginY: 'vert-origin-y',
  27681. viewBox: 'viewBox',
  27682. viewTarget: 'viewTarget',
  27683. visibility: 0,
  27684. widths: 0,
  27685. wordSpacing: 'word-spacing',
  27686. writingMode: 'writing-mode',
  27687. x: 0,
  27688. xHeight: 'x-height',
  27689. x1: 0,
  27690. x2: 0,
  27691. xChannelSelector: 'xChannelSelector',
  27692. xlinkActuate: 'xlink:actuate',
  27693. xlinkArcrole: 'xlink:arcrole',
  27694. xlinkHref: 'xlink:href',
  27695. xlinkRole: 'xlink:role',
  27696. xlinkShow: 'xlink:show',
  27697. xlinkTitle: 'xlink:title',
  27698. xlinkType: 'xlink:type',
  27699. xmlBase: 'xml:base',
  27700. xmlns: 0,
  27701. xmlnsXlink: 'xmlns:xlink',
  27702. xmlLang: 'xml:lang',
  27703. xmlSpace: 'xml:space',
  27704. y: 0,
  27705. y1: 0,
  27706. y2: 0,
  27707. yChannelSelector: 'yChannelSelector',
  27708. z: 0,
  27709. zoomAndPan: 'zoomAndPan'
  27710. };
  27711. var SVGDOMPropertyConfig = {
  27712. Properties: {},
  27713. DOMAttributeNamespaces: {
  27714. xlinkActuate: NS.xlink,
  27715. xlinkArcrole: NS.xlink,
  27716. xlinkHref: NS.xlink,
  27717. xlinkRole: NS.xlink,
  27718. xlinkShow: NS.xlink,
  27719. xlinkTitle: NS.xlink,
  27720. xlinkType: NS.xlink,
  27721. xmlBase: NS.xml,
  27722. xmlLang: NS.xml,
  27723. xmlSpace: NS.xml
  27724. },
  27725. DOMAttributeNames: {}
  27726. };
  27727. Object.keys(ATTRS).forEach(function (key) {
  27728. SVGDOMPropertyConfig.Properties[key] = 0;
  27729. if (ATTRS[key]) {
  27730. SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  27731. }
  27732. });
  27733. module.exports = SVGDOMPropertyConfig;
  27734. /***/ }),
  27735. /* 209 */
  27736. /***/ (function(module, exports, __webpack_require__) {
  27737. "use strict";
  27738. /**
  27739. * Copyright 2013-present, Facebook, Inc.
  27740. * All rights reserved.
  27741. *
  27742. * This source code is licensed under the BSD-style license found in the
  27743. * LICENSE file in the root directory of this source tree. An additional grant
  27744. * of patent rights can be found in the PATENTS file in the same directory.
  27745. *
  27746. */
  27747. var EventPropagators = __webpack_require__(26);
  27748. var ExecutionEnvironment = __webpack_require__(9);
  27749. var ReactDOMComponentTree = __webpack_require__(5);
  27750. var ReactInputSelection = __webpack_require__(85);
  27751. var SyntheticEvent = __webpack_require__(13);
  27752. var getActiveElement = __webpack_require__(75);
  27753. var isTextInputElement = __webpack_require__(94);
  27754. var shallowEqual = __webpack_require__(48);
  27755. var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
  27756. var eventTypes = {
  27757. select: {
  27758. phasedRegistrationNames: {
  27759. bubbled: 'onSelect',
  27760. captured: 'onSelectCapture'
  27761. },
  27762. dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
  27763. }
  27764. };
  27765. var activeElement = null;
  27766. var activeElementInst = null;
  27767. var lastSelection = null;
  27768. var mouseDown = false;
  27769. // Track whether a listener exists for this plugin. If none exist, we do
  27770. // not extract events. See #3639.
  27771. var hasListener = false;
  27772. /**
  27773. * Get an object which is a unique representation of the current selection.
  27774. *
  27775. * The return value will not be consistent across nodes or browsers, but
  27776. * two identical selections on the same node will return identical objects.
  27777. *
  27778. * @param {DOMElement} node
  27779. * @return {object}
  27780. */
  27781. function getSelection(node) {
  27782. if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
  27783. return {
  27784. start: node.selectionStart,
  27785. end: node.selectionEnd
  27786. };
  27787. } else if (window.getSelection) {
  27788. var selection = window.getSelection();
  27789. return {
  27790. anchorNode: selection.anchorNode,
  27791. anchorOffset: selection.anchorOffset,
  27792. focusNode: selection.focusNode,
  27793. focusOffset: selection.focusOffset
  27794. };
  27795. } else if (document.selection) {
  27796. var range = document.selection.createRange();
  27797. return {
  27798. parentElement: range.parentElement(),
  27799. text: range.text,
  27800. top: range.boundingTop,
  27801. left: range.boundingLeft
  27802. };
  27803. }
  27804. }
  27805. /**
  27806. * Poll selection to see whether it's changed.
  27807. *
  27808. * @param {object} nativeEvent
  27809. * @return {?SyntheticEvent}
  27810. */
  27811. function constructSelectEvent(nativeEvent, nativeEventTarget) {
  27812. // Ensure we have the right element, and that the user is not dragging a
  27813. // selection (this matches native `select` event behavior). In HTML5, select
  27814. // fires only on input and textarea thus if there's no focused element we
  27815. // won't dispatch.
  27816. if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
  27817. return null;
  27818. }
  27819. // Only fire when selection has actually changed.
  27820. var currentSelection = getSelection(activeElement);
  27821. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  27822. lastSelection = currentSelection;
  27823. var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
  27824. syntheticEvent.type = 'select';
  27825. syntheticEvent.target = activeElement;
  27826. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  27827. return syntheticEvent;
  27828. }
  27829. return null;
  27830. }
  27831. /**
  27832. * This plugin creates an `onSelect` event that normalizes select events
  27833. * across form elements.
  27834. *
  27835. * Supported elements are:
  27836. * - input (see `isTextInputElement`)
  27837. * - textarea
  27838. * - contentEditable
  27839. *
  27840. * This differs from native browser implementations in the following ways:
  27841. * - Fires on contentEditable fields as well as inputs.
  27842. * - Fires for collapsed selection.
  27843. * - Fires after user input.
  27844. */
  27845. var SelectEventPlugin = {
  27846. eventTypes: eventTypes,
  27847. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  27848. if (!hasListener) {
  27849. return null;
  27850. }
  27851. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  27852. switch (topLevelType) {
  27853. // Track the input node that has focus.
  27854. case 'topFocus':
  27855. if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
  27856. activeElement = targetNode;
  27857. activeElementInst = targetInst;
  27858. lastSelection = null;
  27859. }
  27860. break;
  27861. case 'topBlur':
  27862. activeElement = null;
  27863. activeElementInst = null;
  27864. lastSelection = null;
  27865. break;
  27866. // Don't fire the event while the user is dragging. This matches the
  27867. // semantics of the native select event.
  27868. case 'topMouseDown':
  27869. mouseDown = true;
  27870. break;
  27871. case 'topContextMenu':
  27872. case 'topMouseUp':
  27873. mouseDown = false;
  27874. return constructSelectEvent(nativeEvent, nativeEventTarget);
  27875. // Chrome and IE fire non-standard event when selection is changed (and
  27876. // sometimes when it hasn't). IE's event fires out of order with respect
  27877. // to key and input events on deletion, so we discard it.
  27878. //
  27879. // Firefox doesn't support selectionchange, so check selection status
  27880. // after each key entry. The selection changes after keydown and before
  27881. // keyup, but we check on keydown as well in the case of holding down a
  27882. // key, when multiple keydown events are fired but only one keyup is.
  27883. // This is also our approach for IE handling, for the reason above.
  27884. case 'topSelectionChange':
  27885. if (skipSelectionChangeEvent) {
  27886. break;
  27887. }
  27888. // falls through
  27889. case 'topKeyDown':
  27890. case 'topKeyUp':
  27891. return constructSelectEvent(nativeEvent, nativeEventTarget);
  27892. }
  27893. return null;
  27894. },
  27895. didPutListener: function (inst, registrationName, listener) {
  27896. if (registrationName === 'onSelect') {
  27897. hasListener = true;
  27898. }
  27899. }
  27900. };
  27901. module.exports = SelectEventPlugin;
  27902. /***/ }),
  27903. /* 210 */
  27904. /***/ (function(module, exports, __webpack_require__) {
  27905. "use strict";
  27906. /**
  27907. * Copyright 2013-present, Facebook, Inc.
  27908. * All rights reserved.
  27909. *
  27910. * This source code is licensed under the BSD-style license found in the
  27911. * LICENSE file in the root directory of this source tree. An additional grant
  27912. * of patent rights can be found in the PATENTS file in the same directory.
  27913. *
  27914. *
  27915. */
  27916. var _prodInvariant = __webpack_require__(2);
  27917. var EventListener = __webpack_require__(73);
  27918. var EventPropagators = __webpack_require__(26);
  27919. var ReactDOMComponentTree = __webpack_require__(5);
  27920. var SyntheticAnimationEvent = __webpack_require__(211);
  27921. var SyntheticClipboardEvent = __webpack_require__(212);
  27922. var SyntheticEvent = __webpack_require__(13);
  27923. var SyntheticFocusEvent = __webpack_require__(215);
  27924. var SyntheticKeyboardEvent = __webpack_require__(217);
  27925. var SyntheticMouseEvent = __webpack_require__(33);
  27926. var SyntheticDragEvent = __webpack_require__(214);
  27927. var SyntheticTouchEvent = __webpack_require__(218);
  27928. var SyntheticTransitionEvent = __webpack_require__(219);
  27929. var SyntheticUIEvent = __webpack_require__(28);
  27930. var SyntheticWheelEvent = __webpack_require__(220);
  27931. var emptyFunction = __webpack_require__(10);
  27932. var getEventCharCode = __webpack_require__(59);
  27933. var invariant = __webpack_require__(0);
  27934. /**
  27935. * Turns
  27936. * ['abort', ...]
  27937. * into
  27938. * eventTypes = {
  27939. * 'abort': {
  27940. * phasedRegistrationNames: {
  27941. * bubbled: 'onAbort',
  27942. * captured: 'onAbortCapture',
  27943. * },
  27944. * dependencies: ['topAbort'],
  27945. * },
  27946. * ...
  27947. * };
  27948. * topLevelEventsToDispatchConfig = {
  27949. * 'topAbort': { sameConfig }
  27950. * };
  27951. */
  27952. var eventTypes = {};
  27953. var topLevelEventsToDispatchConfig = {};
  27954. ['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'canPlay', 'canPlayThrough', 'click', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) {
  27955. var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  27956. var onEvent = 'on' + capitalizedEvent;
  27957. var topEvent = 'top' + capitalizedEvent;
  27958. var type = {
  27959. phasedRegistrationNames: {
  27960. bubbled: onEvent,
  27961. captured: onEvent + 'Capture'
  27962. },
  27963. dependencies: [topEvent]
  27964. };
  27965. eventTypes[event] = type;
  27966. topLevelEventsToDispatchConfig[topEvent] = type;
  27967. });
  27968. var onClickListeners = {};
  27969. function getDictionaryKey(inst) {
  27970. // Prevents V8 performance issue:
  27971. // https://github.com/facebook/react/pull/7232
  27972. return '.' + inst._rootNodeID;
  27973. }
  27974. function isInteractive(tag) {
  27975. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  27976. }
  27977. var SimpleEventPlugin = {
  27978. eventTypes: eventTypes,
  27979. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  27980. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  27981. if (!dispatchConfig) {
  27982. return null;
  27983. }
  27984. var EventConstructor;
  27985. switch (topLevelType) {
  27986. case 'topAbort':
  27987. case 'topCanPlay':
  27988. case 'topCanPlayThrough':
  27989. case 'topDurationChange':
  27990. case 'topEmptied':
  27991. case 'topEncrypted':
  27992. case 'topEnded':
  27993. case 'topError':
  27994. case 'topInput':
  27995. case 'topInvalid':
  27996. case 'topLoad':
  27997. case 'topLoadedData':
  27998. case 'topLoadedMetadata':
  27999. case 'topLoadStart':
  28000. case 'topPause':
  28001. case 'topPlay':
  28002. case 'topPlaying':
  28003. case 'topProgress':
  28004. case 'topRateChange':
  28005. case 'topReset':
  28006. case 'topSeeked':
  28007. case 'topSeeking':
  28008. case 'topStalled':
  28009. case 'topSubmit':
  28010. case 'topSuspend':
  28011. case 'topTimeUpdate':
  28012. case 'topVolumeChange':
  28013. case 'topWaiting':
  28014. // HTML Events
  28015. // @see http://www.w3.org/TR/html5/index.html#events-0
  28016. EventConstructor = SyntheticEvent;
  28017. break;
  28018. case 'topKeyPress':
  28019. // Firefox creates a keypress event for function keys too. This removes
  28020. // the unwanted keypress events. Enter is however both printable and
  28021. // non-printable. One would expect Tab to be as well (but it isn't).
  28022. if (getEventCharCode(nativeEvent) === 0) {
  28023. return null;
  28024. }
  28025. /* falls through */
  28026. case 'topKeyDown':
  28027. case 'topKeyUp':
  28028. EventConstructor = SyntheticKeyboardEvent;
  28029. break;
  28030. case 'topBlur':
  28031. case 'topFocus':
  28032. EventConstructor = SyntheticFocusEvent;
  28033. break;
  28034. case 'topClick':
  28035. // Firefox creates a click event on right mouse clicks. This removes the
  28036. // unwanted click events.
  28037. if (nativeEvent.button === 2) {
  28038. return null;
  28039. }
  28040. /* falls through */
  28041. case 'topDoubleClick':
  28042. case 'topMouseDown':
  28043. case 'topMouseMove':
  28044. case 'topMouseUp':
  28045. // TODO: Disabled elements should not respond to mouse events
  28046. /* falls through */
  28047. case 'topMouseOut':
  28048. case 'topMouseOver':
  28049. case 'topContextMenu':
  28050. EventConstructor = SyntheticMouseEvent;
  28051. break;
  28052. case 'topDrag':
  28053. case 'topDragEnd':
  28054. case 'topDragEnter':
  28055. case 'topDragExit':
  28056. case 'topDragLeave':
  28057. case 'topDragOver':
  28058. case 'topDragStart':
  28059. case 'topDrop':
  28060. EventConstructor = SyntheticDragEvent;
  28061. break;
  28062. case 'topTouchCancel':
  28063. case 'topTouchEnd':
  28064. case 'topTouchMove':
  28065. case 'topTouchStart':
  28066. EventConstructor = SyntheticTouchEvent;
  28067. break;
  28068. case 'topAnimationEnd':
  28069. case 'topAnimationIteration':
  28070. case 'topAnimationStart':
  28071. EventConstructor = SyntheticAnimationEvent;
  28072. break;
  28073. case 'topTransitionEnd':
  28074. EventConstructor = SyntheticTransitionEvent;
  28075. break;
  28076. case 'topScroll':
  28077. EventConstructor = SyntheticUIEvent;
  28078. break;
  28079. case 'topWheel':
  28080. EventConstructor = SyntheticWheelEvent;
  28081. break;
  28082. case 'topCopy':
  28083. case 'topCut':
  28084. case 'topPaste':
  28085. EventConstructor = SyntheticClipboardEvent;
  28086. break;
  28087. }
  28088. !EventConstructor ? false ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
  28089. var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
  28090. EventPropagators.accumulateTwoPhaseDispatches(event);
  28091. return event;
  28092. },
  28093. didPutListener: function (inst, registrationName, listener) {
  28094. // Mobile Safari does not fire properly bubble click events on
  28095. // non-interactive elements, which means delegated click listeners do not
  28096. // fire. The workaround for this bug involves attaching an empty click
  28097. // listener on the target node.
  28098. // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  28099. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  28100. var key = getDictionaryKey(inst);
  28101. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  28102. if (!onClickListeners[key]) {
  28103. onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
  28104. }
  28105. }
  28106. },
  28107. willDeleteListener: function (inst, registrationName) {
  28108. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  28109. var key = getDictionaryKey(inst);
  28110. onClickListeners[key].remove();
  28111. delete onClickListeners[key];
  28112. }
  28113. }
  28114. };
  28115. module.exports = SimpleEventPlugin;
  28116. /***/ }),
  28117. /* 211 */
  28118. /***/ (function(module, exports, __webpack_require__) {
  28119. "use strict";
  28120. /**
  28121. * Copyright 2013-present, Facebook, Inc.
  28122. * All rights reserved.
  28123. *
  28124. * This source code is licensed under the BSD-style license found in the
  28125. * LICENSE file in the root directory of this source tree. An additional grant
  28126. * of patent rights can be found in the PATENTS file in the same directory.
  28127. *
  28128. */
  28129. var SyntheticEvent = __webpack_require__(13);
  28130. /**
  28131. * @interface Event
  28132. * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  28133. * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
  28134. */
  28135. var AnimationEventInterface = {
  28136. animationName: null,
  28137. elapsedTime: null,
  28138. pseudoElement: null
  28139. };
  28140. /**
  28141. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28142. * @param {string} dispatchMarker Marker identifying the event target.
  28143. * @param {object} nativeEvent Native browser event.
  28144. * @extends {SyntheticEvent}
  28145. */
  28146. function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28147. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28148. }
  28149. SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
  28150. module.exports = SyntheticAnimationEvent;
  28151. /***/ }),
  28152. /* 212 */
  28153. /***/ (function(module, exports, __webpack_require__) {
  28154. "use strict";
  28155. /**
  28156. * Copyright 2013-present, Facebook, Inc.
  28157. * All rights reserved.
  28158. *
  28159. * This source code is licensed under the BSD-style license found in the
  28160. * LICENSE file in the root directory of this source tree. An additional grant
  28161. * of patent rights can be found in the PATENTS file in the same directory.
  28162. *
  28163. */
  28164. var SyntheticEvent = __webpack_require__(13);
  28165. /**
  28166. * @interface Event
  28167. * @see http://www.w3.org/TR/clipboard-apis/
  28168. */
  28169. var ClipboardEventInterface = {
  28170. clipboardData: function (event) {
  28171. return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  28172. }
  28173. };
  28174. /**
  28175. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28176. * @param {string} dispatchMarker Marker identifying the event target.
  28177. * @param {object} nativeEvent Native browser event.
  28178. * @extends {SyntheticUIEvent}
  28179. */
  28180. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28181. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28182. }
  28183. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  28184. module.exports = SyntheticClipboardEvent;
  28185. /***/ }),
  28186. /* 213 */
  28187. /***/ (function(module, exports, __webpack_require__) {
  28188. "use strict";
  28189. /**
  28190. * Copyright 2013-present, Facebook, Inc.
  28191. * All rights reserved.
  28192. *
  28193. * This source code is licensed under the BSD-style license found in the
  28194. * LICENSE file in the root directory of this source tree. An additional grant
  28195. * of patent rights can be found in the PATENTS file in the same directory.
  28196. *
  28197. */
  28198. var SyntheticEvent = __webpack_require__(13);
  28199. /**
  28200. * @interface Event
  28201. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  28202. */
  28203. var CompositionEventInterface = {
  28204. data: null
  28205. };
  28206. /**
  28207. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28208. * @param {string} dispatchMarker Marker identifying the event target.
  28209. * @param {object} nativeEvent Native browser event.
  28210. * @extends {SyntheticUIEvent}
  28211. */
  28212. function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28213. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28214. }
  28215. SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
  28216. module.exports = SyntheticCompositionEvent;
  28217. /***/ }),
  28218. /* 214 */
  28219. /***/ (function(module, exports, __webpack_require__) {
  28220. "use strict";
  28221. /**
  28222. * Copyright 2013-present, Facebook, Inc.
  28223. * All rights reserved.
  28224. *
  28225. * This source code is licensed under the BSD-style license found in the
  28226. * LICENSE file in the root directory of this source tree. An additional grant
  28227. * of patent rights can be found in the PATENTS file in the same directory.
  28228. *
  28229. */
  28230. var SyntheticMouseEvent = __webpack_require__(33);
  28231. /**
  28232. * @interface DragEvent
  28233. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28234. */
  28235. var DragEventInterface = {
  28236. dataTransfer: null
  28237. };
  28238. /**
  28239. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28240. * @param {string} dispatchMarker Marker identifying the event target.
  28241. * @param {object} nativeEvent Native browser event.
  28242. * @extends {SyntheticUIEvent}
  28243. */
  28244. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28245. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28246. }
  28247. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  28248. module.exports = SyntheticDragEvent;
  28249. /***/ }),
  28250. /* 215 */
  28251. /***/ (function(module, exports, __webpack_require__) {
  28252. "use strict";
  28253. /**
  28254. * Copyright 2013-present, Facebook, Inc.
  28255. * All rights reserved.
  28256. *
  28257. * This source code is licensed under the BSD-style license found in the
  28258. * LICENSE file in the root directory of this source tree. An additional grant
  28259. * of patent rights can be found in the PATENTS file in the same directory.
  28260. *
  28261. */
  28262. var SyntheticUIEvent = __webpack_require__(28);
  28263. /**
  28264. * @interface FocusEvent
  28265. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28266. */
  28267. var FocusEventInterface = {
  28268. relatedTarget: null
  28269. };
  28270. /**
  28271. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28272. * @param {string} dispatchMarker Marker identifying the event target.
  28273. * @param {object} nativeEvent Native browser event.
  28274. * @extends {SyntheticUIEvent}
  28275. */
  28276. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28277. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28278. }
  28279. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  28280. module.exports = SyntheticFocusEvent;
  28281. /***/ }),
  28282. /* 216 */
  28283. /***/ (function(module, exports, __webpack_require__) {
  28284. "use strict";
  28285. /**
  28286. * Copyright 2013-present, Facebook, Inc.
  28287. * All rights reserved.
  28288. *
  28289. * This source code is licensed under the BSD-style license found in the
  28290. * LICENSE file in the root directory of this source tree. An additional grant
  28291. * of patent rights can be found in the PATENTS file in the same directory.
  28292. *
  28293. */
  28294. var SyntheticEvent = __webpack_require__(13);
  28295. /**
  28296. * @interface Event
  28297. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  28298. * /#events-inputevents
  28299. */
  28300. var InputEventInterface = {
  28301. data: null
  28302. };
  28303. /**
  28304. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28305. * @param {string} dispatchMarker Marker identifying the event target.
  28306. * @param {object} nativeEvent Native browser event.
  28307. * @extends {SyntheticUIEvent}
  28308. */
  28309. function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28310. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28311. }
  28312. SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
  28313. module.exports = SyntheticInputEvent;
  28314. /***/ }),
  28315. /* 217 */
  28316. /***/ (function(module, exports, __webpack_require__) {
  28317. "use strict";
  28318. /**
  28319. * Copyright 2013-present, Facebook, Inc.
  28320. * All rights reserved.
  28321. *
  28322. * This source code is licensed under the BSD-style license found in the
  28323. * LICENSE file in the root directory of this source tree. An additional grant
  28324. * of patent rights can be found in the PATENTS file in the same directory.
  28325. *
  28326. */
  28327. var SyntheticUIEvent = __webpack_require__(28);
  28328. var getEventCharCode = __webpack_require__(59);
  28329. var getEventKey = __webpack_require__(225);
  28330. var getEventModifierState = __webpack_require__(60);
  28331. /**
  28332. * @interface KeyboardEvent
  28333. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28334. */
  28335. var KeyboardEventInterface = {
  28336. key: getEventKey,
  28337. location: null,
  28338. ctrlKey: null,
  28339. shiftKey: null,
  28340. altKey: null,
  28341. metaKey: null,
  28342. repeat: null,
  28343. locale: null,
  28344. getModifierState: getEventModifierState,
  28345. // Legacy Interface
  28346. charCode: function (event) {
  28347. // `charCode` is the result of a KeyPress event and represents the value of
  28348. // the actual printable character.
  28349. // KeyPress is deprecated, but its replacement is not yet final and not
  28350. // implemented in any major browser. Only KeyPress has charCode.
  28351. if (event.type === 'keypress') {
  28352. return getEventCharCode(event);
  28353. }
  28354. return 0;
  28355. },
  28356. keyCode: function (event) {
  28357. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  28358. // physical keyboard key.
  28359. // The actual meaning of the value depends on the users' keyboard layout
  28360. // which cannot be detected. Assuming that it is a US keyboard layout
  28361. // provides a surprisingly accurate mapping for US and European users.
  28362. // Due to this, it is left to the user to implement at this time.
  28363. if (event.type === 'keydown' || event.type === 'keyup') {
  28364. return event.keyCode;
  28365. }
  28366. return 0;
  28367. },
  28368. which: function (event) {
  28369. // `which` is an alias for either `keyCode` or `charCode` depending on the
  28370. // type of the event.
  28371. if (event.type === 'keypress') {
  28372. return getEventCharCode(event);
  28373. }
  28374. if (event.type === 'keydown' || event.type === 'keyup') {
  28375. return event.keyCode;
  28376. }
  28377. return 0;
  28378. }
  28379. };
  28380. /**
  28381. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28382. * @param {string} dispatchMarker Marker identifying the event target.
  28383. * @param {object} nativeEvent Native browser event.
  28384. * @extends {SyntheticUIEvent}
  28385. */
  28386. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28387. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28388. }
  28389. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  28390. module.exports = SyntheticKeyboardEvent;
  28391. /***/ }),
  28392. /* 218 */
  28393. /***/ (function(module, exports, __webpack_require__) {
  28394. "use strict";
  28395. /**
  28396. * Copyright 2013-present, Facebook, Inc.
  28397. * All rights reserved.
  28398. *
  28399. * This source code is licensed under the BSD-style license found in the
  28400. * LICENSE file in the root directory of this source tree. An additional grant
  28401. * of patent rights can be found in the PATENTS file in the same directory.
  28402. *
  28403. */
  28404. var SyntheticUIEvent = __webpack_require__(28);
  28405. var getEventModifierState = __webpack_require__(60);
  28406. /**
  28407. * @interface TouchEvent
  28408. * @see http://www.w3.org/TR/touch-events/
  28409. */
  28410. var TouchEventInterface = {
  28411. touches: null,
  28412. targetTouches: null,
  28413. changedTouches: null,
  28414. altKey: null,
  28415. metaKey: null,
  28416. ctrlKey: null,
  28417. shiftKey: null,
  28418. getModifierState: getEventModifierState
  28419. };
  28420. /**
  28421. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28422. * @param {string} dispatchMarker Marker identifying the event target.
  28423. * @param {object} nativeEvent Native browser event.
  28424. * @extends {SyntheticUIEvent}
  28425. */
  28426. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28427. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28428. }
  28429. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  28430. module.exports = SyntheticTouchEvent;
  28431. /***/ }),
  28432. /* 219 */
  28433. /***/ (function(module, exports, __webpack_require__) {
  28434. "use strict";
  28435. /**
  28436. * Copyright 2013-present, Facebook, Inc.
  28437. * All rights reserved.
  28438. *
  28439. * This source code is licensed under the BSD-style license found in the
  28440. * LICENSE file in the root directory of this source tree. An additional grant
  28441. * of patent rights can be found in the PATENTS file in the same directory.
  28442. *
  28443. */
  28444. var SyntheticEvent = __webpack_require__(13);
  28445. /**
  28446. * @interface Event
  28447. * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
  28448. * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
  28449. */
  28450. var TransitionEventInterface = {
  28451. propertyName: null,
  28452. elapsedTime: null,
  28453. pseudoElement: null
  28454. };
  28455. /**
  28456. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28457. * @param {string} dispatchMarker Marker identifying the event target.
  28458. * @param {object} nativeEvent Native browser event.
  28459. * @extends {SyntheticEvent}
  28460. */
  28461. function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28462. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28463. }
  28464. SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
  28465. module.exports = SyntheticTransitionEvent;
  28466. /***/ }),
  28467. /* 220 */
  28468. /***/ (function(module, exports, __webpack_require__) {
  28469. "use strict";
  28470. /**
  28471. * Copyright 2013-present, Facebook, Inc.
  28472. * All rights reserved.
  28473. *
  28474. * This source code is licensed under the BSD-style license found in the
  28475. * LICENSE file in the root directory of this source tree. An additional grant
  28476. * of patent rights can be found in the PATENTS file in the same directory.
  28477. *
  28478. */
  28479. var SyntheticMouseEvent = __webpack_require__(33);
  28480. /**
  28481. * @interface WheelEvent
  28482. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28483. */
  28484. var WheelEventInterface = {
  28485. deltaX: function (event) {
  28486. return 'deltaX' in event ? event.deltaX :
  28487. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  28488. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
  28489. },
  28490. deltaY: function (event) {
  28491. return 'deltaY' in event ? event.deltaY :
  28492. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  28493. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  28494. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  28495. 'wheelDelta' in event ? -event.wheelDelta : 0;
  28496. },
  28497. deltaZ: null,
  28498. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  28499. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  28500. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  28501. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  28502. deltaMode: null
  28503. };
  28504. /**
  28505. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28506. * @param {string} dispatchMarker Marker identifying the event target.
  28507. * @param {object} nativeEvent Native browser event.
  28508. * @extends {SyntheticMouseEvent}
  28509. */
  28510. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28511. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28512. }
  28513. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  28514. module.exports = SyntheticWheelEvent;
  28515. /***/ }),
  28516. /* 221 */
  28517. /***/ (function(module, exports, __webpack_require__) {
  28518. "use strict";
  28519. /**
  28520. * Copyright 2013-present, Facebook, Inc.
  28521. * All rights reserved.
  28522. *
  28523. * This source code is licensed under the BSD-style license found in the
  28524. * LICENSE file in the root directory of this source tree. An additional grant
  28525. * of patent rights can be found in the PATENTS file in the same directory.
  28526. *
  28527. *
  28528. */
  28529. var MOD = 65521;
  28530. // adler32 is not cryptographically strong, and is only used to sanity check that
  28531. // markup generated on the server matches the markup generated on the client.
  28532. // This implementation (a modified version of the SheetJS version) has been optimized
  28533. // for our use case, at the expense of conforming to the adler32 specification
  28534. // for non-ascii inputs.
  28535. function adler32(data) {
  28536. var a = 1;
  28537. var b = 0;
  28538. var i = 0;
  28539. var l = data.length;
  28540. var m = l & ~0x3;
  28541. while (i < m) {
  28542. var n = Math.min(i + 4096, m);
  28543. for (; i < n; i += 4) {
  28544. b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
  28545. }
  28546. a %= MOD;
  28547. b %= MOD;
  28548. }
  28549. for (; i < l; i++) {
  28550. b += a += data.charCodeAt(i);
  28551. }
  28552. a %= MOD;
  28553. b %= MOD;
  28554. return a | b << 16;
  28555. }
  28556. module.exports = adler32;
  28557. /***/ }),
  28558. /* 222 */
  28559. /***/ (function(module, exports, __webpack_require__) {
  28560. "use strict";
  28561. /**
  28562. * Copyright 2013-present, Facebook, Inc.
  28563. * All rights reserved.
  28564. *
  28565. * This source code is licensed under the BSD-style license found in the
  28566. * LICENSE file in the root directory of this source tree. An additional grant
  28567. * of patent rights can be found in the PATENTS file in the same directory.
  28568. *
  28569. */
  28570. var CSSProperty = __webpack_require__(77);
  28571. var warning = __webpack_require__(1);
  28572. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  28573. var styleWarnings = {};
  28574. /**
  28575. * Convert a value into the proper css writable value. The style name `name`
  28576. * should be logical (no hyphens), as specified
  28577. * in `CSSProperty.isUnitlessNumber`.
  28578. *
  28579. * @param {string} name CSS property name such as `topMargin`.
  28580. * @param {*} value CSS property value such as `10px`.
  28581. * @param {ReactDOMComponent} component
  28582. * @return {string} Normalized style value with dimensions applied.
  28583. */
  28584. function dangerousStyleValue(name, value, component) {
  28585. // Note that we've removed escapeTextForBrowser() calls here since the
  28586. // whole string will be escaped when the attribute is injected into
  28587. // the markup. If you provide unsafe user data here they can inject
  28588. // arbitrary CSS which may be problematic (I couldn't repro this):
  28589. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  28590. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  28591. // This is not an XSS hole but instead a potential CSS injection issue
  28592. // which has lead to a greater discussion about how we're going to
  28593. // trust URLs moving forward. See #2115901
  28594. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  28595. if (isEmpty) {
  28596. return '';
  28597. }
  28598. var isNonNumeric = isNaN(value);
  28599. if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  28600. return '' + value; // cast to string
  28601. }
  28602. if (typeof value === 'string') {
  28603. if (false) {
  28604. // Allow '0' to pass through without warning. 0 is already special and
  28605. // doesn't require units, so we don't need to warn about it.
  28606. if (component && value !== '0') {
  28607. var owner = component._currentElement._owner;
  28608. var ownerName = owner ? owner.getName() : null;
  28609. if (ownerName && !styleWarnings[ownerName]) {
  28610. styleWarnings[ownerName] = {};
  28611. }
  28612. var warned = false;
  28613. if (ownerName) {
  28614. var warnings = styleWarnings[ownerName];
  28615. warned = warnings[name];
  28616. if (!warned) {
  28617. warnings[name] = true;
  28618. }
  28619. }
  28620. if (!warned) {
  28621. process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
  28622. }
  28623. }
  28624. }
  28625. value = value.trim();
  28626. }
  28627. return value + 'px';
  28628. }
  28629. module.exports = dangerousStyleValue;
  28630. /***/ }),
  28631. /* 223 */
  28632. /***/ (function(module, exports, __webpack_require__) {
  28633. "use strict";
  28634. /**
  28635. * Copyright 2013-present, Facebook, Inc.
  28636. * All rights reserved.
  28637. *
  28638. * This source code is licensed under the BSD-style license found in the
  28639. * LICENSE file in the root directory of this source tree. An additional grant
  28640. * of patent rights can be found in the PATENTS file in the same directory.
  28641. *
  28642. */
  28643. var _prodInvariant = __webpack_require__(2);
  28644. var ReactCurrentOwner = __webpack_require__(14);
  28645. var ReactDOMComponentTree = __webpack_require__(5);
  28646. var ReactInstanceMap = __webpack_require__(27);
  28647. var getHostComponentFromComposite = __webpack_require__(91);
  28648. var invariant = __webpack_require__(0);
  28649. var warning = __webpack_require__(1);
  28650. /**
  28651. * Returns the DOM node rendered by this element.
  28652. *
  28653. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
  28654. *
  28655. * @param {ReactComponent|DOMElement} componentOrElement
  28656. * @return {?DOMElement} The root node of this element.
  28657. */
  28658. function findDOMNode(componentOrElement) {
  28659. if (false) {
  28660. var owner = ReactCurrentOwner.current;
  28661. if (owner !== null) {
  28662. process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
  28663. owner._warnedAboutRefsInRender = true;
  28664. }
  28665. }
  28666. if (componentOrElement == null) {
  28667. return null;
  28668. }
  28669. if (componentOrElement.nodeType === 1) {
  28670. return componentOrElement;
  28671. }
  28672. var inst = ReactInstanceMap.get(componentOrElement);
  28673. if (inst) {
  28674. inst = getHostComponentFromComposite(inst);
  28675. return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
  28676. }
  28677. if (typeof componentOrElement.render === 'function') {
  28678. true ? false ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
  28679. } else {
  28680. true ? false ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
  28681. }
  28682. }
  28683. module.exports = findDOMNode;
  28684. /***/ }),
  28685. /* 224 */
  28686. /***/ (function(module, exports, __webpack_require__) {
  28687. "use strict";
  28688. /* WEBPACK VAR INJECTION */(function(process) {/**
  28689. * Copyright 2013-present, Facebook, Inc.
  28690. * All rights reserved.
  28691. *
  28692. * This source code is licensed under the BSD-style license found in the
  28693. * LICENSE file in the root directory of this source tree. An additional grant
  28694. * of patent rights can be found in the PATENTS file in the same directory.
  28695. *
  28696. *
  28697. */
  28698. var KeyEscapeUtils = __webpack_require__(53);
  28699. var traverseAllChildren = __webpack_require__(96);
  28700. var warning = __webpack_require__(1);
  28701. var ReactComponentTreeHook;
  28702. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  28703. // Temporary hack.
  28704. // Inline requires don't work well with Jest:
  28705. // https://github.com/facebook/react/issues/7240
  28706. // Remove the inline requires when we don't need them anymore:
  28707. // https://github.com/facebook/react/pull/7178
  28708. ReactComponentTreeHook = __webpack_require__(97);
  28709. }
  28710. /**
  28711. * @param {function} traverseContext Context passed through traversal.
  28712. * @param {?ReactComponent} child React child component.
  28713. * @param {!string} name String name of key path to child.
  28714. * @param {number=} selfDebugID Optional debugID of the current internal instance.
  28715. */
  28716. function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
  28717. // We found a component instance.
  28718. if (traverseContext && typeof traverseContext === 'object') {
  28719. var result = traverseContext;
  28720. var keyUnique = result[name] === undefined;
  28721. if (false) {
  28722. if (!ReactComponentTreeHook) {
  28723. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  28724. }
  28725. if (!keyUnique) {
  28726. process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
  28727. }
  28728. }
  28729. if (keyUnique && child != null) {
  28730. result[name] = child;
  28731. }
  28732. }
  28733. }
  28734. /**
  28735. * Flattens children that are typically specified as `props.children`. Any null
  28736. * children will not be included in the resulting object.
  28737. * @return {!object} flattened children keyed by name.
  28738. */
  28739. function flattenChildren(children, selfDebugID) {
  28740. if (children == null) {
  28741. return children;
  28742. }
  28743. var result = {};
  28744. if (false) {
  28745. traverseAllChildren(children, function (traverseContext, child, name) {
  28746. return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID);
  28747. }, result);
  28748. } else {
  28749. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  28750. }
  28751. return result;
  28752. }
  28753. module.exports = flattenChildren;
  28754. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(68)))
  28755. /***/ }),
  28756. /* 225 */
  28757. /***/ (function(module, exports, __webpack_require__) {
  28758. "use strict";
  28759. /**
  28760. * Copyright 2013-present, Facebook, Inc.
  28761. * All rights reserved.
  28762. *
  28763. * This source code is licensed under the BSD-style license found in the
  28764. * LICENSE file in the root directory of this source tree. An additional grant
  28765. * of patent rights can be found in the PATENTS file in the same directory.
  28766. *
  28767. */
  28768. var getEventCharCode = __webpack_require__(59);
  28769. /**
  28770. * Normalization of deprecated HTML5 `key` values
  28771. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  28772. */
  28773. var normalizeKey = {
  28774. 'Esc': 'Escape',
  28775. 'Spacebar': ' ',
  28776. 'Left': 'ArrowLeft',
  28777. 'Up': 'ArrowUp',
  28778. 'Right': 'ArrowRight',
  28779. 'Down': 'ArrowDown',
  28780. 'Del': 'Delete',
  28781. 'Win': 'OS',
  28782. 'Menu': 'ContextMenu',
  28783. 'Apps': 'ContextMenu',
  28784. 'Scroll': 'ScrollLock',
  28785. 'MozPrintableKey': 'Unidentified'
  28786. };
  28787. /**
  28788. * Translation from legacy `keyCode` to HTML5 `key`
  28789. * Only special keys supported, all others depend on keyboard layout or browser
  28790. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  28791. */
  28792. var translateToKey = {
  28793. 8: 'Backspace',
  28794. 9: 'Tab',
  28795. 12: 'Clear',
  28796. 13: 'Enter',
  28797. 16: 'Shift',
  28798. 17: 'Control',
  28799. 18: 'Alt',
  28800. 19: 'Pause',
  28801. 20: 'CapsLock',
  28802. 27: 'Escape',
  28803. 32: ' ',
  28804. 33: 'PageUp',
  28805. 34: 'PageDown',
  28806. 35: 'End',
  28807. 36: 'Home',
  28808. 37: 'ArrowLeft',
  28809. 38: 'ArrowUp',
  28810. 39: 'ArrowRight',
  28811. 40: 'ArrowDown',
  28812. 45: 'Insert',
  28813. 46: 'Delete',
  28814. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  28815. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  28816. 144: 'NumLock',
  28817. 145: 'ScrollLock',
  28818. 224: 'Meta'
  28819. };
  28820. /**
  28821. * @param {object} nativeEvent Native browser event.
  28822. * @return {string} Normalized `key` property.
  28823. */
  28824. function getEventKey(nativeEvent) {
  28825. if (nativeEvent.key) {
  28826. // Normalize inconsistent values reported by browsers due to
  28827. // implementations of a working draft specification.
  28828. // FireFox implements `key` but returns `MozPrintableKey` for all
  28829. // printable characters (normalized to `Unidentified`), ignore it.
  28830. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  28831. if (key !== 'Unidentified') {
  28832. return key;
  28833. }
  28834. }
  28835. // Browser does not implement `key`, polyfill as much of it as we can.
  28836. if (nativeEvent.type === 'keypress') {
  28837. var charCode = getEventCharCode(nativeEvent);
  28838. // The enter-key is technically both printable and non-printable and can
  28839. // thus be captured by `keypress`, no other non-printable key should.
  28840. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  28841. }
  28842. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  28843. // While user keyboard layout determines the actual meaning of each
  28844. // `keyCode` value, almost all function keys have a universal value.
  28845. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  28846. }
  28847. return '';
  28848. }
  28849. module.exports = getEventKey;
  28850. /***/ }),
  28851. /* 226 */
  28852. /***/ (function(module, exports, __webpack_require__) {
  28853. "use strict";
  28854. /**
  28855. * Copyright 2013-present, Facebook, Inc.
  28856. * All rights reserved.
  28857. *
  28858. * This source code is licensed under the BSD-style license found in the
  28859. * LICENSE file in the root directory of this source tree. An additional grant
  28860. * of patent rights can be found in the PATENTS file in the same directory.
  28861. *
  28862. *
  28863. */
  28864. /* global Symbol */
  28865. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  28866. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  28867. /**
  28868. * Returns the iterator method function contained on the iterable object.
  28869. *
  28870. * Be sure to invoke the function with the iterable as context:
  28871. *
  28872. * var iteratorFn = getIteratorFn(myIterable);
  28873. * if (iteratorFn) {
  28874. * var iterator = iteratorFn.call(myIterable);
  28875. * ...
  28876. * }
  28877. *
  28878. * @param {?object} maybeIterable
  28879. * @return {?function}
  28880. */
  28881. function getIteratorFn(maybeIterable) {
  28882. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  28883. if (typeof iteratorFn === 'function') {
  28884. return iteratorFn;
  28885. }
  28886. }
  28887. module.exports = getIteratorFn;
  28888. /***/ }),
  28889. /* 227 */
  28890. /***/ (function(module, exports, __webpack_require__) {
  28891. "use strict";
  28892. /**
  28893. * Copyright 2013-present, Facebook, Inc.
  28894. * All rights reserved.
  28895. *
  28896. * This source code is licensed under the BSD-style license found in the
  28897. * LICENSE file in the root directory of this source tree. An additional grant
  28898. * of patent rights can be found in the PATENTS file in the same directory.
  28899. *
  28900. *
  28901. */
  28902. var nextDebugID = 1;
  28903. function getNextDebugID() {
  28904. return nextDebugID++;
  28905. }
  28906. module.exports = getNextDebugID;
  28907. /***/ }),
  28908. /* 228 */
  28909. /***/ (function(module, exports, __webpack_require__) {
  28910. "use strict";
  28911. /**
  28912. * Copyright 2013-present, Facebook, Inc.
  28913. * All rights reserved.
  28914. *
  28915. * This source code is licensed under the BSD-style license found in the
  28916. * LICENSE file in the root directory of this source tree. An additional grant
  28917. * of patent rights can be found in the PATENTS file in the same directory.
  28918. *
  28919. */
  28920. /**
  28921. * Given any node return the first leaf node without children.
  28922. *
  28923. * @param {DOMElement|DOMTextNode} node
  28924. * @return {DOMElement|DOMTextNode}
  28925. */
  28926. function getLeafNode(node) {
  28927. while (node && node.firstChild) {
  28928. node = node.firstChild;
  28929. }
  28930. return node;
  28931. }
  28932. /**
  28933. * Get the next sibling within a container. This will walk up the
  28934. * DOM if a node's siblings have been exhausted.
  28935. *
  28936. * @param {DOMElement|DOMTextNode} node
  28937. * @return {?DOMElement|DOMTextNode}
  28938. */
  28939. function getSiblingNode(node) {
  28940. while (node) {
  28941. if (node.nextSibling) {
  28942. return node.nextSibling;
  28943. }
  28944. node = node.parentNode;
  28945. }
  28946. }
  28947. /**
  28948. * Get object describing the nodes which contain characters at offset.
  28949. *
  28950. * @param {DOMElement|DOMTextNode} root
  28951. * @param {number} offset
  28952. * @return {?object}
  28953. */
  28954. function getNodeForCharacterOffset(root, offset) {
  28955. var node = getLeafNode(root);
  28956. var nodeStart = 0;
  28957. var nodeEnd = 0;
  28958. while (node) {
  28959. if (node.nodeType === 3) {
  28960. nodeEnd = nodeStart + node.textContent.length;
  28961. if (nodeStart <= offset && nodeEnd >= offset) {
  28962. return {
  28963. node: node,
  28964. offset: offset - nodeStart
  28965. };
  28966. }
  28967. nodeStart = nodeEnd;
  28968. }
  28969. node = getLeafNode(getSiblingNode(node));
  28970. }
  28971. }
  28972. module.exports = getNodeForCharacterOffset;
  28973. /***/ }),
  28974. /* 229 */
  28975. /***/ (function(module, exports, __webpack_require__) {
  28976. "use strict";
  28977. /**
  28978. * Copyright 2013-present, Facebook, Inc.
  28979. * All rights reserved.
  28980. *
  28981. * This source code is licensed under the BSD-style license found in the
  28982. * LICENSE file in the root directory of this source tree. An additional grant
  28983. * of patent rights can be found in the PATENTS file in the same directory.
  28984. *
  28985. */
  28986. var ExecutionEnvironment = __webpack_require__(9);
  28987. /**
  28988. * Generate a mapping of standard vendor prefixes using the defined style property and event name.
  28989. *
  28990. * @param {string} styleProp
  28991. * @param {string} eventName
  28992. * @returns {object}
  28993. */
  28994. function makePrefixMap(styleProp, eventName) {
  28995. var prefixes = {};
  28996. prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
  28997. prefixes['Webkit' + styleProp] = 'webkit' + eventName;
  28998. prefixes['Moz' + styleProp] = 'moz' + eventName;
  28999. prefixes['ms' + styleProp] = 'MS' + eventName;
  29000. prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
  29001. return prefixes;
  29002. }
  29003. /**
  29004. * A list of event names to a configurable list of vendor prefixes.
  29005. */
  29006. var vendorPrefixes = {
  29007. animationend: makePrefixMap('Animation', 'AnimationEnd'),
  29008. animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
  29009. animationstart: makePrefixMap('Animation', 'AnimationStart'),
  29010. transitionend: makePrefixMap('Transition', 'TransitionEnd')
  29011. };
  29012. /**
  29013. * Event names that have already been detected and prefixed (if applicable).
  29014. */
  29015. var prefixedEventNames = {};
  29016. /**
  29017. * Element to check for prefixes on.
  29018. */
  29019. var style = {};
  29020. /**
  29021. * Bootstrap if a DOM exists.
  29022. */
  29023. if (ExecutionEnvironment.canUseDOM) {
  29024. style = document.createElement('div').style;
  29025. // On some platforms, in particular some releases of Android 4.x,
  29026. // the un-prefixed "animation" and "transition" properties are defined on the
  29027. // style object but the events that fire will still be prefixed, so we need
  29028. // to check if the un-prefixed events are usable, and if not remove them from the map.
  29029. if (!('AnimationEvent' in window)) {
  29030. delete vendorPrefixes.animationend.animation;
  29031. delete vendorPrefixes.animationiteration.animation;
  29032. delete vendorPrefixes.animationstart.animation;
  29033. }
  29034. // Same as above
  29035. if (!('TransitionEvent' in window)) {
  29036. delete vendorPrefixes.transitionend.transition;
  29037. }
  29038. }
  29039. /**
  29040. * Attempts to determine the correct vendor prefixed event name.
  29041. *
  29042. * @param {string} eventName
  29043. * @returns {string}
  29044. */
  29045. function getVendorPrefixedEventName(eventName) {
  29046. if (prefixedEventNames[eventName]) {
  29047. return prefixedEventNames[eventName];
  29048. } else if (!vendorPrefixes[eventName]) {
  29049. return eventName;
  29050. }
  29051. var prefixMap = vendorPrefixes[eventName];
  29052. for (var styleProp in prefixMap) {
  29053. if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
  29054. return prefixedEventNames[eventName] = prefixMap[styleProp];
  29055. }
  29056. }
  29057. return '';
  29058. }
  29059. module.exports = getVendorPrefixedEventName;
  29060. /***/ }),
  29061. /* 230 */
  29062. /***/ (function(module, exports, __webpack_require__) {
  29063. "use strict";
  29064. /**
  29065. * Copyright 2013-present, Facebook, Inc.
  29066. * All rights reserved.
  29067. *
  29068. * This source code is licensed under the BSD-style license found in the
  29069. * LICENSE file in the root directory of this source tree. An additional grant
  29070. * of patent rights can be found in the PATENTS file in the same directory.
  29071. *
  29072. */
  29073. var escapeTextContentForBrowser = __webpack_require__(35);
  29074. /**
  29075. * Escapes attribute value to prevent scripting attacks.
  29076. *
  29077. * @param {*} value Value to escape.
  29078. * @return {string} An escaped string.
  29079. */
  29080. function quoteAttributeValueForBrowser(value) {
  29081. return '"' + escapeTextContentForBrowser(value) + '"';
  29082. }
  29083. module.exports = quoteAttributeValueForBrowser;
  29084. /***/ }),
  29085. /* 231 */
  29086. /***/ (function(module, exports, __webpack_require__) {
  29087. "use strict";
  29088. /**
  29089. * Copyright 2013-present, Facebook, Inc.
  29090. * All rights reserved.
  29091. *
  29092. * This source code is licensed under the BSD-style license found in the
  29093. * LICENSE file in the root directory of this source tree. An additional grant
  29094. * of patent rights can be found in the PATENTS file in the same directory.
  29095. *
  29096. */
  29097. var ReactMount = __webpack_require__(86);
  29098. module.exports = ReactMount.renderSubtreeIntoContainer;
  29099. /***/ }),
  29100. /* 232 */
  29101. /***/ (function(module, exports, __webpack_require__) {
  29102. "use strict";
  29103. /**
  29104. * Copyright 2013-present, Facebook, Inc.
  29105. * All rights reserved.
  29106. *
  29107. * This source code is licensed under the BSD-style license found in the
  29108. * LICENSE file in the root directory of this source tree. An additional grant
  29109. * of patent rights can be found in the PATENTS file in the same directory.
  29110. *
  29111. *
  29112. */
  29113. /**
  29114. * Escape and wrap key so it is safe to use as a reactid
  29115. *
  29116. * @param {string} key to be escaped.
  29117. * @return {string} the escaped key.
  29118. */
  29119. function escape(key) {
  29120. var escapeRegex = /[=:]/g;
  29121. var escaperLookup = {
  29122. '=': '=0',
  29123. ':': '=2'
  29124. };
  29125. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  29126. return escaperLookup[match];
  29127. });
  29128. return '$' + escapedString;
  29129. }
  29130. /**
  29131. * Unescape and unwrap key for human-readable display
  29132. *
  29133. * @param {string} key to unescape.
  29134. * @return {string} the unescaped key.
  29135. */
  29136. function unescape(key) {
  29137. var unescapeRegex = /(=0|=2)/g;
  29138. var unescaperLookup = {
  29139. '=0': '=',
  29140. '=2': ':'
  29141. };
  29142. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  29143. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  29144. return unescaperLookup[match];
  29145. });
  29146. }
  29147. var KeyEscapeUtils = {
  29148. escape: escape,
  29149. unescape: unescape
  29150. };
  29151. module.exports = KeyEscapeUtils;
  29152. /***/ }),
  29153. /* 233 */
  29154. /***/ (function(module, exports, __webpack_require__) {
  29155. "use strict";
  29156. /**
  29157. * Copyright 2013-present, Facebook, Inc.
  29158. * All rights reserved.
  29159. *
  29160. * This source code is licensed under the BSD-style license found in the
  29161. * LICENSE file in the root directory of this source tree. An additional grant
  29162. * of patent rights can be found in the PATENTS file in the same directory.
  29163. *
  29164. *
  29165. */
  29166. var _prodInvariant = __webpack_require__(23);
  29167. var invariant = __webpack_require__(0);
  29168. /**
  29169. * Static poolers. Several custom versions for each potential number of
  29170. * arguments. A completely generic pooler is easy to implement, but would
  29171. * require accessing the `arguments` object. In each of these, `this` refers to
  29172. * the Class itself, not an instance. If any others are needed, simply add them
  29173. * here, or in their own files.
  29174. */
  29175. var oneArgumentPooler = function (copyFieldsFrom) {
  29176. var Klass = this;
  29177. if (Klass.instancePool.length) {
  29178. var instance = Klass.instancePool.pop();
  29179. Klass.call(instance, copyFieldsFrom);
  29180. return instance;
  29181. } else {
  29182. return new Klass(copyFieldsFrom);
  29183. }
  29184. };
  29185. var twoArgumentPooler = function (a1, a2) {
  29186. var Klass = this;
  29187. if (Klass.instancePool.length) {
  29188. var instance = Klass.instancePool.pop();
  29189. Klass.call(instance, a1, a2);
  29190. return instance;
  29191. } else {
  29192. return new Klass(a1, a2);
  29193. }
  29194. };
  29195. var threeArgumentPooler = function (a1, a2, a3) {
  29196. var Klass = this;
  29197. if (Klass.instancePool.length) {
  29198. var instance = Klass.instancePool.pop();
  29199. Klass.call(instance, a1, a2, a3);
  29200. return instance;
  29201. } else {
  29202. return new Klass(a1, a2, a3);
  29203. }
  29204. };
  29205. var fourArgumentPooler = function (a1, a2, a3, a4) {
  29206. var Klass = this;
  29207. if (Klass.instancePool.length) {
  29208. var instance = Klass.instancePool.pop();
  29209. Klass.call(instance, a1, a2, a3, a4);
  29210. return instance;
  29211. } else {
  29212. return new Klass(a1, a2, a3, a4);
  29213. }
  29214. };
  29215. var standardReleaser = function (instance) {
  29216. var Klass = this;
  29217. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  29218. instance.destructor();
  29219. if (Klass.instancePool.length < Klass.poolSize) {
  29220. Klass.instancePool.push(instance);
  29221. }
  29222. };
  29223. var DEFAULT_POOL_SIZE = 10;
  29224. var DEFAULT_POOLER = oneArgumentPooler;
  29225. /**
  29226. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  29227. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  29228. * you give this may have a `poolSize` property, and will look for a
  29229. * prototypical `destructor` on instances.
  29230. *
  29231. * @param {Function} CopyConstructor Constructor that can be used to reset.
  29232. * @param {Function} pooler Customizable pooler.
  29233. */
  29234. var addPoolingTo = function (CopyConstructor, pooler) {
  29235. // Casting as any so that flow ignores the actual implementation and trusts
  29236. // it to match the type we declared
  29237. var NewKlass = CopyConstructor;
  29238. NewKlass.instancePool = [];
  29239. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  29240. if (!NewKlass.poolSize) {
  29241. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  29242. }
  29243. NewKlass.release = standardReleaser;
  29244. return NewKlass;
  29245. };
  29246. var PooledClass = {
  29247. addPoolingTo: addPoolingTo,
  29248. oneArgumentPooler: oneArgumentPooler,
  29249. twoArgumentPooler: twoArgumentPooler,
  29250. threeArgumentPooler: threeArgumentPooler,
  29251. fourArgumentPooler: fourArgumentPooler
  29252. };
  29253. module.exports = PooledClass;
  29254. /***/ }),
  29255. /* 234 */
  29256. /***/ (function(module, exports, __webpack_require__) {
  29257. "use strict";
  29258. /**
  29259. * Copyright 2013-present, Facebook, Inc.
  29260. * All rights reserved.
  29261. *
  29262. * This source code is licensed under the BSD-style license found in the
  29263. * LICENSE file in the root directory of this source tree. An additional grant
  29264. * of patent rights can be found in the PATENTS file in the same directory.
  29265. *
  29266. */
  29267. var PooledClass = __webpack_require__(233);
  29268. var ReactElement = __webpack_require__(22);
  29269. var emptyFunction = __webpack_require__(10);
  29270. var traverseAllChildren = __webpack_require__(242);
  29271. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  29272. var fourArgumentPooler = PooledClass.fourArgumentPooler;
  29273. var userProvidedKeyEscapeRegex = /\/+/g;
  29274. function escapeUserProvidedKey(text) {
  29275. return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
  29276. }
  29277. /**
  29278. * PooledClass representing the bookkeeping associated with performing a child
  29279. * traversal. Allows avoiding binding callbacks.
  29280. *
  29281. * @constructor ForEachBookKeeping
  29282. * @param {!function} forEachFunction Function to perform traversal with.
  29283. * @param {?*} forEachContext Context to perform context with.
  29284. */
  29285. function ForEachBookKeeping(forEachFunction, forEachContext) {
  29286. this.func = forEachFunction;
  29287. this.context = forEachContext;
  29288. this.count = 0;
  29289. }
  29290. ForEachBookKeeping.prototype.destructor = function () {
  29291. this.func = null;
  29292. this.context = null;
  29293. this.count = 0;
  29294. };
  29295. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  29296. function forEachSingleChild(bookKeeping, child, name) {
  29297. var func = bookKeeping.func,
  29298. context = bookKeeping.context;
  29299. func.call(context, child, bookKeeping.count++);
  29300. }
  29301. /**
  29302. * Iterates through children that are typically specified as `props.children`.
  29303. *
  29304. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
  29305. *
  29306. * The provided forEachFunc(child, index) will be called for each
  29307. * leaf child.
  29308. *
  29309. * @param {?*} children Children tree container.
  29310. * @param {function(*, int)} forEachFunc
  29311. * @param {*} forEachContext Context for forEachContext.
  29312. */
  29313. function forEachChildren(children, forEachFunc, forEachContext) {
  29314. if (children == null) {
  29315. return children;
  29316. }
  29317. var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  29318. traverseAllChildren(children, forEachSingleChild, traverseContext);
  29319. ForEachBookKeeping.release(traverseContext);
  29320. }
  29321. /**
  29322. * PooledClass representing the bookkeeping associated with performing a child
  29323. * mapping. Allows avoiding binding callbacks.
  29324. *
  29325. * @constructor MapBookKeeping
  29326. * @param {!*} mapResult Object containing the ordered map of results.
  29327. * @param {!function} mapFunction Function to perform mapping with.
  29328. * @param {?*} mapContext Context to perform mapping with.
  29329. */
  29330. function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
  29331. this.result = mapResult;
  29332. this.keyPrefix = keyPrefix;
  29333. this.func = mapFunction;
  29334. this.context = mapContext;
  29335. this.count = 0;
  29336. }
  29337. MapBookKeeping.prototype.destructor = function () {
  29338. this.result = null;
  29339. this.keyPrefix = null;
  29340. this.func = null;
  29341. this.context = null;
  29342. this.count = 0;
  29343. };
  29344. PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
  29345. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  29346. var result = bookKeeping.result,
  29347. keyPrefix = bookKeeping.keyPrefix,
  29348. func = bookKeeping.func,
  29349. context = bookKeeping.context;
  29350. var mappedChild = func.call(context, child, bookKeeping.count++);
  29351. if (Array.isArray(mappedChild)) {
  29352. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
  29353. } else if (mappedChild != null) {
  29354. if (ReactElement.isValidElement(mappedChild)) {
  29355. mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
  29356. // Keep both the (mapped) and old keys if they differ, just as
  29357. // traverseAllChildren used to do for objects as children
  29358. keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
  29359. }
  29360. result.push(mappedChild);
  29361. }
  29362. }
  29363. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  29364. var escapedPrefix = '';
  29365. if (prefix != null) {
  29366. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  29367. }
  29368. var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
  29369. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  29370. MapBookKeeping.release(traverseContext);
  29371. }
  29372. /**
  29373. * Maps children that are typically specified as `props.children`.
  29374. *
  29375. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
  29376. *
  29377. * The provided mapFunction(child, key, index) will be called for each
  29378. * leaf child.
  29379. *
  29380. * @param {?*} children Children tree container.
  29381. * @param {function(*, int)} func The map function.
  29382. * @param {*} context Context for mapFunction.
  29383. * @return {object} Object containing the ordered map of results.
  29384. */
  29385. function mapChildren(children, func, context) {
  29386. if (children == null) {
  29387. return children;
  29388. }
  29389. var result = [];
  29390. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  29391. return result;
  29392. }
  29393. function forEachSingleChildDummy(traverseContext, child, name) {
  29394. return null;
  29395. }
  29396. /**
  29397. * Count the number of children that are typically specified as
  29398. * `props.children`.
  29399. *
  29400. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
  29401. *
  29402. * @param {?*} children Children tree container.
  29403. * @return {number} The number of children.
  29404. */
  29405. function countChildren(children, context) {
  29406. return traverseAllChildren(children, forEachSingleChildDummy, null);
  29407. }
  29408. /**
  29409. * Flatten a children object (typically specified as `props.children`) and
  29410. * return an array with appropriately re-keyed children.
  29411. *
  29412. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
  29413. */
  29414. function toArray(children) {
  29415. var result = [];
  29416. mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
  29417. return result;
  29418. }
  29419. var ReactChildren = {
  29420. forEach: forEachChildren,
  29421. map: mapChildren,
  29422. mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
  29423. count: countChildren,
  29424. toArray: toArray
  29425. };
  29426. module.exports = ReactChildren;
  29427. /***/ }),
  29428. /* 235 */
  29429. /***/ (function(module, exports, __webpack_require__) {
  29430. "use strict";
  29431. /**
  29432. * Copyright 2013-present, Facebook, Inc.
  29433. * All rights reserved.
  29434. *
  29435. * This source code is licensed under the BSD-style license found in the
  29436. * LICENSE file in the root directory of this source tree. An additional grant
  29437. * of patent rights can be found in the PATENTS file in the same directory.
  29438. *
  29439. */
  29440. var _prodInvariant = __webpack_require__(23),
  29441. _assign = __webpack_require__(3);
  29442. var ReactComponent = __webpack_require__(65);
  29443. var ReactElement = __webpack_require__(22);
  29444. var ReactPropTypeLocationNames = __webpack_require__(99);
  29445. var ReactNoopUpdateQueue = __webpack_require__(66);
  29446. var emptyObject = __webpack_require__(24);
  29447. var invariant = __webpack_require__(0);
  29448. var warning = __webpack_require__(1);
  29449. var MIXINS_KEY = 'mixins';
  29450. // Helper function to allow the creation of anonymous functions which do not
  29451. // have .name set to the name of the variable being assigned to.
  29452. function identity(fn) {
  29453. return fn;
  29454. }
  29455. /**
  29456. * Policies that describe methods in `ReactClassInterface`.
  29457. */
  29458. var injectedMixins = [];
  29459. /**
  29460. * Composite components are higher-level components that compose other composite
  29461. * or host components.
  29462. *
  29463. * To create a new type of `ReactClass`, pass a specification of
  29464. * your new class to `React.createClass`. The only requirement of your class
  29465. * specification is that you implement a `render` method.
  29466. *
  29467. * var MyComponent = React.createClass({
  29468. * render: function() {
  29469. * return <div>Hello World</div>;
  29470. * }
  29471. * });
  29472. *
  29473. * The class specification supports a specific protocol of methods that have
  29474. * special meaning (e.g. `render`). See `ReactClassInterface` for
  29475. * more the comprehensive protocol. Any other properties and methods in the
  29476. * class specification will be available on the prototype.
  29477. *
  29478. * @interface ReactClassInterface
  29479. * @internal
  29480. */
  29481. var ReactClassInterface = {
  29482. /**
  29483. * An array of Mixin objects to include when defining your component.
  29484. *
  29485. * @type {array}
  29486. * @optional
  29487. */
  29488. mixins: 'DEFINE_MANY',
  29489. /**
  29490. * An object containing properties and methods that should be defined on
  29491. * the component's constructor instead of its prototype (static methods).
  29492. *
  29493. * @type {object}
  29494. * @optional
  29495. */
  29496. statics: 'DEFINE_MANY',
  29497. /**
  29498. * Definition of prop types for this component.
  29499. *
  29500. * @type {object}
  29501. * @optional
  29502. */
  29503. propTypes: 'DEFINE_MANY',
  29504. /**
  29505. * Definition of context types for this component.
  29506. *
  29507. * @type {object}
  29508. * @optional
  29509. */
  29510. contextTypes: 'DEFINE_MANY',
  29511. /**
  29512. * Definition of context types this component sets for its children.
  29513. *
  29514. * @type {object}
  29515. * @optional
  29516. */
  29517. childContextTypes: 'DEFINE_MANY',
  29518. // ==== Definition methods ====
  29519. /**
  29520. * Invoked when the component is mounted. Values in the mapping will be set on
  29521. * `this.props` if that prop is not specified (i.e. using an `in` check).
  29522. *
  29523. * This method is invoked before `getInitialState` and therefore cannot rely
  29524. * on `this.state` or use `this.setState`.
  29525. *
  29526. * @return {object}
  29527. * @optional
  29528. */
  29529. getDefaultProps: 'DEFINE_MANY_MERGED',
  29530. /**
  29531. * Invoked once before the component is mounted. The return value will be used
  29532. * as the initial value of `this.state`.
  29533. *
  29534. * getInitialState: function() {
  29535. * return {
  29536. * isOn: false,
  29537. * fooBaz: new BazFoo()
  29538. * }
  29539. * }
  29540. *
  29541. * @return {object}
  29542. * @optional
  29543. */
  29544. getInitialState: 'DEFINE_MANY_MERGED',
  29545. /**
  29546. * @return {object}
  29547. * @optional
  29548. */
  29549. getChildContext: 'DEFINE_MANY_MERGED',
  29550. /**
  29551. * Uses props from `this.props` and state from `this.state` to render the
  29552. * structure of the component.
  29553. *
  29554. * No guarantees are made about when or how often this method is invoked, so
  29555. * it must not have side effects.
  29556. *
  29557. * render: function() {
  29558. * var name = this.props.name;
  29559. * return <div>Hello, {name}!</div>;
  29560. * }
  29561. *
  29562. * @return {ReactComponent}
  29563. * @nosideeffects
  29564. * @required
  29565. */
  29566. render: 'DEFINE_ONCE',
  29567. // ==== Delegate methods ====
  29568. /**
  29569. * Invoked when the component is initially created and about to be mounted.
  29570. * This may have side effects, but any external subscriptions or data created
  29571. * by this method must be cleaned up in `componentWillUnmount`.
  29572. *
  29573. * @optional
  29574. */
  29575. componentWillMount: 'DEFINE_MANY',
  29576. /**
  29577. * Invoked when the component has been mounted and has a DOM representation.
  29578. * However, there is no guarantee that the DOM node is in the document.
  29579. *
  29580. * Use this as an opportunity to operate on the DOM when the component has
  29581. * been mounted (initialized and rendered) for the first time.
  29582. *
  29583. * @param {DOMElement} rootNode DOM element representing the component.
  29584. * @optional
  29585. */
  29586. componentDidMount: 'DEFINE_MANY',
  29587. /**
  29588. * Invoked before the component receives new props.
  29589. *
  29590. * Use this as an opportunity to react to a prop transition by updating the
  29591. * state using `this.setState`. Current props are accessed via `this.props`.
  29592. *
  29593. * componentWillReceiveProps: function(nextProps, nextContext) {
  29594. * this.setState({
  29595. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  29596. * });
  29597. * }
  29598. *
  29599. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  29600. * transition may cause a state change, but the opposite is not true. If you
  29601. * need it, you are probably looking for `componentWillUpdate`.
  29602. *
  29603. * @param {object} nextProps
  29604. * @optional
  29605. */
  29606. componentWillReceiveProps: 'DEFINE_MANY',
  29607. /**
  29608. * Invoked while deciding if the component should be updated as a result of
  29609. * receiving new props, state and/or context.
  29610. *
  29611. * Use this as an opportunity to `return false` when you're certain that the
  29612. * transition to the new props/state/context will not require a component
  29613. * update.
  29614. *
  29615. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  29616. * return !equal(nextProps, this.props) ||
  29617. * !equal(nextState, this.state) ||
  29618. * !equal(nextContext, this.context);
  29619. * }
  29620. *
  29621. * @param {object} nextProps
  29622. * @param {?object} nextState
  29623. * @param {?object} nextContext
  29624. * @return {boolean} True if the component should update.
  29625. * @optional
  29626. */
  29627. shouldComponentUpdate: 'DEFINE_ONCE',
  29628. /**
  29629. * Invoked when the component is about to update due to a transition from
  29630. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  29631. * and `nextContext`.
  29632. *
  29633. * Use this as an opportunity to perform preparation before an update occurs.
  29634. *
  29635. * NOTE: You **cannot** use `this.setState()` in this method.
  29636. *
  29637. * @param {object} nextProps
  29638. * @param {?object} nextState
  29639. * @param {?object} nextContext
  29640. * @param {ReactReconcileTransaction} transaction
  29641. * @optional
  29642. */
  29643. componentWillUpdate: 'DEFINE_MANY',
  29644. /**
  29645. * Invoked when the component's DOM representation has been updated.
  29646. *
  29647. * Use this as an opportunity to operate on the DOM when the component has
  29648. * been updated.
  29649. *
  29650. * @param {object} prevProps
  29651. * @param {?object} prevState
  29652. * @param {?object} prevContext
  29653. * @param {DOMElement} rootNode DOM element representing the component.
  29654. * @optional
  29655. */
  29656. componentDidUpdate: 'DEFINE_MANY',
  29657. /**
  29658. * Invoked when the component is about to be removed from its parent and have
  29659. * its DOM representation destroyed.
  29660. *
  29661. * Use this as an opportunity to deallocate any external resources.
  29662. *
  29663. * NOTE: There is no `componentDidUnmount` since your component will have been
  29664. * destroyed by that point.
  29665. *
  29666. * @optional
  29667. */
  29668. componentWillUnmount: 'DEFINE_MANY',
  29669. // ==== Advanced methods ====
  29670. /**
  29671. * Updates the component's currently mounted DOM representation.
  29672. *
  29673. * By default, this implements React's rendering and reconciliation algorithm.
  29674. * Sophisticated clients may wish to override this.
  29675. *
  29676. * @param {ReactReconcileTransaction} transaction
  29677. * @internal
  29678. * @overridable
  29679. */
  29680. updateComponent: 'OVERRIDE_BASE'
  29681. };
  29682. /**
  29683. * Mapping from class specification keys to special processing functions.
  29684. *
  29685. * Although these are declared like instance properties in the specification
  29686. * when defining classes using `React.createClass`, they are actually static
  29687. * and are accessible on the constructor instead of the prototype. Despite
  29688. * being static, they must be defined outside of the "statics" key under
  29689. * which all other static methods are defined.
  29690. */
  29691. var RESERVED_SPEC_KEYS = {
  29692. displayName: function (Constructor, displayName) {
  29693. Constructor.displayName = displayName;
  29694. },
  29695. mixins: function (Constructor, mixins) {
  29696. if (mixins) {
  29697. for (var i = 0; i < mixins.length; i++) {
  29698. mixSpecIntoComponent(Constructor, mixins[i]);
  29699. }
  29700. }
  29701. },
  29702. childContextTypes: function (Constructor, childContextTypes) {
  29703. if (false) {
  29704. validateTypeDef(Constructor, childContextTypes, 'childContext');
  29705. }
  29706. Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
  29707. },
  29708. contextTypes: function (Constructor, contextTypes) {
  29709. if (false) {
  29710. validateTypeDef(Constructor, contextTypes, 'context');
  29711. }
  29712. Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
  29713. },
  29714. /**
  29715. * Special case getDefaultProps which should move into statics but requires
  29716. * automatic merging.
  29717. */
  29718. getDefaultProps: function (Constructor, getDefaultProps) {
  29719. if (Constructor.getDefaultProps) {
  29720. Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
  29721. } else {
  29722. Constructor.getDefaultProps = getDefaultProps;
  29723. }
  29724. },
  29725. propTypes: function (Constructor, propTypes) {
  29726. if (false) {
  29727. validateTypeDef(Constructor, propTypes, 'prop');
  29728. }
  29729. Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
  29730. },
  29731. statics: function (Constructor, statics) {
  29732. mixStaticSpecIntoComponent(Constructor, statics);
  29733. },
  29734. autobind: function () {} };
  29735. function validateTypeDef(Constructor, typeDef, location) {
  29736. for (var propName in typeDef) {
  29737. if (typeDef.hasOwnProperty(propName)) {
  29738. // use a warning instead of an invariant so components
  29739. // don't show up in prod but only in __DEV__
  29740. false ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
  29741. }
  29742. }
  29743. }
  29744. function validateMethodOverride(isAlreadyDefined, name) {
  29745. var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
  29746. // Disallow overriding of base class methods unless explicitly allowed.
  29747. if (ReactClassMixin.hasOwnProperty(name)) {
  29748. !(specPolicy === 'OVERRIDE_BASE') ? false ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0;
  29749. }
  29750. // Disallow defining methods more than once unless explicitly allowed.
  29751. if (isAlreadyDefined) {
  29752. !(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? false ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0;
  29753. }
  29754. }
  29755. /**
  29756. * Mixin helper which handles policy validation and reserved
  29757. * specification keys when building React classes.
  29758. */
  29759. function mixSpecIntoComponent(Constructor, spec) {
  29760. if (!spec) {
  29761. if (false) {
  29762. var typeofSpec = typeof spec;
  29763. var isMixinValid = typeofSpec === 'object' && spec !== null;
  29764. process.env.NODE_ENV !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0;
  29765. }
  29766. return;
  29767. }
  29768. !(typeof spec !== 'function') ? false ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0;
  29769. !!ReactElement.isValidElement(spec) ? false ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0;
  29770. var proto = Constructor.prototype;
  29771. var autoBindPairs = proto.__reactAutoBindPairs;
  29772. // By handling mixins before any other properties, we ensure the same
  29773. // chaining order is applied to methods with DEFINE_MANY policy, whether
  29774. // mixins are listed before or after these methods in the spec.
  29775. if (spec.hasOwnProperty(MIXINS_KEY)) {
  29776. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  29777. }
  29778. for (var name in spec) {
  29779. if (!spec.hasOwnProperty(name)) {
  29780. continue;
  29781. }
  29782. if (name === MIXINS_KEY) {
  29783. // We have already handled mixins in a special case above.
  29784. continue;
  29785. }
  29786. var property = spec[name];
  29787. var isAlreadyDefined = proto.hasOwnProperty(name);
  29788. validateMethodOverride(isAlreadyDefined, name);
  29789. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  29790. RESERVED_SPEC_KEYS[name](Constructor, property);
  29791. } else {
  29792. // Setup methods on prototype:
  29793. // The following member methods should not be automatically bound:
  29794. // 1. Expected ReactClass methods (in the "interface").
  29795. // 2. Overridden methods (that were mixed in).
  29796. var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
  29797. var isFunction = typeof property === 'function';
  29798. var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
  29799. if (shouldAutoBind) {
  29800. autoBindPairs.push(name, property);
  29801. proto[name] = property;
  29802. } else {
  29803. if (isAlreadyDefined) {
  29804. var specPolicy = ReactClassInterface[name];
  29805. // These cases should already be caught by validateMethodOverride.
  29806. !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? false ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0;
  29807. // For methods which are defined more than once, call the existing
  29808. // methods before calling the new property, merging if appropriate.
  29809. if (specPolicy === 'DEFINE_MANY_MERGED') {
  29810. proto[name] = createMergedResultFunction(proto[name], property);
  29811. } else if (specPolicy === 'DEFINE_MANY') {
  29812. proto[name] = createChainedFunction(proto[name], property);
  29813. }
  29814. } else {
  29815. proto[name] = property;
  29816. if (false) {
  29817. // Add verbose displayName to the function, which helps when looking
  29818. // at profiling tools.
  29819. if (typeof property === 'function' && spec.displayName) {
  29820. proto[name].displayName = spec.displayName + '_' + name;
  29821. }
  29822. }
  29823. }
  29824. }
  29825. }
  29826. }
  29827. }
  29828. function mixStaticSpecIntoComponent(Constructor, statics) {
  29829. if (!statics) {
  29830. return;
  29831. }
  29832. for (var name in statics) {
  29833. var property = statics[name];
  29834. if (!statics.hasOwnProperty(name)) {
  29835. continue;
  29836. }
  29837. var isReserved = name in RESERVED_SPEC_KEYS;
  29838. !!isReserved ? false ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0;
  29839. var isInherited = name in Constructor;
  29840. !!isInherited ? false ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0;
  29841. Constructor[name] = property;
  29842. }
  29843. }
  29844. /**
  29845. * Merge two objects, but throw if both contain the same key.
  29846. *
  29847. * @param {object} one The first object, which is mutated.
  29848. * @param {object} two The second object
  29849. * @return {object} one after it has been mutated to contain everything in two.
  29850. */
  29851. function mergeIntoWithNoDuplicateKeys(one, two) {
  29852. !(one && two && typeof one === 'object' && typeof two === 'object') ? false ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
  29853. for (var key in two) {
  29854. if (two.hasOwnProperty(key)) {
  29855. !(one[key] === undefined) ? false ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0;
  29856. one[key] = two[key];
  29857. }
  29858. }
  29859. return one;
  29860. }
  29861. /**
  29862. * Creates a function that invokes two functions and merges their return values.
  29863. *
  29864. * @param {function} one Function to invoke first.
  29865. * @param {function} two Function to invoke second.
  29866. * @return {function} Function that invokes the two argument functions.
  29867. * @private
  29868. */
  29869. function createMergedResultFunction(one, two) {
  29870. return function mergedResult() {
  29871. var a = one.apply(this, arguments);
  29872. var b = two.apply(this, arguments);
  29873. if (a == null) {
  29874. return b;
  29875. } else if (b == null) {
  29876. return a;
  29877. }
  29878. var c = {};
  29879. mergeIntoWithNoDuplicateKeys(c, a);
  29880. mergeIntoWithNoDuplicateKeys(c, b);
  29881. return c;
  29882. };
  29883. }
  29884. /**
  29885. * Creates a function that invokes two functions and ignores their return vales.
  29886. *
  29887. * @param {function} one Function to invoke first.
  29888. * @param {function} two Function to invoke second.
  29889. * @return {function} Function that invokes the two argument functions.
  29890. * @private
  29891. */
  29892. function createChainedFunction(one, two) {
  29893. return function chainedFunction() {
  29894. one.apply(this, arguments);
  29895. two.apply(this, arguments);
  29896. };
  29897. }
  29898. /**
  29899. * Binds a method to the component.
  29900. *
  29901. * @param {object} component Component whose method is going to be bound.
  29902. * @param {function} method Method to be bound.
  29903. * @return {function} The bound method.
  29904. */
  29905. function bindAutoBindMethod(component, method) {
  29906. var boundMethod = method.bind(component);
  29907. if (false) {
  29908. boundMethod.__reactBoundContext = component;
  29909. boundMethod.__reactBoundMethod = method;
  29910. boundMethod.__reactBoundArguments = null;
  29911. var componentName = component.constructor.displayName;
  29912. var _bind = boundMethod.bind;
  29913. boundMethod.bind = function (newThis) {
  29914. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  29915. args[_key - 1] = arguments[_key];
  29916. }
  29917. // User is trying to bind() an autobound method; we effectively will
  29918. // ignore the value of "this" that the user is trying to use, so
  29919. // let's warn.
  29920. if (newThis !== component && newThis !== null) {
  29921. process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
  29922. } else if (!args.length) {
  29923. process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
  29924. return boundMethod;
  29925. }
  29926. var reboundMethod = _bind.apply(boundMethod, arguments);
  29927. reboundMethod.__reactBoundContext = component;
  29928. reboundMethod.__reactBoundMethod = method;
  29929. reboundMethod.__reactBoundArguments = args;
  29930. return reboundMethod;
  29931. };
  29932. }
  29933. return boundMethod;
  29934. }
  29935. /**
  29936. * Binds all auto-bound methods in a component.
  29937. *
  29938. * @param {object} component Component whose method is going to be bound.
  29939. */
  29940. function bindAutoBindMethods(component) {
  29941. var pairs = component.__reactAutoBindPairs;
  29942. for (var i = 0; i < pairs.length; i += 2) {
  29943. var autoBindKey = pairs[i];
  29944. var method = pairs[i + 1];
  29945. component[autoBindKey] = bindAutoBindMethod(component, method);
  29946. }
  29947. }
  29948. /**
  29949. * Add more to the ReactClass base class. These are all legacy features and
  29950. * therefore not already part of the modern ReactComponent.
  29951. */
  29952. var ReactClassMixin = {
  29953. /**
  29954. * TODO: This will be deprecated because state should always keep a consistent
  29955. * type signature and the only use case for this, is to avoid that.
  29956. */
  29957. replaceState: function (newState, callback) {
  29958. this.updater.enqueueReplaceState(this, newState);
  29959. if (callback) {
  29960. this.updater.enqueueCallback(this, callback, 'replaceState');
  29961. }
  29962. },
  29963. /**
  29964. * Checks whether or not this composite component is mounted.
  29965. * @return {boolean} True if mounted, false otherwise.
  29966. * @protected
  29967. * @final
  29968. */
  29969. isMounted: function () {
  29970. return this.updater.isMounted(this);
  29971. }
  29972. };
  29973. var ReactClassComponent = function () {};
  29974. _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
  29975. /**
  29976. * Module for creating composite components.
  29977. *
  29978. * @class ReactClass
  29979. */
  29980. var ReactClass = {
  29981. /**
  29982. * Creates a composite component class given a class specification.
  29983. * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
  29984. *
  29985. * @param {object} spec Class specification (which must define `render`).
  29986. * @return {function} Component constructor function.
  29987. * @public
  29988. */
  29989. createClass: function (spec) {
  29990. // To keep our warnings more understandable, we'll use a little hack here to
  29991. // ensure that Constructor.name !== 'Constructor'. This makes sure we don't
  29992. // unnecessarily identify a class without displayName as 'Constructor'.
  29993. var Constructor = identity(function (props, context, updater) {
  29994. // This constructor gets overridden by mocks. The argument is used
  29995. // by mocks to assert on what gets mounted.
  29996. if (false) {
  29997. process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
  29998. }
  29999. // Wire up auto-binding
  30000. if (this.__reactAutoBindPairs.length) {
  30001. bindAutoBindMethods(this);
  30002. }
  30003. this.props = props;
  30004. this.context = context;
  30005. this.refs = emptyObject;
  30006. this.updater = updater || ReactNoopUpdateQueue;
  30007. this.state = null;
  30008. // ReactClasses doesn't have constructors. Instead, they use the
  30009. // getInitialState and componentWillMount methods for initialization.
  30010. var initialState = this.getInitialState ? this.getInitialState() : null;
  30011. if (false) {
  30012. // We allow auto-mocks to proceed as if they're returning null.
  30013. if (initialState === undefined && this.getInitialState._isMockFunction) {
  30014. // This is probably bad practice. Consider warning here and
  30015. // deprecating this convenience.
  30016. initialState = null;
  30017. }
  30018. }
  30019. !(typeof initialState === 'object' && !Array.isArray(initialState)) ? false ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0;
  30020. this.state = initialState;
  30021. });
  30022. Constructor.prototype = new ReactClassComponent();
  30023. Constructor.prototype.constructor = Constructor;
  30024. Constructor.prototype.__reactAutoBindPairs = [];
  30025. injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
  30026. mixSpecIntoComponent(Constructor, spec);
  30027. // Initialize the defaultProps property after all mixins have been merged.
  30028. if (Constructor.getDefaultProps) {
  30029. Constructor.defaultProps = Constructor.getDefaultProps();
  30030. }
  30031. if (false) {
  30032. // This is a tag to indicate that the use of these method names is ok,
  30033. // since it's used with createClass. If it's not, then it's likely a
  30034. // mistake so we'll warn you to use the static property, property
  30035. // initializer or constructor respectively.
  30036. if (Constructor.getDefaultProps) {
  30037. Constructor.getDefaultProps.isReactClassApproved = {};
  30038. }
  30039. if (Constructor.prototype.getInitialState) {
  30040. Constructor.prototype.getInitialState.isReactClassApproved = {};
  30041. }
  30042. }
  30043. !Constructor.prototype.render ? false ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
  30044. if (false) {
  30045. process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
  30046. process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
  30047. }
  30048. // Reduce time spent doing lookups by setting these on the prototype.
  30049. for (var methodName in ReactClassInterface) {
  30050. if (!Constructor.prototype[methodName]) {
  30051. Constructor.prototype[methodName] = null;
  30052. }
  30053. }
  30054. return Constructor;
  30055. },
  30056. injection: {
  30057. injectMixin: function (mixin) {
  30058. injectedMixins.push(mixin);
  30059. }
  30060. }
  30061. };
  30062. module.exports = ReactClass;
  30063. /***/ }),
  30064. /* 236 */
  30065. /***/ (function(module, exports, __webpack_require__) {
  30066. "use strict";
  30067. /**
  30068. * Copyright 2013-present, Facebook, Inc.
  30069. * All rights reserved.
  30070. *
  30071. * This source code is licensed under the BSD-style license found in the
  30072. * LICENSE file in the root directory of this source tree. An additional grant
  30073. * of patent rights can be found in the PATENTS file in the same directory.
  30074. *
  30075. */
  30076. var ReactElement = __webpack_require__(22);
  30077. /**
  30078. * Create a factory that creates HTML tag elements.
  30079. *
  30080. * @private
  30081. */
  30082. var createDOMFactory = ReactElement.createFactory;
  30083. if (false) {
  30084. var ReactElementValidator = require('./ReactElementValidator');
  30085. createDOMFactory = ReactElementValidator.createFactory;
  30086. }
  30087. /**
  30088. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  30089. * This is also accessible via `React.DOM`.
  30090. *
  30091. * @public
  30092. */
  30093. var ReactDOMFactories = {
  30094. a: createDOMFactory('a'),
  30095. abbr: createDOMFactory('abbr'),
  30096. address: createDOMFactory('address'),
  30097. area: createDOMFactory('area'),
  30098. article: createDOMFactory('article'),
  30099. aside: createDOMFactory('aside'),
  30100. audio: createDOMFactory('audio'),
  30101. b: createDOMFactory('b'),
  30102. base: createDOMFactory('base'),
  30103. bdi: createDOMFactory('bdi'),
  30104. bdo: createDOMFactory('bdo'),
  30105. big: createDOMFactory('big'),
  30106. blockquote: createDOMFactory('blockquote'),
  30107. body: createDOMFactory('body'),
  30108. br: createDOMFactory('br'),
  30109. button: createDOMFactory('button'),
  30110. canvas: createDOMFactory('canvas'),
  30111. caption: createDOMFactory('caption'),
  30112. cite: createDOMFactory('cite'),
  30113. code: createDOMFactory('code'),
  30114. col: createDOMFactory('col'),
  30115. colgroup: createDOMFactory('colgroup'),
  30116. data: createDOMFactory('data'),
  30117. datalist: createDOMFactory('datalist'),
  30118. dd: createDOMFactory('dd'),
  30119. del: createDOMFactory('del'),
  30120. details: createDOMFactory('details'),
  30121. dfn: createDOMFactory('dfn'),
  30122. dialog: createDOMFactory('dialog'),
  30123. div: createDOMFactory('div'),
  30124. dl: createDOMFactory('dl'),
  30125. dt: createDOMFactory('dt'),
  30126. em: createDOMFactory('em'),
  30127. embed: createDOMFactory('embed'),
  30128. fieldset: createDOMFactory('fieldset'),
  30129. figcaption: createDOMFactory('figcaption'),
  30130. figure: createDOMFactory('figure'),
  30131. footer: createDOMFactory('footer'),
  30132. form: createDOMFactory('form'),
  30133. h1: createDOMFactory('h1'),
  30134. h2: createDOMFactory('h2'),
  30135. h3: createDOMFactory('h3'),
  30136. h4: createDOMFactory('h4'),
  30137. h5: createDOMFactory('h5'),
  30138. h6: createDOMFactory('h6'),
  30139. head: createDOMFactory('head'),
  30140. header: createDOMFactory('header'),
  30141. hgroup: createDOMFactory('hgroup'),
  30142. hr: createDOMFactory('hr'),
  30143. html: createDOMFactory('html'),
  30144. i: createDOMFactory('i'),
  30145. iframe: createDOMFactory('iframe'),
  30146. img: createDOMFactory('img'),
  30147. input: createDOMFactory('input'),
  30148. ins: createDOMFactory('ins'),
  30149. kbd: createDOMFactory('kbd'),
  30150. keygen: createDOMFactory('keygen'),
  30151. label: createDOMFactory('label'),
  30152. legend: createDOMFactory('legend'),
  30153. li: createDOMFactory('li'),
  30154. link: createDOMFactory('link'),
  30155. main: createDOMFactory('main'),
  30156. map: createDOMFactory('map'),
  30157. mark: createDOMFactory('mark'),
  30158. menu: createDOMFactory('menu'),
  30159. menuitem: createDOMFactory('menuitem'),
  30160. meta: createDOMFactory('meta'),
  30161. meter: createDOMFactory('meter'),
  30162. nav: createDOMFactory('nav'),
  30163. noscript: createDOMFactory('noscript'),
  30164. object: createDOMFactory('object'),
  30165. ol: createDOMFactory('ol'),
  30166. optgroup: createDOMFactory('optgroup'),
  30167. option: createDOMFactory('option'),
  30168. output: createDOMFactory('output'),
  30169. p: createDOMFactory('p'),
  30170. param: createDOMFactory('param'),
  30171. picture: createDOMFactory('picture'),
  30172. pre: createDOMFactory('pre'),
  30173. progress: createDOMFactory('progress'),
  30174. q: createDOMFactory('q'),
  30175. rp: createDOMFactory('rp'),
  30176. rt: createDOMFactory('rt'),
  30177. ruby: createDOMFactory('ruby'),
  30178. s: createDOMFactory('s'),
  30179. samp: createDOMFactory('samp'),
  30180. script: createDOMFactory('script'),
  30181. section: createDOMFactory('section'),
  30182. select: createDOMFactory('select'),
  30183. small: createDOMFactory('small'),
  30184. source: createDOMFactory('source'),
  30185. span: createDOMFactory('span'),
  30186. strong: createDOMFactory('strong'),
  30187. style: createDOMFactory('style'),
  30188. sub: createDOMFactory('sub'),
  30189. summary: createDOMFactory('summary'),
  30190. sup: createDOMFactory('sup'),
  30191. table: createDOMFactory('table'),
  30192. tbody: createDOMFactory('tbody'),
  30193. td: createDOMFactory('td'),
  30194. textarea: createDOMFactory('textarea'),
  30195. tfoot: createDOMFactory('tfoot'),
  30196. th: createDOMFactory('th'),
  30197. thead: createDOMFactory('thead'),
  30198. time: createDOMFactory('time'),
  30199. title: createDOMFactory('title'),
  30200. tr: createDOMFactory('tr'),
  30201. track: createDOMFactory('track'),
  30202. u: createDOMFactory('u'),
  30203. ul: createDOMFactory('ul'),
  30204. 'var': createDOMFactory('var'),
  30205. video: createDOMFactory('video'),
  30206. wbr: createDOMFactory('wbr'),
  30207. // SVG
  30208. circle: createDOMFactory('circle'),
  30209. clipPath: createDOMFactory('clipPath'),
  30210. defs: createDOMFactory('defs'),
  30211. ellipse: createDOMFactory('ellipse'),
  30212. g: createDOMFactory('g'),
  30213. image: createDOMFactory('image'),
  30214. line: createDOMFactory('line'),
  30215. linearGradient: createDOMFactory('linearGradient'),
  30216. mask: createDOMFactory('mask'),
  30217. path: createDOMFactory('path'),
  30218. pattern: createDOMFactory('pattern'),
  30219. polygon: createDOMFactory('polygon'),
  30220. polyline: createDOMFactory('polyline'),
  30221. radialGradient: createDOMFactory('radialGradient'),
  30222. rect: createDOMFactory('rect'),
  30223. stop: createDOMFactory('stop'),
  30224. svg: createDOMFactory('svg'),
  30225. text: createDOMFactory('text'),
  30226. tspan: createDOMFactory('tspan')
  30227. };
  30228. module.exports = ReactDOMFactories;
  30229. /***/ }),
  30230. /* 237 */
  30231. /***/ (function(module, exports, __webpack_require__) {
  30232. "use strict";
  30233. /**
  30234. * Copyright 2013-present, Facebook, Inc.
  30235. * All rights reserved.
  30236. *
  30237. * This source code is licensed under the BSD-style license found in the
  30238. * LICENSE file in the root directory of this source tree. An additional grant
  30239. * of patent rights can be found in the PATENTS file in the same directory.
  30240. *
  30241. */
  30242. var ReactElement = __webpack_require__(22);
  30243. var ReactPropTypeLocationNames = __webpack_require__(99);
  30244. var ReactPropTypesSecret = __webpack_require__(238);
  30245. var emptyFunction = __webpack_require__(10);
  30246. var getIteratorFn = __webpack_require__(101);
  30247. var warning = __webpack_require__(1);
  30248. /**
  30249. * Collection of methods that allow declaration and validation of props that are
  30250. * supplied to React components. Example usage:
  30251. *
  30252. * var Props = require('ReactPropTypes');
  30253. * var MyArticle = React.createClass({
  30254. * propTypes: {
  30255. * // An optional string prop named "description".
  30256. * description: Props.string,
  30257. *
  30258. * // A required enum prop named "category".
  30259. * category: Props.oneOf(['News','Photos']).isRequired,
  30260. *
  30261. * // A prop named "dialog" that requires an instance of Dialog.
  30262. * dialog: Props.instanceOf(Dialog).isRequired
  30263. * },
  30264. * render: function() { ... }
  30265. * });
  30266. *
  30267. * A more formal specification of how these methods are used:
  30268. *
  30269. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  30270. * decl := ReactPropTypes.{type}(.isRequired)?
  30271. *
  30272. * Each and every declaration produces a function with the same signature. This
  30273. * allows the creation of custom validation functions. For example:
  30274. *
  30275. * var MyLink = React.createClass({
  30276. * propTypes: {
  30277. * // An optional string or URI prop named "href".
  30278. * href: function(props, propName, componentName) {
  30279. * var propValue = props[propName];
  30280. * if (propValue != null && typeof propValue !== 'string' &&
  30281. * !(propValue instanceof URI)) {
  30282. * return new Error(
  30283. * 'Expected a string or an URI for ' + propName + ' in ' +
  30284. * componentName
  30285. * );
  30286. * }
  30287. * }
  30288. * },
  30289. * render: function() {...}
  30290. * });
  30291. *
  30292. * @internal
  30293. */
  30294. var ANONYMOUS = '<<anonymous>>';
  30295. var ReactPropTypes = {
  30296. array: createPrimitiveTypeChecker('array'),
  30297. bool: createPrimitiveTypeChecker('boolean'),
  30298. func: createPrimitiveTypeChecker('function'),
  30299. number: createPrimitiveTypeChecker('number'),
  30300. object: createPrimitiveTypeChecker('object'),
  30301. string: createPrimitiveTypeChecker('string'),
  30302. symbol: createPrimitiveTypeChecker('symbol'),
  30303. any: createAnyTypeChecker(),
  30304. arrayOf: createArrayOfTypeChecker,
  30305. element: createElementTypeChecker(),
  30306. instanceOf: createInstanceTypeChecker,
  30307. node: createNodeChecker(),
  30308. objectOf: createObjectOfTypeChecker,
  30309. oneOf: createEnumTypeChecker,
  30310. oneOfType: createUnionTypeChecker,
  30311. shape: createShapeTypeChecker
  30312. };
  30313. /**
  30314. * inlined Object.is polyfill to avoid requiring consumers ship their own
  30315. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  30316. */
  30317. /*eslint-disable no-self-compare*/
  30318. function is(x, y) {
  30319. // SameValue algorithm
  30320. if (x === y) {
  30321. // Steps 1-5, 7-10
  30322. // Steps 6.b-6.e: +0 != -0
  30323. return x !== 0 || 1 / x === 1 / y;
  30324. } else {
  30325. // Step 6.a: NaN == NaN
  30326. return x !== x && y !== y;
  30327. }
  30328. }
  30329. /*eslint-enable no-self-compare*/
  30330. /**
  30331. * We use an Error-like object for backward compatibility as people may call
  30332. * PropTypes directly and inspect their output. However we don't use real
  30333. * Errors anymore. We don't inspect their stack anyway, and creating them
  30334. * is prohibitively expensive if they are created too often, such as what
  30335. * happens in oneOfType() for any type before the one that matched.
  30336. */
  30337. function PropTypeError(message) {
  30338. this.message = message;
  30339. this.stack = '';
  30340. }
  30341. // Make `instanceof Error` still work for returned errors.
  30342. PropTypeError.prototype = Error.prototype;
  30343. function createChainableTypeChecker(validate) {
  30344. if (false) {
  30345. var manualPropTypeCallCache = {};
  30346. }
  30347. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  30348. componentName = componentName || ANONYMOUS;
  30349. propFullName = propFullName || propName;
  30350. if (false) {
  30351. if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
  30352. var cacheKey = componentName + ':' + propName;
  30353. if (!manualPropTypeCallCache[cacheKey]) {
  30354. process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;
  30355. manualPropTypeCallCache[cacheKey] = true;
  30356. }
  30357. }
  30358. }
  30359. if (props[propName] == null) {
  30360. var locationName = ReactPropTypeLocationNames[location];
  30361. if (isRequired) {
  30362. if (props[propName] === null) {
  30363. return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  30364. }
  30365. return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  30366. }
  30367. return null;
  30368. } else {
  30369. return validate(props, propName, componentName, location, propFullName);
  30370. }
  30371. }
  30372. var chainedCheckType = checkType.bind(null, false);
  30373. chainedCheckType.isRequired = checkType.bind(null, true);
  30374. return chainedCheckType;
  30375. }
  30376. function createPrimitiveTypeChecker(expectedType) {
  30377. function validate(props, propName, componentName, location, propFullName, secret) {
  30378. var propValue = props[propName];
  30379. var propType = getPropType(propValue);
  30380. if (propType !== expectedType) {
  30381. var locationName = ReactPropTypeLocationNames[location];
  30382. // `propValue` being instance of, say, date/regexp, pass the 'object'
  30383. // check, but we can offer a more precise error message here rather than
  30384. // 'of type `object`'.
  30385. var preciseType = getPreciseType(propValue);
  30386. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  30387. }
  30388. return null;
  30389. }
  30390. return createChainableTypeChecker(validate);
  30391. }
  30392. function createAnyTypeChecker() {
  30393. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  30394. }
  30395. function createArrayOfTypeChecker(typeChecker) {
  30396. function validate(props, propName, componentName, location, propFullName) {
  30397. if (typeof typeChecker !== 'function') {
  30398. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  30399. }
  30400. var propValue = props[propName];
  30401. if (!Array.isArray(propValue)) {
  30402. var locationName = ReactPropTypeLocationNames[location];
  30403. var propType = getPropType(propValue);
  30404. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  30405. }
  30406. for (var i = 0; i < propValue.length; i++) {
  30407. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  30408. if (error instanceof Error) {
  30409. return error;
  30410. }
  30411. }
  30412. return null;
  30413. }
  30414. return createChainableTypeChecker(validate);
  30415. }
  30416. function createElementTypeChecker() {
  30417. function validate(props, propName, componentName, location, propFullName) {
  30418. var propValue = props[propName];
  30419. if (!ReactElement.isValidElement(propValue)) {
  30420. var locationName = ReactPropTypeLocationNames[location];
  30421. var propType = getPropType(propValue);
  30422. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  30423. }
  30424. return null;
  30425. }
  30426. return createChainableTypeChecker(validate);
  30427. }
  30428. function createInstanceTypeChecker(expectedClass) {
  30429. function validate(props, propName, componentName, location, propFullName) {
  30430. if (!(props[propName] instanceof expectedClass)) {
  30431. var locationName = ReactPropTypeLocationNames[location];
  30432. var expectedClassName = expectedClass.name || ANONYMOUS;
  30433. var actualClassName = getClassName(props[propName]);
  30434. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  30435. }
  30436. return null;
  30437. }
  30438. return createChainableTypeChecker(validate);
  30439. }
  30440. function createEnumTypeChecker(expectedValues) {
  30441. if (!Array.isArray(expectedValues)) {
  30442. false ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
  30443. return emptyFunction.thatReturnsNull;
  30444. }
  30445. function validate(props, propName, componentName, location, propFullName) {
  30446. var propValue = props[propName];
  30447. for (var i = 0; i < expectedValues.length; i++) {
  30448. if (is(propValue, expectedValues[i])) {
  30449. return null;
  30450. }
  30451. }
  30452. var locationName = ReactPropTypeLocationNames[location];
  30453. var valuesString = JSON.stringify(expectedValues);
  30454. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  30455. }
  30456. return createChainableTypeChecker(validate);
  30457. }
  30458. function createObjectOfTypeChecker(typeChecker) {
  30459. function validate(props, propName, componentName, location, propFullName) {
  30460. if (typeof typeChecker !== 'function') {
  30461. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  30462. }
  30463. var propValue = props[propName];
  30464. var propType = getPropType(propValue);
  30465. if (propType !== 'object') {
  30466. var locationName = ReactPropTypeLocationNames[location];
  30467. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  30468. }
  30469. for (var key in propValue) {
  30470. if (propValue.hasOwnProperty(key)) {
  30471. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  30472. if (error instanceof Error) {
  30473. return error;
  30474. }
  30475. }
  30476. }
  30477. return null;
  30478. }
  30479. return createChainableTypeChecker(validate);
  30480. }
  30481. function createUnionTypeChecker(arrayOfTypeCheckers) {
  30482. if (!Array.isArray(arrayOfTypeCheckers)) {
  30483. false ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  30484. return emptyFunction.thatReturnsNull;
  30485. }
  30486. function validate(props, propName, componentName, location, propFullName) {
  30487. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  30488. var checker = arrayOfTypeCheckers[i];
  30489. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
  30490. return null;
  30491. }
  30492. }
  30493. var locationName = ReactPropTypeLocationNames[location];
  30494. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  30495. }
  30496. return createChainableTypeChecker(validate);
  30497. }
  30498. function createNodeChecker() {
  30499. function validate(props, propName, componentName, location, propFullName) {
  30500. if (!isNode(props[propName])) {
  30501. var locationName = ReactPropTypeLocationNames[location];
  30502. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  30503. }
  30504. return null;
  30505. }
  30506. return createChainableTypeChecker(validate);
  30507. }
  30508. function createShapeTypeChecker(shapeTypes) {
  30509. function validate(props, propName, componentName, location, propFullName) {
  30510. var propValue = props[propName];
  30511. var propType = getPropType(propValue);
  30512. if (propType !== 'object') {
  30513. var locationName = ReactPropTypeLocationNames[location];
  30514. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  30515. }
  30516. for (var key in shapeTypes) {
  30517. var checker = shapeTypes[key];
  30518. if (!checker) {
  30519. continue;
  30520. }
  30521. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  30522. if (error) {
  30523. return error;
  30524. }
  30525. }
  30526. return null;
  30527. }
  30528. return createChainableTypeChecker(validate);
  30529. }
  30530. function isNode(propValue) {
  30531. switch (typeof propValue) {
  30532. case 'number':
  30533. case 'string':
  30534. case 'undefined':
  30535. return true;
  30536. case 'boolean':
  30537. return !propValue;
  30538. case 'object':
  30539. if (Array.isArray(propValue)) {
  30540. return propValue.every(isNode);
  30541. }
  30542. if (propValue === null || ReactElement.isValidElement(propValue)) {
  30543. return true;
  30544. }
  30545. var iteratorFn = getIteratorFn(propValue);
  30546. if (iteratorFn) {
  30547. var iterator = iteratorFn.call(propValue);
  30548. var step;
  30549. if (iteratorFn !== propValue.entries) {
  30550. while (!(step = iterator.next()).done) {
  30551. if (!isNode(step.value)) {
  30552. return false;
  30553. }
  30554. }
  30555. } else {
  30556. // Iterator will provide entry [k,v] tuples rather than values.
  30557. while (!(step = iterator.next()).done) {
  30558. var entry = step.value;
  30559. if (entry) {
  30560. if (!isNode(entry[1])) {
  30561. return false;
  30562. }
  30563. }
  30564. }
  30565. }
  30566. } else {
  30567. return false;
  30568. }
  30569. return true;
  30570. default:
  30571. return false;
  30572. }
  30573. }
  30574. function isSymbol(propType, propValue) {
  30575. // Native Symbol.
  30576. if (propType === 'symbol') {
  30577. return true;
  30578. }
  30579. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  30580. if (propValue['@@toStringTag'] === 'Symbol') {
  30581. return true;
  30582. }
  30583. // Fallback for non-spec compliant Symbols which are polyfilled.
  30584. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  30585. return true;
  30586. }
  30587. return false;
  30588. }
  30589. // Equivalent of `typeof` but with special handling for array and regexp.
  30590. function getPropType(propValue) {
  30591. var propType = typeof propValue;
  30592. if (Array.isArray(propValue)) {
  30593. return 'array';
  30594. }
  30595. if (propValue instanceof RegExp) {
  30596. // Old webkits (at least until Android 4.0) return 'function' rather than
  30597. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  30598. // passes PropTypes.object.
  30599. return 'object';
  30600. }
  30601. if (isSymbol(propType, propValue)) {
  30602. return 'symbol';
  30603. }
  30604. return propType;
  30605. }
  30606. // This handles more types than `getPropType`. Only used for error messages.
  30607. // See `createPrimitiveTypeChecker`.
  30608. function getPreciseType(propValue) {
  30609. var propType = getPropType(propValue);
  30610. if (propType === 'object') {
  30611. if (propValue instanceof Date) {
  30612. return 'date';
  30613. } else if (propValue instanceof RegExp) {
  30614. return 'regexp';
  30615. }
  30616. }
  30617. return propType;
  30618. }
  30619. // Returns class name of the object, if any.
  30620. function getClassName(propValue) {
  30621. if (!propValue.constructor || !propValue.constructor.name) {
  30622. return ANONYMOUS;
  30623. }
  30624. return propValue.constructor.name;
  30625. }
  30626. module.exports = ReactPropTypes;
  30627. /***/ }),
  30628. /* 238 */
  30629. /***/ (function(module, exports, __webpack_require__) {
  30630. "use strict";
  30631. /**
  30632. * Copyright 2013-present, Facebook, Inc.
  30633. * All rights reserved.
  30634. *
  30635. * This source code is licensed under the BSD-style license found in the
  30636. * LICENSE file in the root directory of this source tree. An additional grant
  30637. * of patent rights can be found in the PATENTS file in the same directory.
  30638. *
  30639. *
  30640. */
  30641. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  30642. module.exports = ReactPropTypesSecret;
  30643. /***/ }),
  30644. /* 239 */
  30645. /***/ (function(module, exports, __webpack_require__) {
  30646. "use strict";
  30647. /**
  30648. * Copyright 2013-present, Facebook, Inc.
  30649. * All rights reserved.
  30650. *
  30651. * This source code is licensed under the BSD-style license found in the
  30652. * LICENSE file in the root directory of this source tree. An additional grant
  30653. * of patent rights can be found in the PATENTS file in the same directory.
  30654. *
  30655. */
  30656. var _assign = __webpack_require__(3);
  30657. var ReactComponent = __webpack_require__(65);
  30658. var ReactNoopUpdateQueue = __webpack_require__(66);
  30659. var emptyObject = __webpack_require__(24);
  30660. /**
  30661. * Base class helpers for the updating state of a component.
  30662. */
  30663. function ReactPureComponent(props, context, updater) {
  30664. // Duplicated from ReactComponent.
  30665. this.props = props;
  30666. this.context = context;
  30667. this.refs = emptyObject;
  30668. // We initialize the default updater but the real one gets injected by the
  30669. // renderer.
  30670. this.updater = updater || ReactNoopUpdateQueue;
  30671. }
  30672. function ComponentDummy() {}
  30673. ComponentDummy.prototype = ReactComponent.prototype;
  30674. ReactPureComponent.prototype = new ComponentDummy();
  30675. ReactPureComponent.prototype.constructor = ReactPureComponent;
  30676. // Avoid an extra prototype jump for these methods.
  30677. _assign(ReactPureComponent.prototype, ReactComponent.prototype);
  30678. ReactPureComponent.prototype.isPureReactComponent = true;
  30679. module.exports = ReactPureComponent;
  30680. /***/ }),
  30681. /* 240 */
  30682. /***/ (function(module, exports, __webpack_require__) {
  30683. "use strict";
  30684. /**
  30685. * Copyright 2013-present, Facebook, Inc.
  30686. * All rights reserved.
  30687. *
  30688. * This source code is licensed under the BSD-style license found in the
  30689. * LICENSE file in the root directory of this source tree. An additional grant
  30690. * of patent rights can be found in the PATENTS file in the same directory.
  30691. *
  30692. */
  30693. module.exports = '15.4.2';
  30694. /***/ }),
  30695. /* 241 */
  30696. /***/ (function(module, exports, __webpack_require__) {
  30697. "use strict";
  30698. /**
  30699. * Copyright 2013-present, Facebook, Inc.
  30700. * All rights reserved.
  30701. *
  30702. * This source code is licensed under the BSD-style license found in the
  30703. * LICENSE file in the root directory of this source tree. An additional grant
  30704. * of patent rights can be found in the PATENTS file in the same directory.
  30705. *
  30706. */
  30707. var _prodInvariant = __webpack_require__(23);
  30708. var ReactElement = __webpack_require__(22);
  30709. var invariant = __webpack_require__(0);
  30710. /**
  30711. * Returns the first child in a collection of children and verifies that there
  30712. * is only one child in the collection.
  30713. *
  30714. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
  30715. *
  30716. * The current implementation of this function assumes that a single child gets
  30717. * passed without a wrapper, but the purpose of this helper function is to
  30718. * abstract away the particular structure of children.
  30719. *
  30720. * @param {?object} children Child collection structure.
  30721. * @return {ReactElement} The first and only `ReactElement` contained in the
  30722. * structure.
  30723. */
  30724. function onlyChild(children) {
  30725. !ReactElement.isValidElement(children) ? false ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
  30726. return children;
  30727. }
  30728. module.exports = onlyChild;
  30729. /***/ }),
  30730. /* 242 */
  30731. /***/ (function(module, exports, __webpack_require__) {
  30732. "use strict";
  30733. /**
  30734. * Copyright 2013-present, Facebook, Inc.
  30735. * All rights reserved.
  30736. *
  30737. * This source code is licensed under the BSD-style license found in the
  30738. * LICENSE file in the root directory of this source tree. An additional grant
  30739. * of patent rights can be found in the PATENTS file in the same directory.
  30740. *
  30741. */
  30742. var _prodInvariant = __webpack_require__(23);
  30743. var ReactCurrentOwner = __webpack_require__(14);
  30744. var REACT_ELEMENT_TYPE = __webpack_require__(98);
  30745. var getIteratorFn = __webpack_require__(101);
  30746. var invariant = __webpack_require__(0);
  30747. var KeyEscapeUtils = __webpack_require__(232);
  30748. var warning = __webpack_require__(1);
  30749. var SEPARATOR = '.';
  30750. var SUBSEPARATOR = ':';
  30751. /**
  30752. * This is inlined from ReactElement since this file is shared between
  30753. * isomorphic and renderers. We could extract this to a
  30754. *
  30755. */
  30756. /**
  30757. * TODO: Test that a single child and an array with one item have the same key
  30758. * pattern.
  30759. */
  30760. var didWarnAboutMaps = false;
  30761. /**
  30762. * Generate a key string that identifies a component within a set.
  30763. *
  30764. * @param {*} component A component that could contain a manual key.
  30765. * @param {number} index Index that is used if a manual key is not provided.
  30766. * @return {string}
  30767. */
  30768. function getComponentKey(component, index) {
  30769. // Do some typechecking here since we call this blindly. We want to ensure
  30770. // that we don't block potential future ES APIs.
  30771. if (component && typeof component === 'object' && component.key != null) {
  30772. // Explicit key
  30773. return KeyEscapeUtils.escape(component.key);
  30774. }
  30775. // Implicit key determined by the index in the set
  30776. return index.toString(36);
  30777. }
  30778. /**
  30779. * @param {?*} children Children tree container.
  30780. * @param {!string} nameSoFar Name of the key path so far.
  30781. * @param {!function} callback Callback to invoke with each child found.
  30782. * @param {?*} traverseContext Used to pass information throughout the traversal
  30783. * process.
  30784. * @return {!number} The number of children in this subtree.
  30785. */
  30786. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  30787. var type = typeof children;
  30788. if (type === 'undefined' || type === 'boolean') {
  30789. // All of the above are perceived as null.
  30790. children = null;
  30791. }
  30792. if (children === null || type === 'string' || type === 'number' ||
  30793. // The following is inlined from ReactElement. This means we can optimize
  30794. // some checks. React Fiber also inlines this logic for similar purposes.
  30795. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  30796. callback(traverseContext, children,
  30797. // If it's the only child, treat the name as if it was wrapped in an array
  30798. // so that it's consistent if the number of children grows.
  30799. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  30800. return 1;
  30801. }
  30802. var child;
  30803. var nextName;
  30804. var subtreeCount = 0; // Count of children found in the current subtree.
  30805. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  30806. if (Array.isArray(children)) {
  30807. for (var i = 0; i < children.length; i++) {
  30808. child = children[i];
  30809. nextName = nextNamePrefix + getComponentKey(child, i);
  30810. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30811. }
  30812. } else {
  30813. var iteratorFn = getIteratorFn(children);
  30814. if (iteratorFn) {
  30815. var iterator = iteratorFn.call(children);
  30816. var step;
  30817. if (iteratorFn !== children.entries) {
  30818. var ii = 0;
  30819. while (!(step = iterator.next()).done) {
  30820. child = step.value;
  30821. nextName = nextNamePrefix + getComponentKey(child, ii++);
  30822. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30823. }
  30824. } else {
  30825. if (false) {
  30826. var mapsAsChildrenAddendum = '';
  30827. if (ReactCurrentOwner.current) {
  30828. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  30829. if (mapsAsChildrenOwnerName) {
  30830. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  30831. }
  30832. }
  30833. process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
  30834. didWarnAboutMaps = true;
  30835. }
  30836. // Iterator will provide entry [k,v] tuples rather than values.
  30837. while (!(step = iterator.next()).done) {
  30838. var entry = step.value;
  30839. if (entry) {
  30840. child = entry[1];
  30841. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  30842. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30843. }
  30844. }
  30845. }
  30846. } else if (type === 'object') {
  30847. var addendum = '';
  30848. if (false) {
  30849. addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
  30850. if (children._isReactElement) {
  30851. addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
  30852. }
  30853. if (ReactCurrentOwner.current) {
  30854. var name = ReactCurrentOwner.current.getName();
  30855. if (name) {
  30856. addendum += ' Check the render method of `' + name + '`.';
  30857. }
  30858. }
  30859. }
  30860. var childrenString = String(children);
  30861. true ? false ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
  30862. }
  30863. }
  30864. return subtreeCount;
  30865. }
  30866. /**
  30867. * Traverses children that are typically specified as `props.children`, but
  30868. * might also be specified through attributes:
  30869. *
  30870. * - `traverseAllChildren(this.props.children, ...)`
  30871. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  30872. *
  30873. * The `traverseContext` is an optional argument that is passed through the
  30874. * entire traversal. It can be used to store accumulations or anything else that
  30875. * the callback might find relevant.
  30876. *
  30877. * @param {?*} children Children tree object.
  30878. * @param {!function} callback To invoke upon traversing each child.
  30879. * @param {?*} traverseContext Context for traversal.
  30880. * @return {!number} The number of children in this subtree.
  30881. */
  30882. function traverseAllChildren(children, callback, traverseContext) {
  30883. if (children == null) {
  30884. return 0;
  30885. }
  30886. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  30887. }
  30888. module.exports = traverseAllChildren;
  30889. /***/ }),
  30890. /* 243 */
  30891. /***/ (function(module, exports, __webpack_require__) {
  30892. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  30893. // Distributed under an MIT license: http://codemirror.net/LICENSE
  30894. (function(mod) {
  30895. if (true) // CommonJS
  30896. mod(__webpack_require__(67));
  30897. else if (typeof define == "function" && define.amd) // AMD
  30898. define(["../../lib/codemirror"], mod);
  30899. else // Plain browser env
  30900. mod(CodeMirror);
  30901. })(function(CodeMirror) {
  30902. "use strict";
  30903. var noOptions = {};
  30904. var nonWS = /[^\s\u00a0]/;
  30905. var Pos = CodeMirror.Pos;
  30906. function firstNonWS(str) {
  30907. var found = str.search(nonWS);
  30908. return found == -1 ? 0 : found;
  30909. }
  30910. CodeMirror.commands.toggleComment = function(cm) {
  30911. cm.toggleComment();
  30912. };
  30913. CodeMirror.defineExtension("toggleComment", function(options) {
  30914. if (!options) options = noOptions;
  30915. var cm = this;
  30916. var minLine = Infinity, ranges = this.listSelections(), mode = null;
  30917. for (var i = ranges.length - 1; i >= 0; i--) {
  30918. var from = ranges[i].from(), to = ranges[i].to();
  30919. if (from.line >= minLine) continue;
  30920. if (to.line >= minLine) to = Pos(minLine, 0);
  30921. minLine = from.line;
  30922. if (mode == null) {
  30923. if (cm.uncomment(from, to, options)) mode = "un";
  30924. else { cm.lineComment(from, to, options); mode = "line"; }
  30925. } else if (mode == "un") {
  30926. cm.uncomment(from, to, options);
  30927. } else {
  30928. cm.lineComment(from, to, options);
  30929. }
  30930. }
  30931. });
  30932. // Rough heuristic to try and detect lines that are part of multi-line string
  30933. function probablyInsideString(cm, pos, line) {
  30934. return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
  30935. }
  30936. function getMode(cm, pos) {
  30937. var mode = cm.getMode()
  30938. return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
  30939. }
  30940. CodeMirror.defineExtension("lineComment", function(from, to, options) {
  30941. if (!options) options = noOptions;
  30942. var self = this, mode = getMode(self, from);
  30943. var firstLine = self.getLine(from.line);
  30944. if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
  30945. var commentString = options.lineComment || mode.lineComment;
  30946. if (!commentString) {
  30947. if (options.blockCommentStart || mode.blockCommentStart) {
  30948. options.fullLines = true;
  30949. self.blockComment(from, to, options);
  30950. }
  30951. return;
  30952. }
  30953. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
  30954. var pad = options.padding == null ? " " : options.padding;
  30955. var blankLines = options.commentBlankLines || from.line == to.line;
  30956. self.operation(function() {
  30957. if (options.indent) {
  30958. var baseString = null;
  30959. for (var i = from.line; i < end; ++i) {
  30960. var line = self.getLine(i);
  30961. var whitespace = line.slice(0, firstNonWS(line));
  30962. if (baseString == null || baseString.length > whitespace.length) {
  30963. baseString = whitespace;
  30964. }
  30965. }
  30966. for (var i = from.line; i < end; ++i) {
  30967. var line = self.getLine(i), cut = baseString.length;
  30968. if (!blankLines && !nonWS.test(line)) continue;
  30969. if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
  30970. self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
  30971. }
  30972. } else {
  30973. for (var i = from.line; i < end; ++i) {
  30974. if (blankLines || nonWS.test(self.getLine(i)))
  30975. self.replaceRange(commentString + pad, Pos(i, 0));
  30976. }
  30977. }
  30978. });
  30979. });
  30980. CodeMirror.defineExtension("blockComment", function(from, to, options) {
  30981. if (!options) options = noOptions;
  30982. var self = this, mode = getMode(self, from);
  30983. var startString = options.blockCommentStart || mode.blockCommentStart;
  30984. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  30985. if (!startString || !endString) {
  30986. if ((options.lineComment || mode.lineComment) && options.fullLines != false)
  30987. self.lineComment(from, to, options);
  30988. return;
  30989. }
  30990. if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
  30991. var end = Math.min(to.line, self.lastLine());
  30992. if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
  30993. var pad = options.padding == null ? " " : options.padding;
  30994. if (from.line > end) return;
  30995. self.operation(function() {
  30996. if (options.fullLines != false) {
  30997. var lastLineHasText = nonWS.test(self.getLine(end));
  30998. self.replaceRange(pad + endString, Pos(end));
  30999. self.replaceRange(startString + pad, Pos(from.line, 0));
  31000. var lead = options.blockCommentLead || mode.blockCommentLead;
  31001. if (lead != null) for (var i = from.line + 1; i <= end; ++i)
  31002. if (i != end || lastLineHasText)
  31003. self.replaceRange(lead + pad, Pos(i, 0));
  31004. } else {
  31005. self.replaceRange(endString, to);
  31006. self.replaceRange(startString, from);
  31007. }
  31008. });
  31009. });
  31010. CodeMirror.defineExtension("uncomment", function(from, to, options) {
  31011. if (!options) options = noOptions;
  31012. var self = this, mode = getMode(self, from);
  31013. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
  31014. // Try finding line comments
  31015. var lineString = options.lineComment || mode.lineComment, lines = [];
  31016. var pad = options.padding == null ? " " : options.padding, didSomething;
  31017. lineComment: {
  31018. if (!lineString) break lineComment;
  31019. for (var i = start; i <= end; ++i) {
  31020. var line = self.getLine(i);
  31021. var found = line.indexOf(lineString);
  31022. if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
  31023. if (found == -1 && nonWS.test(line)) break lineComment;
  31024. if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
  31025. lines.push(line);
  31026. }
  31027. self.operation(function() {
  31028. for (var i = start; i <= end; ++i) {
  31029. var line = lines[i - start];
  31030. var pos = line.indexOf(lineString), endPos = pos + lineString.length;
  31031. if (pos < 0) continue;
  31032. if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
  31033. didSomething = true;
  31034. self.replaceRange("", Pos(i, pos), Pos(i, endPos));
  31035. }
  31036. });
  31037. if (didSomething) return true;
  31038. }
  31039. // Try block comments
  31040. var startString = options.blockCommentStart || mode.blockCommentStart;
  31041. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  31042. if (!startString || !endString) return false;
  31043. var lead = options.blockCommentLead || mode.blockCommentLead;
  31044. var startLine = self.getLine(start), open = startLine.indexOf(startString)
  31045. if (open == -1) return false
  31046. var endLine = end == start ? startLine : self.getLine(end)
  31047. var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
  31048. if (close == -1 && start != end) {
  31049. endLine = self.getLine(--end);
  31050. close = endLine.indexOf(endString);
  31051. }
  31052. var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
  31053. if (close == -1 ||
  31054. !/comment/.test(self.getTokenTypeAt(insideStart)) ||
  31055. !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
  31056. self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
  31057. return false;
  31058. // Avoid killing block comments completely outside the selection.
  31059. // Positions of the last startString before the start of the selection, and the first endString after it.
  31060. var lastStart = startLine.lastIndexOf(startString, from.ch);
  31061. var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
  31062. if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
  31063. // Positions of the first endString after the end of the selection, and the last startString before it.
  31064. firstEnd = endLine.indexOf(endString, to.ch);
  31065. var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
  31066. lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
  31067. if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
  31068. self.operation(function() {
  31069. self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
  31070. Pos(end, close + endString.length));
  31071. var openEnd = open + startString.length;
  31072. if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
  31073. self.replaceRange("", Pos(start, open), Pos(start, openEnd));
  31074. if (lead) for (var i = start + 1; i <= end; ++i) {
  31075. var line = self.getLine(i), found = line.indexOf(lead);
  31076. if (found == -1 || nonWS.test(line.slice(0, found))) continue;
  31077. var foundEnd = found + lead.length;
  31078. if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
  31079. self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
  31080. }
  31081. });
  31082. return true;
  31083. });
  31084. });
  31085. /***/ })
  31086. /******/ ]);
  31087. //# sourceMappingURL=bundle.js.map