bundle.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344
  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 = 114);
  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__(79);
  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. "use strict";
  593. /**
  594. * Copyright (c) 2013-present, Facebook, Inc.
  595. * All rights reserved.
  596. *
  597. * This source code is licensed under the BSD-style license found in the
  598. * LICENSE file in the root directory of this source tree. An additional grant
  599. * of patent rights can be found in the PATENTS file in the same directory.
  600. *
  601. */
  602. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  603. /**
  604. * Simple, lightweight module assisting with the detection and context of
  605. * Worker. Helps avoid circular dependencies and allows code to reason about
  606. * whether or not they are in a Worker, even if they never include the main
  607. * `ReactWorker` dependency.
  608. */
  609. var ExecutionEnvironment = {
  610. canUseDOM: canUseDOM,
  611. canUseWorkers: typeof Worker !== 'undefined',
  612. canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
  613. canUseViewport: canUseDOM && !!window.screen,
  614. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  615. };
  616. module.exports = ExecutionEnvironment;
  617. /***/ }),
  618. /* 9 */
  619. /***/ (function(module, exports, __webpack_require__) {
  620. /*
  621. MIT License http://www.opensource.org/licenses/mit-license.php
  622. Author Tobias Koppers @sokra
  623. */
  624. var stylesInDom = {},
  625. memoize = function(fn) {
  626. var memo;
  627. return function () {
  628. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  629. return memo;
  630. };
  631. },
  632. isOldIE = memoize(function() {
  633. // Test for IE <= 9 as proposed by Browserhacks
  634. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  635. // Tests for existence of standard globals is to allow style-loader
  636. // to operate correctly into non-standard environments
  637. // @see https://github.com/webpack-contrib/style-loader/issues/177
  638. return window && document && document.all && !window.atob;
  639. }),
  640. getElement = (function(fn) {
  641. var memo = {};
  642. return function(selector) {
  643. if (typeof memo[selector] === "undefined") {
  644. memo[selector] = fn.call(this, selector);
  645. }
  646. return memo[selector]
  647. };
  648. })(function (styleTarget) {
  649. return document.querySelector(styleTarget)
  650. }),
  651. singletonElement = null,
  652. singletonCounter = 0,
  653. styleElementsInsertedAtTop = [],
  654. fixUrls = __webpack_require__(227);
  655. module.exports = function(list, options) {
  656. if(typeof DEBUG !== "undefined" && DEBUG) {
  657. if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  658. }
  659. options = options || {};
  660. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  661. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  662. // tags it will allow on a page
  663. if (typeof options.singleton === "undefined") options.singleton = isOldIE();
  664. // By default, add <style> tags to the <head> element
  665. if (typeof options.insertInto === "undefined") options.insertInto = "head";
  666. // By default, add <style> tags to the bottom of the target
  667. if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
  668. var styles = listToStyles(list);
  669. addStylesToDom(styles, options);
  670. return function update(newList) {
  671. var mayRemove = [];
  672. for(var i = 0; i < styles.length; i++) {
  673. var item = styles[i];
  674. var domStyle = stylesInDom[item.id];
  675. domStyle.refs--;
  676. mayRemove.push(domStyle);
  677. }
  678. if(newList) {
  679. var newStyles = listToStyles(newList);
  680. addStylesToDom(newStyles, options);
  681. }
  682. for(var i = 0; i < mayRemove.length; i++) {
  683. var domStyle = mayRemove[i];
  684. if(domStyle.refs === 0) {
  685. for(var j = 0; j < domStyle.parts.length; j++)
  686. domStyle.parts[j]();
  687. delete stylesInDom[domStyle.id];
  688. }
  689. }
  690. };
  691. };
  692. function addStylesToDom(styles, options) {
  693. for(var i = 0; i < styles.length; i++) {
  694. var item = styles[i];
  695. var domStyle = stylesInDom[item.id];
  696. if(domStyle) {
  697. domStyle.refs++;
  698. for(var j = 0; j < domStyle.parts.length; j++) {
  699. domStyle.parts[j](item.parts[j]);
  700. }
  701. for(; j < item.parts.length; j++) {
  702. domStyle.parts.push(addStyle(item.parts[j], options));
  703. }
  704. } else {
  705. var parts = [];
  706. for(var j = 0; j < item.parts.length; j++) {
  707. parts.push(addStyle(item.parts[j], options));
  708. }
  709. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  710. }
  711. }
  712. }
  713. function listToStyles(list) {
  714. var styles = [];
  715. var newStyles = {};
  716. for(var i = 0; i < list.length; i++) {
  717. var item = list[i];
  718. var id = item[0];
  719. var css = item[1];
  720. var media = item[2];
  721. var sourceMap = item[3];
  722. var part = {css: css, media: media, sourceMap: sourceMap};
  723. if(!newStyles[id])
  724. styles.push(newStyles[id] = {id: id, parts: [part]});
  725. else
  726. newStyles[id].parts.push(part);
  727. }
  728. return styles;
  729. }
  730. function insertStyleElement(options, styleElement) {
  731. var styleTarget = getElement(options.insertInto)
  732. if (!styleTarget) {
  733. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  734. }
  735. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  736. if (options.insertAt === "top") {
  737. if(!lastStyleElementInsertedAtTop) {
  738. styleTarget.insertBefore(styleElement, styleTarget.firstChild);
  739. } else if(lastStyleElementInsertedAtTop.nextSibling) {
  740. styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
  741. } else {
  742. styleTarget.appendChild(styleElement);
  743. }
  744. styleElementsInsertedAtTop.push(styleElement);
  745. } else if (options.insertAt === "bottom") {
  746. styleTarget.appendChild(styleElement);
  747. } else {
  748. throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  749. }
  750. }
  751. function removeStyleElement(styleElement) {
  752. styleElement.parentNode.removeChild(styleElement);
  753. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  754. if(idx >= 0) {
  755. styleElementsInsertedAtTop.splice(idx, 1);
  756. }
  757. }
  758. function createStyleElement(options) {
  759. var styleElement = document.createElement("style");
  760. options.attrs.type = "text/css";
  761. attachTagAttrs(styleElement, options.attrs);
  762. insertStyleElement(options, styleElement);
  763. return styleElement;
  764. }
  765. function createLinkElement(options) {
  766. var linkElement = document.createElement("link");
  767. options.attrs.type = "text/css";
  768. options.attrs.rel = "stylesheet";
  769. attachTagAttrs(linkElement, options.attrs);
  770. insertStyleElement(options, linkElement);
  771. return linkElement;
  772. }
  773. function attachTagAttrs(element, attrs) {
  774. Object.keys(attrs).forEach(function (key) {
  775. element.setAttribute(key, attrs[key]);
  776. });
  777. }
  778. function addStyle(obj, options) {
  779. var styleElement, update, remove;
  780. if (options.singleton) {
  781. var styleIndex = singletonCounter++;
  782. styleElement = singletonElement || (singletonElement = createStyleElement(options));
  783. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
  784. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
  785. } else if(obj.sourceMap &&
  786. typeof URL === "function" &&
  787. typeof URL.createObjectURL === "function" &&
  788. typeof URL.revokeObjectURL === "function" &&
  789. typeof Blob === "function" &&
  790. typeof btoa === "function") {
  791. styleElement = createLinkElement(options);
  792. update = updateLink.bind(null, styleElement, options);
  793. remove = function() {
  794. removeStyleElement(styleElement);
  795. if(styleElement.href)
  796. URL.revokeObjectURL(styleElement.href);
  797. };
  798. } else {
  799. styleElement = createStyleElement(options);
  800. update = applyToTag.bind(null, styleElement);
  801. remove = function() {
  802. removeStyleElement(styleElement);
  803. };
  804. }
  805. update(obj);
  806. return function updateStyle(newObj) {
  807. if(newObj) {
  808. if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
  809. return;
  810. update(obj = newObj);
  811. } else {
  812. remove();
  813. }
  814. };
  815. }
  816. var replaceText = (function () {
  817. var textStore = [];
  818. return function (index, replacement) {
  819. textStore[index] = replacement;
  820. return textStore.filter(Boolean).join('\n');
  821. };
  822. })();
  823. function applyToSingletonTag(styleElement, index, remove, obj) {
  824. var css = remove ? "" : obj.css;
  825. if (styleElement.styleSheet) {
  826. styleElement.styleSheet.cssText = replaceText(index, css);
  827. } else {
  828. var cssNode = document.createTextNode(css);
  829. var childNodes = styleElement.childNodes;
  830. if (childNodes[index]) styleElement.removeChild(childNodes[index]);
  831. if (childNodes.length) {
  832. styleElement.insertBefore(cssNode, childNodes[index]);
  833. } else {
  834. styleElement.appendChild(cssNode);
  835. }
  836. }
  837. }
  838. function applyToTag(styleElement, obj) {
  839. var css = obj.css;
  840. var media = obj.media;
  841. if(media) {
  842. styleElement.setAttribute("media", media)
  843. }
  844. if(styleElement.styleSheet) {
  845. styleElement.styleSheet.cssText = css;
  846. } else {
  847. while(styleElement.firstChild) {
  848. styleElement.removeChild(styleElement.firstChild);
  849. }
  850. styleElement.appendChild(document.createTextNode(css));
  851. }
  852. }
  853. function updateLink(linkElement, options, obj) {
  854. var css = obj.css;
  855. var sourceMap = obj.sourceMap;
  856. /* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  857. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  858. on by default. Otherwise default to the convertToAbsoluteUrls option
  859. directly
  860. */
  861. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  862. if (options.convertToAbsoluteUrls || autoFixUrls){
  863. css = fixUrls(css);
  864. }
  865. if(sourceMap) {
  866. // http://stackoverflow.com/a/26603875
  867. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  868. }
  869. var blob = new Blob([css], { type: "text/css" });
  870. var oldSrc = linkElement.href;
  871. linkElement.href = URL.createObjectURL(blob);
  872. if(oldSrc)
  873. URL.revokeObjectURL(oldSrc);
  874. }
  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__(77);
  948. var PooledClass = __webpack_require__(16);
  949. var ReactFeatureFlags = __webpack_require__(82);
  950. var ReactReconciler = __webpack_require__(20);
  951. var Transaction = __webpack_require__(33);
  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__(16);
  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. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  1416. Copyright (c) 2016 Jed Watson.
  1417. Licensed under the MIT License (MIT), see
  1418. http://jedwatson.github.io/classnames
  1419. */
  1420. /* global define */
  1421. (function () {
  1422. 'use strict';
  1423. var hasOwn = {}.hasOwnProperty;
  1424. function classNames () {
  1425. var classes = [];
  1426. for (var i = 0; i < arguments.length; i++) {
  1427. var arg = arguments[i];
  1428. if (!arg) continue;
  1429. var argType = typeof arg;
  1430. if (argType === 'string' || argType === 'number') {
  1431. classes.push(arg);
  1432. } else if (Array.isArray(arg)) {
  1433. classes.push(classNames.apply(null, arg));
  1434. } else if (argType === 'object') {
  1435. for (var key in arg) {
  1436. if (hasOwn.call(arg, key) && arg[key]) {
  1437. classes.push(key);
  1438. }
  1439. }
  1440. }
  1441. }
  1442. return classes.join(' ');
  1443. }
  1444. if (typeof module !== 'undefined' && module.exports) {
  1445. module.exports = classNames;
  1446. } else if (true) {
  1447. // register as 'classnames', consistent with npm package name
  1448. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
  1449. return classNames;
  1450. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  1451. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1452. } else {
  1453. window.classNames = classNames;
  1454. }
  1455. }());
  1456. /***/ }),
  1457. /* 16 */
  1458. /***/ (function(module, exports, __webpack_require__) {
  1459. "use strict";
  1460. /**
  1461. * Copyright 2013-present, Facebook, Inc.
  1462. * All rights reserved.
  1463. *
  1464. * This source code is licensed under the BSD-style license found in the
  1465. * LICENSE file in the root directory of this source tree. An additional grant
  1466. * of patent rights can be found in the PATENTS file in the same directory.
  1467. *
  1468. *
  1469. */
  1470. var _prodInvariant = __webpack_require__(2);
  1471. var invariant = __webpack_require__(0);
  1472. /**
  1473. * Static poolers. Several custom versions for each potential number of
  1474. * arguments. A completely generic pooler is easy to implement, but would
  1475. * require accessing the `arguments` object. In each of these, `this` refers to
  1476. * the Class itself, not an instance. If any others are needed, simply add them
  1477. * here, or in their own files.
  1478. */
  1479. var oneArgumentPooler = function (copyFieldsFrom) {
  1480. var Klass = this;
  1481. if (Klass.instancePool.length) {
  1482. var instance = Klass.instancePool.pop();
  1483. Klass.call(instance, copyFieldsFrom);
  1484. return instance;
  1485. } else {
  1486. return new Klass(copyFieldsFrom);
  1487. }
  1488. };
  1489. var twoArgumentPooler = function (a1, a2) {
  1490. var Klass = this;
  1491. if (Klass.instancePool.length) {
  1492. var instance = Klass.instancePool.pop();
  1493. Klass.call(instance, a1, a2);
  1494. return instance;
  1495. } else {
  1496. return new Klass(a1, a2);
  1497. }
  1498. };
  1499. var threeArgumentPooler = function (a1, a2, a3) {
  1500. var Klass = this;
  1501. if (Klass.instancePool.length) {
  1502. var instance = Klass.instancePool.pop();
  1503. Klass.call(instance, a1, a2, a3);
  1504. return instance;
  1505. } else {
  1506. return new Klass(a1, a2, a3);
  1507. }
  1508. };
  1509. var fourArgumentPooler = function (a1, a2, a3, a4) {
  1510. var Klass = this;
  1511. if (Klass.instancePool.length) {
  1512. var instance = Klass.instancePool.pop();
  1513. Klass.call(instance, a1, a2, a3, a4);
  1514. return instance;
  1515. } else {
  1516. return new Klass(a1, a2, a3, a4);
  1517. }
  1518. };
  1519. var standardReleaser = function (instance) {
  1520. var Klass = this;
  1521. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  1522. instance.destructor();
  1523. if (Klass.instancePool.length < Klass.poolSize) {
  1524. Klass.instancePool.push(instance);
  1525. }
  1526. };
  1527. var DEFAULT_POOL_SIZE = 10;
  1528. var DEFAULT_POOLER = oneArgumentPooler;
  1529. /**
  1530. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  1531. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  1532. * you give this may have a `poolSize` property, and will look for a
  1533. * prototypical `destructor` on instances.
  1534. *
  1535. * @param {Function} CopyConstructor Constructor that can be used to reset.
  1536. * @param {Function} pooler Customizable pooler.
  1537. */
  1538. var addPoolingTo = function (CopyConstructor, pooler) {
  1539. // Casting as any so that flow ignores the actual implementation and trusts
  1540. // it to match the type we declared
  1541. var NewKlass = CopyConstructor;
  1542. NewKlass.instancePool = [];
  1543. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  1544. if (!NewKlass.poolSize) {
  1545. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  1546. }
  1547. NewKlass.release = standardReleaser;
  1548. return NewKlass;
  1549. };
  1550. var PooledClass = {
  1551. addPoolingTo: addPoolingTo,
  1552. oneArgumentPooler: oneArgumentPooler,
  1553. twoArgumentPooler: twoArgumentPooler,
  1554. threeArgumentPooler: threeArgumentPooler,
  1555. fourArgumentPooler: fourArgumentPooler
  1556. };
  1557. module.exports = PooledClass;
  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. return Promise.resolve().then(function () {
  1573. var current = app.state.current;
  1574. if (current && current.is_sys) {
  1575. return _Agent2.default.pact('getSysHosts').then(function (sys_hosts) {
  1576. state.sys_hosts = sys_hosts;
  1577. state.current = sys_hosts;
  1578. });
  1579. } else if (hosts) {
  1580. state.current = hosts;
  1581. } else if (current) {
  1582. var c = new_list.find(function (i) {
  1583. return i.id === current.id;
  1584. });
  1585. if (c) {
  1586. state.current = c;
  1587. }
  1588. }
  1589. }).then(function () {
  1590. app.setState(state, function () {
  1591. if (hosts) {
  1592. _Agent2.default.emit('select', hosts.id);
  1593. }
  1594. });
  1595. });
  1596. };
  1597. /***/ }),
  1598. /* 18 */
  1599. /***/ (function(module, exports, __webpack_require__) {
  1600. "use strict";
  1601. /**
  1602. * Copyright 2015-present, Facebook, Inc.
  1603. * All rights reserved.
  1604. *
  1605. * This source code is licensed under the BSD-style license found in the
  1606. * LICENSE file in the root directory of this source tree. An additional grant
  1607. * of patent rights can be found in the PATENTS file in the same directory.
  1608. *
  1609. */
  1610. var DOMNamespaces = __webpack_require__(52);
  1611. var setInnerHTML = __webpack_require__(35);
  1612. var createMicrosoftUnsafeLocalFunction = __webpack_require__(60);
  1613. var setTextContent = __webpack_require__(94);
  1614. var ELEMENT_NODE_TYPE = 1;
  1615. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  1616. /**
  1617. * In IE (8-11) and Edge, appending nodes with no children is dramatically
  1618. * faster than appending a full subtree, so we essentially queue up the
  1619. * .appendChild calls here and apply them so each node is added to its parent
  1620. * before any children are added.
  1621. *
  1622. * In other browsers, doing so is slower or neutral compared to the other order
  1623. * (in Firefox, twice as slow) so we only do this inversion in IE.
  1624. *
  1625. * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
  1626. */
  1627. var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
  1628. function insertTreeChildren(tree) {
  1629. if (!enableLazy) {
  1630. return;
  1631. }
  1632. var node = tree.node;
  1633. var children = tree.children;
  1634. if (children.length) {
  1635. for (var i = 0; i < children.length; i++) {
  1636. insertTreeBefore(node, children[i], null);
  1637. }
  1638. } else if (tree.html != null) {
  1639. setInnerHTML(node, tree.html);
  1640. } else if (tree.text != null) {
  1641. setTextContent(node, tree.text);
  1642. }
  1643. }
  1644. var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
  1645. // DocumentFragments aren't actually part of the DOM after insertion so
  1646. // appending children won't update the DOM. We need to ensure the fragment
  1647. // is properly populated first, breaking out of our lazy approach for just
  1648. // this level. Also, some <object> plugins (like Flash Player) will read
  1649. // <param> nodes immediately upon insertion into the DOM, so <object>
  1650. // must also be populated prior to insertion into the DOM.
  1651. 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)) {
  1652. insertTreeChildren(tree);
  1653. parentNode.insertBefore(tree.node, referenceNode);
  1654. } else {
  1655. parentNode.insertBefore(tree.node, referenceNode);
  1656. insertTreeChildren(tree);
  1657. }
  1658. });
  1659. function replaceChildWithTree(oldNode, newTree) {
  1660. oldNode.parentNode.replaceChild(newTree.node, oldNode);
  1661. insertTreeChildren(newTree);
  1662. }
  1663. function queueChild(parentTree, childTree) {
  1664. if (enableLazy) {
  1665. parentTree.children.push(childTree);
  1666. } else {
  1667. parentTree.node.appendChild(childTree.node);
  1668. }
  1669. }
  1670. function queueHTML(tree, html) {
  1671. if (enableLazy) {
  1672. tree.html = html;
  1673. } else {
  1674. setInnerHTML(tree.node, html);
  1675. }
  1676. }
  1677. function queueText(tree, text) {
  1678. if (enableLazy) {
  1679. tree.text = text;
  1680. } else {
  1681. setTextContent(tree.node, text);
  1682. }
  1683. }
  1684. function toString() {
  1685. return this.node.nodeName;
  1686. }
  1687. function DOMLazyTree(node) {
  1688. return {
  1689. node: node,
  1690. children: [],
  1691. html: null,
  1692. text: null,
  1693. toString: toString
  1694. };
  1695. }
  1696. DOMLazyTree.insertTreeBefore = insertTreeBefore;
  1697. DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
  1698. DOMLazyTree.queueChild = queueChild;
  1699. DOMLazyTree.queueHTML = queueHTML;
  1700. DOMLazyTree.queueText = queueText;
  1701. module.exports = DOMLazyTree;
  1702. /***/ }),
  1703. /* 19 */
  1704. /***/ (function(module, exports, __webpack_require__) {
  1705. "use strict";
  1706. /**
  1707. * Copyright 2013-present, Facebook, Inc.
  1708. * All rights reserved.
  1709. *
  1710. * This source code is licensed under the BSD-style license found in the
  1711. * LICENSE file in the root directory of this source tree. An additional grant
  1712. * of patent rights can be found in the PATENTS file in the same directory.
  1713. *
  1714. */
  1715. var _prodInvariant = __webpack_require__(2);
  1716. var invariant = __webpack_require__(0);
  1717. function checkMask(value, bitmask) {
  1718. return (value & bitmask) === bitmask;
  1719. }
  1720. var DOMPropertyInjection = {
  1721. /**
  1722. * Mapping from normalized, camelcased property names to a configuration that
  1723. * specifies how the associated DOM property should be accessed or rendered.
  1724. */
  1725. MUST_USE_PROPERTY: 0x1,
  1726. HAS_BOOLEAN_VALUE: 0x4,
  1727. HAS_NUMERIC_VALUE: 0x8,
  1728. HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
  1729. HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
  1730. /**
  1731. * Inject some specialized knowledge about the DOM. This takes a config object
  1732. * with the following properties:
  1733. *
  1734. * isCustomAttribute: function that given an attribute name will return true
  1735. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1736. * attributes where it's impossible to enumerate all of the possible
  1737. * attribute names,
  1738. *
  1739. * Properties: object mapping DOM property name to one of the
  1740. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1741. * it won't get written to the DOM.
  1742. *
  1743. * DOMAttributeNames: object mapping React attribute name to the DOM
  1744. * attribute name. Attribute names not specified use the **lowercase**
  1745. * normalized name.
  1746. *
  1747. * DOMAttributeNamespaces: object mapping React attribute name to the DOM
  1748. * attribute namespace URL. (Attribute names not specified use no namespace.)
  1749. *
  1750. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1751. * Property names not specified use the normalized name.
  1752. *
  1753. * DOMMutationMethods: Properties that require special mutation methods. If
  1754. * `value` is undefined, the mutation method should unset the property.
  1755. *
  1756. * @param {object} domPropertyConfig the config as described above.
  1757. */
  1758. injectDOMPropertyConfig: function (domPropertyConfig) {
  1759. var Injection = DOMPropertyInjection;
  1760. var Properties = domPropertyConfig.Properties || {};
  1761. var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
  1762. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1763. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1764. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1765. if (domPropertyConfig.isCustomAttribute) {
  1766. DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
  1767. }
  1768. for (var propName in Properties) {
  1769. !!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;
  1770. var lowerCased = propName.toLowerCase();
  1771. var propConfig = Properties[propName];
  1772. var propertyInfo = {
  1773. attributeName: lowerCased,
  1774. attributeNamespace: null,
  1775. propertyName: propName,
  1776. mutationMethod: null,
  1777. mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
  1778. hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
  1779. hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
  1780. hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
  1781. hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
  1782. };
  1783. !(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;
  1784. if (false) {
  1785. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1786. }
  1787. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1788. var attributeName = DOMAttributeNames[propName];
  1789. propertyInfo.attributeName = attributeName;
  1790. if (false) {
  1791. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1792. }
  1793. }
  1794. if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
  1795. propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
  1796. }
  1797. if (DOMPropertyNames.hasOwnProperty(propName)) {
  1798. propertyInfo.propertyName = DOMPropertyNames[propName];
  1799. }
  1800. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1801. propertyInfo.mutationMethod = DOMMutationMethods[propName];
  1802. }
  1803. DOMProperty.properties[propName] = propertyInfo;
  1804. }
  1805. }
  1806. };
  1807. /* eslint-disable max-len */
  1808. 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';
  1809. /* eslint-enable max-len */
  1810. /**
  1811. * DOMProperty exports lookup objects that can be used like functions:
  1812. *
  1813. * > DOMProperty.isValid['id']
  1814. * true
  1815. * > DOMProperty.isValid['foobar']
  1816. * undefined
  1817. *
  1818. * Although this may be confusing, it performs better in general.
  1819. *
  1820. * @see http://jsperf.com/key-exists
  1821. * @see http://jsperf.com/key-missing
  1822. */
  1823. var DOMProperty = {
  1824. ID_ATTRIBUTE_NAME: 'data-reactid',
  1825. ROOT_ATTRIBUTE_NAME: 'data-reactroot',
  1826. ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
  1827. ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
  1828. /**
  1829. * Map from property "standard name" to an object with info about how to set
  1830. * the property in the DOM. Each object contains:
  1831. *
  1832. * attributeName:
  1833. * Used when rendering markup or with `*Attribute()`.
  1834. * attributeNamespace
  1835. * propertyName:
  1836. * Used on DOM node instances. (This includes properties that mutate due to
  1837. * external factors.)
  1838. * mutationMethod:
  1839. * If non-null, used instead of the property or `setAttribute()` after
  1840. * initial render.
  1841. * mustUseProperty:
  1842. * Whether the property must be accessed and mutated as an object property.
  1843. * hasBooleanValue:
  1844. * Whether the property should be removed when set to a falsey value.
  1845. * hasNumericValue:
  1846. * Whether the property must be numeric or parse as a numeric and should be
  1847. * removed when set to a falsey value.
  1848. * hasPositiveNumericValue:
  1849. * Whether the property must be positive numeric or parse as a positive
  1850. * numeric and should be removed when set to a falsey value.
  1851. * hasOverloadedBooleanValue:
  1852. * Whether the property can be used as a flag as well as with a value.
  1853. * Removed when strictly equal to false; present without a value when
  1854. * strictly equal to true; present with a value otherwise.
  1855. */
  1856. properties: {},
  1857. /**
  1858. * Mapping from lowercase property names to the properly cased version, used
  1859. * to warn in the case of missing properties. Available only in __DEV__.
  1860. *
  1861. * autofocus is predefined, because adding it to the property whitelist
  1862. * causes unintended side effects.
  1863. *
  1864. * @type {Object}
  1865. */
  1866. getPossibleStandardName: false ? { autofocus: 'autoFocus' } : null,
  1867. /**
  1868. * All of the isCustomAttribute() functions that have been injected.
  1869. */
  1870. _isCustomAttributeFunctions: [],
  1871. /**
  1872. * Checks whether a property name is a custom attribute.
  1873. * @method
  1874. */
  1875. isCustomAttribute: function (attributeName) {
  1876. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1877. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1878. if (isCustomAttributeFn(attributeName)) {
  1879. return true;
  1880. }
  1881. }
  1882. return false;
  1883. },
  1884. injection: DOMPropertyInjection
  1885. };
  1886. module.exports = DOMProperty;
  1887. /***/ }),
  1888. /* 20 */
  1889. /***/ (function(module, exports, __webpack_require__) {
  1890. "use strict";
  1891. /**
  1892. * Copyright 2013-present, Facebook, Inc.
  1893. * All rights reserved.
  1894. *
  1895. * This source code is licensed under the BSD-style license found in the
  1896. * LICENSE file in the root directory of this source tree. An additional grant
  1897. * of patent rights can be found in the PATENTS file in the same directory.
  1898. *
  1899. */
  1900. var ReactRef = __webpack_require__(187);
  1901. var ReactInstrumentation = __webpack_require__(11);
  1902. var warning = __webpack_require__(1);
  1903. /**
  1904. * Helper to call ReactRef.attachRefs with this composite component, split out
  1905. * to avoid allocations in the transaction mount-ready queue.
  1906. */
  1907. function attachRefs() {
  1908. ReactRef.attachRefs(this, this._currentElement);
  1909. }
  1910. var ReactReconciler = {
  1911. /**
  1912. * Initializes the component, renders markup, and registers event listeners.
  1913. *
  1914. * @param {ReactComponent} internalInstance
  1915. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  1916. * @param {?object} the containing host component instance
  1917. * @param {?object} info about the host container
  1918. * @return {?string} Rendered markup to be inserted into the DOM.
  1919. * @final
  1920. * @internal
  1921. */
  1922. mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
  1923. ) {
  1924. if (false) {
  1925. if (internalInstance._debugID !== 0) {
  1926. ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
  1927. }
  1928. }
  1929. var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);
  1930. if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1931. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  1932. }
  1933. if (false) {
  1934. if (internalInstance._debugID !== 0) {
  1935. ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
  1936. }
  1937. }
  1938. return markup;
  1939. },
  1940. /**
  1941. * Returns a value that can be passed to
  1942. * ReactComponentEnvironment.replaceNodeWithMarkup.
  1943. */
  1944. getHostNode: function (internalInstance) {
  1945. return internalInstance.getHostNode();
  1946. },
  1947. /**
  1948. * Releases any resources allocated by `mountComponent`.
  1949. *
  1950. * @final
  1951. * @internal
  1952. */
  1953. unmountComponent: function (internalInstance, safely) {
  1954. if (false) {
  1955. if (internalInstance._debugID !== 0) {
  1956. ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);
  1957. }
  1958. }
  1959. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  1960. internalInstance.unmountComponent(safely);
  1961. if (false) {
  1962. if (internalInstance._debugID !== 0) {
  1963. ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
  1964. }
  1965. }
  1966. },
  1967. /**
  1968. * Update a component using a new element.
  1969. *
  1970. * @param {ReactComponent} internalInstance
  1971. * @param {ReactElement} nextElement
  1972. * @param {ReactReconcileTransaction} transaction
  1973. * @param {object} context
  1974. * @internal
  1975. */
  1976. receiveComponent: function (internalInstance, nextElement, transaction, context) {
  1977. var prevElement = internalInstance._currentElement;
  1978. if (nextElement === prevElement && context === internalInstance._context) {
  1979. // Since elements are immutable after the owner is rendered,
  1980. // we can do a cheap identity compare here to determine if this is a
  1981. // superfluous reconcile. It's possible for state to be mutable but such
  1982. // change should trigger an update of the owner which would recreate
  1983. // the element. We explicitly check for the existence of an owner since
  1984. // it's possible for an element created outside a composite to be
  1985. // deeply mutated and reused.
  1986. // TODO: Bailing out early is just a perf optimization right?
  1987. // TODO: Removing the return statement should affect correctness?
  1988. return;
  1989. }
  1990. if (false) {
  1991. if (internalInstance._debugID !== 0) {
  1992. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
  1993. }
  1994. }
  1995. var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
  1996. if (refsChanged) {
  1997. ReactRef.detachRefs(internalInstance, prevElement);
  1998. }
  1999. internalInstance.receiveComponent(nextElement, transaction, context);
  2000. if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  2001. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  2002. }
  2003. if (false) {
  2004. if (internalInstance._debugID !== 0) {
  2005. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  2006. }
  2007. }
  2008. },
  2009. /**
  2010. * Flush any dirty changes in a component.
  2011. *
  2012. * @param {ReactComponent} internalInstance
  2013. * @param {ReactReconcileTransaction} transaction
  2014. * @internal
  2015. */
  2016. performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
  2017. if (internalInstance._updateBatchNumber !== updateBatchNumber) {
  2018. // The component's enqueued batch number should always be the current
  2019. // batch or the following one.
  2020. false ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;
  2021. return;
  2022. }
  2023. if (false) {
  2024. if (internalInstance._debugID !== 0) {
  2025. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
  2026. }
  2027. }
  2028. internalInstance.performUpdateIfNecessary(transaction);
  2029. if (false) {
  2030. if (internalInstance._debugID !== 0) {
  2031. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  2032. }
  2033. }
  2034. }
  2035. };
  2036. module.exports = ReactReconciler;
  2037. /***/ }),
  2038. /* 21 */
  2039. /***/ (function(module, exports, __webpack_require__) {
  2040. "use strict";
  2041. /**
  2042. * Copyright 2013-present, Facebook, Inc.
  2043. * All rights reserved.
  2044. *
  2045. * This source code is licensed under the BSD-style license found in the
  2046. * LICENSE file in the root directory of this source tree. An additional grant
  2047. * of patent rights can be found in the PATENTS file in the same directory.
  2048. *
  2049. */
  2050. var _assign = __webpack_require__(3);
  2051. var ReactChildren = __webpack_require__(216);
  2052. var ReactComponent = __webpack_require__(67);
  2053. var ReactPureComponent = __webpack_require__(221);
  2054. var ReactClass = __webpack_require__(217);
  2055. var ReactDOMFactories = __webpack_require__(218);
  2056. var ReactElement = __webpack_require__(22);
  2057. var ReactPropTypes = __webpack_require__(220);
  2058. var ReactVersion = __webpack_require__(222);
  2059. var onlyChild = __webpack_require__(225);
  2060. var warning = __webpack_require__(1);
  2061. var createElement = ReactElement.createElement;
  2062. var createFactory = ReactElement.createFactory;
  2063. var cloneElement = ReactElement.cloneElement;
  2064. if (false) {
  2065. var canDefineProperty = require('./canDefineProperty');
  2066. var ReactElementValidator = require('./ReactElementValidator');
  2067. var didWarnPropTypesDeprecated = false;
  2068. createElement = ReactElementValidator.createElement;
  2069. createFactory = ReactElementValidator.createFactory;
  2070. cloneElement = ReactElementValidator.cloneElement;
  2071. }
  2072. var __spread = _assign;
  2073. if (false) {
  2074. var warned = false;
  2075. __spread = function () {
  2076. 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;
  2077. warned = true;
  2078. return _assign.apply(null, arguments);
  2079. };
  2080. }
  2081. var React = {
  2082. // Modern
  2083. Children: {
  2084. map: ReactChildren.map,
  2085. forEach: ReactChildren.forEach,
  2086. count: ReactChildren.count,
  2087. toArray: ReactChildren.toArray,
  2088. only: onlyChild
  2089. },
  2090. Component: ReactComponent,
  2091. PureComponent: ReactPureComponent,
  2092. createElement: createElement,
  2093. cloneElement: cloneElement,
  2094. isValidElement: ReactElement.isValidElement,
  2095. // Classic
  2096. PropTypes: ReactPropTypes,
  2097. createClass: ReactClass.createClass,
  2098. createFactory: createFactory,
  2099. createMixin: function (mixin) {
  2100. // Currently a noop. Will be used to validate and trace mixins.
  2101. return mixin;
  2102. },
  2103. // This looks DOM specific but these are actually isomorphic helpers
  2104. // since they are just generating DOM strings.
  2105. DOM: ReactDOMFactories,
  2106. version: ReactVersion,
  2107. // Deprecated hook for JSX spread, don't use this for anything.
  2108. __spread: __spread
  2109. };
  2110. // TODO: Fix tests so that this deprecation warning doesn't cause failures.
  2111. if (false) {
  2112. if (canDefineProperty) {
  2113. Object.defineProperty(React, 'PropTypes', {
  2114. get: function () {
  2115. process.env.NODE_ENV !== 'production' ? warning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated. Use ' + 'the prop-types package from npm instead.') : void 0;
  2116. didWarnPropTypesDeprecated = true;
  2117. return ReactPropTypes;
  2118. }
  2119. });
  2120. }
  2121. }
  2122. module.exports = React;
  2123. /***/ }),
  2124. /* 22 */
  2125. /***/ (function(module, exports, __webpack_require__) {
  2126. "use strict";
  2127. /**
  2128. * Copyright 2014-present, Facebook, Inc.
  2129. * All rights reserved.
  2130. *
  2131. * This source code is licensed under the BSD-style license found in the
  2132. * LICENSE file in the root directory of this source tree. An additional grant
  2133. * of patent rights can be found in the PATENTS file in the same directory.
  2134. *
  2135. */
  2136. var _assign = __webpack_require__(3);
  2137. var ReactCurrentOwner = __webpack_require__(14);
  2138. var warning = __webpack_require__(1);
  2139. var canDefineProperty = __webpack_require__(98);
  2140. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2141. var REACT_ELEMENT_TYPE = __webpack_require__(97);
  2142. var RESERVED_PROPS = {
  2143. key: true,
  2144. ref: true,
  2145. __self: true,
  2146. __source: true
  2147. };
  2148. var specialPropKeyWarningShown, specialPropRefWarningShown;
  2149. function hasValidRef(config) {
  2150. if (false) {
  2151. if (hasOwnProperty.call(config, 'ref')) {
  2152. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  2153. if (getter && getter.isReactWarning) {
  2154. return false;
  2155. }
  2156. }
  2157. }
  2158. return config.ref !== undefined;
  2159. }
  2160. function hasValidKey(config) {
  2161. if (false) {
  2162. if (hasOwnProperty.call(config, 'key')) {
  2163. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  2164. if (getter && getter.isReactWarning) {
  2165. return false;
  2166. }
  2167. }
  2168. }
  2169. return config.key !== undefined;
  2170. }
  2171. function defineKeyPropWarningGetter(props, displayName) {
  2172. var warnAboutAccessingKey = function () {
  2173. if (!specialPropKeyWarningShown) {
  2174. specialPropKeyWarningShown = true;
  2175. 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;
  2176. }
  2177. };
  2178. warnAboutAccessingKey.isReactWarning = true;
  2179. Object.defineProperty(props, 'key', {
  2180. get: warnAboutAccessingKey,
  2181. configurable: true
  2182. });
  2183. }
  2184. function defineRefPropWarningGetter(props, displayName) {
  2185. var warnAboutAccessingRef = function () {
  2186. if (!specialPropRefWarningShown) {
  2187. specialPropRefWarningShown = true;
  2188. 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;
  2189. }
  2190. };
  2191. warnAboutAccessingRef.isReactWarning = true;
  2192. Object.defineProperty(props, 'ref', {
  2193. get: warnAboutAccessingRef,
  2194. configurable: true
  2195. });
  2196. }
  2197. /**
  2198. * Factory method to create a new React element. This no longer adheres to
  2199. * the class pattern, so do not use new to call it. Also, no instanceof check
  2200. * will work. Instead test $$typeof field against Symbol.for('react.element') to check
  2201. * if something is a React Element.
  2202. *
  2203. * @param {*} type
  2204. * @param {*} key
  2205. * @param {string|object} ref
  2206. * @param {*} self A *temporary* helper to detect places where `this` is
  2207. * different from the `owner` when React.createElement is called, so that we
  2208. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  2209. * functions, and as long as `this` and owner are the same, there will be no
  2210. * change in behavior.
  2211. * @param {*} source An annotation object (added by a transpiler or otherwise)
  2212. * indicating filename, line number, and/or other information.
  2213. * @param {*} owner
  2214. * @param {*} props
  2215. * @internal
  2216. */
  2217. var ReactElement = function (type, key, ref, self, source, owner, props) {
  2218. var element = {
  2219. // This tag allow us to uniquely identify this as a React Element
  2220. $$typeof: REACT_ELEMENT_TYPE,
  2221. // Built-in properties that belong on the element
  2222. type: type,
  2223. key: key,
  2224. ref: ref,
  2225. props: props,
  2226. // Record the component responsible for creating this element.
  2227. _owner: owner
  2228. };
  2229. if (false) {
  2230. // The validation flag is currently mutative. We put it on
  2231. // an external backing store so that we can freeze the whole object.
  2232. // This can be replaced with a WeakMap once they are implemented in
  2233. // commonly used development environments.
  2234. element._store = {};
  2235. // To make comparing ReactElements easier for testing purposes, we make
  2236. // the validation flag non-enumerable (where possible, which should
  2237. // include every environment we run tests in), so the test framework
  2238. // ignores it.
  2239. if (canDefineProperty) {
  2240. Object.defineProperty(element._store, 'validated', {
  2241. configurable: false,
  2242. enumerable: false,
  2243. writable: true,
  2244. value: false
  2245. });
  2246. // self and source are DEV only properties.
  2247. Object.defineProperty(element, '_self', {
  2248. configurable: false,
  2249. enumerable: false,
  2250. writable: false,
  2251. value: self
  2252. });
  2253. // Two elements created in two different places should be considered
  2254. // equal for testing purposes and therefore we hide it from enumeration.
  2255. Object.defineProperty(element, '_source', {
  2256. configurable: false,
  2257. enumerable: false,
  2258. writable: false,
  2259. value: source
  2260. });
  2261. } else {
  2262. element._store.validated = false;
  2263. element._self = self;
  2264. element._source = source;
  2265. }
  2266. if (Object.freeze) {
  2267. Object.freeze(element.props);
  2268. Object.freeze(element);
  2269. }
  2270. }
  2271. return element;
  2272. };
  2273. /**
  2274. * Create and return a new ReactElement of the given type.
  2275. * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
  2276. */
  2277. ReactElement.createElement = function (type, config, children) {
  2278. var propName;
  2279. // Reserved names are extracted
  2280. var props = {};
  2281. var key = null;
  2282. var ref = null;
  2283. var self = null;
  2284. var source = null;
  2285. if (config != null) {
  2286. if (hasValidRef(config)) {
  2287. ref = config.ref;
  2288. }
  2289. if (hasValidKey(config)) {
  2290. key = '' + config.key;
  2291. }
  2292. self = config.__self === undefined ? null : config.__self;
  2293. source = config.__source === undefined ? null : config.__source;
  2294. // Remaining properties are added to a new props object
  2295. for (propName in config) {
  2296. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2297. props[propName] = config[propName];
  2298. }
  2299. }
  2300. }
  2301. // Children can be more than one argument, and those are transferred onto
  2302. // the newly allocated props object.
  2303. var childrenLength = arguments.length - 2;
  2304. if (childrenLength === 1) {
  2305. props.children = children;
  2306. } else if (childrenLength > 1) {
  2307. var childArray = Array(childrenLength);
  2308. for (var i = 0; i < childrenLength; i++) {
  2309. childArray[i] = arguments[i + 2];
  2310. }
  2311. if (false) {
  2312. if (Object.freeze) {
  2313. Object.freeze(childArray);
  2314. }
  2315. }
  2316. props.children = childArray;
  2317. }
  2318. // Resolve default props
  2319. if (type && type.defaultProps) {
  2320. var defaultProps = type.defaultProps;
  2321. for (propName in defaultProps) {
  2322. if (props[propName] === undefined) {
  2323. props[propName] = defaultProps[propName];
  2324. }
  2325. }
  2326. }
  2327. if (false) {
  2328. if (key || ref) {
  2329. if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
  2330. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  2331. if (key) {
  2332. defineKeyPropWarningGetter(props, displayName);
  2333. }
  2334. if (ref) {
  2335. defineRefPropWarningGetter(props, displayName);
  2336. }
  2337. }
  2338. }
  2339. }
  2340. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  2341. };
  2342. /**
  2343. * Return a function that produces ReactElements of a given type.
  2344. * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
  2345. */
  2346. ReactElement.createFactory = function (type) {
  2347. var factory = ReactElement.createElement.bind(null, type);
  2348. // Expose the type on the factory and the prototype so that it can be
  2349. // easily accessed on elements. E.g. `<Foo />.type === Foo`.
  2350. // This should not be named `constructor` since this may not be the function
  2351. // that created the element, and it may not even be a constructor.
  2352. // Legacy hook TODO: Warn if this is accessed
  2353. factory.type = type;
  2354. return factory;
  2355. };
  2356. ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
  2357. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  2358. return newElement;
  2359. };
  2360. /**
  2361. * Clone and return a new ReactElement using element as the starting point.
  2362. * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
  2363. */
  2364. ReactElement.cloneElement = function (element, config, children) {
  2365. var propName;
  2366. // Original props are copied
  2367. var props = _assign({}, element.props);
  2368. // Reserved names are extracted
  2369. var key = element.key;
  2370. var ref = element.ref;
  2371. // Self is preserved since the owner is preserved.
  2372. var self = element._self;
  2373. // Source is preserved since cloneElement is unlikely to be targeted by a
  2374. // transpiler, and the original source is probably a better indicator of the
  2375. // true owner.
  2376. var source = element._source;
  2377. // Owner will be preserved, unless ref is overridden
  2378. var owner = element._owner;
  2379. if (config != null) {
  2380. if (hasValidRef(config)) {
  2381. // Silently steal the ref from the parent.
  2382. ref = config.ref;
  2383. owner = ReactCurrentOwner.current;
  2384. }
  2385. if (hasValidKey(config)) {
  2386. key = '' + config.key;
  2387. }
  2388. // Remaining properties override existing props
  2389. var defaultProps;
  2390. if (element.type && element.type.defaultProps) {
  2391. defaultProps = element.type.defaultProps;
  2392. }
  2393. for (propName in config) {
  2394. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2395. if (config[propName] === undefined && defaultProps !== undefined) {
  2396. // Resolve default props
  2397. props[propName] = defaultProps[propName];
  2398. } else {
  2399. props[propName] = config[propName];
  2400. }
  2401. }
  2402. }
  2403. }
  2404. // Children can be more than one argument, and those are transferred onto
  2405. // the newly allocated props object.
  2406. var childrenLength = arguments.length - 2;
  2407. if (childrenLength === 1) {
  2408. props.children = children;
  2409. } else if (childrenLength > 1) {
  2410. var childArray = Array(childrenLength);
  2411. for (var i = 0; i < childrenLength; i++) {
  2412. childArray[i] = arguments[i + 2];
  2413. }
  2414. props.children = childArray;
  2415. }
  2416. return ReactElement(element.type, key, ref, self, source, owner, props);
  2417. };
  2418. /**
  2419. * Verifies the object is a ReactElement.
  2420. * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
  2421. * @param {?object} object
  2422. * @return {boolean} True if `object` is a valid component.
  2423. * @final
  2424. */
  2425. ReactElement.isValidElement = function (object) {
  2426. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  2427. };
  2428. module.exports = ReactElement;
  2429. /***/ }),
  2430. /* 23 */
  2431. /***/ (function(module, exports, __webpack_require__) {
  2432. "use strict";
  2433. /**
  2434. * Copyright (c) 2013-present, Facebook, Inc.
  2435. * All rights reserved.
  2436. *
  2437. * This source code is licensed under the BSD-style license found in the
  2438. * LICENSE file in the root directory of this source tree. An additional grant
  2439. * of patent rights can be found in the PATENTS file in the same directory.
  2440. *
  2441. *
  2442. */
  2443. /**
  2444. * WARNING: DO NOT manually require this module.
  2445. * This is a replacement for `invariant(...)` used by the error code system
  2446. * and will _only_ be required by the corresponding babel pass.
  2447. * It always throws.
  2448. */
  2449. function reactProdInvariant(code) {
  2450. var argCount = arguments.length - 1;
  2451. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  2452. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  2453. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  2454. }
  2455. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  2456. var error = new Error(message);
  2457. error.name = 'Invariant Violation';
  2458. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  2459. throw error;
  2460. }
  2461. module.exports = reactProdInvariant;
  2462. /***/ }),
  2463. /* 24 */
  2464. /***/ (function(module, exports, __webpack_require__) {
  2465. "use strict";
  2466. /**
  2467. * @author oldj
  2468. * @blog https://oldj.net
  2469. */
  2470. var _Agent = __webpack_require__(4);
  2471. var _Agent2 = _interopRequireDefault(_Agent);
  2472. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2473. var updated = __webpack_require__(17);
  2474. module.exports = function (app, list) {
  2475. var hosts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  2476. return _Agent2.default.pact('saveHosts', list).then(function (new_list) {
  2477. return updated(app, new_list, hosts);
  2478. })
  2479. //.then(() => {
  2480. // console.log('saved.', hosts && hosts.content.substring(0, 50))
  2481. //})
  2482. .catch(function (e) {
  2483. console.log(e);
  2484. });
  2485. };
  2486. /***/ }),
  2487. /* 25 */
  2488. /***/ (function(module, exports, __webpack_require__) {
  2489. "use strict";
  2490. /**
  2491. * Copyright (c) 2013-present, Facebook, Inc.
  2492. * All rights reserved.
  2493. *
  2494. * This source code is licensed under the BSD-style license found in the
  2495. * LICENSE file in the root directory of this source tree. An additional grant
  2496. * of patent rights can be found in the PATENTS file in the same directory.
  2497. *
  2498. */
  2499. var emptyObject = {};
  2500. if (false) {
  2501. Object.freeze(emptyObject);
  2502. }
  2503. module.exports = emptyObject;
  2504. /***/ }),
  2505. /* 26 */
  2506. /***/ (function(module, exports, __webpack_require__) {
  2507. "use strict";
  2508. /**
  2509. * Copyright 2013-present, Facebook, Inc.
  2510. * All rights reserved.
  2511. *
  2512. * This source code is licensed under the BSD-style license found in the
  2513. * LICENSE file in the root directory of this source tree. An additional grant
  2514. * of patent rights can be found in the PATENTS file in the same directory.
  2515. *
  2516. */
  2517. var _prodInvariant = __webpack_require__(2);
  2518. var EventPluginRegistry = __webpack_require__(53);
  2519. var EventPluginUtils = __webpack_require__(54);
  2520. var ReactErrorUtils = __webpack_require__(58);
  2521. var accumulateInto = __webpack_require__(88);
  2522. var forEachAccumulated = __webpack_require__(89);
  2523. var invariant = __webpack_require__(0);
  2524. /**
  2525. * Internal store for event listeners
  2526. */
  2527. var listenerBank = {};
  2528. /**
  2529. * Internal queue of events that have accumulated their dispatches and are
  2530. * waiting to have their dispatches executed.
  2531. */
  2532. var eventQueue = null;
  2533. /**
  2534. * Dispatches an event and releases it back into the pool, unless persistent.
  2535. *
  2536. * @param {?object} event Synthetic event to be dispatched.
  2537. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2538. * @private
  2539. */
  2540. var executeDispatchesAndRelease = function (event, simulated) {
  2541. if (event) {
  2542. EventPluginUtils.executeDispatchesInOrder(event, simulated);
  2543. if (!event.isPersistent()) {
  2544. event.constructor.release(event);
  2545. }
  2546. }
  2547. };
  2548. var executeDispatchesAndReleaseSimulated = function (e) {
  2549. return executeDispatchesAndRelease(e, true);
  2550. };
  2551. var executeDispatchesAndReleaseTopLevel = function (e) {
  2552. return executeDispatchesAndRelease(e, false);
  2553. };
  2554. var getDictionaryKey = function (inst) {
  2555. // Prevents V8 performance issue:
  2556. // https://github.com/facebook/react/pull/7232
  2557. return '.' + inst._rootNodeID;
  2558. };
  2559. function isInteractive(tag) {
  2560. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  2561. }
  2562. function shouldPreventMouseEvent(name, type, props) {
  2563. switch (name) {
  2564. case 'onClick':
  2565. case 'onClickCapture':
  2566. case 'onDoubleClick':
  2567. case 'onDoubleClickCapture':
  2568. case 'onMouseDown':
  2569. case 'onMouseDownCapture':
  2570. case 'onMouseMove':
  2571. case 'onMouseMoveCapture':
  2572. case 'onMouseUp':
  2573. case 'onMouseUpCapture':
  2574. return !!(props.disabled && isInteractive(type));
  2575. default:
  2576. return false;
  2577. }
  2578. }
  2579. /**
  2580. * This is a unified interface for event plugins to be installed and configured.
  2581. *
  2582. * Event plugins can implement the following properties:
  2583. *
  2584. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2585. * Required. When a top-level event is fired, this method is expected to
  2586. * extract synthetic events that will in turn be queued and dispatched.
  2587. *
  2588. * `eventTypes` {object}
  2589. * Optional, plugins that fire events must publish a mapping of registration
  2590. * names that are used to register listeners. Values of this mapping must
  2591. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2592. *
  2593. * `executeDispatch` {function(object, function, string)}
  2594. * Optional, allows plugins to override how an event gets dispatched. By
  2595. * default, the listener is simply invoked.
  2596. *
  2597. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2598. *
  2599. * @public
  2600. */
  2601. var EventPluginHub = {
  2602. /**
  2603. * Methods for injecting dependencies.
  2604. */
  2605. injection: {
  2606. /**
  2607. * @param {array} InjectedEventPluginOrder
  2608. * @public
  2609. */
  2610. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2611. /**
  2612. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2613. */
  2614. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2615. },
  2616. /**
  2617. * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
  2618. *
  2619. * @param {object} inst The instance, which is the source of events.
  2620. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2621. * @param {function} listener The callback to store.
  2622. */
  2623. putListener: function (inst, registrationName, listener) {
  2624. !(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;
  2625. var key = getDictionaryKey(inst);
  2626. var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2627. bankForRegistrationName[key] = listener;
  2628. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2629. if (PluginModule && PluginModule.didPutListener) {
  2630. PluginModule.didPutListener(inst, registrationName, listener);
  2631. }
  2632. },
  2633. /**
  2634. * @param {object} inst The instance, which is the source of events.
  2635. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2636. * @return {?function} The stored callback.
  2637. */
  2638. getListener: function (inst, registrationName) {
  2639. // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
  2640. // live here; needs to be moved to a better place soon
  2641. var bankForRegistrationName = listenerBank[registrationName];
  2642. if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) {
  2643. return null;
  2644. }
  2645. var key = getDictionaryKey(inst);
  2646. return bankForRegistrationName && bankForRegistrationName[key];
  2647. },
  2648. /**
  2649. * Deletes a listener from the registration bank.
  2650. *
  2651. * @param {object} inst The instance, which is the source of events.
  2652. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2653. */
  2654. deleteListener: function (inst, registrationName) {
  2655. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2656. if (PluginModule && PluginModule.willDeleteListener) {
  2657. PluginModule.willDeleteListener(inst, registrationName);
  2658. }
  2659. var bankForRegistrationName = listenerBank[registrationName];
  2660. // TODO: This should never be null -- when is it?
  2661. if (bankForRegistrationName) {
  2662. var key = getDictionaryKey(inst);
  2663. delete bankForRegistrationName[key];
  2664. }
  2665. },
  2666. /**
  2667. * Deletes all listeners for the DOM element with the supplied ID.
  2668. *
  2669. * @param {object} inst The instance, which is the source of events.
  2670. */
  2671. deleteAllListeners: function (inst) {
  2672. var key = getDictionaryKey(inst);
  2673. for (var registrationName in listenerBank) {
  2674. if (!listenerBank.hasOwnProperty(registrationName)) {
  2675. continue;
  2676. }
  2677. if (!listenerBank[registrationName][key]) {
  2678. continue;
  2679. }
  2680. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2681. if (PluginModule && PluginModule.willDeleteListener) {
  2682. PluginModule.willDeleteListener(inst, registrationName);
  2683. }
  2684. delete listenerBank[registrationName][key];
  2685. }
  2686. },
  2687. /**
  2688. * Allows registered plugins an opportunity to extract events from top-level
  2689. * native browser events.
  2690. *
  2691. * @return {*} An accumulation of synthetic events.
  2692. * @internal
  2693. */
  2694. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  2695. var events;
  2696. var plugins = EventPluginRegistry.plugins;
  2697. for (var i = 0; i < plugins.length; i++) {
  2698. // Not every plugin in the ordering may be loaded at runtime.
  2699. var possiblePlugin = plugins[i];
  2700. if (possiblePlugin) {
  2701. var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  2702. if (extractedEvents) {
  2703. events = accumulateInto(events, extractedEvents);
  2704. }
  2705. }
  2706. }
  2707. return events;
  2708. },
  2709. /**
  2710. * Enqueues a synthetic event that should be dispatched when
  2711. * `processEventQueue` is invoked.
  2712. *
  2713. * @param {*} events An accumulation of synthetic events.
  2714. * @internal
  2715. */
  2716. enqueueEvents: function (events) {
  2717. if (events) {
  2718. eventQueue = accumulateInto(eventQueue, events);
  2719. }
  2720. },
  2721. /**
  2722. * Dispatches all synthetic events on the event queue.
  2723. *
  2724. * @internal
  2725. */
  2726. processEventQueue: function (simulated) {
  2727. // Set `eventQueue` to null before processing it so that we can tell if more
  2728. // events get enqueued while processing.
  2729. var processingEventQueue = eventQueue;
  2730. eventQueue = null;
  2731. if (simulated) {
  2732. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
  2733. } else {
  2734. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
  2735. }
  2736. !!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;
  2737. // This would be a good time to rethrow if any of the event handlers threw.
  2738. ReactErrorUtils.rethrowCaughtError();
  2739. },
  2740. /**
  2741. * These are needed for tests only. Do not use!
  2742. */
  2743. __purge: function () {
  2744. listenerBank = {};
  2745. },
  2746. __getListenerBank: function () {
  2747. return listenerBank;
  2748. }
  2749. };
  2750. module.exports = EventPluginHub;
  2751. /***/ }),
  2752. /* 27 */
  2753. /***/ (function(module, exports, __webpack_require__) {
  2754. "use strict";
  2755. /**
  2756. * Copyright 2013-present, Facebook, Inc.
  2757. * All rights reserved.
  2758. *
  2759. * This source code is licensed under the BSD-style license found in the
  2760. * LICENSE file in the root directory of this source tree. An additional grant
  2761. * of patent rights can be found in the PATENTS file in the same directory.
  2762. *
  2763. */
  2764. var EventPluginHub = __webpack_require__(26);
  2765. var EventPluginUtils = __webpack_require__(54);
  2766. var accumulateInto = __webpack_require__(88);
  2767. var forEachAccumulated = __webpack_require__(89);
  2768. var warning = __webpack_require__(1);
  2769. var getListener = EventPluginHub.getListener;
  2770. /**
  2771. * Some event types have a notion of different registration names for different
  2772. * "phases" of propagation. This finds listeners by a given phase.
  2773. */
  2774. function listenerAtPhase(inst, event, propagationPhase) {
  2775. var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  2776. return getListener(inst, registrationName);
  2777. }
  2778. /**
  2779. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  2780. * here, allows us to not have to bind or create functions for each event.
  2781. * Mutating the event's members allows us to not have to create a wrapping
  2782. * "dispatch" object that pairs the event with the listener.
  2783. */
  2784. function accumulateDirectionalDispatches(inst, phase, event) {
  2785. if (false) {
  2786. process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
  2787. }
  2788. var listener = listenerAtPhase(inst, event, phase);
  2789. if (listener) {
  2790. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2791. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2792. }
  2793. }
  2794. /**
  2795. * Collect dispatches (must be entirely collected before dispatching - see unit
  2796. * tests). Lazily allocate the array to conserve memory. We must loop through
  2797. * each event and perform the traversal for each one. We cannot perform a
  2798. * single traversal for the entire collection of events because each event may
  2799. * have a different target.
  2800. */
  2801. function accumulateTwoPhaseDispatchesSingle(event) {
  2802. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2803. EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
  2804. }
  2805. }
  2806. /**
  2807. * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
  2808. */
  2809. function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
  2810. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2811. var targetInst = event._targetInst;
  2812. var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
  2813. EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
  2814. }
  2815. }
  2816. /**
  2817. * Accumulates without regard to direction, does not look for phased
  2818. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  2819. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  2820. */
  2821. function accumulateDispatches(inst, ignoredDirection, event) {
  2822. if (event && event.dispatchConfig.registrationName) {
  2823. var registrationName = event.dispatchConfig.registrationName;
  2824. var listener = getListener(inst, registrationName);
  2825. if (listener) {
  2826. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2827. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2828. }
  2829. }
  2830. }
  2831. /**
  2832. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  2833. * `dispatchMarker`.
  2834. * @param {SyntheticEvent} event
  2835. */
  2836. function accumulateDirectDispatchesSingle(event) {
  2837. if (event && event.dispatchConfig.registrationName) {
  2838. accumulateDispatches(event._targetInst, null, event);
  2839. }
  2840. }
  2841. function accumulateTwoPhaseDispatches(events) {
  2842. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  2843. }
  2844. function accumulateTwoPhaseDispatchesSkipTarget(events) {
  2845. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
  2846. }
  2847. function accumulateEnterLeaveDispatches(leave, enter, from, to) {
  2848. EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
  2849. }
  2850. function accumulateDirectDispatches(events) {
  2851. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  2852. }
  2853. /**
  2854. * A small set of propagation patterns, each of which will accept a small amount
  2855. * of information, and generate a set of "dispatch ready event objects" - which
  2856. * are sets of events that have already been annotated with a set of dispatched
  2857. * listener functions/ids. The API is designed this way to discourage these
  2858. * propagation strategies from actually executing the dispatches, since we
  2859. * always want to collect the entire set of dispatches before executing event a
  2860. * single one.
  2861. *
  2862. * @constructor EventPropagators
  2863. */
  2864. var EventPropagators = {
  2865. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  2866. accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
  2867. accumulateDirectDispatches: accumulateDirectDispatches,
  2868. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  2869. };
  2870. module.exports = EventPropagators;
  2871. /***/ }),
  2872. /* 28 */
  2873. /***/ (function(module, exports, __webpack_require__) {
  2874. "use strict";
  2875. /**
  2876. * Copyright 2013-present, Facebook, Inc.
  2877. * All rights reserved.
  2878. *
  2879. * This source code is licensed under the BSD-style license found in the
  2880. * LICENSE file in the root directory of this source tree. An additional grant
  2881. * of patent rights can be found in the PATENTS file in the same directory.
  2882. *
  2883. */
  2884. /**
  2885. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  2886. * instance (key) and the internal representation (value). This allows public
  2887. * methods to accept the user facing instance as an argument and map them back
  2888. * to internal methods.
  2889. */
  2890. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  2891. var ReactInstanceMap = {
  2892. /**
  2893. * This API should be called `delete` but we'd have to make sure to always
  2894. * transform these to strings for IE support. When this transform is fully
  2895. * supported we can rename it.
  2896. */
  2897. remove: function (key) {
  2898. key._reactInternalInstance = undefined;
  2899. },
  2900. get: function (key) {
  2901. return key._reactInternalInstance;
  2902. },
  2903. has: function (key) {
  2904. return key._reactInternalInstance !== undefined;
  2905. },
  2906. set: function (key, value) {
  2907. key._reactInternalInstance = value;
  2908. }
  2909. };
  2910. module.exports = ReactInstanceMap;
  2911. /***/ }),
  2912. /* 29 */
  2913. /***/ (function(module, exports, __webpack_require__) {
  2914. "use strict";
  2915. /**
  2916. * Copyright 2013-present, Facebook, Inc.
  2917. * All rights reserved.
  2918. *
  2919. * This source code is licensed under the BSD-style license found in the
  2920. * LICENSE file in the root directory of this source tree. An additional grant
  2921. * of patent rights can be found in the PATENTS file in the same directory.
  2922. *
  2923. */
  2924. var SyntheticEvent = __webpack_require__(13);
  2925. var getEventTarget = __webpack_require__(63);
  2926. /**
  2927. * @interface UIEvent
  2928. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  2929. */
  2930. var UIEventInterface = {
  2931. view: function (event) {
  2932. if (event.view) {
  2933. return event.view;
  2934. }
  2935. var target = getEventTarget(event);
  2936. if (target.window === target) {
  2937. // target is a window object
  2938. return target;
  2939. }
  2940. var doc = target.ownerDocument;
  2941. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2942. if (doc) {
  2943. return doc.defaultView || doc.parentWindow;
  2944. } else {
  2945. return window;
  2946. }
  2947. },
  2948. detail: function (event) {
  2949. return event.detail || 0;
  2950. }
  2951. };
  2952. /**
  2953. * @param {object} dispatchConfig Configuration used to dispatch this event.
  2954. * @param {string} dispatchMarker Marker identifying the event target.
  2955. * @param {object} nativeEvent Native browser event.
  2956. * @extends {SyntheticEvent}
  2957. */
  2958. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  2959. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  2960. }
  2961. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  2962. module.exports = SyntheticUIEvent;
  2963. /***/ }),
  2964. /* 30 */
  2965. /***/ (function(module, exports, __webpack_require__) {
  2966. "use strict";
  2967. /**
  2968. * @author oldj
  2969. * @blog https://oldj.net
  2970. */
  2971. var _Agent = __webpack_require__(4);
  2972. var _Agent2 = _interopRequireDefault(_Agent);
  2973. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2974. var req = __webpack_require__(247);
  2975. exports.reg = function (app) {
  2976. req.keys().map(function (fn) {
  2977. var m = fn.match(/^\.\/([\w\-]+)\.js$/);
  2978. var name = m ? m[1] : null;
  2979. if (!name || name === 'index') return;
  2980. _Agent2.default.on(name, function () {
  2981. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  2982. args[_key] = arguments[_key];
  2983. }
  2984. var fn = __webpack_require__(246)("./" + name);
  2985. fn.apply(undefined, [app].concat(args));
  2986. });
  2987. });
  2988. };
  2989. /***/ }),
  2990. /* 31 */
  2991. /***/ (function(module, exports, __webpack_require__) {
  2992. "use strict";
  2993. /**
  2994. * Copyright 2013-present, Facebook, Inc.
  2995. * All rights reserved.
  2996. *
  2997. * This source code is licensed under the BSD-style license found in the
  2998. * LICENSE file in the root directory of this source tree. An additional grant
  2999. * of patent rights can be found in the PATENTS file in the same directory.
  3000. *
  3001. */
  3002. var _assign = __webpack_require__(3);
  3003. var EventPluginRegistry = __webpack_require__(53);
  3004. var ReactEventEmitterMixin = __webpack_require__(179);
  3005. var ViewportMetrics = __webpack_require__(87);
  3006. var getVendorPrefixedEventName = __webpack_require__(211);
  3007. var isEventSupported = __webpack_require__(64);
  3008. /**
  3009. * Summary of `ReactBrowserEventEmitter` event handling:
  3010. *
  3011. * - Top-level delegation is used to trap most native browser events. This
  3012. * may only occur in the main thread and is the responsibility of
  3013. * ReactEventListener, which is injected and can therefore support pluggable
  3014. * event sources. This is the only work that occurs in the main thread.
  3015. *
  3016. * - We normalize and de-duplicate events to account for browser quirks. This
  3017. * may be done in the worker thread.
  3018. *
  3019. * - Forward these native events (with the associated top-level type used to
  3020. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  3021. * to extract any synthetic events.
  3022. *
  3023. * - The `EventPluginHub` will then process each event by annotating them with
  3024. * "dispatches", a sequence of listeners and IDs that care about that event.
  3025. *
  3026. * - The `EventPluginHub` then dispatches the events.
  3027. *
  3028. * Overview of React and the event system:
  3029. *
  3030. * +------------+ .
  3031. * | DOM | .
  3032. * +------------+ .
  3033. * | .
  3034. * v .
  3035. * +------------+ .
  3036. * | ReactEvent | .
  3037. * | Listener | .
  3038. * +------------+ . +-----------+
  3039. * | . +--------+|SimpleEvent|
  3040. * | . | |Plugin |
  3041. * +-----|------+ . v +-----------+
  3042. * | | | . +--------------+ +------------+
  3043. * | +-----------.--->|EventPluginHub| | Event |
  3044. * | | . | | +-----------+ | Propagators|
  3045. * | ReactEvent | . | | |TapEvent | |------------|
  3046. * | Emitter | . | |<---+|Plugin | |other plugin|
  3047. * | | . | | +-----------+ | utilities |
  3048. * | +-----------.--->| | +------------+
  3049. * | | | . +--------------+
  3050. * +-----|------+ . ^ +-----------+
  3051. * | . | |Enter/Leave|
  3052. * + . +-------+|Plugin |
  3053. * +-------------+ . +-----------+
  3054. * | application | .
  3055. * |-------------| .
  3056. * | | .
  3057. * | | .
  3058. * +-------------+ .
  3059. * .
  3060. * React Core . General Purpose Event Plugin System
  3061. */
  3062. var hasEventPageXY;
  3063. var alreadyListeningTo = {};
  3064. var isMonitoringScrollValue = false;
  3065. var reactTopListenersCounter = 0;
  3066. // For events like 'submit' which don't consistently bubble (which we trap at a
  3067. // lower node than `document`), binding at `document` would cause duplicate
  3068. // events so we don't include them here
  3069. var topEventMapping = {
  3070. topAbort: 'abort',
  3071. topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
  3072. topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
  3073. topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
  3074. topBlur: 'blur',
  3075. topCanPlay: 'canplay',
  3076. topCanPlayThrough: 'canplaythrough',
  3077. topChange: 'change',
  3078. topClick: 'click',
  3079. topCompositionEnd: 'compositionend',
  3080. topCompositionStart: 'compositionstart',
  3081. topCompositionUpdate: 'compositionupdate',
  3082. topContextMenu: 'contextmenu',
  3083. topCopy: 'copy',
  3084. topCut: 'cut',
  3085. topDoubleClick: 'dblclick',
  3086. topDrag: 'drag',
  3087. topDragEnd: 'dragend',
  3088. topDragEnter: 'dragenter',
  3089. topDragExit: 'dragexit',
  3090. topDragLeave: 'dragleave',
  3091. topDragOver: 'dragover',
  3092. topDragStart: 'dragstart',
  3093. topDrop: 'drop',
  3094. topDurationChange: 'durationchange',
  3095. topEmptied: 'emptied',
  3096. topEncrypted: 'encrypted',
  3097. topEnded: 'ended',
  3098. topError: 'error',
  3099. topFocus: 'focus',
  3100. topInput: 'input',
  3101. topKeyDown: 'keydown',
  3102. topKeyPress: 'keypress',
  3103. topKeyUp: 'keyup',
  3104. topLoadedData: 'loadeddata',
  3105. topLoadedMetadata: 'loadedmetadata',
  3106. topLoadStart: 'loadstart',
  3107. topMouseDown: 'mousedown',
  3108. topMouseMove: 'mousemove',
  3109. topMouseOut: 'mouseout',
  3110. topMouseOver: 'mouseover',
  3111. topMouseUp: 'mouseup',
  3112. topPaste: 'paste',
  3113. topPause: 'pause',
  3114. topPlay: 'play',
  3115. topPlaying: 'playing',
  3116. topProgress: 'progress',
  3117. topRateChange: 'ratechange',
  3118. topScroll: 'scroll',
  3119. topSeeked: 'seeked',
  3120. topSeeking: 'seeking',
  3121. topSelectionChange: 'selectionchange',
  3122. topStalled: 'stalled',
  3123. topSuspend: 'suspend',
  3124. topTextInput: 'textInput',
  3125. topTimeUpdate: 'timeupdate',
  3126. topTouchCancel: 'touchcancel',
  3127. topTouchEnd: 'touchend',
  3128. topTouchMove: 'touchmove',
  3129. topTouchStart: 'touchstart',
  3130. topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
  3131. topVolumeChange: 'volumechange',
  3132. topWaiting: 'waiting',
  3133. topWheel: 'wheel'
  3134. };
  3135. /**
  3136. * To ensure no conflicts with other potential React instances on the page
  3137. */
  3138. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3139. function getListeningForDocument(mountAt) {
  3140. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3141. // directly.
  3142. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3143. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3144. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3145. }
  3146. return alreadyListeningTo[mountAt[topListenersIDKey]];
  3147. }
  3148. /**
  3149. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  3150. * example:
  3151. *
  3152. * EventPluginHub.putListener('myID', 'onClick', myFunction);
  3153. *
  3154. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  3155. *
  3156. * @internal
  3157. */
  3158. var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
  3159. /**
  3160. * Injectable event backend
  3161. */
  3162. ReactEventListener: null,
  3163. injection: {
  3164. /**
  3165. * @param {object} ReactEventListener
  3166. */
  3167. injectReactEventListener: function (ReactEventListener) {
  3168. ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
  3169. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  3170. }
  3171. },
  3172. /**
  3173. * Sets whether or not any created callbacks should be enabled.
  3174. *
  3175. * @param {boolean} enabled True if callbacks should be enabled.
  3176. */
  3177. setEnabled: function (enabled) {
  3178. if (ReactBrowserEventEmitter.ReactEventListener) {
  3179. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  3180. }
  3181. },
  3182. /**
  3183. * @return {boolean} True if callbacks are enabled.
  3184. */
  3185. isEnabled: function () {
  3186. return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
  3187. },
  3188. /**
  3189. * We listen for bubbled touch events on the document object.
  3190. *
  3191. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  3192. * mounting `onmousemove` events at some node that was not the document
  3193. * element. The symptoms were that if your mouse is not moving over something
  3194. * contained within that mount point (for example on the background) the
  3195. * top-level listeners for `onmousemove` won't be called. However, if you
  3196. * register the `mousemove` on the document object, then it will of course
  3197. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  3198. * top-level listeners to the document object only, at least for these
  3199. * movement types of events and possibly all events.
  3200. *
  3201. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  3202. *
  3203. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  3204. * they bubble to document.
  3205. *
  3206. * @param {string} registrationName Name of listener (e.g. `onClick`).
  3207. * @param {object} contentDocumentHandle Document which owns the container
  3208. */
  3209. listenTo: function (registrationName, contentDocumentHandle) {
  3210. var mountAt = contentDocumentHandle;
  3211. var isListening = getListeningForDocument(mountAt);
  3212. var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
  3213. for (var i = 0; i < dependencies.length; i++) {
  3214. var dependency = dependencies[i];
  3215. if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  3216. if (dependency === 'topWheel') {
  3217. if (isEventSupported('wheel')) {
  3218. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt);
  3219. } else if (isEventSupported('mousewheel')) {
  3220. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt);
  3221. } else {
  3222. // Firefox needs to capture a different mouse scroll event.
  3223. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  3224. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt);
  3225. }
  3226. } else if (dependency === 'topScroll') {
  3227. if (isEventSupported('scroll', true)) {
  3228. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt);
  3229. } else {
  3230. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
  3231. }
  3232. } else if (dependency === 'topFocus' || dependency === 'topBlur') {
  3233. if (isEventSupported('focus', true)) {
  3234. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt);
  3235. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt);
  3236. } else if (isEventSupported('focusin')) {
  3237. // IE has `focusin` and `focusout` events which bubble.
  3238. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  3239. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt);
  3240. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt);
  3241. }
  3242. // to make sure blur and focus event listeners are only attached once
  3243. isListening.topBlur = true;
  3244. isListening.topFocus = true;
  3245. } else if (topEventMapping.hasOwnProperty(dependency)) {
  3246. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
  3247. }
  3248. isListening[dependency] = true;
  3249. }
  3250. }
  3251. },
  3252. trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
  3253. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
  3254. },
  3255. trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
  3256. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
  3257. },
  3258. /**
  3259. * Protect against document.createEvent() returning null
  3260. * Some popup blocker extensions appear to do this:
  3261. * https://github.com/facebook/react/issues/6887
  3262. */
  3263. supportsEventPageXY: function () {
  3264. if (!document.createEvent) {
  3265. return false;
  3266. }
  3267. var ev = document.createEvent('MouseEvent');
  3268. return ev != null && 'pageX' in ev;
  3269. },
  3270. /**
  3271. * Listens to window scroll and resize events. We cache scroll values so that
  3272. * application code can access them without triggering reflows.
  3273. *
  3274. * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
  3275. * pageX/pageY isn't supported (legacy browsers).
  3276. *
  3277. * NOTE: Scroll events do not bubble.
  3278. *
  3279. * @see http://www.quirksmode.org/dom/events/scroll.html
  3280. */
  3281. ensureScrollValueMonitoring: function () {
  3282. if (hasEventPageXY === undefined) {
  3283. hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
  3284. }
  3285. if (!hasEventPageXY && !isMonitoringScrollValue) {
  3286. var refresh = ViewportMetrics.refreshScrollValues;
  3287. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  3288. isMonitoringScrollValue = true;
  3289. }
  3290. }
  3291. });
  3292. module.exports = ReactBrowserEventEmitter;
  3293. /***/ }),
  3294. /* 32 */
  3295. /***/ (function(module, exports, __webpack_require__) {
  3296. "use strict";
  3297. /**
  3298. * Copyright 2013-present, Facebook, Inc.
  3299. * All rights reserved.
  3300. *
  3301. * This source code is licensed under the BSD-style license found in the
  3302. * LICENSE file in the root directory of this source tree. An additional grant
  3303. * of patent rights can be found in the PATENTS file in the same directory.
  3304. *
  3305. */
  3306. var SyntheticUIEvent = __webpack_require__(29);
  3307. var ViewportMetrics = __webpack_require__(87);
  3308. var getEventModifierState = __webpack_require__(62);
  3309. /**
  3310. * @interface MouseEvent
  3311. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  3312. */
  3313. var MouseEventInterface = {
  3314. screenX: null,
  3315. screenY: null,
  3316. clientX: null,
  3317. clientY: null,
  3318. ctrlKey: null,
  3319. shiftKey: null,
  3320. altKey: null,
  3321. metaKey: null,
  3322. getModifierState: getEventModifierState,
  3323. button: function (event) {
  3324. // Webkit, Firefox, IE9+
  3325. // which: 1 2 3
  3326. // button: 0 1 2 (standard)
  3327. var button = event.button;
  3328. if ('which' in event) {
  3329. return button;
  3330. }
  3331. // IE<9
  3332. // which: undefined
  3333. // button: 0 0 0
  3334. // button: 1 4 2 (onmouseup)
  3335. return button === 2 ? 2 : button === 4 ? 1 : 0;
  3336. },
  3337. buttons: null,
  3338. relatedTarget: function (event) {
  3339. return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
  3340. },
  3341. // "Proprietary" Interface.
  3342. pageX: function (event) {
  3343. return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
  3344. },
  3345. pageY: function (event) {
  3346. return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
  3347. }
  3348. };
  3349. /**
  3350. * @param {object} dispatchConfig Configuration used to dispatch this event.
  3351. * @param {string} dispatchMarker Marker identifying the event target.
  3352. * @param {object} nativeEvent Native browser event.
  3353. * @extends {SyntheticUIEvent}
  3354. */
  3355. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  3356. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  3357. }
  3358. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  3359. module.exports = SyntheticMouseEvent;
  3360. /***/ }),
  3361. /* 33 */
  3362. /***/ (function(module, exports, __webpack_require__) {
  3363. "use strict";
  3364. /**
  3365. * Copyright 2013-present, Facebook, Inc.
  3366. * All rights reserved.
  3367. *
  3368. * This source code is licensed under the BSD-style license found in the
  3369. * LICENSE file in the root directory of this source tree. An additional grant
  3370. * of patent rights can be found in the PATENTS file in the same directory.
  3371. *
  3372. *
  3373. */
  3374. var _prodInvariant = __webpack_require__(2);
  3375. var invariant = __webpack_require__(0);
  3376. var OBSERVED_ERROR = {};
  3377. /**
  3378. * `Transaction` creates a black box that is able to wrap any method such that
  3379. * certain invariants are maintained before and after the method is invoked
  3380. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  3381. * instantiates a transaction can provide enforcers of the invariants at
  3382. * creation time. The `Transaction` class itself will supply one additional
  3383. * automatic invariant for you - the invariant that any transaction instance
  3384. * should not be run while it is already being run. You would typically create a
  3385. * single instance of a `Transaction` for reuse multiple times, that potentially
  3386. * is used to wrap several different methods. Wrappers are extremely simple -
  3387. * they only require implementing two methods.
  3388. *
  3389. * <pre>
  3390. * wrappers (injected at creation time)
  3391. * + +
  3392. * | |
  3393. * +-----------------|--------|--------------+
  3394. * | v | |
  3395. * | +---------------+ | |
  3396. * | +--| wrapper1 |---|----+ |
  3397. * | | +---------------+ v | |
  3398. * | | +-------------+ | |
  3399. * | | +----| wrapper2 |--------+ |
  3400. * | | | +-------------+ | | |
  3401. * | | | | | |
  3402. * | v v v v | wrapper
  3403. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  3404. * perform(anyMethod) | | | | | | | | | | | | maintained
  3405. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  3406. * | | | | | | | | | | | |
  3407. * | | | | | | | | | | | |
  3408. * | | | | | | | | | | | |
  3409. * | +---+ +---+ +---------+ +---+ +---+ |
  3410. * | initialize close |
  3411. * +-----------------------------------------+
  3412. * </pre>
  3413. *
  3414. * Use cases:
  3415. * - Preserving the input selection ranges before/after reconciliation.
  3416. * Restoring selection even in the event of an unexpected error.
  3417. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  3418. * while guaranteeing that afterwards, the event system is reactivated.
  3419. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  3420. * reconciliation takes place in a worker thread.
  3421. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  3422. * content.
  3423. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  3424. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  3425. * - (Future use case): Layout calculations before and after DOM updates.
  3426. *
  3427. * Transactional plugin API:
  3428. * - A module that has an `initialize` method that returns any precomputation.
  3429. * - and a `close` method that accepts the precomputation. `close` is invoked
  3430. * when the wrapped process is completed, or has failed.
  3431. *
  3432. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  3433. * that implement `initialize` and `close`.
  3434. * @return {Transaction} Single transaction for reuse in thread.
  3435. *
  3436. * @class Transaction
  3437. */
  3438. var TransactionImpl = {
  3439. /**
  3440. * Sets up this instance so that it is prepared for collecting metrics. Does
  3441. * so such that this setup method may be used on an instance that is already
  3442. * initialized, in a way that does not consume additional memory upon reuse.
  3443. * That can be useful if you decide to make your subclass of this mixin a
  3444. * "PooledClass".
  3445. */
  3446. reinitializeTransaction: function () {
  3447. this.transactionWrappers = this.getTransactionWrappers();
  3448. if (this.wrapperInitData) {
  3449. this.wrapperInitData.length = 0;
  3450. } else {
  3451. this.wrapperInitData = [];
  3452. }
  3453. this._isInTransaction = false;
  3454. },
  3455. _isInTransaction: false,
  3456. /**
  3457. * @abstract
  3458. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  3459. */
  3460. getTransactionWrappers: null,
  3461. isInTransaction: function () {
  3462. return !!this._isInTransaction;
  3463. },
  3464. /**
  3465. * Executes the function within a safety window. Use this for the top level
  3466. * methods that result in large amounts of computation/mutations that would
  3467. * need to be safety checked. The optional arguments helps prevent the need
  3468. * to bind in many cases.
  3469. *
  3470. * @param {function} method Member of scope to call.
  3471. * @param {Object} scope Scope to invoke from.
  3472. * @param {Object?=} a Argument to pass to the method.
  3473. * @param {Object?=} b Argument to pass to the method.
  3474. * @param {Object?=} c Argument to pass to the method.
  3475. * @param {Object?=} d Argument to pass to the method.
  3476. * @param {Object?=} e Argument to pass to the method.
  3477. * @param {Object?=} f Argument to pass to the method.
  3478. *
  3479. * @return {*} Return value from `method`.
  3480. */
  3481. perform: function (method, scope, a, b, c, d, e, f) {
  3482. !!this.isInTransaction() ? false ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
  3483. var errorThrown;
  3484. var ret;
  3485. try {
  3486. this._isInTransaction = true;
  3487. // Catching errors makes debugging more difficult, so we start with
  3488. // errorThrown set to true before setting it to false after calling
  3489. // close -- if it's still set to true in the finally block, it means
  3490. // one of these calls threw.
  3491. errorThrown = true;
  3492. this.initializeAll(0);
  3493. ret = method.call(scope, a, b, c, d, e, f);
  3494. errorThrown = false;
  3495. } finally {
  3496. try {
  3497. if (errorThrown) {
  3498. // If `method` throws, prefer to show that stack trace over any thrown
  3499. // by invoking `closeAll`.
  3500. try {
  3501. this.closeAll(0);
  3502. } catch (err) {}
  3503. } else {
  3504. // Since `method` didn't throw, we don't want to silence the exception
  3505. // here.
  3506. this.closeAll(0);
  3507. }
  3508. } finally {
  3509. this._isInTransaction = false;
  3510. }
  3511. }
  3512. return ret;
  3513. },
  3514. initializeAll: function (startIndex) {
  3515. var transactionWrappers = this.transactionWrappers;
  3516. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3517. var wrapper = transactionWrappers[i];
  3518. try {
  3519. // Catching errors makes debugging more difficult, so we start with the
  3520. // OBSERVED_ERROR state before overwriting it with the real return value
  3521. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  3522. // block, it means wrapper.initialize threw.
  3523. this.wrapperInitData[i] = OBSERVED_ERROR;
  3524. this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
  3525. } finally {
  3526. if (this.wrapperInitData[i] === OBSERVED_ERROR) {
  3527. // The initializer for wrapper i threw an error; initialize the
  3528. // remaining wrappers but silence any exceptions from them to ensure
  3529. // that the first error is the one to bubble up.
  3530. try {
  3531. this.initializeAll(i + 1);
  3532. } catch (err) {}
  3533. }
  3534. }
  3535. }
  3536. },
  3537. /**
  3538. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  3539. * them the respective return values of `this.transactionWrappers.init[i]`
  3540. * (`close`rs that correspond to initializers that failed will not be
  3541. * invoked).
  3542. */
  3543. closeAll: function (startIndex) {
  3544. !this.isInTransaction() ? false ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
  3545. var transactionWrappers = this.transactionWrappers;
  3546. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3547. var wrapper = transactionWrappers[i];
  3548. var initData = this.wrapperInitData[i];
  3549. var errorThrown;
  3550. try {
  3551. // Catching errors makes debugging more difficult, so we start with
  3552. // errorThrown set to true before setting it to false after calling
  3553. // close -- if it's still set to true in the finally block, it means
  3554. // wrapper.close threw.
  3555. errorThrown = true;
  3556. if (initData !== OBSERVED_ERROR && wrapper.close) {
  3557. wrapper.close.call(this, initData);
  3558. }
  3559. errorThrown = false;
  3560. } finally {
  3561. if (errorThrown) {
  3562. // The closer for wrapper i threw an error; close the remaining
  3563. // wrappers but silence any exceptions from them to ensure that the
  3564. // first error is the one to bubble up.
  3565. try {
  3566. this.closeAll(i + 1);
  3567. } catch (e) {}
  3568. }
  3569. }
  3570. }
  3571. this.wrapperInitData.length = 0;
  3572. }
  3573. };
  3574. module.exports = TransactionImpl;
  3575. /***/ }),
  3576. /* 34 */
  3577. /***/ (function(module, exports, __webpack_require__) {
  3578. "use strict";
  3579. /**
  3580. * Copyright 2016-present, Facebook, Inc.
  3581. * All rights reserved.
  3582. *
  3583. * This source code is licensed under the BSD-style license found in the
  3584. * LICENSE file in the root directory of this source tree. An additional grant
  3585. * of patent rights can be found in the PATENTS file in the same directory.
  3586. *
  3587. * Based on the escape-html library, which is used under the MIT License below:
  3588. *
  3589. * Copyright (c) 2012-2013 TJ Holowaychuk
  3590. * Copyright (c) 2015 Andreas Lubbe
  3591. * Copyright (c) 2015 Tiancheng "Timothy" Gu
  3592. *
  3593. * Permission is hereby granted, free of charge, to any person obtaining
  3594. * a copy of this software and associated documentation files (the
  3595. * 'Software'), to deal in the Software without restriction, including
  3596. * without limitation the rights to use, copy, modify, merge, publish,
  3597. * distribute, sublicense, and/or sell copies of the Software, and to
  3598. * permit persons to whom the Software is furnished to do so, subject to
  3599. * the following conditions:
  3600. *
  3601. * The above copyright notice and this permission notice shall be
  3602. * included in all copies or substantial portions of the Software.
  3603. *
  3604. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  3605. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3606. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  3607. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  3608. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  3609. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  3610. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  3611. *
  3612. */
  3613. // code copied and modified from escape-html
  3614. /**
  3615. * Module variables.
  3616. * @private
  3617. */
  3618. var matchHtmlRegExp = /["'&<>]/;
  3619. /**
  3620. * Escape special characters in the given string of html.
  3621. *
  3622. * @param {string} string The string to escape for inserting into HTML
  3623. * @return {string}
  3624. * @public
  3625. */
  3626. function escapeHtml(string) {
  3627. var str = '' + string;
  3628. var match = matchHtmlRegExp.exec(str);
  3629. if (!match) {
  3630. return str;
  3631. }
  3632. var escape;
  3633. var html = '';
  3634. var index = 0;
  3635. var lastIndex = 0;
  3636. for (index = match.index; index < str.length; index++) {
  3637. switch (str.charCodeAt(index)) {
  3638. case 34:
  3639. // "
  3640. escape = '&quot;';
  3641. break;
  3642. case 38:
  3643. // &
  3644. escape = '&amp;';
  3645. break;
  3646. case 39:
  3647. // '
  3648. escape = '&#x27;'; // modified from escape-html; used to be '&#39'
  3649. break;
  3650. case 60:
  3651. // <
  3652. escape = '&lt;';
  3653. break;
  3654. case 62:
  3655. // >
  3656. escape = '&gt;';
  3657. break;
  3658. default:
  3659. continue;
  3660. }
  3661. if (lastIndex !== index) {
  3662. html += str.substring(lastIndex, index);
  3663. }
  3664. lastIndex = index + 1;
  3665. html += escape;
  3666. }
  3667. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  3668. }
  3669. // end code copied and modified from escape-html
  3670. /**
  3671. * Escapes text to prevent scripting attacks.
  3672. *
  3673. * @param {*} text Text value to escape.
  3674. * @return {string} An escaped string.
  3675. */
  3676. function escapeTextContentForBrowser(text) {
  3677. if (typeof text === 'boolean' || typeof text === 'number') {
  3678. // this shortcircuit helps perf for types that we know will never have
  3679. // special characters, especially given that this function is used often
  3680. // for numeric dom ids.
  3681. return '' + text;
  3682. }
  3683. return escapeHtml(text);
  3684. }
  3685. module.exports = escapeTextContentForBrowser;
  3686. /***/ }),
  3687. /* 35 */
  3688. /***/ (function(module, exports, __webpack_require__) {
  3689. "use strict";
  3690. /**
  3691. * Copyright 2013-present, Facebook, Inc.
  3692. * All rights reserved.
  3693. *
  3694. * This source code is licensed under the BSD-style license found in the
  3695. * LICENSE file in the root directory of this source tree. An additional grant
  3696. * of patent rights can be found in the PATENTS file in the same directory.
  3697. *
  3698. */
  3699. var ExecutionEnvironment = __webpack_require__(8);
  3700. var DOMNamespaces = __webpack_require__(52);
  3701. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  3702. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  3703. var createMicrosoftUnsafeLocalFunction = __webpack_require__(60);
  3704. // SVG temp container for IE lacking innerHTML
  3705. var reusableSVGContainer;
  3706. /**
  3707. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  3708. * even in IE8.
  3709. *
  3710. * @param {DOMElement} node
  3711. * @param {string} html
  3712. * @internal
  3713. */
  3714. var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
  3715. // IE does not have innerHTML for SVG nodes, so instead we inject the
  3716. // new markup in a temp node and then move the child nodes across into
  3717. // the target node
  3718. if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
  3719. reusableSVGContainer = reusableSVGContainer || document.createElement('div');
  3720. reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
  3721. var svgNode = reusableSVGContainer.firstChild;
  3722. while (svgNode.firstChild) {
  3723. node.appendChild(svgNode.firstChild);
  3724. }
  3725. } else {
  3726. node.innerHTML = html;
  3727. }
  3728. });
  3729. if (ExecutionEnvironment.canUseDOM) {
  3730. // IE8: When updating a just created node with innerHTML only leading
  3731. // whitespace is removed. When updating an existing node with innerHTML
  3732. // whitespace in root TextNodes is also collapsed.
  3733. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  3734. // Feature detection; only IE8 is known to behave improperly like this.
  3735. var testElement = document.createElement('div');
  3736. testElement.innerHTML = ' ';
  3737. if (testElement.innerHTML === '') {
  3738. setInnerHTML = function (node, html) {
  3739. // Magic theory: IE8 supposedly differentiates between added and updated
  3740. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  3741. // from worse whitespace behavior. Re-adding a node like this triggers
  3742. // the initial and more favorable whitespace behavior.
  3743. // TODO: What to do on a detached node?
  3744. if (node.parentNode) {
  3745. node.parentNode.replaceChild(node, node);
  3746. }
  3747. // We also implement a workaround for non-visible tags disappearing into
  3748. // thin air on IE8, this only happens if there is no visible text
  3749. // in-front of the non-visible tags. Piggyback on the whitespace fix
  3750. // and simply check if any non-visible tags appear in the source.
  3751. if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  3752. // Recover leading whitespace by temporarily prepending any character.
  3753. // \uFEFF has the potential advantage of being zero-width/invisible.
  3754. // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
  3755. // in hopes that this is preserved even if "\uFEFF" is transformed to
  3756. // the actual Unicode character (by Babel, for example).
  3757. // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
  3758. node.innerHTML = String.fromCharCode(0xFEFF) + html;
  3759. // deleteData leaves an empty `TextNode` which offsets the index of all
  3760. // children. Definitely want to avoid this.
  3761. var textNode = node.firstChild;
  3762. if (textNode.data.length === 1) {
  3763. node.removeChild(textNode);
  3764. } else {
  3765. textNode.deleteData(0, 1);
  3766. }
  3767. } else {
  3768. node.innerHTML = html;
  3769. }
  3770. };
  3771. }
  3772. testElement = null;
  3773. }
  3774. module.exports = setInnerHTML;
  3775. /***/ }),
  3776. /* 36 */
  3777. /***/ (function(module, exports, __webpack_require__) {
  3778. "use strict";
  3779. /**
  3780. * @author oldj
  3781. * @blog http://oldj.net
  3782. */
  3783. module.exports = function (app, msg) {
  3784. alert(msg);
  3785. };
  3786. /***/ }),
  3787. /* 37 */
  3788. /***/ (function(module, exports, __webpack_require__) {
  3789. "use strict";
  3790. /**
  3791. * @author oldj
  3792. * @blog https://oldj.net
  3793. */
  3794. var _Agent = __webpack_require__(4);
  3795. var _Agent2 = _interopRequireDefault(_Agent);
  3796. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3797. module.exports = function (app, hosts) {
  3798. var list = app.state.list;
  3799. _Agent2.default.pact('checkNeedRemoteRefresh', list, hosts).then(function (list) {
  3800. if (!list) return;
  3801. _Agent2.default.emit('list_updated', list);
  3802. }).catch(function (e) {
  3803. console.log(e);
  3804. });
  3805. };
  3806. /***/ }),
  3807. /* 38 */
  3808. /***/ (function(module, exports, __webpack_require__) {
  3809. "use strict";
  3810. /**
  3811. * @author oldj
  3812. * @blog https://oldj.net
  3813. */
  3814. var _Agent = __webpack_require__(4);
  3815. var _Agent2 = _interopRequireDefault(_Agent);
  3816. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3817. module.exports = function (app, hosts) {
  3818. var list = app.state.list;
  3819. var idx = list.findIndex(function (item) {
  3820. return item.id === hosts.id;
  3821. });
  3822. if (idx === -1) {
  3823. return;
  3824. }
  3825. list.splice(idx, 1);
  3826. _Agent2.default.pact('saveHosts', list).then(function () {
  3827. app.setState({ list: list }, function () {
  3828. // 选中下一个 hosts
  3829. var next_hosts = list[idx] || list[idx - 1] || null;
  3830. if (next_hosts) {
  3831. app.setState({ current: next_hosts });
  3832. }
  3833. });
  3834. }).catch(function (e) {
  3835. return console.log(e);
  3836. });
  3837. };
  3838. /***/ }),
  3839. /* 39 */
  3840. /***/ (function(module, exports, __webpack_require__) {
  3841. "use strict";
  3842. /**
  3843. * @author oldj
  3844. * @blog https://oldj.net
  3845. */
  3846. var _Agent = __webpack_require__(4);
  3847. var _Agent2 = _interopRequireDefault(_Agent);
  3848. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3849. module.exports = function () {
  3850. _Agent2.default.pact('esc');
  3851. _Agent2.default.pact('sudoCancel');
  3852. };
  3853. /***/ }),
  3854. /* 40 */
  3855. /***/ (function(module, exports, __webpack_require__) {
  3856. "use strict";
  3857. /**
  3858. * @author oldj
  3859. * @blog https://oldj.net
  3860. */
  3861. module.exports = function (app, callback) {
  3862. var list = app.state.list;
  3863. var ids = list.filter(function (item) {
  3864. return item.on;
  3865. }).map(function (item) {
  3866. return item.id;
  3867. });
  3868. callback(ids);
  3869. };
  3870. /***/ }),
  3871. /* 41 */
  3872. /***/ (function(module, exports, __webpack_require__) {
  3873. "use strict";
  3874. /**
  3875. * @author oldj
  3876. * @blog https://oldj.net
  3877. */
  3878. module.exports = function (app) {
  3879. app.loadHosts();
  3880. };
  3881. /***/ }),
  3882. /* 42 */
  3883. /***/ (function(module, exports, __webpack_require__) {
  3884. "use strict";
  3885. /**
  3886. * @author oldj
  3887. * @blog https://oldj.net
  3888. */
  3889. var _Agent = __webpack_require__(4);
  3890. var _Agent2 = _interopRequireDefault(_Agent);
  3891. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3892. var updated = __webpack_require__(17);
  3893. module.exports = function (app, ids) {
  3894. var list = app.state.list;
  3895. var new_list = [];
  3896. ids.map(function (id) {
  3897. var item = list.find(function (i) {
  3898. return i.id === id;
  3899. });
  3900. if (item) {
  3901. new_list.push(item);
  3902. }
  3903. });
  3904. _Agent2.default.pact('saveHosts', new_list).then(function (list) {
  3905. updated(app, list);
  3906. }).catch(function (e) {
  3907. return console.log(e);
  3908. });
  3909. };
  3910. /***/ }),
  3911. /* 43 */
  3912. /***/ (function(module, exports, __webpack_require__) {
  3913. "use strict";
  3914. /**
  3915. * @author oldj
  3916. * @blog https://oldj.net
  3917. */
  3918. var _Agent = __webpack_require__(4);
  3919. var _Agent2 = _interopRequireDefault(_Agent);
  3920. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3921. module.exports = function () {
  3922. _Agent2.default.pact('sudoCancel');
  3923. };
  3924. /***/ }),
  3925. /* 44 */
  3926. /***/ (function(module, exports, __webpack_require__) {
  3927. "use strict";
  3928. /**
  3929. * @author oldj
  3930. * @blog https://oldj.net
  3931. */
  3932. var _Agent = __webpack_require__(4);
  3933. var _Agent2 = _interopRequireDefault(_Agent);
  3934. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3935. module.exports = function (app, pswd) {
  3936. _Agent2.default.pact('sudoPSWD', pswd);
  3937. };
  3938. /***/ }),
  3939. /* 45 */
  3940. /***/ (function(module, exports, __webpack_require__) {
  3941. "use strict";
  3942. /**
  3943. * @author oldj
  3944. * @blog https://oldj.net
  3945. */
  3946. var _Agent = __webpack_require__(4);
  3947. var _Agent2 = _interopRequireDefault(_Agent);
  3948. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3949. var save = __webpack_require__(24);
  3950. module.exports = function (app, hosts) {
  3951. hosts.on = !hosts.on;
  3952. var lang = app.state.lang;
  3953. return _Agent2.default.pact('getPref').then(function (pref) {
  3954. var list = app.state.list.slice(0);
  3955. var is_single = pref.choice_mode === 'single';
  3956. if (is_single && hosts.on) {
  3957. list.map(function (item) {
  3958. if (item.id !== hosts.id) {
  3959. item.on = false;
  3960. }
  3961. });
  3962. }
  3963. return list;
  3964. }).then(function (list) {
  3965. var idx = list.findIndex(function (item) {
  3966. return item.id === hosts.id;
  3967. });
  3968. if (idx === -1) {
  3969. list.push(Object.assign({}, hosts));
  3970. } else {
  3971. var old_hosts = list[idx];
  3972. list.splice(idx, 1, Object.assign({}, old_hosts, hosts));
  3973. }
  3974. return save(app, list, hosts);
  3975. }).then(function () {
  3976. _Agent2.default.pact('statRecord', 'switch');
  3977. return _Agent2.default.pact('notify', 'SwitchHosts!', lang.hosts_switched);
  3978. });
  3979. };
  3980. /***/ }),
  3981. /* 46 */
  3982. /***/ (function(module, exports, __webpack_require__) {
  3983. "use strict";
  3984. /**
  3985. * @author oldj
  3986. * @blog https://oldj.net
  3987. */
  3988. var _Agent = __webpack_require__(4);
  3989. var _Agent2 = _interopRequireDefault(_Agent);
  3990. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3991. var updated = __webpack_require__(17);
  3992. module.exports = function (app, on, on_ids, callback) {
  3993. var list = app.state.list;
  3994. var new_list = list.map(function (item) {
  3995. var new_item = Object.assign({}, item);
  3996. new_item.on = !!(on && on_ids.includes(item.id));
  3997. return new_item;
  3998. });
  3999. _Agent2.default.pact('saveHosts', new_list).then(function () {
  4000. //app.setState({list: new_list})
  4001. updated(app, new_list);
  4002. //app.forceUpdate()
  4003. callback();
  4004. }).catch(function (e) {
  4005. return callback(e);
  4006. });
  4007. };
  4008. /***/ }),
  4009. /* 47 */
  4010. /***/ (function(module, exports, __webpack_require__) {
  4011. "use strict";
  4012. /**
  4013. * @author oldj
  4014. * @blog https://oldj.net
  4015. */
  4016. //import Agent from '../Agent'
  4017. //import cleanData from '../../app/server/cleanData'
  4018. var save = __webpack_require__(24);
  4019. module.exports = function (app, hosts) {
  4020. var list = app.state.list.slice(0);
  4021. var idx = list.findIndex(function (item) {
  4022. return item.id === hosts.id;
  4023. });
  4024. if (idx === -1) {
  4025. list.push(Object.assign({}, hosts));
  4026. } else {
  4027. var old_hosts = list[idx];
  4028. list.splice(idx, 1, Object.assign({}, old_hosts, hosts));
  4029. }
  4030. //list = cleanData(list)
  4031. save(app, list, hosts);
  4032. };
  4033. /***/ }),
  4034. /* 48 */
  4035. /***/ (function(module, exports, __webpack_require__) {
  4036. "use strict";
  4037. /**
  4038. * @author oldj
  4039. * @blog http://oldj.net
  4040. */
  4041. Object.defineProperty(exports, "__esModule", {
  4042. value: true
  4043. });
  4044. 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; }; }();
  4045. var _react = __webpack_require__(7);
  4046. var _react2 = _interopRequireDefault(_react);
  4047. var _Agent = __webpack_require__(4);
  4048. var _Agent2 = _interopRequireDefault(_Agent);
  4049. __webpack_require__(233);
  4050. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4051. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4052. 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; }
  4053. 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; }
  4054. var MyFrame = function (_React$Component) {
  4055. _inherits(MyFrame, _React$Component);
  4056. function MyFrame(props) {
  4057. _classCallCheck(this, MyFrame);
  4058. return _possibleConstructorReturn(this, (MyFrame.__proto__ || Object.getPrototypeOf(MyFrame)).call(this, props));
  4059. }
  4060. _createClass(MyFrame, [{
  4061. key: 'componentDidMount',
  4062. value: function componentDidMount() {
  4063. var _this2 = this;
  4064. _Agent2.default.on('esc', function () {
  4065. _this2.onCancel();
  4066. });
  4067. }
  4068. }, {
  4069. key: 'onOK',
  4070. value: function onOK() {
  4071. this.props.onOK();
  4072. }
  4073. }, {
  4074. key: 'onCancel',
  4075. value: function onCancel() {
  4076. this.props.onCancel();
  4077. }
  4078. }, {
  4079. key: 'renderFootButtons',
  4080. value: function renderFootButtons() {
  4081. var html = [];
  4082. var lang = this.props.lang;
  4083. html.push(_react2.default.createElement(
  4084. 'div',
  4085. {
  4086. className: 'button btn-cancel',
  4087. key: 'btn-cancel',
  4088. onClick: this.onCancel.bind(this)
  4089. },
  4090. this.props.cancel_title || lang.cancel
  4091. ));
  4092. html.push(_react2.default.createElement(
  4093. 'div',
  4094. {
  4095. className: 'button btn-ok btn-default',
  4096. key: 'btn-ok',
  4097. onClick: this.onOK.bind(this)
  4098. },
  4099. this.props.ok_title || lang.ok
  4100. ));
  4101. return html;
  4102. }
  4103. }, {
  4104. key: 'render',
  4105. value: function render() {
  4106. if (!this.props.show) {
  4107. return null;
  4108. }
  4109. return _react2.default.createElement(
  4110. 'div',
  4111. { className: 'frame', ref: 'frame' },
  4112. _react2.default.createElement('div', { className: 'overlay' }),
  4113. _react2.default.createElement(
  4114. 'div',
  4115. { className: 'prompt' },
  4116. _react2.default.createElement(
  4117. 'div',
  4118. { className: 'head' },
  4119. this.props.head
  4120. ),
  4121. _react2.default.createElement(
  4122. 'div',
  4123. { className: 'body' },
  4124. this.props.body
  4125. ),
  4126. _react2.default.createElement(
  4127. 'div',
  4128. { className: 'foot' },
  4129. this.renderFootButtons()
  4130. )
  4131. )
  4132. );
  4133. }
  4134. }]);
  4135. return MyFrame;
  4136. }(_react2.default.Component);
  4137. exports.default = MyFrame;
  4138. /***/ }),
  4139. /* 49 */
  4140. /***/ (function(module, exports, __webpack_require__) {
  4141. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  4142. // Distributed under an MIT license: http://codemirror.net/LICENSE
  4143. // This is CodeMirror (http://codemirror.net), a code editor
  4144. // implemented in JavaScript on top of the browser's DOM.
  4145. //
  4146. // You can find some technical background for some of the code below
  4147. // at http://marijnhaverbeke.nl/blog/#cm-internals .
  4148. (function (global, factory) {
  4149. true ? module.exports = factory() :
  4150. typeof define === 'function' && define.amd ? define(factory) :
  4151. (global.CodeMirror = factory());
  4152. }(this, (function () { 'use strict';
  4153. // Kludges for bugs and behavior differences that can't be feature
  4154. // detected are enabled based on userAgent etc sniffing.
  4155. var userAgent = navigator.userAgent;
  4156. var platform = navigator.platform;
  4157. var gecko = /gecko\/\d/i.test(userAgent);
  4158. var ie_upto10 = /MSIE \d/.test(userAgent);
  4159. var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
  4160. var edge = /Edge\/(\d+)/.exec(userAgent);
  4161. var ie = ie_upto10 || ie_11up || edge;
  4162. var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
  4163. var webkit = !edge && /WebKit\//.test(userAgent);
  4164. var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
  4165. var chrome = !edge && /Chrome\//.test(userAgent);
  4166. var presto = /Opera\//.test(userAgent);
  4167. var safari = /Apple Computer/.test(navigator.vendor);
  4168. var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
  4169. var phantom = /PhantomJS/.test(userAgent);
  4170. var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
  4171. var android = /Android/.test(userAgent);
  4172. // This is woefully incomplete. Suggestions for alternative methods welcome.
  4173. var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
  4174. var mac = ios || /Mac/.test(platform);
  4175. var chromeOS = /\bCrOS\b/.test(userAgent);
  4176. var windows = /win/i.test(platform);
  4177. var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
  4178. if (presto_version) { presto_version = Number(presto_version[1]); }
  4179. if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
  4180. // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
  4181. var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
  4182. var captureRightClick = gecko || (ie && ie_version >= 9);
  4183. function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
  4184. var rmClass = function(node, cls) {
  4185. var current = node.className;
  4186. var match = classTest(cls).exec(current);
  4187. if (match) {
  4188. var after = current.slice(match.index + match[0].length);
  4189. node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
  4190. }
  4191. };
  4192. function removeChildren(e) {
  4193. for (var count = e.childNodes.length; count > 0; --count)
  4194. { e.removeChild(e.firstChild); }
  4195. return e
  4196. }
  4197. function removeChildrenAndAdd(parent, e) {
  4198. return removeChildren(parent).appendChild(e)
  4199. }
  4200. function elt(tag, content, className, style) {
  4201. var e = document.createElement(tag);
  4202. if (className) { e.className = className; }
  4203. if (style) { e.style.cssText = style; }
  4204. if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
  4205. else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
  4206. return e
  4207. }
  4208. // wrapper for elt, which removes the elt from the accessibility tree
  4209. function eltP(tag, content, className, style) {
  4210. var e = elt(tag, content, className, style);
  4211. e.setAttribute("role", "presentation");
  4212. return e
  4213. }
  4214. var range;
  4215. if (document.createRange) { range = function(node, start, end, endNode) {
  4216. var r = document.createRange();
  4217. r.setEnd(endNode || node, end);
  4218. r.setStart(node, start);
  4219. return r
  4220. }; }
  4221. else { range = function(node, start, end) {
  4222. var r = document.body.createTextRange();
  4223. try { r.moveToElementText(node.parentNode); }
  4224. catch(e) { return r }
  4225. r.collapse(true);
  4226. r.moveEnd("character", end);
  4227. r.moveStart("character", start);
  4228. return r
  4229. }; }
  4230. function contains(parent, child) {
  4231. if (child.nodeType == 3) // Android browser always returns false when child is a textnode
  4232. { child = child.parentNode; }
  4233. if (parent.contains)
  4234. { return parent.contains(child) }
  4235. do {
  4236. if (child.nodeType == 11) { child = child.host; }
  4237. if (child == parent) { return true }
  4238. } while (child = child.parentNode)
  4239. }
  4240. function activeElt() {
  4241. // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
  4242. // IE < 10 will throw when accessed while the page is loading or in an iframe.
  4243. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
  4244. var activeElement;
  4245. try {
  4246. activeElement = document.activeElement;
  4247. } catch(e) {
  4248. activeElement = document.body || null;
  4249. }
  4250. while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
  4251. { activeElement = activeElement.shadowRoot.activeElement; }
  4252. return activeElement
  4253. }
  4254. function addClass(node, cls) {
  4255. var current = node.className;
  4256. if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
  4257. }
  4258. function joinClasses(a, b) {
  4259. var as = a.split(" ");
  4260. for (var i = 0; i < as.length; i++)
  4261. { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
  4262. return b
  4263. }
  4264. var selectInput = function(node) { node.select(); };
  4265. if (ios) // Mobile Safari apparently has a bug where select() is broken.
  4266. { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
  4267. else if (ie) // Suppress mysterious IE10 errors
  4268. { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
  4269. function bind(f) {
  4270. var args = Array.prototype.slice.call(arguments, 1);
  4271. return function(){return f.apply(null, args)}
  4272. }
  4273. function copyObj(obj, target, overwrite) {
  4274. if (!target) { target = {}; }
  4275. for (var prop in obj)
  4276. { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
  4277. { target[prop] = obj[prop]; } }
  4278. return target
  4279. }
  4280. // Counts the column offset in a string, taking tabs into account.
  4281. // Used mostly to find indentation.
  4282. function countColumn(string, end, tabSize, startIndex, startValue) {
  4283. if (end == null) {
  4284. end = string.search(/[^\s\u00a0]/);
  4285. if (end == -1) { end = string.length; }
  4286. }
  4287. for (var i = startIndex || 0, n = startValue || 0;;) {
  4288. var nextTab = string.indexOf("\t", i);
  4289. if (nextTab < 0 || nextTab >= end)
  4290. { return n + (end - i) }
  4291. n += nextTab - i;
  4292. n += tabSize - (n % tabSize);
  4293. i = nextTab + 1;
  4294. }
  4295. }
  4296. var Delayed = function() {this.id = null;};
  4297. Delayed.prototype.set = function (ms, f) {
  4298. clearTimeout(this.id);
  4299. this.id = setTimeout(f, ms);
  4300. };
  4301. function indexOf(array, elt) {
  4302. for (var i = 0; i < array.length; ++i)
  4303. { if (array[i] == elt) { return i } }
  4304. return -1
  4305. }
  4306. // Number of pixels added to scroller and sizer to hide scrollbar
  4307. var scrollerGap = 30;
  4308. // Returned or thrown by various protocols to signal 'I'm not
  4309. // handling this'.
  4310. var Pass = {toString: function(){return "CodeMirror.Pass"}};
  4311. // Reused option objects for setSelection & friends
  4312. var sel_dontScroll = {scroll: false};
  4313. var sel_mouse = {origin: "*mouse"};
  4314. var sel_move = {origin: "+move"};
  4315. // The inverse of countColumn -- find the offset that corresponds to
  4316. // a particular column.
  4317. function findColumn(string, goal, tabSize) {
  4318. for (var pos = 0, col = 0;;) {
  4319. var nextTab = string.indexOf("\t", pos);
  4320. if (nextTab == -1) { nextTab = string.length; }
  4321. var skipped = nextTab - pos;
  4322. if (nextTab == string.length || col + skipped >= goal)
  4323. { return pos + Math.min(skipped, goal - col) }
  4324. col += nextTab - pos;
  4325. col += tabSize - (col % tabSize);
  4326. pos = nextTab + 1;
  4327. if (col >= goal) { return pos }
  4328. }
  4329. }
  4330. var spaceStrs = [""];
  4331. function spaceStr(n) {
  4332. while (spaceStrs.length <= n)
  4333. { spaceStrs.push(lst(spaceStrs) + " "); }
  4334. return spaceStrs[n]
  4335. }
  4336. function lst(arr) { return arr[arr.length-1] }
  4337. function map(array, f) {
  4338. var out = [];
  4339. for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
  4340. return out
  4341. }
  4342. function insertSorted(array, value, score) {
  4343. var pos = 0, priority = score(value);
  4344. while (pos < array.length && score(array[pos]) <= priority) { pos++; }
  4345. array.splice(pos, 0, value);
  4346. }
  4347. function nothing() {}
  4348. function createObj(base, props) {
  4349. var inst;
  4350. if (Object.create) {
  4351. inst = Object.create(base);
  4352. } else {
  4353. nothing.prototype = base;
  4354. inst = new nothing();
  4355. }
  4356. if (props) { copyObj(props, inst); }
  4357. return inst
  4358. }
  4359. var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
  4360. function isWordCharBasic(ch) {
  4361. return /\w/.test(ch) || ch > "\x80" &&
  4362. (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
  4363. }
  4364. function isWordChar(ch, helper) {
  4365. if (!helper) { return isWordCharBasic(ch) }
  4366. if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
  4367. return helper.test(ch)
  4368. }
  4369. function isEmpty(obj) {
  4370. for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
  4371. return true
  4372. }
  4373. // Extending unicode characters. A series of a non-extending char +
  4374. // any number of extending chars is treated as a single unit as far
  4375. // as editing and measuring is concerned. This is not fully correct,
  4376. // since some scripts/fonts/browsers also treat other configurations
  4377. // of code points as a group.
  4378. 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]/;
  4379. function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
  4380. // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
  4381. function skipExtendingChars(str, pos, dir) {
  4382. while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
  4383. return pos
  4384. }
  4385. // Returns the value from the range [`from`; `to`] that satisfies
  4386. // `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
  4387. function findFirst(pred, from, to) {
  4388. for (;;) {
  4389. if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
  4390. var mid = Math.floor((from + to) / 2);
  4391. if (pred(mid)) { to = mid; }
  4392. else { from = mid; }
  4393. }
  4394. }
  4395. // The display handles the DOM integration, both for input reading
  4396. // and content drawing. It holds references to DOM nodes and
  4397. // display-related state.
  4398. function Display(place, doc, input) {
  4399. var d = this;
  4400. this.input = input;
  4401. // Covers bottom-right square when both scrollbars are present.
  4402. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
  4403. d.scrollbarFiller.setAttribute("cm-not-content", "true");
  4404. // Covers bottom of gutter when coverGutterNextToScrollbar is on
  4405. // and h scrollbar is present.
  4406. d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
  4407. d.gutterFiller.setAttribute("cm-not-content", "true");
  4408. // Will contain the actual code, positioned to cover the viewport.
  4409. d.lineDiv = eltP("div", null, "CodeMirror-code");
  4410. // Elements are added to these to represent selection and cursors.
  4411. d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
  4412. d.cursorDiv = elt("div", null, "CodeMirror-cursors");
  4413. // A visibility: hidden element used to find the size of things.
  4414. d.measure = elt("div", null, "CodeMirror-measure");
  4415. // When lines outside of the viewport are measured, they are drawn in this.
  4416. d.lineMeasure = elt("div", null, "CodeMirror-measure");
  4417. // Wraps everything that needs to exist inside the vertically-padded coordinate system
  4418. d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
  4419. null, "position: relative; outline: none");
  4420. var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
  4421. // Moved around its parent to cover visible view.
  4422. d.mover = elt("div", [lines], null, "position: relative");
  4423. // Set to the height of the document, allowing scrolling.
  4424. d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
  4425. d.sizerWidth = null;
  4426. // Behavior of elts with overflow: auto and padding is
  4427. // inconsistent across browsers. This is used to ensure the
  4428. // scrollable area is big enough.
  4429. d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
  4430. // Will contain the gutters, if any.
  4431. d.gutters = elt("div", null, "CodeMirror-gutters");
  4432. d.lineGutter = null;
  4433. // Actual scrollable element.
  4434. d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
  4435. d.scroller.setAttribute("tabIndex", "-1");
  4436. // The element in which the editor lives.
  4437. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
  4438. // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
  4439. if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
  4440. if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
  4441. if (place) {
  4442. if (place.appendChild) { place.appendChild(d.wrapper); }
  4443. else { place(d.wrapper); }
  4444. }
  4445. // Current rendered range (may be bigger than the view window).
  4446. d.viewFrom = d.viewTo = doc.first;
  4447. d.reportedViewFrom = d.reportedViewTo = doc.first;
  4448. // Information about the rendered lines.
  4449. d.view = [];
  4450. d.renderedView = null;
  4451. // Holds info about a single rendered line when it was rendered
  4452. // for measurement, while not in view.
  4453. d.externalMeasured = null;
  4454. // Empty space (in pixels) above the view
  4455. d.viewOffset = 0;
  4456. d.lastWrapHeight = d.lastWrapWidth = 0;
  4457. d.updateLineNumbers = null;
  4458. d.nativeBarWidth = d.barHeight = d.barWidth = 0;
  4459. d.scrollbarsClipped = false;
  4460. // Used to only resize the line number gutter when necessary (when
  4461. // the amount of lines crosses a boundary that makes its width change)
  4462. d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
  4463. // Set to true when a non-horizontal-scrolling line widget is
  4464. // added. As an optimization, line widget aligning is skipped when
  4465. // this is false.
  4466. d.alignWidgets = false;
  4467. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  4468. // Tracks the maximum line length so that the horizontal scrollbar
  4469. // can be kept static when scrolling.
  4470. d.maxLine = null;
  4471. d.maxLineLength = 0;
  4472. d.maxLineChanged = false;
  4473. // Used for measuring wheel scrolling granularity
  4474. d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
  4475. // True when shift is held down.
  4476. d.shift = false;
  4477. // Used to track whether anything happened since the context menu
  4478. // was opened.
  4479. d.selForContextMenu = null;
  4480. d.activeTouch = null;
  4481. input.init(d);
  4482. }
  4483. // Find the line object corresponding to the given line number.
  4484. function getLine(doc, n) {
  4485. n -= doc.first;
  4486. if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
  4487. var chunk = doc;
  4488. while (!chunk.lines) {
  4489. for (var i = 0;; ++i) {
  4490. var child = chunk.children[i], sz = child.chunkSize();
  4491. if (n < sz) { chunk = child; break }
  4492. n -= sz;
  4493. }
  4494. }
  4495. return chunk.lines[n]
  4496. }
  4497. // Get the part of a document between two positions, as an array of
  4498. // strings.
  4499. function getBetween(doc, start, end) {
  4500. var out = [], n = start.line;
  4501. doc.iter(start.line, end.line + 1, function (line) {
  4502. var text = line.text;
  4503. if (n == end.line) { text = text.slice(0, end.ch); }
  4504. if (n == start.line) { text = text.slice(start.ch); }
  4505. out.push(text);
  4506. ++n;
  4507. });
  4508. return out
  4509. }
  4510. // Get the lines between from and to, as array of strings.
  4511. function getLines(doc, from, to) {
  4512. var out = [];
  4513. doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
  4514. return out
  4515. }
  4516. // Update the height of a line, propagating the height change
  4517. // upwards to parent nodes.
  4518. function updateLineHeight(line, height) {
  4519. var diff = height - line.height;
  4520. if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
  4521. }
  4522. // Given a line object, find its line number by walking up through
  4523. // its parent links.
  4524. function lineNo(line) {
  4525. if (line.parent == null) { return null }
  4526. var cur = line.parent, no = indexOf(cur.lines, line);
  4527. for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
  4528. for (var i = 0;; ++i) {
  4529. if (chunk.children[i] == cur) { break }
  4530. no += chunk.children[i].chunkSize();
  4531. }
  4532. }
  4533. return no + cur.first
  4534. }
  4535. // Find the line at the given vertical position, using the height
  4536. // information in the document tree.
  4537. function lineAtHeight(chunk, h) {
  4538. var n = chunk.first;
  4539. outer: do {
  4540. for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
  4541. var child = chunk.children[i$1], ch = child.height;
  4542. if (h < ch) { chunk = child; continue outer }
  4543. h -= ch;
  4544. n += child.chunkSize();
  4545. }
  4546. return n
  4547. } while (!chunk.lines)
  4548. var i = 0;
  4549. for (; i < chunk.lines.length; ++i) {
  4550. var line = chunk.lines[i], lh = line.height;
  4551. if (h < lh) { break }
  4552. h -= lh;
  4553. }
  4554. return n + i
  4555. }
  4556. function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
  4557. function lineNumberFor(options, i) {
  4558. return String(options.lineNumberFormatter(i + options.firstLineNumber))
  4559. }
  4560. // A Pos instance represents a position within the text.
  4561. function Pos(line, ch, sticky) {
  4562. if ( sticky === void 0 ) sticky = null;
  4563. if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
  4564. this.line = line;
  4565. this.ch = ch;
  4566. this.sticky = sticky;
  4567. }
  4568. // Compare two positions, return 0 if they are the same, a negative
  4569. // number when a is less, and a positive number otherwise.
  4570. function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
  4571. function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
  4572. function copyPos(x) {return Pos(x.line, x.ch)}
  4573. function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
  4574. function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
  4575. // Most of the external API clips given positions to make sure they
  4576. // actually exist within the document.
  4577. function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
  4578. function clipPos(doc, pos) {
  4579. if (pos.line < doc.first) { return Pos(doc.first, 0) }
  4580. var last = doc.first + doc.size - 1;
  4581. if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
  4582. return clipToLen(pos, getLine(doc, pos.line).text.length)
  4583. }
  4584. function clipToLen(pos, linelen) {
  4585. var ch = pos.ch;
  4586. if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
  4587. else if (ch < 0) { return Pos(pos.line, 0) }
  4588. else { return pos }
  4589. }
  4590. function clipPosArray(doc, array) {
  4591. var out = [];
  4592. for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
  4593. return out
  4594. }
  4595. // Optimize some code when these features are not used.
  4596. var sawReadOnlySpans = false;
  4597. var sawCollapsedSpans = false;
  4598. function seeReadOnlySpans() {
  4599. sawReadOnlySpans = true;
  4600. }
  4601. function seeCollapsedSpans() {
  4602. sawCollapsedSpans = true;
  4603. }
  4604. // TEXTMARKER SPANS
  4605. function MarkedSpan(marker, from, to) {
  4606. this.marker = marker;
  4607. this.from = from; this.to = to;
  4608. }
  4609. // Search an array of spans for a span matching the given marker.
  4610. function getMarkedSpanFor(spans, marker) {
  4611. if (spans) { for (var i = 0; i < spans.length; ++i) {
  4612. var span = spans[i];
  4613. if (span.marker == marker) { return span }
  4614. } }
  4615. }
  4616. // Remove a span from an array, returning undefined if no spans are
  4617. // left (we don't store arrays for lines without spans).
  4618. function removeMarkedSpan(spans, span) {
  4619. var r;
  4620. for (var i = 0; i < spans.length; ++i)
  4621. { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
  4622. return r
  4623. }
  4624. // Add a span to a line.
  4625. function addMarkedSpan(line, span) {
  4626. line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
  4627. span.marker.attachLine(line);
  4628. }
  4629. // Used for the algorithm that adjusts markers for a change in the
  4630. // document. These functions cut an array of spans at a given
  4631. // character position, returning an array of remaining chunks (or
  4632. // undefined if nothing remains).
  4633. function markedSpansBefore(old, startCh, isInsert) {
  4634. var nw;
  4635. if (old) { for (var i = 0; i < old.length; ++i) {
  4636. var span = old[i], marker = span.marker;
  4637. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
  4638. if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
  4639. 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));
  4640. }
  4641. } }
  4642. return nw
  4643. }
  4644. function markedSpansAfter(old, endCh, isInsert) {
  4645. var nw;
  4646. if (old) { for (var i = 0; i < old.length; ++i) {
  4647. var span = old[i], marker = span.marker;
  4648. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
  4649. if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
  4650. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
  4651. span.to == null ? null : span.to - endCh));
  4652. }
  4653. } }
  4654. return nw
  4655. }
  4656. // Given a change object, compute the new set of marker spans that
  4657. // cover the line in which the change took place. Removes spans
  4658. // entirely within the change, reconnects spans belonging to the
  4659. // same marker that appear on both sides of the change, and cuts off
  4660. // spans partially within the change. Returns an array of span
  4661. // arrays with one element for each line in (after) the change.
  4662. function stretchSpansOverChange(doc, change) {
  4663. if (change.full) { return null }
  4664. var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
  4665. var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
  4666. if (!oldFirst && !oldLast) { return null }
  4667. var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
  4668. // Get the spans that 'stick out' on both sides
  4669. var first = markedSpansBefore(oldFirst, startCh, isInsert);
  4670. var last = markedSpansAfter(oldLast, endCh, isInsert);
  4671. // Next, merge those two ends
  4672. var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
  4673. if (first) {
  4674. // Fix up .to properties of first
  4675. for (var i = 0; i < first.length; ++i) {
  4676. var span = first[i];
  4677. if (span.to == null) {
  4678. var found = getMarkedSpanFor(last, span.marker);
  4679. if (!found) { span.to = startCh; }
  4680. else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
  4681. }
  4682. }
  4683. }
  4684. if (last) {
  4685. // Fix up .from in last (or move them into first in case of sameLine)
  4686. for (var i$1 = 0; i$1 < last.length; ++i$1) {
  4687. var span$1 = last[i$1];
  4688. if (span$1.to != null) { span$1.to += offset; }
  4689. if (span$1.from == null) {
  4690. var found$1 = getMarkedSpanFor(first, span$1.marker);
  4691. if (!found$1) {
  4692. span$1.from = offset;
  4693. if (sameLine) { (first || (first = [])).push(span$1); }
  4694. }
  4695. } else {
  4696. span$1.from += offset;
  4697. if (sameLine) { (first || (first = [])).push(span$1); }
  4698. }
  4699. }
  4700. }
  4701. // Make sure we didn't create any zero-length spans
  4702. if (first) { first = clearEmptySpans(first); }
  4703. if (last && last != first) { last = clearEmptySpans(last); }
  4704. var newMarkers = [first];
  4705. if (!sameLine) {
  4706. // Fill gap with whole-line-spans
  4707. var gap = change.text.length - 2, gapMarkers;
  4708. if (gap > 0 && first)
  4709. { for (var i$2 = 0; i$2 < first.length; ++i$2)
  4710. { if (first[i$2].to == null)
  4711. { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
  4712. for (var i$3 = 0; i$3 < gap; ++i$3)
  4713. { newMarkers.push(gapMarkers); }
  4714. newMarkers.push(last);
  4715. }
  4716. return newMarkers
  4717. }
  4718. // Remove spans that are empty and don't have a clearWhenEmpty
  4719. // option of false.
  4720. function clearEmptySpans(spans) {
  4721. for (var i = 0; i < spans.length; ++i) {
  4722. var span = spans[i];
  4723. if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
  4724. { spans.splice(i--, 1); }
  4725. }
  4726. if (!spans.length) { return null }
  4727. return spans
  4728. }
  4729. // Used to 'clip' out readOnly ranges when making a change.
  4730. function removeReadOnlyRanges(doc, from, to) {
  4731. var markers = null;
  4732. doc.iter(from.line, to.line + 1, function (line) {
  4733. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  4734. var mark = line.markedSpans[i].marker;
  4735. if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
  4736. { (markers || (markers = [])).push(mark); }
  4737. } }
  4738. });
  4739. if (!markers) { return null }
  4740. var parts = [{from: from, to: to}];
  4741. for (var i = 0; i < markers.length; ++i) {
  4742. var mk = markers[i], m = mk.find(0);
  4743. for (var j = 0; j < parts.length; ++j) {
  4744. var p = parts[j];
  4745. if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
  4746. var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
  4747. if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
  4748. { newParts.push({from: p.from, to: m.from}); }
  4749. if (dto > 0 || !mk.inclusiveRight && !dto)
  4750. { newParts.push({from: m.to, to: p.to}); }
  4751. parts.splice.apply(parts, newParts);
  4752. j += newParts.length - 3;
  4753. }
  4754. }
  4755. return parts
  4756. }
  4757. // Connect or disconnect spans from a line.
  4758. function detachMarkedSpans(line) {
  4759. var spans = line.markedSpans;
  4760. if (!spans) { return }
  4761. for (var i = 0; i < spans.length; ++i)
  4762. { spans[i].marker.detachLine(line); }
  4763. line.markedSpans = null;
  4764. }
  4765. function attachMarkedSpans(line, spans) {
  4766. if (!spans) { return }
  4767. for (var i = 0; i < spans.length; ++i)
  4768. { spans[i].marker.attachLine(line); }
  4769. line.markedSpans = spans;
  4770. }
  4771. // Helpers used when computing which overlapping collapsed span
  4772. // counts as the larger one.
  4773. function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
  4774. function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
  4775. // Returns a number indicating which of two overlapping collapsed
  4776. // spans is larger (and thus includes the other). Falls back to
  4777. // comparing ids when the spans cover exactly the same range.
  4778. function compareCollapsedMarkers(a, b) {
  4779. var lenDiff = a.lines.length - b.lines.length;
  4780. if (lenDiff != 0) { return lenDiff }
  4781. var aPos = a.find(), bPos = b.find();
  4782. var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
  4783. if (fromCmp) { return -fromCmp }
  4784. var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
  4785. if (toCmp) { return toCmp }
  4786. return b.id - a.id
  4787. }
  4788. // Find out whether a line ends or starts in a collapsed span. If
  4789. // so, return the marker for that span.
  4790. function collapsedSpanAtSide(line, start) {
  4791. var sps = sawCollapsedSpans && line.markedSpans, found;
  4792. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  4793. sp = sps[i];
  4794. if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
  4795. (!found || compareCollapsedMarkers(found, sp.marker) < 0))
  4796. { found = sp.marker; }
  4797. } }
  4798. return found
  4799. }
  4800. function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
  4801. function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
  4802. // Test whether there exists a collapsed span that partially
  4803. // overlaps (covers the start or end, but not both) of a new span.
  4804. // Such overlap is not allowed.
  4805. function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
  4806. var line = getLine(doc, lineNo$$1);
  4807. var sps = sawCollapsedSpans && line.markedSpans;
  4808. if (sps) { for (var i = 0; i < sps.length; ++i) {
  4809. var sp = sps[i];
  4810. if (!sp.marker.collapsed) { continue }
  4811. var found = sp.marker.find(0);
  4812. var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
  4813. var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
  4814. if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
  4815. if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
  4816. fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
  4817. { return true }
  4818. } }
  4819. }
  4820. // A visual line is a line as drawn on the screen. Folding, for
  4821. // example, can cause multiple logical lines to appear on the same
  4822. // visual line. This finds the start of the visual line that the
  4823. // given line is part of (usually that is the line itself).
  4824. function visualLine(line) {
  4825. var merged;
  4826. while (merged = collapsedSpanAtStart(line))
  4827. { line = merged.find(-1, true).line; }
  4828. return line
  4829. }
  4830. function visualLineEnd(line) {
  4831. var merged;
  4832. while (merged = collapsedSpanAtEnd(line))
  4833. { line = merged.find(1, true).line; }
  4834. return line
  4835. }
  4836. // Returns an array of logical lines that continue the visual line
  4837. // started by the argument, or undefined if there are no such lines.
  4838. function visualLineContinued(line) {
  4839. var merged, lines;
  4840. while (merged = collapsedSpanAtEnd(line)) {
  4841. line = merged.find(1, true).line
  4842. ;(lines || (lines = [])).push(line);
  4843. }
  4844. return lines
  4845. }
  4846. // Get the line number of the start of the visual line that the
  4847. // given line number is part of.
  4848. function visualLineNo(doc, lineN) {
  4849. var line = getLine(doc, lineN), vis = visualLine(line);
  4850. if (line == vis) { return lineN }
  4851. return lineNo(vis)
  4852. }
  4853. // Get the line number of the start of the next visual line after
  4854. // the given line.
  4855. function visualLineEndNo(doc, lineN) {
  4856. if (lineN > doc.lastLine()) { return lineN }
  4857. var line = getLine(doc, lineN), merged;
  4858. if (!lineIsHidden(doc, line)) { return lineN }
  4859. while (merged = collapsedSpanAtEnd(line))
  4860. { line = merged.find(1, true).line; }
  4861. return lineNo(line) + 1
  4862. }
  4863. // Compute whether a line is hidden. Lines count as hidden when they
  4864. // are part of a visual line that starts with another line, or when
  4865. // they are entirely covered by collapsed, non-widget span.
  4866. function lineIsHidden(doc, line) {
  4867. var sps = sawCollapsedSpans && line.markedSpans;
  4868. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  4869. sp = sps[i];
  4870. if (!sp.marker.collapsed) { continue }
  4871. if (sp.from == null) { return true }
  4872. if (sp.marker.widgetNode) { continue }
  4873. if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
  4874. { return true }
  4875. } }
  4876. }
  4877. function lineIsHiddenInner(doc, line, span) {
  4878. if (span.to == null) {
  4879. var end = span.marker.find(1, true);
  4880. return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
  4881. }
  4882. if (span.marker.inclusiveRight && span.to == line.text.length)
  4883. { return true }
  4884. for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
  4885. sp = line.markedSpans[i];
  4886. if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
  4887. (sp.to == null || sp.to != span.from) &&
  4888. (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
  4889. lineIsHiddenInner(doc, line, sp)) { return true }
  4890. }
  4891. }
  4892. // Find the height above the given line.
  4893. function heightAtLine(lineObj) {
  4894. lineObj = visualLine(lineObj);
  4895. var h = 0, chunk = lineObj.parent;
  4896. for (var i = 0; i < chunk.lines.length; ++i) {
  4897. var line = chunk.lines[i];
  4898. if (line == lineObj) { break }
  4899. else { h += line.height; }
  4900. }
  4901. for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
  4902. for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
  4903. var cur = p.children[i$1];
  4904. if (cur == chunk) { break }
  4905. else { h += cur.height; }
  4906. }
  4907. }
  4908. return h
  4909. }
  4910. // Compute the character length of a line, taking into account
  4911. // collapsed ranges (see markText) that might hide parts, and join
  4912. // other lines onto it.
  4913. function lineLength(line) {
  4914. if (line.height == 0) { return 0 }
  4915. var len = line.text.length, merged, cur = line;
  4916. while (merged = collapsedSpanAtStart(cur)) {
  4917. var found = merged.find(0, true);
  4918. cur = found.from.line;
  4919. len += found.from.ch - found.to.ch;
  4920. }
  4921. cur = line;
  4922. while (merged = collapsedSpanAtEnd(cur)) {
  4923. var found$1 = merged.find(0, true);
  4924. len -= cur.text.length - found$1.from.ch;
  4925. cur = found$1.to.line;
  4926. len += cur.text.length - found$1.to.ch;
  4927. }
  4928. return len
  4929. }
  4930. // Find the longest line in the document.
  4931. function findMaxLine(cm) {
  4932. var d = cm.display, doc = cm.doc;
  4933. d.maxLine = getLine(doc, doc.first);
  4934. d.maxLineLength = lineLength(d.maxLine);
  4935. d.maxLineChanged = true;
  4936. doc.iter(function (line) {
  4937. var len = lineLength(line);
  4938. if (len > d.maxLineLength) {
  4939. d.maxLineLength = len;
  4940. d.maxLine = line;
  4941. }
  4942. });
  4943. }
  4944. // BIDI HELPERS
  4945. function iterateBidiSections(order, from, to, f) {
  4946. if (!order) { return f(from, to, "ltr") }
  4947. var found = false;
  4948. for (var i = 0; i < order.length; ++i) {
  4949. var part = order[i];
  4950. if (part.from < to && part.to > from || from == to && part.to == from) {
  4951. f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
  4952. found = true;
  4953. }
  4954. }
  4955. if (!found) { f(from, to, "ltr"); }
  4956. }
  4957. var bidiOther = null;
  4958. function getBidiPartAt(order, ch, sticky) {
  4959. var found;
  4960. bidiOther = null;
  4961. for (var i = 0; i < order.length; ++i) {
  4962. var cur = order[i];
  4963. if (cur.from < ch && cur.to > ch) { return i }
  4964. if (cur.to == ch) {
  4965. if (cur.from != cur.to && sticky == "before") { found = i; }
  4966. else { bidiOther = i; }
  4967. }
  4968. if (cur.from == ch) {
  4969. if (cur.from != cur.to && sticky != "before") { found = i; }
  4970. else { bidiOther = i; }
  4971. }
  4972. }
  4973. return found != null ? found : bidiOther
  4974. }
  4975. // Bidirectional ordering algorithm
  4976. // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
  4977. // that this (partially) implements.
  4978. // One-char codes used for character types:
  4979. // L (L): Left-to-Right
  4980. // R (R): Right-to-Left
  4981. // r (AL): Right-to-Left Arabic
  4982. // 1 (EN): European Number
  4983. // + (ES): European Number Separator
  4984. // % (ET): European Number Terminator
  4985. // n (AN): Arabic Number
  4986. // , (CS): Common Number Separator
  4987. // m (NSM): Non-Spacing Mark
  4988. // b (BN): Boundary Neutral
  4989. // s (B): Paragraph Separator
  4990. // t (S): Segment Separator
  4991. // w (WS): Whitespace
  4992. // N (ON): Other Neutrals
  4993. // Returns null if characters are ordered as they appear
  4994. // (left-to-right), or an array of sections ({from, to, level}
  4995. // objects) in the order in which they occur visually.
  4996. var bidiOrdering = (function() {
  4997. // Character types for codepoints 0 to 0xff
  4998. var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
  4999. // Character types for codepoints 0x600 to 0x6f9
  5000. var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
  5001. function charType(code) {
  5002. if (code <= 0xf7) { return lowTypes.charAt(code) }
  5003. else if (0x590 <= code && code <= 0x5f4) { return "R" }
  5004. else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
  5005. else if (0x6ee <= code && code <= 0x8ac) { return "r" }
  5006. else if (0x2000 <= code && code <= 0x200b) { return "w" }
  5007. else if (code == 0x200c) { return "b" }
  5008. else { return "L" }
  5009. }
  5010. var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
  5011. var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
  5012. function BidiSpan(level, from, to) {
  5013. this.level = level;
  5014. this.from = from; this.to = to;
  5015. }
  5016. return function(str, direction) {
  5017. var outerType = direction == "ltr" ? "L" : "R";
  5018. if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
  5019. var len = str.length, types = [];
  5020. for (var i = 0; i < len; ++i)
  5021. { types.push(charType(str.charCodeAt(i))); }
  5022. // W1. Examine each non-spacing mark (NSM) in the level run, and
  5023. // change the type of the NSM to the type of the previous
  5024. // character. If the NSM is at the start of the level run, it will
  5025. // get the type of sor.
  5026. for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
  5027. var type = types[i$1];
  5028. if (type == "m") { types[i$1] = prev; }
  5029. else { prev = type; }
  5030. }
  5031. // W2. Search backwards from each instance of a European number
  5032. // until the first strong type (R, L, AL, or sor) is found. If an
  5033. // AL is found, change the type of the European number to Arabic
  5034. // number.
  5035. // W3. Change all ALs to R.
  5036. for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
  5037. var type$1 = types[i$2];
  5038. if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
  5039. else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
  5040. }
  5041. // W4. A single European separator between two European numbers
  5042. // changes to a European number. A single common separator between
  5043. // two numbers of the same type changes to that type.
  5044. for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
  5045. var type$2 = types[i$3];
  5046. if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
  5047. else if (type$2 == "," && prev$1 == types[i$3+1] &&
  5048. (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
  5049. prev$1 = type$2;
  5050. }
  5051. // W5. A sequence of European terminators adjacent to European
  5052. // numbers changes to all European numbers.
  5053. // W6. Otherwise, separators and terminators change to Other
  5054. // Neutral.
  5055. for (var i$4 = 0; i$4 < len; ++i$4) {
  5056. var type$3 = types[i$4];
  5057. if (type$3 == ",") { types[i$4] = "N"; }
  5058. else if (type$3 == "%") {
  5059. var end = (void 0);
  5060. for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
  5061. var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
  5062. for (var j = i$4; j < end; ++j) { types[j] = replace; }
  5063. i$4 = end - 1;
  5064. }
  5065. }
  5066. // W7. Search backwards from each instance of a European number
  5067. // until the first strong type (R, L, or sor) is found. If an L is
  5068. // found, then change the type of the European number to L.
  5069. for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
  5070. var type$4 = types[i$5];
  5071. if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
  5072. else if (isStrong.test(type$4)) { cur$1 = type$4; }
  5073. }
  5074. // N1. A sequence of neutrals takes the direction of the
  5075. // surrounding strong text if the text on both sides has the same
  5076. // direction. European and Arabic numbers act as if they were R in
  5077. // terms of their influence on neutrals. Start-of-level-run (sor)
  5078. // and end-of-level-run (eor) are used at level run boundaries.
  5079. // N2. Any remaining neutrals take the embedding direction.
  5080. for (var i$6 = 0; i$6 < len; ++i$6) {
  5081. if (isNeutral.test(types[i$6])) {
  5082. var end$1 = (void 0);
  5083. for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
  5084. var before = (i$6 ? types[i$6-1] : outerType) == "L";
  5085. var after = (end$1 < len ? types[end$1] : outerType) == "L";
  5086. var replace$1 = before == after ? (before ? "L" : "R") : outerType;
  5087. for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
  5088. i$6 = end$1 - 1;
  5089. }
  5090. }
  5091. // Here we depart from the documented algorithm, in order to avoid
  5092. // building up an actual levels array. Since there are only three
  5093. // levels (0, 1, 2) in an implementation that doesn't take
  5094. // explicit embedding into account, we can build up the order on
  5095. // the fly, without following the level-based algorithm.
  5096. var order = [], m;
  5097. for (var i$7 = 0; i$7 < len;) {
  5098. if (countsAsLeft.test(types[i$7])) {
  5099. var start = i$7;
  5100. for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
  5101. order.push(new BidiSpan(0, start, i$7));
  5102. } else {
  5103. var pos = i$7, at = order.length;
  5104. for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
  5105. for (var j$2 = pos; j$2 < i$7;) {
  5106. if (countsAsNum.test(types[j$2])) {
  5107. if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
  5108. var nstart = j$2;
  5109. for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
  5110. order.splice(at, 0, new BidiSpan(2, nstart, j$2));
  5111. pos = j$2;
  5112. } else { ++j$2; }
  5113. }
  5114. if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
  5115. }
  5116. }
  5117. if (order[0].level == 1 && (m = str.match(/^\s+/))) {
  5118. order[0].from = m[0].length;
  5119. order.unshift(new BidiSpan(0, 0, m[0].length));
  5120. }
  5121. if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
  5122. lst(order).to -= m[0].length;
  5123. order.push(new BidiSpan(0, len - m[0].length, len));
  5124. }
  5125. return direction == "rtl" ? order.reverse() : order
  5126. }
  5127. })();
  5128. // Get the bidi ordering for the given line (and cache it). Returns
  5129. // false for lines that are fully left-to-right, and an array of
  5130. // BidiSpan objects otherwise.
  5131. function getOrder(line, direction) {
  5132. var order = line.order;
  5133. if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
  5134. return order
  5135. }
  5136. function moveCharLogically(line, ch, dir) {
  5137. var target = skipExtendingChars(line.text, ch + dir, dir);
  5138. return target < 0 || target > line.text.length ? null : target
  5139. }
  5140. function moveLogically(line, start, dir) {
  5141. var ch = moveCharLogically(line, start.ch, dir);
  5142. return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
  5143. }
  5144. function endOfLine(visually, cm, lineObj, lineNo, dir) {
  5145. if (visually) {
  5146. var order = getOrder(lineObj, cm.doc.direction);
  5147. if (order) {
  5148. var part = dir < 0 ? lst(order) : order[0];
  5149. var moveInStorageOrder = (dir < 0) == (part.level == 1);
  5150. var sticky = moveInStorageOrder ? "after" : "before";
  5151. var ch;
  5152. // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
  5153. // it could be that the last bidi part is not on the last visual line,
  5154. // since visual lines contain content order-consecutive chunks.
  5155. // Thus, in rtl, we are looking for the first (content-order) character
  5156. // in the rtl chunk that is on the last line (that is, the same line
  5157. // as the last (content-order) character).
  5158. if (part.level > 0) {
  5159. var prep = prepareMeasureForLine(cm, lineObj);
  5160. ch = dir < 0 ? lineObj.text.length - 1 : 0;
  5161. var targetTop = measureCharPrepared(cm, prep, ch).top;
  5162. ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
  5163. if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true); }
  5164. } else { ch = dir < 0 ? part.to : part.from; }
  5165. return new Pos(lineNo, ch, sticky)
  5166. }
  5167. }
  5168. return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
  5169. }
  5170. function moveVisually(cm, line, start, dir) {
  5171. var bidi = getOrder(line, cm.doc.direction);
  5172. if (!bidi) { return moveLogically(line, start, dir) }
  5173. if (start.ch >= line.text.length) {
  5174. start.ch = line.text.length;
  5175. start.sticky = "before";
  5176. } else if (start.ch <= 0) {
  5177. start.ch = 0;
  5178. start.sticky = "after";
  5179. }
  5180. var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
  5181. if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
  5182. // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
  5183. // nothing interesting happens.
  5184. return moveLogically(line, start, dir)
  5185. }
  5186. var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
  5187. var prep;
  5188. var getWrappedLineExtent = function (ch) {
  5189. if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
  5190. prep = prep || prepareMeasureForLine(cm, line);
  5191. return wrappedLineExtentChar(cm, line, prep, ch)
  5192. };
  5193. var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
  5194. if (cm.doc.direction == "rtl" || part.level == 1) {
  5195. var moveInStorageOrder = (part.level == 1) == (dir < 0);
  5196. var ch = mv(start, moveInStorageOrder ? 1 : -1);
  5197. if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
  5198. // Case 2: We move within an rtl part or in an rtl editor on the same visual line
  5199. var sticky = moveInStorageOrder ? "before" : "after";
  5200. return new Pos(start.line, ch, sticky)
  5201. }
  5202. }
  5203. // Case 3: Could not move within this bidi part in this visual line, so leave
  5204. // the current bidi part
  5205. var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
  5206. var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
  5207. ? new Pos(start.line, mv(ch, 1), "before")
  5208. : new Pos(start.line, ch, "after"); };
  5209. for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
  5210. var part = bidi[partPos];
  5211. var moveInStorageOrder = (dir > 0) == (part.level != 1);
  5212. var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
  5213. if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
  5214. ch = moveInStorageOrder ? part.from : mv(part.to, -1);
  5215. if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
  5216. }
  5217. };
  5218. // Case 3a: Look for other bidi parts on the same visual line
  5219. var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
  5220. if (res) { return res }
  5221. // Case 3b: Look for other bidi parts on the next visual line
  5222. var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
  5223. if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
  5224. res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
  5225. if (res) { return res }
  5226. }
  5227. // Case 4: Nowhere to move
  5228. return null
  5229. }
  5230. // EVENT HANDLING
  5231. // Lightweight event framework. on/off also work on DOM nodes,
  5232. // registering native DOM handlers.
  5233. var noHandlers = [];
  5234. var on = function(emitter, type, f) {
  5235. if (emitter.addEventListener) {
  5236. emitter.addEventListener(type, f, false);
  5237. } else if (emitter.attachEvent) {
  5238. emitter.attachEvent("on" + type, f);
  5239. } else {
  5240. var map$$1 = emitter._handlers || (emitter._handlers = {});
  5241. map$$1[type] = (map$$1[type] || noHandlers).concat(f);
  5242. }
  5243. };
  5244. function getHandlers(emitter, type) {
  5245. return emitter._handlers && emitter._handlers[type] || noHandlers
  5246. }
  5247. function off(emitter, type, f) {
  5248. if (emitter.removeEventListener) {
  5249. emitter.removeEventListener(type, f, false);
  5250. } else if (emitter.detachEvent) {
  5251. emitter.detachEvent("on" + type, f);
  5252. } else {
  5253. var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
  5254. if (arr) {
  5255. var index = indexOf(arr, f);
  5256. if (index > -1)
  5257. { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
  5258. }
  5259. }
  5260. }
  5261. function signal(emitter, type /*, values...*/) {
  5262. var handlers = getHandlers(emitter, type);
  5263. if (!handlers.length) { return }
  5264. var args = Array.prototype.slice.call(arguments, 2);
  5265. for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
  5266. }
  5267. // The DOM events that CodeMirror handles can be overridden by
  5268. // registering a (non-DOM) handler on the editor for the event name,
  5269. // and preventDefault-ing the event in that handler.
  5270. function signalDOMEvent(cm, e, override) {
  5271. if (typeof e == "string")
  5272. { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
  5273. signal(cm, override || e.type, cm, e);
  5274. return e_defaultPrevented(e) || e.codemirrorIgnore
  5275. }
  5276. function signalCursorActivity(cm) {
  5277. var arr = cm._handlers && cm._handlers.cursorActivity;
  5278. if (!arr) { return }
  5279. var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
  5280. for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
  5281. { set.push(arr[i]); } }
  5282. }
  5283. function hasHandler(emitter, type) {
  5284. return getHandlers(emitter, type).length > 0
  5285. }
  5286. // Add on and off methods to a constructor's prototype, to make
  5287. // registering events on such objects more convenient.
  5288. function eventMixin(ctor) {
  5289. ctor.prototype.on = function(type, f) {on(this, type, f);};
  5290. ctor.prototype.off = function(type, f) {off(this, type, f);};
  5291. }
  5292. // Due to the fact that we still support jurassic IE versions, some
  5293. // compatibility wrappers are needed.
  5294. function e_preventDefault(e) {
  5295. if (e.preventDefault) { e.preventDefault(); }
  5296. else { e.returnValue = false; }
  5297. }
  5298. function e_stopPropagation(e) {
  5299. if (e.stopPropagation) { e.stopPropagation(); }
  5300. else { e.cancelBubble = true; }
  5301. }
  5302. function e_defaultPrevented(e) {
  5303. return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
  5304. }
  5305. function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
  5306. function e_target(e) {return e.target || e.srcElement}
  5307. function e_button(e) {
  5308. var b = e.which;
  5309. if (b == null) {
  5310. if (e.button & 1) { b = 1; }
  5311. else if (e.button & 2) { b = 3; }
  5312. else if (e.button & 4) { b = 2; }
  5313. }
  5314. if (mac && e.ctrlKey && b == 1) { b = 3; }
  5315. return b
  5316. }
  5317. // Detect drag-and-drop
  5318. var dragAndDrop = function() {
  5319. // There is *some* kind of drag-and-drop support in IE6-8, but I
  5320. // couldn't get it to work yet.
  5321. if (ie && ie_version < 9) { return false }
  5322. var div = elt('div');
  5323. return "draggable" in div || "dragDrop" in div
  5324. }();
  5325. var zwspSupported;
  5326. function zeroWidthElement(measure) {
  5327. if (zwspSupported == null) {
  5328. var test = elt("span", "\u200b");
  5329. removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
  5330. if (measure.firstChild.offsetHeight != 0)
  5331. { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
  5332. }
  5333. var node = zwspSupported ? elt("span", "\u200b") :
  5334. elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
  5335. node.setAttribute("cm-text", "");
  5336. return node
  5337. }
  5338. // Feature-detect IE's crummy client rect reporting for bidi text
  5339. var badBidiRects;
  5340. function hasBadBidiRects(measure) {
  5341. if (badBidiRects != null) { return badBidiRects }
  5342. var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
  5343. var r0 = range(txt, 0, 1).getBoundingClientRect();
  5344. var r1 = range(txt, 1, 2).getBoundingClientRect();
  5345. removeChildren(measure);
  5346. if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
  5347. return badBidiRects = (r1.right - r0.right < 3)
  5348. }
  5349. // See if "".split is the broken IE version, if so, provide an
  5350. // alternative way to split lines.
  5351. var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
  5352. var pos = 0, result = [], l = string.length;
  5353. while (pos <= l) {
  5354. var nl = string.indexOf("\n", pos);
  5355. if (nl == -1) { nl = string.length; }
  5356. var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
  5357. var rt = line.indexOf("\r");
  5358. if (rt != -1) {
  5359. result.push(line.slice(0, rt));
  5360. pos += rt + 1;
  5361. } else {
  5362. result.push(line);
  5363. pos = nl + 1;
  5364. }
  5365. }
  5366. return result
  5367. } : function (string) { return string.split(/\r\n?|\n/); };
  5368. var hasSelection = window.getSelection ? function (te) {
  5369. try { return te.selectionStart != te.selectionEnd }
  5370. catch(e) { return false }
  5371. } : function (te) {
  5372. var range$$1;
  5373. try {range$$1 = te.ownerDocument.selection.createRange();}
  5374. catch(e) {}
  5375. if (!range$$1 || range$$1.parentElement() != te) { return false }
  5376. return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
  5377. };
  5378. var hasCopyEvent = (function () {
  5379. var e = elt("div");
  5380. if ("oncopy" in e) { return true }
  5381. e.setAttribute("oncopy", "return;");
  5382. return typeof e.oncopy == "function"
  5383. })();
  5384. var badZoomedRects = null;
  5385. function hasBadZoomedRects(measure) {
  5386. if (badZoomedRects != null) { return badZoomedRects }
  5387. var node = removeChildrenAndAdd(measure, elt("span", "x"));
  5388. var normal = node.getBoundingClientRect();
  5389. var fromRange = range(node, 0, 1).getBoundingClientRect();
  5390. return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
  5391. }
  5392. // Known modes, by name and by MIME
  5393. var modes = {};
  5394. var mimeModes = {};
  5395. // Extra arguments are stored as the mode's dependencies, which is
  5396. // used by (legacy) mechanisms like loadmode.js to automatically
  5397. // load a mode. (Preferred mechanism is the require/define calls.)
  5398. function defineMode(name, mode) {
  5399. if (arguments.length > 2)
  5400. { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
  5401. modes[name] = mode;
  5402. }
  5403. function defineMIME(mime, spec) {
  5404. mimeModes[mime] = spec;
  5405. }
  5406. // Given a MIME type, a {name, ...options} config object, or a name
  5407. // string, return a mode config object.
  5408. function resolveMode(spec) {
  5409. if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
  5410. spec = mimeModes[spec];
  5411. } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
  5412. var found = mimeModes[spec.name];
  5413. if (typeof found == "string") { found = {name: found}; }
  5414. spec = createObj(found, spec);
  5415. spec.name = found.name;
  5416. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
  5417. return resolveMode("application/xml")
  5418. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
  5419. return resolveMode("application/json")
  5420. }
  5421. if (typeof spec == "string") { return {name: spec} }
  5422. else { return spec || {name: "null"} }
  5423. }
  5424. // Given a mode spec (anything that resolveMode accepts), find and
  5425. // initialize an actual mode object.
  5426. function getMode(options, spec) {
  5427. spec = resolveMode(spec);
  5428. var mfactory = modes[spec.name];
  5429. if (!mfactory) { return getMode(options, "text/plain") }
  5430. var modeObj = mfactory(options, spec);
  5431. if (modeExtensions.hasOwnProperty(spec.name)) {
  5432. var exts = modeExtensions[spec.name];
  5433. for (var prop in exts) {
  5434. if (!exts.hasOwnProperty(prop)) { continue }
  5435. if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
  5436. modeObj[prop] = exts[prop];
  5437. }
  5438. }
  5439. modeObj.name = spec.name;
  5440. if (spec.helperType) { modeObj.helperType = spec.helperType; }
  5441. if (spec.modeProps) { for (var prop$1 in spec.modeProps)
  5442. { modeObj[prop$1] = spec.modeProps[prop$1]; } }
  5443. return modeObj
  5444. }
  5445. // This can be used to attach properties to mode objects from
  5446. // outside the actual mode definition.
  5447. var modeExtensions = {};
  5448. function extendMode(mode, properties) {
  5449. var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
  5450. copyObj(properties, exts);
  5451. }
  5452. function copyState(mode, state) {
  5453. if (state === true) { return state }
  5454. if (mode.copyState) { return mode.copyState(state) }
  5455. var nstate = {};
  5456. for (var n in state) {
  5457. var val = state[n];
  5458. if (val instanceof Array) { val = val.concat([]); }
  5459. nstate[n] = val;
  5460. }
  5461. return nstate
  5462. }
  5463. // Given a mode and a state (for that mode), find the inner mode and
  5464. // state at the position that the state refers to.
  5465. function innerMode(mode, state) {
  5466. var info;
  5467. while (mode.innerMode) {
  5468. info = mode.innerMode(state);
  5469. if (!info || info.mode == mode) { break }
  5470. state = info.state;
  5471. mode = info.mode;
  5472. }
  5473. return info || {mode: mode, state: state}
  5474. }
  5475. function startState(mode, a1, a2) {
  5476. return mode.startState ? mode.startState(a1, a2) : true
  5477. }
  5478. // STRING STREAM
  5479. // Fed to the mode parsers, provides helper functions to make
  5480. // parsers more succinct.
  5481. var StringStream = function(string, tabSize) {
  5482. this.pos = this.start = 0;
  5483. this.string = string;
  5484. this.tabSize = tabSize || 8;
  5485. this.lastColumnPos = this.lastColumnValue = 0;
  5486. this.lineStart = 0;
  5487. };
  5488. StringStream.prototype.eol = function () {return this.pos >= this.string.length};
  5489. StringStream.prototype.sol = function () {return this.pos == this.lineStart};
  5490. StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
  5491. StringStream.prototype.next = function () {
  5492. if (this.pos < this.string.length)
  5493. { return this.string.charAt(this.pos++) }
  5494. };
  5495. StringStream.prototype.eat = function (match) {
  5496. var ch = this.string.charAt(this.pos);
  5497. var ok;
  5498. if (typeof match == "string") { ok = ch == match; }
  5499. else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
  5500. if (ok) {++this.pos; return ch}
  5501. };
  5502. StringStream.prototype.eatWhile = function (match) {
  5503. var start = this.pos;
  5504. while (this.eat(match)){}
  5505. return this.pos > start
  5506. };
  5507. StringStream.prototype.eatSpace = function () {
  5508. var this$1 = this;
  5509. var start = this.pos;
  5510. while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
  5511. return this.pos > start
  5512. };
  5513. StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
  5514. StringStream.prototype.skipTo = function (ch) {
  5515. var found = this.string.indexOf(ch, this.pos);
  5516. if (found > -1) {this.pos = found; return true}
  5517. };
  5518. StringStream.prototype.backUp = function (n) {this.pos -= n;};
  5519. StringStream.prototype.column = function () {
  5520. if (this.lastColumnPos < this.start) {
  5521. this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
  5522. this.lastColumnPos = this.start;
  5523. }
  5524. return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  5525. };
  5526. StringStream.prototype.indentation = function () {
  5527. return countColumn(this.string, null, this.tabSize) -
  5528. (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  5529. };
  5530. StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
  5531. if (typeof pattern == "string") {
  5532. var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
  5533. var substr = this.string.substr(this.pos, pattern.length);
  5534. if (cased(substr) == cased(pattern)) {
  5535. if (consume !== false) { this.pos += pattern.length; }
  5536. return true
  5537. }
  5538. } else {
  5539. var match = this.string.slice(this.pos).match(pattern);
  5540. if (match && match.index > 0) { return null }
  5541. if (match && consume !== false) { this.pos += match[0].length; }
  5542. return match
  5543. }
  5544. };
  5545. StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
  5546. StringStream.prototype.hideFirstChars = function (n, inner) {
  5547. this.lineStart += n;
  5548. try { return inner() }
  5549. finally { this.lineStart -= n; }
  5550. };
  5551. // Compute a style array (an array starting with a mode generation
  5552. // -- for invalidation -- followed by pairs of end positions and
  5553. // style strings), which is used to highlight the tokens on the
  5554. // line.
  5555. function highlightLine(cm, line, state, forceToEnd) {
  5556. // A styles array always starts with a number identifying the
  5557. // mode/overlays that it is based on (for easy invalidation).
  5558. var st = [cm.state.modeGen], lineClasses = {};
  5559. // Compute the base array of styles
  5560. runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
  5561. lineClasses, forceToEnd);
  5562. // Run overlays, adjust style array.
  5563. var loop = function ( o ) {
  5564. var overlay = cm.state.overlays[o], i = 1, at = 0;
  5565. runMode(cm, line.text, overlay.mode, true, function (end, style) {
  5566. var start = i;
  5567. // Ensure there's a token end at the current position, and that i points at it
  5568. while (at < end) {
  5569. var i_end = st[i];
  5570. if (i_end > end)
  5571. { st.splice(i, 1, end, st[i+1], i_end); }
  5572. i += 2;
  5573. at = Math.min(end, i_end);
  5574. }
  5575. if (!style) { return }
  5576. if (overlay.opaque) {
  5577. st.splice(start, i - start, end, "overlay " + style);
  5578. i = start + 2;
  5579. } else {
  5580. for (; start < i; start += 2) {
  5581. var cur = st[start+1];
  5582. st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
  5583. }
  5584. }
  5585. }, lineClasses);
  5586. };
  5587. for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
  5588. return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
  5589. }
  5590. function getLineStyles(cm, line, updateFrontier) {
  5591. if (!line.styles || line.styles[0] != cm.state.modeGen) {
  5592. var state = getStateBefore(cm, lineNo(line));
  5593. var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);
  5594. line.stateAfter = state;
  5595. line.styles = result.styles;
  5596. if (result.classes) { line.styleClasses = result.classes; }
  5597. else if (line.styleClasses) { line.styleClasses = null; }
  5598. if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++; }
  5599. }
  5600. return line.styles
  5601. }
  5602. function getStateBefore(cm, n, precise) {
  5603. var doc = cm.doc, display = cm.display;
  5604. if (!doc.mode.startState) { return true }
  5605. var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
  5606. if (!state) { state = startState(doc.mode); }
  5607. else { state = copyState(doc.mode, state); }
  5608. doc.iter(pos, n, function (line) {
  5609. processLine(cm, line.text, state);
  5610. var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
  5611. line.stateAfter = save ? copyState(doc.mode, state) : null;
  5612. ++pos;
  5613. });
  5614. if (precise) { doc.frontier = pos; }
  5615. return state
  5616. }
  5617. // Lightweight form of highlight -- proceed over this line and
  5618. // update state, but don't save a style array. Used for lines that
  5619. // aren't currently visible.
  5620. function processLine(cm, text, state, startAt) {
  5621. var mode = cm.doc.mode;
  5622. var stream = new StringStream(text, cm.options.tabSize);
  5623. stream.start = stream.pos = startAt || 0;
  5624. if (text == "") { callBlankLine(mode, state); }
  5625. while (!stream.eol()) {
  5626. readToken(mode, stream, state);
  5627. stream.start = stream.pos;
  5628. }
  5629. }
  5630. function callBlankLine(mode, state) {
  5631. if (mode.blankLine) { return mode.blankLine(state) }
  5632. if (!mode.innerMode) { return }
  5633. var inner = innerMode(mode, state);
  5634. if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
  5635. }
  5636. function readToken(mode, stream, state, inner) {
  5637. for (var i = 0; i < 10; i++) {
  5638. if (inner) { inner[0] = innerMode(mode, state).mode; }
  5639. var style = mode.token(stream, state);
  5640. if (stream.pos > stream.start) { return style }
  5641. }
  5642. throw new Error("Mode " + mode.name + " failed to advance stream.")
  5643. }
  5644. // Utility for getTokenAt and getLineTokens
  5645. function takeToken(cm, pos, precise, asArray) {
  5646. var getObj = function (copy) { return ({
  5647. start: stream.start, end: stream.pos,
  5648. string: stream.current(),
  5649. type: style || null,
  5650. state: copy ? copyState(doc.mode, state) : state
  5651. }); };
  5652. var doc = cm.doc, mode = doc.mode, style;
  5653. pos = clipPos(doc, pos);
  5654. var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);
  5655. var stream = new StringStream(line.text, cm.options.tabSize), tokens;
  5656. if (asArray) { tokens = []; }
  5657. while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
  5658. stream.start = stream.pos;
  5659. style = readToken(mode, stream, state);
  5660. if (asArray) { tokens.push(getObj(true)); }
  5661. }
  5662. return asArray ? tokens : getObj()
  5663. }
  5664. function extractLineClasses(type, output) {
  5665. if (type) { for (;;) {
  5666. var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
  5667. if (!lineClass) { break }
  5668. type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
  5669. var prop = lineClass[1] ? "bgClass" : "textClass";
  5670. if (output[prop] == null)
  5671. { output[prop] = lineClass[2]; }
  5672. else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
  5673. { output[prop] += " " + lineClass[2]; }
  5674. } }
  5675. return type
  5676. }
  5677. // Run the given mode's parser over a line, calling f for each token.
  5678. function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
  5679. var flattenSpans = mode.flattenSpans;
  5680. if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
  5681. var curStart = 0, curStyle = null;
  5682. var stream = new StringStream(text, cm.options.tabSize), style;
  5683. var inner = cm.options.addModeClass && [null];
  5684. if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses); }
  5685. while (!stream.eol()) {
  5686. if (stream.pos > cm.options.maxHighlightLength) {
  5687. flattenSpans = false;
  5688. if (forceToEnd) { processLine(cm, text, state, stream.pos); }
  5689. stream.pos = text.length;
  5690. style = null;
  5691. } else {
  5692. style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);
  5693. }
  5694. if (inner) {
  5695. var mName = inner[0].name;
  5696. if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
  5697. }
  5698. if (!flattenSpans || curStyle != style) {
  5699. while (curStart < stream.start) {
  5700. curStart = Math.min(stream.start, curStart + 5000);
  5701. f(curStart, curStyle);
  5702. }
  5703. curStyle = style;
  5704. }
  5705. stream.start = stream.pos;
  5706. }
  5707. while (curStart < stream.pos) {
  5708. // Webkit seems to refuse to render text nodes longer than 57444
  5709. // characters, and returns inaccurate measurements in nodes
  5710. // starting around 5000 chars.
  5711. var pos = Math.min(stream.pos, curStart + 5000);
  5712. f(pos, curStyle);
  5713. curStart = pos;
  5714. }
  5715. }
  5716. // Finds the line to start with when starting a parse. Tries to
  5717. // find a line with a stateAfter, so that it can start with a
  5718. // valid state. If that fails, it returns the line with the
  5719. // smallest indentation, which tends to need the least context to
  5720. // parse correctly.
  5721. function findStartLine(cm, n, precise) {
  5722. var minindent, minline, doc = cm.doc;
  5723. var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
  5724. for (var search = n; search > lim; --search) {
  5725. if (search <= doc.first) { return doc.first }
  5726. var line = getLine(doc, search - 1);
  5727. if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
  5728. var indented = countColumn(line.text, null, cm.options.tabSize);
  5729. if (minline == null || minindent > indented) {
  5730. minline = search - 1;
  5731. minindent = indented;
  5732. }
  5733. }
  5734. return minline
  5735. }
  5736. // LINE DATA STRUCTURE
  5737. // Line objects. These hold state related to a line, including
  5738. // highlighting info (the styles array).
  5739. var Line = function(text, markedSpans, estimateHeight) {
  5740. this.text = text;
  5741. attachMarkedSpans(this, markedSpans);
  5742. this.height = estimateHeight ? estimateHeight(this) : 1;
  5743. };
  5744. Line.prototype.lineNo = function () { return lineNo(this) };
  5745. eventMixin(Line);
  5746. // Change the content (text, markers) of a line. Automatically
  5747. // invalidates cached information and tries to re-estimate the
  5748. // line's height.
  5749. function updateLine(line, text, markedSpans, estimateHeight) {
  5750. line.text = text;
  5751. if (line.stateAfter) { line.stateAfter = null; }
  5752. if (line.styles) { line.styles = null; }
  5753. if (line.order != null) { line.order = null; }
  5754. detachMarkedSpans(line);
  5755. attachMarkedSpans(line, markedSpans);
  5756. var estHeight = estimateHeight ? estimateHeight(line) : 1;
  5757. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  5758. }
  5759. // Detach a line from the document tree and its markers.
  5760. function cleanUpLine(line) {
  5761. line.parent = null;
  5762. detachMarkedSpans(line);
  5763. }
  5764. // Convert a style as returned by a mode (either null, or a string
  5765. // containing one or more styles) to a CSS style. This is cached,
  5766. // and also looks for line-wide styles.
  5767. var styleToClassCache = {};
  5768. var styleToClassCacheWithMode = {};
  5769. function interpretTokenStyle(style, options) {
  5770. if (!style || /^\s*$/.test(style)) { return null }
  5771. var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
  5772. return cache[style] ||
  5773. (cache[style] = style.replace(/\S+/g, "cm-$&"))
  5774. }
  5775. // Render the DOM representation of the text of a line. Also builds
  5776. // up a 'line map', which points at the DOM nodes that represent
  5777. // specific stretches of text, and is used by the measuring code.
  5778. // The returned object contains the DOM node, this map, and
  5779. // information about line-wide styles that were set by the mode.
  5780. function buildLineContent(cm, lineView) {
  5781. // The padding-right forces the element to have a 'border', which
  5782. // is needed on Webkit to be able to get line-level bounding
  5783. // rectangles for it (in measureChar).
  5784. var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
  5785. var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
  5786. col: 0, pos: 0, cm: cm,
  5787. trailingSpace: false,
  5788. splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")};
  5789. lineView.measure = {};
  5790. // Iterate over the logical lines that make up this visual line.
  5791. for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
  5792. var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
  5793. builder.pos = 0;
  5794. builder.addToken = buildToken;
  5795. // Optionally wire in some hacks into the token-rendering
  5796. // algorithm, to deal with browser quirks.
  5797. if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
  5798. { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
  5799. builder.map = [];
  5800. var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
  5801. insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
  5802. if (line.styleClasses) {
  5803. if (line.styleClasses.bgClass)
  5804. { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
  5805. if (line.styleClasses.textClass)
  5806. { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
  5807. }
  5808. // Ensure at least a single node is present, for measuring.
  5809. if (builder.map.length == 0)
  5810. { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
  5811. // Store the map and a cache object for the current logical line
  5812. if (i == 0) {
  5813. lineView.measure.map = builder.map;
  5814. lineView.measure.cache = {};
  5815. } else {
  5816. (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
  5817. ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
  5818. }
  5819. }
  5820. // See issue #2901
  5821. if (webkit) {
  5822. var last = builder.content.lastChild;
  5823. if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
  5824. { builder.content.className = "cm-tab-wrap-hack"; }
  5825. }
  5826. signal(cm, "renderLine", cm, lineView.line, builder.pre);
  5827. if (builder.pre.className)
  5828. { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
  5829. return builder
  5830. }
  5831. function defaultSpecialCharPlaceholder(ch) {
  5832. var token = elt("span", "\u2022", "cm-invalidchar");
  5833. token.title = "\\u" + ch.charCodeAt(0).toString(16);
  5834. token.setAttribute("aria-label", token.title);
  5835. return token
  5836. }
  5837. // Build up the DOM representation for a single token, and add it to
  5838. // the line map. Takes care to render special characters separately.
  5839. function buildToken(builder, text, style, startStyle, endStyle, title, css) {
  5840. if (!text) { return }
  5841. var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
  5842. var special = builder.cm.state.specialChars, mustWrap = false;
  5843. var content;
  5844. if (!special.test(text)) {
  5845. builder.col += text.length;
  5846. content = document.createTextNode(displayText);
  5847. builder.map.push(builder.pos, builder.pos + text.length, content);
  5848. if (ie && ie_version < 9) { mustWrap = true; }
  5849. builder.pos += text.length;
  5850. } else {
  5851. content = document.createDocumentFragment();
  5852. var pos = 0;
  5853. while (true) {
  5854. special.lastIndex = pos;
  5855. var m = special.exec(text);
  5856. var skipped = m ? m.index - pos : text.length - pos;
  5857. if (skipped) {
  5858. var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
  5859. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
  5860. else { content.appendChild(txt); }
  5861. builder.map.push(builder.pos, builder.pos + skipped, txt);
  5862. builder.col += skipped;
  5863. builder.pos += skipped;
  5864. }
  5865. if (!m) { break }
  5866. pos += skipped + 1;
  5867. var txt$1 = (void 0);
  5868. if (m[0] == "\t") {
  5869. var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
  5870. txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
  5871. txt$1.setAttribute("role", "presentation");
  5872. txt$1.setAttribute("cm-text", "\t");
  5873. builder.col += tabWidth;
  5874. } else if (m[0] == "\r" || m[0] == "\n") {
  5875. txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
  5876. txt$1.setAttribute("cm-text", m[0]);
  5877. builder.col += 1;
  5878. } else {
  5879. txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
  5880. txt$1.setAttribute("cm-text", m[0]);
  5881. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
  5882. else { content.appendChild(txt$1); }
  5883. builder.col += 1;
  5884. }
  5885. builder.map.push(builder.pos, builder.pos + 1, txt$1);
  5886. builder.pos++;
  5887. }
  5888. }
  5889. builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
  5890. if (style || startStyle || endStyle || mustWrap || css) {
  5891. var fullStyle = style || "";
  5892. if (startStyle) { fullStyle += startStyle; }
  5893. if (endStyle) { fullStyle += endStyle; }
  5894. var token = elt("span", [content], fullStyle, css);
  5895. if (title) { token.title = title; }
  5896. return builder.content.appendChild(token)
  5897. }
  5898. builder.content.appendChild(content);
  5899. }
  5900. function splitSpaces(text, trailingBefore) {
  5901. if (text.length > 1 && !/ /.test(text)) { return text }
  5902. var spaceBefore = trailingBefore, result = "";
  5903. for (var i = 0; i < text.length; i++) {
  5904. var ch = text.charAt(i);
  5905. if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
  5906. { ch = "\u00a0"; }
  5907. result += ch;
  5908. spaceBefore = ch == " ";
  5909. }
  5910. return result
  5911. }
  5912. // Work around nonsense dimensions being reported for stretches of
  5913. // right-to-left text.
  5914. function buildTokenBadBidi(inner, order) {
  5915. return function (builder, text, style, startStyle, endStyle, title, css) {
  5916. style = style ? style + " cm-force-border" : "cm-force-border";
  5917. var start = builder.pos, end = start + text.length;
  5918. for (;;) {
  5919. // Find the part that overlaps with the start of this text
  5920. var part = (void 0);
  5921. for (var i = 0; i < order.length; i++) {
  5922. part = order[i];
  5923. if (part.to > start && part.from <= start) { break }
  5924. }
  5925. if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
  5926. inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);
  5927. startStyle = null;
  5928. text = text.slice(part.to - start);
  5929. start = part.to;
  5930. }
  5931. }
  5932. }
  5933. function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
  5934. var widget = !ignoreWidget && marker.widgetNode;
  5935. if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
  5936. if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
  5937. if (!widget)
  5938. { widget = builder.content.appendChild(document.createElement("span")); }
  5939. widget.setAttribute("cm-marker", marker.id);
  5940. }
  5941. if (widget) {
  5942. builder.cm.display.input.setUneditable(widget);
  5943. builder.content.appendChild(widget);
  5944. }
  5945. builder.pos += size;
  5946. builder.trailingSpace = false;
  5947. }
  5948. // Outputs a number of spans to make up a line, taking highlighting
  5949. // and marked text into account.
  5950. function insertLineContent(line, builder, styles) {
  5951. var spans = line.markedSpans, allText = line.text, at = 0;
  5952. if (!spans) {
  5953. for (var i$1 = 1; i$1 < styles.length; i$1+=2)
  5954. { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
  5955. return
  5956. }
  5957. var len = allText.length, pos = 0, i = 1, text = "", style, css;
  5958. var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
  5959. for (;;) {
  5960. if (nextChange == pos) { // Update current marker set
  5961. spanStyle = spanEndStyle = spanStartStyle = title = css = "";
  5962. collapsed = null; nextChange = Infinity;
  5963. var foundBookmarks = [], endStyles = (void 0);
  5964. for (var j = 0; j < spans.length; ++j) {
  5965. var sp = spans[j], m = sp.marker;
  5966. if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
  5967. foundBookmarks.push(m);
  5968. } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
  5969. if (sp.to != null && sp.to != pos && nextChange > sp.to) {
  5970. nextChange = sp.to;
  5971. spanEndStyle = "";
  5972. }
  5973. if (m.className) { spanStyle += " " + m.className; }
  5974. if (m.css) { css = (css ? css + ";" : "") + m.css; }
  5975. if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
  5976. if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
  5977. if (m.title && !title) { title = m.title; }
  5978. if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
  5979. { collapsed = sp; }
  5980. } else if (sp.from > pos && nextChange > sp.from) {
  5981. nextChange = sp.from;
  5982. }
  5983. }
  5984. if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
  5985. { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
  5986. if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
  5987. { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
  5988. if (collapsed && (collapsed.from || 0) == pos) {
  5989. buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
  5990. collapsed.marker, collapsed.from == null);
  5991. if (collapsed.to == null) { return }
  5992. if (collapsed.to == pos) { collapsed = false; }
  5993. }
  5994. }
  5995. if (pos >= len) { break }
  5996. var upto = Math.min(len, nextChange);
  5997. while (true) {
  5998. if (text) {
  5999. var end = pos + text.length;
  6000. if (!collapsed) {
  6001. var tokenText = end > upto ? text.slice(0, upto - pos) : text;
  6002. builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
  6003. spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css);
  6004. }
  6005. if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
  6006. pos = end;
  6007. spanStartStyle = "";
  6008. }
  6009. text = allText.slice(at, at = styles[i++]);
  6010. style = interpretTokenStyle(styles[i++], builder.cm.options);
  6011. }
  6012. }
  6013. }
  6014. // These objects are used to represent the visible (currently drawn)
  6015. // part of the document. A LineView may correspond to multiple
  6016. // logical lines, if those are connected by collapsed ranges.
  6017. function LineView(doc, line, lineN) {
  6018. // The starting line
  6019. this.line = line;
  6020. // Continuing lines, if any
  6021. this.rest = visualLineContinued(line);
  6022. // Number of logical lines in this visual line
  6023. this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
  6024. this.node = this.text = null;
  6025. this.hidden = lineIsHidden(doc, line);
  6026. }
  6027. // Create a range of LineView objects for the given lines.
  6028. function buildViewArray(cm, from, to) {
  6029. var array = [], nextPos;
  6030. for (var pos = from; pos < to; pos = nextPos) {
  6031. var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
  6032. nextPos = pos + view.size;
  6033. array.push(view);
  6034. }
  6035. return array
  6036. }
  6037. var operationGroup = null;
  6038. function pushOperation(op) {
  6039. if (operationGroup) {
  6040. operationGroup.ops.push(op);
  6041. } else {
  6042. op.ownsGroup = operationGroup = {
  6043. ops: [op],
  6044. delayedCallbacks: []
  6045. };
  6046. }
  6047. }
  6048. function fireCallbacksForOps(group) {
  6049. // Calls delayed callbacks and cursorActivity handlers until no
  6050. // new ones appear
  6051. var callbacks = group.delayedCallbacks, i = 0;
  6052. do {
  6053. for (; i < callbacks.length; i++)
  6054. { callbacks[i].call(null); }
  6055. for (var j = 0; j < group.ops.length; j++) {
  6056. var op = group.ops[j];
  6057. if (op.cursorActivityHandlers)
  6058. { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
  6059. { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
  6060. }
  6061. } while (i < callbacks.length)
  6062. }
  6063. function finishOperation(op, endCb) {
  6064. var group = op.ownsGroup;
  6065. if (!group) { return }
  6066. try { fireCallbacksForOps(group); }
  6067. finally {
  6068. operationGroup = null;
  6069. endCb(group);
  6070. }
  6071. }
  6072. var orphanDelayedCallbacks = null;
  6073. // Often, we want to signal events at a point where we are in the
  6074. // middle of some work, but don't want the handler to start calling
  6075. // other methods on the editor, which might be in an inconsistent
  6076. // state or simply not expect any other events to happen.
  6077. // signalLater looks whether there are any handlers, and schedules
  6078. // them to be executed when the last operation ends, or, if no
  6079. // operation is active, when a timeout fires.
  6080. function signalLater(emitter, type /*, values...*/) {
  6081. var arr = getHandlers(emitter, type);
  6082. if (!arr.length) { return }
  6083. var args = Array.prototype.slice.call(arguments, 2), list;
  6084. if (operationGroup) {
  6085. list = operationGroup.delayedCallbacks;
  6086. } else if (orphanDelayedCallbacks) {
  6087. list = orphanDelayedCallbacks;
  6088. } else {
  6089. list = orphanDelayedCallbacks = [];
  6090. setTimeout(fireOrphanDelayed, 0);
  6091. }
  6092. var loop = function ( i ) {
  6093. list.push(function () { return arr[i].apply(null, args); });
  6094. };
  6095. for (var i = 0; i < arr.length; ++i)
  6096. loop( i );
  6097. }
  6098. function fireOrphanDelayed() {
  6099. var delayed = orphanDelayedCallbacks;
  6100. orphanDelayedCallbacks = null;
  6101. for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
  6102. }
  6103. // When an aspect of a line changes, a string is added to
  6104. // lineView.changes. This updates the relevant part of the line's
  6105. // DOM structure.
  6106. function updateLineForChanges(cm, lineView, lineN, dims) {
  6107. for (var j = 0; j < lineView.changes.length; j++) {
  6108. var type = lineView.changes[j];
  6109. if (type == "text") { updateLineText(cm, lineView); }
  6110. else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
  6111. else if (type == "class") { updateLineClasses(cm, lineView); }
  6112. else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
  6113. }
  6114. lineView.changes = null;
  6115. }
  6116. // Lines with gutter elements, widgets or a background class need to
  6117. // be wrapped, and have the extra elements added to the wrapper div
  6118. function ensureLineWrapped(lineView) {
  6119. if (lineView.node == lineView.text) {
  6120. lineView.node = elt("div", null, null, "position: relative");
  6121. if (lineView.text.parentNode)
  6122. { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
  6123. lineView.node.appendChild(lineView.text);
  6124. if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
  6125. }
  6126. return lineView.node
  6127. }
  6128. function updateLineBackground(cm, lineView) {
  6129. var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
  6130. if (cls) { cls += " CodeMirror-linebackground"; }
  6131. if (lineView.background) {
  6132. if (cls) { lineView.background.className = cls; }
  6133. else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
  6134. } else if (cls) {
  6135. var wrap = ensureLineWrapped(lineView);
  6136. lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
  6137. cm.display.input.setUneditable(lineView.background);
  6138. }
  6139. }
  6140. // Wrapper around buildLineContent which will reuse the structure
  6141. // in display.externalMeasured when possible.
  6142. function getLineContent(cm, lineView) {
  6143. var ext = cm.display.externalMeasured;
  6144. if (ext && ext.line == lineView.line) {
  6145. cm.display.externalMeasured = null;
  6146. lineView.measure = ext.measure;
  6147. return ext.built
  6148. }
  6149. return buildLineContent(cm, lineView)
  6150. }
  6151. // Redraw the line's text. Interacts with the background and text
  6152. // classes because the mode may output tokens that influence these
  6153. // classes.
  6154. function updateLineText(cm, lineView) {
  6155. var cls = lineView.text.className;
  6156. var built = getLineContent(cm, lineView);
  6157. if (lineView.text == lineView.node) { lineView.node = built.pre; }
  6158. lineView.text.parentNode.replaceChild(built.pre, lineView.text);
  6159. lineView.text = built.pre;
  6160. if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
  6161. lineView.bgClass = built.bgClass;
  6162. lineView.textClass = built.textClass;
  6163. updateLineClasses(cm, lineView);
  6164. } else if (cls) {
  6165. lineView.text.className = cls;
  6166. }
  6167. }
  6168. function updateLineClasses(cm, lineView) {
  6169. updateLineBackground(cm, lineView);
  6170. if (lineView.line.wrapClass)
  6171. { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
  6172. else if (lineView.node != lineView.text)
  6173. { lineView.node.className = ""; }
  6174. var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
  6175. lineView.text.className = textClass || "";
  6176. }
  6177. function updateLineGutter(cm, lineView, lineN, dims) {
  6178. if (lineView.gutter) {
  6179. lineView.node.removeChild(lineView.gutter);
  6180. lineView.gutter = null;
  6181. }
  6182. if (lineView.gutterBackground) {
  6183. lineView.node.removeChild(lineView.gutterBackground);
  6184. lineView.gutterBackground = null;
  6185. }
  6186. if (lineView.line.gutterClass) {
  6187. var wrap = ensureLineWrapped(lineView);
  6188. lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
  6189. ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
  6190. cm.display.input.setUneditable(lineView.gutterBackground);
  6191. wrap.insertBefore(lineView.gutterBackground, lineView.text);
  6192. }
  6193. var markers = lineView.line.gutterMarkers;
  6194. if (cm.options.lineNumbers || markers) {
  6195. var wrap$1 = ensureLineWrapped(lineView);
  6196. var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
  6197. cm.display.input.setUneditable(gutterWrap);
  6198. wrap$1.insertBefore(gutterWrap, lineView.text);
  6199. if (lineView.line.gutterClass)
  6200. { gutterWrap.className += " " + lineView.line.gutterClass; }
  6201. if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
  6202. { lineView.lineNumber = gutterWrap.appendChild(
  6203. elt("div", lineNumberFor(cm.options, lineN),
  6204. "CodeMirror-linenumber CodeMirror-gutter-elt",
  6205. ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
  6206. if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
  6207. var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
  6208. if (found)
  6209. { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
  6210. ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
  6211. } }
  6212. }
  6213. }
  6214. function updateLineWidgets(cm, lineView, dims) {
  6215. if (lineView.alignable) { lineView.alignable = null; }
  6216. for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
  6217. next = node.nextSibling;
  6218. if (node.className == "CodeMirror-linewidget")
  6219. { lineView.node.removeChild(node); }
  6220. }
  6221. insertLineWidgets(cm, lineView, dims);
  6222. }
  6223. // Build a line's DOM representation from scratch
  6224. function buildLineElement(cm, lineView, lineN, dims) {
  6225. var built = getLineContent(cm, lineView);
  6226. lineView.text = lineView.node = built.pre;
  6227. if (built.bgClass) { lineView.bgClass = built.bgClass; }
  6228. if (built.textClass) { lineView.textClass = built.textClass; }
  6229. updateLineClasses(cm, lineView);
  6230. updateLineGutter(cm, lineView, lineN, dims);
  6231. insertLineWidgets(cm, lineView, dims);
  6232. return lineView.node
  6233. }
  6234. // A lineView may contain multiple logical lines (when merged by
  6235. // collapsed spans). The widgets for all of them need to be drawn.
  6236. function insertLineWidgets(cm, lineView, dims) {
  6237. insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
  6238. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  6239. { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
  6240. }
  6241. function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
  6242. if (!line.widgets) { return }
  6243. var wrap = ensureLineWrapped(lineView);
  6244. for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
  6245. var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
  6246. if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
  6247. positionLineWidget(widget, node, lineView, dims);
  6248. cm.display.input.setUneditable(node);
  6249. if (allowAbove && widget.above)
  6250. { wrap.insertBefore(node, lineView.gutter || lineView.text); }
  6251. else
  6252. { wrap.appendChild(node); }
  6253. signalLater(widget, "redraw");
  6254. }
  6255. }
  6256. function positionLineWidget(widget, node, lineView, dims) {
  6257. if (widget.noHScroll) {
  6258. (lineView.alignable || (lineView.alignable = [])).push(node);
  6259. var width = dims.wrapperWidth;
  6260. node.style.left = dims.fixedPos + "px";
  6261. if (!widget.coverGutter) {
  6262. width -= dims.gutterTotalWidth;
  6263. node.style.paddingLeft = dims.gutterTotalWidth + "px";
  6264. }
  6265. node.style.width = width + "px";
  6266. }
  6267. if (widget.coverGutter) {
  6268. node.style.zIndex = 5;
  6269. node.style.position = "relative";
  6270. if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
  6271. }
  6272. }
  6273. function widgetHeight(widget) {
  6274. if (widget.height != null) { return widget.height }
  6275. var cm = widget.doc.cm;
  6276. if (!cm) { return 0 }
  6277. if (!contains(document.body, widget.node)) {
  6278. var parentStyle = "position: relative;";
  6279. if (widget.coverGutter)
  6280. { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
  6281. if (widget.noHScroll)
  6282. { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
  6283. removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
  6284. }
  6285. return widget.height = widget.node.parentNode.offsetHeight
  6286. }
  6287. // Return true when the given mouse event happened in a widget
  6288. function eventInWidget(display, e) {
  6289. for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
  6290. if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
  6291. (n.parentNode == display.sizer && n != display.mover))
  6292. { return true }
  6293. }
  6294. }
  6295. // POSITION MEASUREMENT
  6296. function paddingTop(display) {return display.lineSpace.offsetTop}
  6297. function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
  6298. function paddingH(display) {
  6299. if (display.cachedPaddingH) { return display.cachedPaddingH }
  6300. var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
  6301. var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
  6302. var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
  6303. if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
  6304. return data
  6305. }
  6306. function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
  6307. function displayWidth(cm) {
  6308. return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
  6309. }
  6310. function displayHeight(cm) {
  6311. return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
  6312. }
  6313. // Ensure the lineView.wrapping.heights array is populated. This is
  6314. // an array of bottom offsets for the lines that make up a drawn
  6315. // line. When lineWrapping is on, there might be more than one
  6316. // height.
  6317. function ensureLineHeights(cm, lineView, rect) {
  6318. var wrapping = cm.options.lineWrapping;
  6319. var curWidth = wrapping && displayWidth(cm);
  6320. if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
  6321. var heights = lineView.measure.heights = [];
  6322. if (wrapping) {
  6323. lineView.measure.width = curWidth;
  6324. var rects = lineView.text.firstChild.getClientRects();
  6325. for (var i = 0; i < rects.length - 1; i++) {
  6326. var cur = rects[i], next = rects[i + 1];
  6327. if (Math.abs(cur.bottom - next.bottom) > 2)
  6328. { heights.push((cur.bottom + next.top) / 2 - rect.top); }
  6329. }
  6330. }
  6331. heights.push(rect.bottom - rect.top);
  6332. }
  6333. }
  6334. // Find a line map (mapping character offsets to text nodes) and a
  6335. // measurement cache for the given line number. (A line view might
  6336. // contain multiple lines when collapsed ranges are present.)
  6337. function mapFromLineView(lineView, line, lineN) {
  6338. if (lineView.line == line)
  6339. { return {map: lineView.measure.map, cache: lineView.measure.cache} }
  6340. for (var i = 0; i < lineView.rest.length; i++)
  6341. { if (lineView.rest[i] == line)
  6342. { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
  6343. for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
  6344. { if (lineNo(lineView.rest[i$1]) > lineN)
  6345. { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
  6346. }
  6347. // Render a line into the hidden node display.externalMeasured. Used
  6348. // when measurement is needed for a line that's not in the viewport.
  6349. function updateExternalMeasurement(cm, line) {
  6350. line = visualLine(line);
  6351. var lineN = lineNo(line);
  6352. var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
  6353. view.lineN = lineN;
  6354. var built = view.built = buildLineContent(cm, view);
  6355. view.text = built.pre;
  6356. removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
  6357. return view
  6358. }
  6359. // Get a {top, bottom, left, right} box (in line-local coordinates)
  6360. // for a given character.
  6361. function measureChar(cm, line, ch, bias) {
  6362. return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
  6363. }
  6364. // Find a line view that corresponds to the given line number.
  6365. function findViewForLine(cm, lineN) {
  6366. if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
  6367. { return cm.display.view[findViewIndex(cm, lineN)] }
  6368. var ext = cm.display.externalMeasured;
  6369. if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
  6370. { return ext }
  6371. }
  6372. // Measurement can be split in two steps, the set-up work that
  6373. // applies to the whole line, and the measurement of the actual
  6374. // character. Functions like coordsChar, that need to do a lot of
  6375. // measurements in a row, can thus ensure that the set-up work is
  6376. // only done once.
  6377. function prepareMeasureForLine(cm, line) {
  6378. var lineN = lineNo(line);
  6379. var view = findViewForLine(cm, lineN);
  6380. if (view && !view.text) {
  6381. view = null;
  6382. } else if (view && view.changes) {
  6383. updateLineForChanges(cm, view, lineN, getDimensions(cm));
  6384. cm.curOp.forceUpdate = true;
  6385. }
  6386. if (!view)
  6387. { view = updateExternalMeasurement(cm, line); }
  6388. var info = mapFromLineView(view, line, lineN);
  6389. return {
  6390. line: line, view: view, rect: null,
  6391. map: info.map, cache: info.cache, before: info.before,
  6392. hasHeights: false
  6393. }
  6394. }
  6395. // Given a prepared measurement object, measures the position of an
  6396. // actual character (or fetches it from the cache).
  6397. function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
  6398. if (prepared.before) { ch = -1; }
  6399. var key = ch + (bias || ""), found;
  6400. if (prepared.cache.hasOwnProperty(key)) {
  6401. found = prepared.cache[key];
  6402. } else {
  6403. if (!prepared.rect)
  6404. { prepared.rect = prepared.view.text.getBoundingClientRect(); }
  6405. if (!prepared.hasHeights) {
  6406. ensureLineHeights(cm, prepared.view, prepared.rect);
  6407. prepared.hasHeights = true;
  6408. }
  6409. found = measureCharInner(cm, prepared, ch, bias);
  6410. if (!found.bogus) { prepared.cache[key] = found; }
  6411. }
  6412. return {left: found.left, right: found.right,
  6413. top: varHeight ? found.rtop : found.top,
  6414. bottom: varHeight ? found.rbottom : found.bottom}
  6415. }
  6416. var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
  6417. function nodeAndOffsetInLineMap(map$$1, ch, bias) {
  6418. var node, start, end, collapse, mStart, mEnd;
  6419. // First, search the line map for the text node corresponding to,
  6420. // or closest to, the target character.
  6421. for (var i = 0; i < map$$1.length; i += 3) {
  6422. mStart = map$$1[i];
  6423. mEnd = map$$1[i + 1];
  6424. if (ch < mStart) {
  6425. start = 0; end = 1;
  6426. collapse = "left";
  6427. } else if (ch < mEnd) {
  6428. start = ch - mStart;
  6429. end = start + 1;
  6430. } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
  6431. end = mEnd - mStart;
  6432. start = end - 1;
  6433. if (ch >= mEnd) { collapse = "right"; }
  6434. }
  6435. if (start != null) {
  6436. node = map$$1[i + 2];
  6437. if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
  6438. { collapse = bias; }
  6439. if (bias == "left" && start == 0)
  6440. { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
  6441. node = map$$1[(i -= 3) + 2];
  6442. collapse = "left";
  6443. } }
  6444. if (bias == "right" && start == mEnd - mStart)
  6445. { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
  6446. node = map$$1[(i += 3) + 2];
  6447. collapse = "right";
  6448. } }
  6449. break
  6450. }
  6451. }
  6452. return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
  6453. }
  6454. function getUsefulRect(rects, bias) {
  6455. var rect = nullRect;
  6456. if (bias == "left") { for (var i = 0; i < rects.length; i++) {
  6457. if ((rect = rects[i]).left != rect.right) { break }
  6458. } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
  6459. if ((rect = rects[i$1]).left != rect.right) { break }
  6460. } }
  6461. return rect
  6462. }
  6463. function measureCharInner(cm, prepared, ch, bias) {
  6464. var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
  6465. var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
  6466. var rect;
  6467. if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
  6468. for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
  6469. while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
  6470. while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
  6471. if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
  6472. { rect = node.parentNode.getBoundingClientRect(); }
  6473. else
  6474. { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
  6475. if (rect.left || rect.right || start == 0) { break }
  6476. end = start;
  6477. start = start - 1;
  6478. collapse = "right";
  6479. }
  6480. if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
  6481. } else { // If it is a widget, simply get the box for the whole widget.
  6482. if (start > 0) { collapse = bias = "right"; }
  6483. var rects;
  6484. if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
  6485. { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
  6486. else
  6487. { rect = node.getBoundingClientRect(); }
  6488. }
  6489. if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
  6490. var rSpan = node.parentNode.getClientRects()[0];
  6491. if (rSpan)
  6492. { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
  6493. else
  6494. { rect = nullRect; }
  6495. }
  6496. var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
  6497. var mid = (rtop + rbot) / 2;
  6498. var heights = prepared.view.measure.heights;
  6499. var i = 0;
  6500. for (; i < heights.length - 1; i++)
  6501. { if (mid < heights[i]) { break } }
  6502. var top = i ? heights[i - 1] : 0, bot = heights[i];
  6503. var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
  6504. right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
  6505. top: top, bottom: bot};
  6506. if (!rect.left && !rect.right) { result.bogus = true; }
  6507. if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
  6508. return result
  6509. }
  6510. // Work around problem with bounding client rects on ranges being
  6511. // returned incorrectly when zoomed on IE10 and below.
  6512. function maybeUpdateRectForZooming(measure, rect) {
  6513. if (!window.screen || screen.logicalXDPI == null ||
  6514. screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
  6515. { return rect }
  6516. var scaleX = screen.logicalXDPI / screen.deviceXDPI;
  6517. var scaleY = screen.logicalYDPI / screen.deviceYDPI;
  6518. return {left: rect.left * scaleX, right: rect.right * scaleX,
  6519. top: rect.top * scaleY, bottom: rect.bottom * scaleY}
  6520. }
  6521. function clearLineMeasurementCacheFor(lineView) {
  6522. if (lineView.measure) {
  6523. lineView.measure.cache = {};
  6524. lineView.measure.heights = null;
  6525. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  6526. { lineView.measure.caches[i] = {}; } }
  6527. }
  6528. }
  6529. function clearLineMeasurementCache(cm) {
  6530. cm.display.externalMeasure = null;
  6531. removeChildren(cm.display.lineMeasure);
  6532. for (var i = 0; i < cm.display.view.length; i++)
  6533. { clearLineMeasurementCacheFor(cm.display.view[i]); }
  6534. }
  6535. function clearCaches(cm) {
  6536. clearLineMeasurementCache(cm);
  6537. cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
  6538. if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
  6539. cm.display.lineNumChars = null;
  6540. }
  6541. function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft }
  6542. function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop }
  6543. // Converts a {top, bottom, left, right} box from line-local
  6544. // coordinates into another coordinate system. Context may be one of
  6545. // "line", "div" (display.lineDiv), "local"./null (editor), "window",
  6546. // or "page".
  6547. function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
  6548. if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
  6549. var size = widgetHeight(lineObj.widgets[i]);
  6550. rect.top += size; rect.bottom += size;
  6551. } } }
  6552. if (context == "line") { return rect }
  6553. if (!context) { context = "local"; }
  6554. var yOff = heightAtLine(lineObj);
  6555. if (context == "local") { yOff += paddingTop(cm.display); }
  6556. else { yOff -= cm.display.viewOffset; }
  6557. if (context == "page" || context == "window") {
  6558. var lOff = cm.display.lineSpace.getBoundingClientRect();
  6559. yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
  6560. var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
  6561. rect.left += xOff; rect.right += xOff;
  6562. }
  6563. rect.top += yOff; rect.bottom += yOff;
  6564. return rect
  6565. }
  6566. // Coverts a box from "div" coords to another coordinate system.
  6567. // Context may be "window", "page", "div", or "local"./null.
  6568. function fromCoordSystem(cm, coords, context) {
  6569. if (context == "div") { return coords }
  6570. var left = coords.left, top = coords.top;
  6571. // First move into "page" coordinate system
  6572. if (context == "page") {
  6573. left -= pageScrollX();
  6574. top -= pageScrollY();
  6575. } else if (context == "local" || !context) {
  6576. var localBox = cm.display.sizer.getBoundingClientRect();
  6577. left += localBox.left;
  6578. top += localBox.top;
  6579. }
  6580. var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
  6581. return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
  6582. }
  6583. function charCoords(cm, pos, context, lineObj, bias) {
  6584. if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
  6585. return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
  6586. }
  6587. // Returns a box for a given cursor position, which may have an
  6588. // 'other' property containing the position of the secondary cursor
  6589. // on a bidi boundary.
  6590. // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
  6591. // and after `char - 1` in writing order of `char - 1`
  6592. // A cursor Pos(line, char, "after") is on the same visual line as `char`
  6593. // and before `char` in writing order of `char`
  6594. // Examples (upper-case letters are RTL, lower-case are LTR):
  6595. // Pos(0, 1, ...)
  6596. // before after
  6597. // ab a|b a|b
  6598. // aB a|B aB|
  6599. // Ab |Ab A|b
  6600. // AB B|A B|A
  6601. // Every position after the last character on a line is considered to stick
  6602. // to the last character on the line.
  6603. function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
  6604. lineObj = lineObj || getLine(cm.doc, pos.line);
  6605. if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
  6606. function get(ch, right) {
  6607. var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
  6608. if (right) { m.left = m.right; } else { m.right = m.left; }
  6609. return intoCoordSystem(cm, lineObj, m, context)
  6610. }
  6611. var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
  6612. if (ch >= lineObj.text.length) {
  6613. ch = lineObj.text.length;
  6614. sticky = "before";
  6615. } else if (ch <= 0) {
  6616. ch = 0;
  6617. sticky = "after";
  6618. }
  6619. if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
  6620. function getBidi(ch, partPos, invert) {
  6621. var part = order[partPos], right = (part.level % 2) != 0;
  6622. return get(invert ? ch - 1 : ch, right != invert)
  6623. }
  6624. var partPos = getBidiPartAt(order, ch, sticky);
  6625. var other = bidiOther;
  6626. var val = getBidi(ch, partPos, sticky == "before");
  6627. if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
  6628. return val
  6629. }
  6630. // Used to cheaply estimate the coordinates for a position. Used for
  6631. // intermediate scroll updates.
  6632. function estimateCoords(cm, pos) {
  6633. var left = 0;
  6634. pos = clipPos(cm.doc, pos);
  6635. if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
  6636. var lineObj = getLine(cm.doc, pos.line);
  6637. var top = heightAtLine(lineObj) + paddingTop(cm.display);
  6638. return {left: left, right: left, top: top, bottom: top + lineObj.height}
  6639. }
  6640. // Positions returned by coordsChar contain some extra information.
  6641. // xRel is the relative x position of the input coordinates compared
  6642. // to the found position (so xRel > 0 means the coordinates are to
  6643. // the right of the character position, for example). When outside
  6644. // is true, that means the coordinates lie outside the line's
  6645. // vertical range.
  6646. function PosWithInfo(line, ch, sticky, outside, xRel) {
  6647. var pos = Pos(line, ch, sticky);
  6648. pos.xRel = xRel;
  6649. if (outside) { pos.outside = true; }
  6650. return pos
  6651. }
  6652. // Compute the character position closest to the given coordinates.
  6653. // Input must be lineSpace-local ("div" coordinate system).
  6654. function coordsChar(cm, x, y) {
  6655. var doc = cm.doc;
  6656. y += cm.display.viewOffset;
  6657. if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
  6658. var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
  6659. if (lineN > last)
  6660. { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
  6661. if (x < 0) { x = 0; }
  6662. var lineObj = getLine(doc, lineN);
  6663. for (;;) {
  6664. var found = coordsCharInner(cm, lineObj, lineN, x, y);
  6665. var merged = collapsedSpanAtEnd(lineObj);
  6666. var mergedPos = merged && merged.find(0, true);
  6667. if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
  6668. { lineN = lineNo(lineObj = mergedPos.to.line); }
  6669. else
  6670. { return found }
  6671. }
  6672. }
  6673. function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
  6674. var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); };
  6675. var end = lineObj.text.length;
  6676. var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0);
  6677. end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end);
  6678. return {begin: begin, end: end}
  6679. }
  6680. function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
  6681. var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
  6682. return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
  6683. }
  6684. function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
  6685. y -= heightAtLine(lineObj);
  6686. var begin = 0, end = lineObj.text.length;
  6687. var preparedMeasure = prepareMeasureForLine(cm, lineObj);
  6688. var pos;
  6689. var order = getOrder(lineObj, cm.doc.direction);
  6690. if (order) {
  6691. if (cm.options.lineWrapping) {
  6692. var assign;
  6693. ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign));
  6694. }
  6695. pos = new Pos(lineNo$$1, begin);
  6696. var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left;
  6697. var dir = beginLeft < x ? 1 : -1;
  6698. var prevDiff, diff = beginLeft - x, prevPos;
  6699. do {
  6700. prevDiff = diff;
  6701. prevPos = pos;
  6702. pos = moveVisually(cm, lineObj, pos, dir);
  6703. if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
  6704. pos = prevPos;
  6705. break
  6706. }
  6707. diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x;
  6708. } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
  6709. if (Math.abs(diff) > Math.abs(prevDiff)) {
  6710. if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
  6711. pos = prevPos;
  6712. }
  6713. } else {
  6714. var ch = findFirst(function (ch) {
  6715. var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line");
  6716. if (box.top > y) {
  6717. // For the cursor stickiness
  6718. end = Math.min(ch, end);
  6719. return true
  6720. }
  6721. else if (box.bottom <= y) { return false }
  6722. else if (box.left > x) { return true }
  6723. else if (box.right < x) { return false }
  6724. else { return (x - box.left < box.right - x) }
  6725. }, begin, end);
  6726. ch = skipExtendingChars(lineObj.text, ch, 1);
  6727. pos = new Pos(lineNo$$1, ch, ch == end ? "before" : "after");
  6728. }
  6729. var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure);
  6730. if (y < coords.top || coords.bottom < y) { pos.outside = true; }
  6731. pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0);
  6732. return pos
  6733. }
  6734. var measureText;
  6735. // Compute the default text height.
  6736. function textHeight(display) {
  6737. if (display.cachedTextHeight != null) { return display.cachedTextHeight }
  6738. if (measureText == null) {
  6739. measureText = elt("pre");
  6740. // Measure a bunch of lines, for browsers that compute
  6741. // fractional heights.
  6742. for (var i = 0; i < 49; ++i) {
  6743. measureText.appendChild(document.createTextNode("x"));
  6744. measureText.appendChild(elt("br"));
  6745. }
  6746. measureText.appendChild(document.createTextNode("x"));
  6747. }
  6748. removeChildrenAndAdd(display.measure, measureText);
  6749. var height = measureText.offsetHeight / 50;
  6750. if (height > 3) { display.cachedTextHeight = height; }
  6751. removeChildren(display.measure);
  6752. return height || 1
  6753. }
  6754. // Compute the default character width.
  6755. function charWidth(display) {
  6756. if (display.cachedCharWidth != null) { return display.cachedCharWidth }
  6757. var anchor = elt("span", "xxxxxxxxxx");
  6758. var pre = elt("pre", [anchor]);
  6759. removeChildrenAndAdd(display.measure, pre);
  6760. var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
  6761. if (width > 2) { display.cachedCharWidth = width; }
  6762. return width || 10
  6763. }
  6764. // Do a bulk-read of the DOM positions and sizes needed to draw the
  6765. // view, so that we don't interleave reading and writing to the DOM.
  6766. function getDimensions(cm) {
  6767. var d = cm.display, left = {}, width = {};
  6768. var gutterLeft = d.gutters.clientLeft;
  6769. for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
  6770. left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
  6771. width[cm.options.gutters[i]] = n.clientWidth;
  6772. }
  6773. return {fixedPos: compensateForHScroll(d),
  6774. gutterTotalWidth: d.gutters.offsetWidth,
  6775. gutterLeft: left,
  6776. gutterWidth: width,
  6777. wrapperWidth: d.wrapper.clientWidth}
  6778. }
  6779. // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
  6780. // but using getBoundingClientRect to get a sub-pixel-accurate
  6781. // result.
  6782. function compensateForHScroll(display) {
  6783. return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
  6784. }
  6785. // Returns a function that estimates the height of a line, to use as
  6786. // first approximation until the line becomes visible (and is thus
  6787. // properly measurable).
  6788. function estimateHeight(cm) {
  6789. var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
  6790. var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
  6791. return function (line) {
  6792. if (lineIsHidden(cm.doc, line)) { return 0 }
  6793. var widgetsHeight = 0;
  6794. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
  6795. if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
  6796. } }
  6797. if (wrapping)
  6798. { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
  6799. else
  6800. { return widgetsHeight + th }
  6801. }
  6802. }
  6803. function estimateLineHeights(cm) {
  6804. var doc = cm.doc, est = estimateHeight(cm);
  6805. doc.iter(function (line) {
  6806. var estHeight = est(line);
  6807. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  6808. });
  6809. }
  6810. // Given a mouse event, find the corresponding position. If liberal
  6811. // is false, it checks whether a gutter or scrollbar was clicked,
  6812. // and returns null if it was. forRect is used by rectangular
  6813. // selections, and tries to estimate a character position even for
  6814. // coordinates beyond the right of the text.
  6815. function posFromMouse(cm, e, liberal, forRect) {
  6816. var display = cm.display;
  6817. if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
  6818. var x, y, space = display.lineSpace.getBoundingClientRect();
  6819. // Fails unpredictably on IE[67] when mouse is dragged around quickly.
  6820. try { x = e.clientX - space.left; y = e.clientY - space.top; }
  6821. catch (e) { return null }
  6822. var coords = coordsChar(cm, x, y), line;
  6823. if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
  6824. var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
  6825. coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
  6826. }
  6827. return coords
  6828. }
  6829. // Find the view element corresponding to a given line. Return null
  6830. // when the line isn't visible.
  6831. function findViewIndex(cm, n) {
  6832. if (n >= cm.display.viewTo) { return null }
  6833. n -= cm.display.viewFrom;
  6834. if (n < 0) { return null }
  6835. var view = cm.display.view;
  6836. for (var i = 0; i < view.length; i++) {
  6837. n -= view[i].size;
  6838. if (n < 0) { return i }
  6839. }
  6840. }
  6841. function updateSelection(cm) {
  6842. cm.display.input.showSelection(cm.display.input.prepareSelection());
  6843. }
  6844. function prepareSelection(cm, primary) {
  6845. var doc = cm.doc, result = {};
  6846. var curFragment = result.cursors = document.createDocumentFragment();
  6847. var selFragment = result.selection = document.createDocumentFragment();
  6848. for (var i = 0; i < doc.sel.ranges.length; i++) {
  6849. if (primary === false && i == doc.sel.primIndex) { continue }
  6850. var range$$1 = doc.sel.ranges[i];
  6851. if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
  6852. var collapsed = range$$1.empty();
  6853. if (collapsed || cm.options.showCursorWhenSelecting)
  6854. { drawSelectionCursor(cm, range$$1.head, curFragment); }
  6855. if (!collapsed)
  6856. { drawSelectionRange(cm, range$$1, selFragment); }
  6857. }
  6858. return result
  6859. }
  6860. // Draws a cursor for the given range
  6861. function drawSelectionCursor(cm, head, output) {
  6862. var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
  6863. var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
  6864. cursor.style.left = pos.left + "px";
  6865. cursor.style.top = pos.top + "px";
  6866. cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
  6867. if (pos.other) {
  6868. // Secondary cursor, shown when on a 'jump' in bi-directional text
  6869. var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
  6870. otherCursor.style.display = "";
  6871. otherCursor.style.left = pos.other.left + "px";
  6872. otherCursor.style.top = pos.other.top + "px";
  6873. otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
  6874. }
  6875. }
  6876. // Draws the given range as a highlighted selection
  6877. function drawSelectionRange(cm, range$$1, output) {
  6878. var display = cm.display, doc = cm.doc;
  6879. var fragment = document.createDocumentFragment();
  6880. var padding = paddingH(cm.display), leftSide = padding.left;
  6881. var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
  6882. function add(left, top, width, bottom) {
  6883. if (top < 0) { top = 0; }
  6884. top = Math.round(top);
  6885. bottom = Math.round(bottom);
  6886. 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")));
  6887. }
  6888. function drawForLine(line, fromArg, toArg) {
  6889. var lineObj = getLine(doc, line);
  6890. var lineLen = lineObj.text.length;
  6891. var start, end;
  6892. function coords(ch, bias) {
  6893. return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
  6894. }
  6895. iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
  6896. var leftPos = coords(from, "left"), rightPos, left, right;
  6897. if (from == to) {
  6898. rightPos = leftPos;
  6899. left = right = leftPos.left;
  6900. } else {
  6901. rightPos = coords(to - 1, "right");
  6902. if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
  6903. left = leftPos.left;
  6904. right = rightPos.right;
  6905. }
  6906. if (fromArg == null && from == 0) { left = leftSide; }
  6907. if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
  6908. add(left, leftPos.top, null, leftPos.bottom);
  6909. left = leftSide;
  6910. if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); }
  6911. }
  6912. if (toArg == null && to == lineLen) { right = rightSide; }
  6913. if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
  6914. { start = leftPos; }
  6915. if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
  6916. { end = rightPos; }
  6917. if (left < leftSide + 1) { left = leftSide; }
  6918. add(left, rightPos.top, right - left, rightPos.bottom);
  6919. });
  6920. return {start: start, end: end}
  6921. }
  6922. var sFrom = range$$1.from(), sTo = range$$1.to();
  6923. if (sFrom.line == sTo.line) {
  6924. drawForLine(sFrom.line, sFrom.ch, sTo.ch);
  6925. } else {
  6926. var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
  6927. var singleVLine = visualLine(fromLine) == visualLine(toLine);
  6928. var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
  6929. var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
  6930. if (singleVLine) {
  6931. if (leftEnd.top < rightStart.top - 2) {
  6932. add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
  6933. add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
  6934. } else {
  6935. add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
  6936. }
  6937. }
  6938. if (leftEnd.bottom < rightStart.top)
  6939. { add(leftSide, leftEnd.bottom, null, rightStart.top); }
  6940. }
  6941. output.appendChild(fragment);
  6942. }
  6943. // Cursor-blinking
  6944. function restartBlink(cm) {
  6945. if (!cm.state.focused) { return }
  6946. var display = cm.display;
  6947. clearInterval(display.blinker);
  6948. var on = true;
  6949. display.cursorDiv.style.visibility = "";
  6950. if (cm.options.cursorBlinkRate > 0)
  6951. { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
  6952. cm.options.cursorBlinkRate); }
  6953. else if (cm.options.cursorBlinkRate < 0)
  6954. { display.cursorDiv.style.visibility = "hidden"; }
  6955. }
  6956. function ensureFocus(cm) {
  6957. if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
  6958. }
  6959. function delayBlurEvent(cm) {
  6960. cm.state.delayingBlurEvent = true;
  6961. setTimeout(function () { if (cm.state.delayingBlurEvent) {
  6962. cm.state.delayingBlurEvent = false;
  6963. onBlur(cm);
  6964. } }, 100);
  6965. }
  6966. function onFocus(cm, e) {
  6967. if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
  6968. if (cm.options.readOnly == "nocursor") { return }
  6969. if (!cm.state.focused) {
  6970. signal(cm, "focus", cm, e);
  6971. cm.state.focused = true;
  6972. addClass(cm.display.wrapper, "CodeMirror-focused");
  6973. // This test prevents this from firing when a context
  6974. // menu is closed (since the input reset would kill the
  6975. // select-all detection hack)
  6976. if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
  6977. cm.display.input.reset();
  6978. if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
  6979. }
  6980. cm.display.input.receivedFocus();
  6981. }
  6982. restartBlink(cm);
  6983. }
  6984. function onBlur(cm, e) {
  6985. if (cm.state.delayingBlurEvent) { return }
  6986. if (cm.state.focused) {
  6987. signal(cm, "blur", cm, e);
  6988. cm.state.focused = false;
  6989. rmClass(cm.display.wrapper, "CodeMirror-focused");
  6990. }
  6991. clearInterval(cm.display.blinker);
  6992. setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
  6993. }
  6994. // Re-align line numbers and gutter marks to compensate for
  6995. // horizontal scrolling.
  6996. function alignHorizontally(cm) {
  6997. var display = cm.display, view = display.view;
  6998. if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
  6999. var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
  7000. var gutterW = display.gutters.offsetWidth, left = comp + "px";
  7001. for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
  7002. if (cm.options.fixedGutter) {
  7003. if (view[i].gutter)
  7004. { view[i].gutter.style.left = left; }
  7005. if (view[i].gutterBackground)
  7006. { view[i].gutterBackground.style.left = left; }
  7007. }
  7008. var align = view[i].alignable;
  7009. if (align) { for (var j = 0; j < align.length; j++)
  7010. { align[j].style.left = left; } }
  7011. } }
  7012. if (cm.options.fixedGutter)
  7013. { display.gutters.style.left = (comp + gutterW) + "px"; }
  7014. }
  7015. // Used to ensure that the line number gutter is still the right
  7016. // size for the current document size. Returns true when an update
  7017. // is needed.
  7018. function maybeUpdateLineNumberWidth(cm) {
  7019. if (!cm.options.lineNumbers) { return false }
  7020. var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
  7021. if (last.length != display.lineNumChars) {
  7022. var test = display.measure.appendChild(elt("div", [elt("div", last)],
  7023. "CodeMirror-linenumber CodeMirror-gutter-elt"));
  7024. var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
  7025. display.lineGutter.style.width = "";
  7026. display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
  7027. display.lineNumWidth = display.lineNumInnerWidth + padding;
  7028. display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
  7029. display.lineGutter.style.width = display.lineNumWidth + "px";
  7030. updateGutterSpace(cm);
  7031. return true
  7032. }
  7033. return false
  7034. }
  7035. // Read the actual heights of the rendered lines, and update their
  7036. // stored heights to match.
  7037. function updateHeightsInViewport(cm) {
  7038. var display = cm.display;
  7039. var prevBottom = display.lineDiv.offsetTop;
  7040. for (var i = 0; i < display.view.length; i++) {
  7041. var cur = display.view[i], height = (void 0);
  7042. if (cur.hidden) { continue }
  7043. if (ie && ie_version < 8) {
  7044. var bot = cur.node.offsetTop + cur.node.offsetHeight;
  7045. height = bot - prevBottom;
  7046. prevBottom = bot;
  7047. } else {
  7048. var box = cur.node.getBoundingClientRect();
  7049. height = box.bottom - box.top;
  7050. }
  7051. var diff = cur.line.height - height;
  7052. if (height < 2) { height = textHeight(display); }
  7053. if (diff > .001 || diff < -.001) {
  7054. updateLineHeight(cur.line, height);
  7055. updateWidgetHeight(cur.line);
  7056. if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
  7057. { updateWidgetHeight(cur.rest[j]); } }
  7058. }
  7059. }
  7060. }
  7061. // Read and store the height of line widgets associated with the
  7062. // given line.
  7063. function updateWidgetHeight(line) {
  7064. if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
  7065. { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }
  7066. }
  7067. // Compute the lines that are visible in a given viewport (defaults
  7068. // the the current scroll position). viewport may contain top,
  7069. // height, and ensure (see op.scrollToPos) properties.
  7070. function visibleLines(display, doc, viewport) {
  7071. var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
  7072. top = Math.floor(top - paddingTop(display));
  7073. var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
  7074. var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
  7075. // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
  7076. // forces those lines into the viewport (if possible).
  7077. if (viewport && viewport.ensure) {
  7078. var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
  7079. if (ensureFrom < from) {
  7080. from = ensureFrom;
  7081. to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
  7082. } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
  7083. from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
  7084. to = ensureTo;
  7085. }
  7086. }
  7087. return {from: from, to: Math.max(to, from + 1)}
  7088. }
  7089. // Sync the scrollable area and scrollbars, ensure the viewport
  7090. // covers the visible area.
  7091. function setScrollTop(cm, val) {
  7092. if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
  7093. cm.doc.scrollTop = val;
  7094. if (!gecko) { updateDisplaySimple(cm, {top: val}); }
  7095. if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
  7096. cm.display.scrollbars.setScrollTop(val);
  7097. if (gecko) { updateDisplaySimple(cm); }
  7098. startWorker(cm, 100);
  7099. }
  7100. // Sync scroller and scrollbar, ensure the gutter elements are
  7101. // aligned.
  7102. function setScrollLeft(cm, val, isScroller) {
  7103. if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return }
  7104. val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
  7105. cm.doc.scrollLeft = val;
  7106. alignHorizontally(cm);
  7107. if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
  7108. cm.display.scrollbars.setScrollLeft(val);
  7109. }
  7110. // Since the delta values reported on mouse wheel events are
  7111. // unstandardized between browsers and even browser versions, and
  7112. // generally horribly unpredictable, this code starts by measuring
  7113. // the scroll effect that the first few mouse wheel events have,
  7114. // and, from that, detects the way it can convert deltas to pixel
  7115. // offsets afterwards.
  7116. //
  7117. // The reason we want to know the amount a wheel event will scroll
  7118. // is that it gives us a chance to update the display before the
  7119. // actual scrolling happens, reducing flickering.
  7120. var wheelSamples = 0;
  7121. var wheelPixelsPerUnit = null;
  7122. // Fill in a browser-detected starting value on browsers where we
  7123. // know one. These don't have to be accurate -- the result of them
  7124. // being wrong would just be a slight flicker on the first wheel
  7125. // scroll (if it is large enough).
  7126. if (ie) { wheelPixelsPerUnit = -.53; }
  7127. else if (gecko) { wheelPixelsPerUnit = 15; }
  7128. else if (chrome) { wheelPixelsPerUnit = -.7; }
  7129. else if (safari) { wheelPixelsPerUnit = -1/3; }
  7130. function wheelEventDelta(e) {
  7131. var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
  7132. if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
  7133. if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
  7134. else if (dy == null) { dy = e.wheelDelta; }
  7135. return {x: dx, y: dy}
  7136. }
  7137. function wheelEventPixels(e) {
  7138. var delta = wheelEventDelta(e);
  7139. delta.x *= wheelPixelsPerUnit;
  7140. delta.y *= wheelPixelsPerUnit;
  7141. return delta
  7142. }
  7143. function onScrollWheel(cm, e) {
  7144. var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
  7145. var display = cm.display, scroll = display.scroller;
  7146. // Quit if there's nothing to scroll here
  7147. var canScrollX = scroll.scrollWidth > scroll.clientWidth;
  7148. var canScrollY = scroll.scrollHeight > scroll.clientHeight;
  7149. if (!(dx && canScrollX || dy && canScrollY)) { return }
  7150. // Webkit browsers on OS X abort momentum scrolls when the target
  7151. // of the scroll event is removed from the scrollable element.
  7152. // This hack (see related code in patchDisplay) makes sure the
  7153. // element is kept around.
  7154. if (dy && mac && webkit) {
  7155. outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
  7156. for (var i = 0; i < view.length; i++) {
  7157. if (view[i].node == cur) {
  7158. cm.display.currentWheelTarget = cur;
  7159. break outer
  7160. }
  7161. }
  7162. }
  7163. }
  7164. // On some browsers, horizontal scrolling will cause redraws to
  7165. // happen before the gutter has been realigned, causing it to
  7166. // wriggle around in a most unseemly way. When we have an
  7167. // estimated pixels/delta value, we just handle horizontal
  7168. // scrolling entirely here. It'll be slightly off from native, but
  7169. // better than glitching out.
  7170. if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
  7171. if (dy && canScrollY)
  7172. { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); }
  7173. setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
  7174. // Only prevent default scrolling if vertical scrolling is
  7175. // actually possible. Otherwise, it causes vertical scroll
  7176. // jitter on OSX trackpads when deltaX is small and deltaY
  7177. // is large (issue #3579)
  7178. if (!dy || (dy && canScrollY))
  7179. { e_preventDefault(e); }
  7180. display.wheelStartX = null; // Abort measurement, if in progress
  7181. return
  7182. }
  7183. // 'Project' the visible viewport to cover the area that is being
  7184. // scrolled into view (if we know enough to estimate it).
  7185. if (dy && wheelPixelsPerUnit != null) {
  7186. var pixels = dy * wheelPixelsPerUnit;
  7187. var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
  7188. if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
  7189. else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
  7190. updateDisplaySimple(cm, {top: top, bottom: bot});
  7191. }
  7192. if (wheelSamples < 20) {
  7193. if (display.wheelStartX == null) {
  7194. display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
  7195. display.wheelDX = dx; display.wheelDY = dy;
  7196. setTimeout(function () {
  7197. if (display.wheelStartX == null) { return }
  7198. var movedX = scroll.scrollLeft - display.wheelStartX;
  7199. var movedY = scroll.scrollTop - display.wheelStartY;
  7200. var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
  7201. (movedX && display.wheelDX && movedX / display.wheelDX);
  7202. display.wheelStartX = display.wheelStartY = null;
  7203. if (!sample) { return }
  7204. wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
  7205. ++wheelSamples;
  7206. }, 200);
  7207. } else {
  7208. display.wheelDX += dx; display.wheelDY += dy;
  7209. }
  7210. }
  7211. }
  7212. // SCROLLBARS
  7213. // Prepare DOM reads needed to update the scrollbars. Done in one
  7214. // shot to minimize update/measure roundtrips.
  7215. function measureForScrollbars(cm) {
  7216. var d = cm.display, gutterW = d.gutters.offsetWidth;
  7217. var docH = Math.round(cm.doc.height + paddingVert(cm.display));
  7218. return {
  7219. clientHeight: d.scroller.clientHeight,
  7220. viewHeight: d.wrapper.clientHeight,
  7221. scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
  7222. viewWidth: d.wrapper.clientWidth,
  7223. barLeft: cm.options.fixedGutter ? gutterW : 0,
  7224. docHeight: docH,
  7225. scrollHeight: docH + scrollGap(cm) + d.barHeight,
  7226. nativeBarWidth: d.nativeBarWidth,
  7227. gutterWidth: gutterW
  7228. }
  7229. }
  7230. var NativeScrollbars = function(place, scroll, cm) {
  7231. this.cm = cm;
  7232. var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
  7233. var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
  7234. place(vert); place(horiz);
  7235. on(vert, "scroll", function () {
  7236. if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
  7237. });
  7238. on(horiz, "scroll", function () {
  7239. if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
  7240. });
  7241. this.checkedZeroWidth = false;
  7242. // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
  7243. if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
  7244. };
  7245. NativeScrollbars.prototype.update = function (measure) {
  7246. var needsH = measure.scrollWidth > measure.clientWidth + 1;
  7247. var needsV = measure.scrollHeight > measure.clientHeight + 1;
  7248. var sWidth = measure.nativeBarWidth;
  7249. if (needsV) {
  7250. this.vert.style.display = "block";
  7251. this.vert.style.bottom = needsH ? sWidth + "px" : "0";
  7252. var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
  7253. // A bug in IE8 can cause this value to be negative, so guard it.
  7254. this.vert.firstChild.style.height =
  7255. Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
  7256. } else {
  7257. this.vert.style.display = "";
  7258. this.vert.firstChild.style.height = "0";
  7259. }
  7260. if (needsH) {
  7261. this.horiz.style.display = "block";
  7262. this.horiz.style.right = needsV ? sWidth + "px" : "0";
  7263. this.horiz.style.left = measure.barLeft + "px";
  7264. var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
  7265. this.horiz.firstChild.style.width =
  7266. Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
  7267. } else {
  7268. this.horiz.style.display = "";
  7269. this.horiz.firstChild.style.width = "0";
  7270. }
  7271. if (!this.checkedZeroWidth && measure.clientHeight > 0) {
  7272. if (sWidth == 0) { this.zeroWidthHack(); }
  7273. this.checkedZeroWidth = true;
  7274. }
  7275. return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
  7276. };
  7277. NativeScrollbars.prototype.setScrollLeft = function (pos) {
  7278. if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
  7279. if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz); }
  7280. };
  7281. NativeScrollbars.prototype.setScrollTop = function (pos) {
  7282. if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
  7283. if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert); }
  7284. };
  7285. NativeScrollbars.prototype.zeroWidthHack = function () {
  7286. var w = mac && !mac_geMountainLion ? "12px" : "18px";
  7287. this.horiz.style.height = this.vert.style.width = w;
  7288. this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
  7289. this.disableHoriz = new Delayed;
  7290. this.disableVert = new Delayed;
  7291. };
  7292. NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay) {
  7293. bar.style.pointerEvents = "auto";
  7294. function maybeDisable() {
  7295. // To find out whether the scrollbar is still visible, we
  7296. // check whether the element under the pixel in the bottom
  7297. // left corner of the scrollbar box is the scrollbar box
  7298. // itself (when the bar is still visible) or its filler child
  7299. // (when the bar is hidden). If it is still visible, we keep
  7300. // it enabled, if it's hidden, we disable pointer events.
  7301. var box = bar.getBoundingClientRect();
  7302. var elt$$1 = document.elementFromPoint(box.left + 1, box.bottom - 1);
  7303. if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
  7304. else { delay.set(1000, maybeDisable); }
  7305. }
  7306. delay.set(1000, maybeDisable);
  7307. };
  7308. NativeScrollbars.prototype.clear = function () {
  7309. var parent = this.horiz.parentNode;
  7310. parent.removeChild(this.horiz);
  7311. parent.removeChild(this.vert);
  7312. };
  7313. var NullScrollbars = function () {};
  7314. NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
  7315. NullScrollbars.prototype.setScrollLeft = function () {};
  7316. NullScrollbars.prototype.setScrollTop = function () {};
  7317. NullScrollbars.prototype.clear = function () {};
  7318. function updateScrollbars(cm, measure) {
  7319. if (!measure) { measure = measureForScrollbars(cm); }
  7320. var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
  7321. updateScrollbarsInner(cm, measure);
  7322. for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
  7323. if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
  7324. { updateHeightsInViewport(cm); }
  7325. updateScrollbarsInner(cm, measureForScrollbars(cm));
  7326. startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
  7327. }
  7328. }
  7329. // Re-synchronize the fake scrollbars with the actual size of the
  7330. // content.
  7331. function updateScrollbarsInner(cm, measure) {
  7332. var d = cm.display;
  7333. var sizes = d.scrollbars.update(measure);
  7334. d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
  7335. d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
  7336. d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
  7337. if (sizes.right && sizes.bottom) {
  7338. d.scrollbarFiller.style.display = "block";
  7339. d.scrollbarFiller.style.height = sizes.bottom + "px";
  7340. d.scrollbarFiller.style.width = sizes.right + "px";
  7341. } else { d.scrollbarFiller.style.display = ""; }
  7342. if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
  7343. d.gutterFiller.style.display = "block";
  7344. d.gutterFiller.style.height = sizes.bottom + "px";
  7345. d.gutterFiller.style.width = measure.gutterWidth + "px";
  7346. } else { d.gutterFiller.style.display = ""; }
  7347. }
  7348. var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
  7349. function initScrollbars(cm) {
  7350. if (cm.display.scrollbars) {
  7351. cm.display.scrollbars.clear();
  7352. if (cm.display.scrollbars.addClass)
  7353. { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  7354. }
  7355. cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
  7356. cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
  7357. // Prevent clicks in the scrollbars from killing focus
  7358. on(node, "mousedown", function () {
  7359. if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
  7360. });
  7361. node.setAttribute("cm-not-content", "true");
  7362. }, function (pos, axis) {
  7363. if (axis == "horizontal") { setScrollLeft(cm, pos); }
  7364. else { setScrollTop(cm, pos); }
  7365. }, cm);
  7366. if (cm.display.scrollbars.addClass)
  7367. { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  7368. }
  7369. // SCROLLING THINGS INTO VIEW
  7370. // If an editor sits on the top or bottom of the window, partially
  7371. // scrolled out of view, this ensures that the cursor is visible.
  7372. function maybeScrollWindow(cm, rect) {
  7373. if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
  7374. var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
  7375. if (rect.top + box.top < 0) { doScroll = true; }
  7376. else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
  7377. if (doScroll != null && !phantom) {
  7378. 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;"));
  7379. cm.display.lineSpace.appendChild(scrollNode);
  7380. scrollNode.scrollIntoView(doScroll);
  7381. cm.display.lineSpace.removeChild(scrollNode);
  7382. }
  7383. }
  7384. // Scroll a given position into view (immediately), verifying that
  7385. // it actually became visible (as line heights are accurately
  7386. // measured, the position of something may 'drift' during drawing).
  7387. function scrollPosIntoView(cm, pos, end, margin) {
  7388. if (margin == null) { margin = 0; }
  7389. var rect;
  7390. for (var limit = 0; limit < 5; limit++) {
  7391. var changed = false;
  7392. var coords = cursorCoords(cm, pos);
  7393. var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
  7394. rect = {left: Math.min(coords.left, endCoords.left),
  7395. top: Math.min(coords.top, endCoords.top) - margin,
  7396. right: Math.max(coords.left, endCoords.left),
  7397. bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
  7398. var scrollPos = calculateScrollPos(cm, rect);
  7399. var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
  7400. if (scrollPos.scrollTop != null) {
  7401. setScrollTop(cm, scrollPos.scrollTop);
  7402. if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
  7403. }
  7404. if (scrollPos.scrollLeft != null) {
  7405. setScrollLeft(cm, scrollPos.scrollLeft);
  7406. if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
  7407. }
  7408. if (!changed) { break }
  7409. }
  7410. return rect
  7411. }
  7412. // Scroll a given set of coordinates into view (immediately).
  7413. function scrollIntoView(cm, rect) {
  7414. var scrollPos = calculateScrollPos(cm, rect);
  7415. if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop); }
  7416. if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
  7417. }
  7418. // Calculate a new scroll position needed to scroll the given
  7419. // rectangle into view. Returns an object with scrollTop and
  7420. // scrollLeft properties. When these are undefined, the
  7421. // vertical/horizontal position does not need to be adjusted.
  7422. function calculateScrollPos(cm, rect) {
  7423. var display = cm.display, snapMargin = textHeight(cm.display);
  7424. if (rect.top < 0) { rect.top = 0; }
  7425. var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
  7426. var screen = displayHeight(cm), result = {};
  7427. if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
  7428. var docBottom = cm.doc.height + paddingVert(display);
  7429. var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
  7430. if (rect.top < screentop) {
  7431. result.scrollTop = atTop ? 0 : rect.top;
  7432. } else if (rect.bottom > screentop + screen) {
  7433. var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
  7434. if (newTop != screentop) { result.scrollTop = newTop; }
  7435. }
  7436. var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
  7437. var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
  7438. var tooWide = rect.right - rect.left > screenw;
  7439. if (tooWide) { rect.right = rect.left + screenw; }
  7440. if (rect.left < 10)
  7441. { result.scrollLeft = 0; }
  7442. else if (rect.left < screenleft)
  7443. { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
  7444. else if (rect.right > screenw + screenleft - 3)
  7445. { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
  7446. return result
  7447. }
  7448. // Store a relative adjustment to the scroll position in the current
  7449. // operation (to be applied when the operation finishes).
  7450. function addToScrollPos(cm, left, top) {
  7451. if (left != null || top != null) { resolveScrollToPos(cm); }
  7452. if (left != null)
  7453. { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; }
  7454. if (top != null)
  7455. { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
  7456. }
  7457. // Make sure that at the end of the operation the current cursor is
  7458. // shown.
  7459. function ensureCursorVisible(cm) {
  7460. resolveScrollToPos(cm);
  7461. var cur = cm.getCursor(), from = cur, to = cur;
  7462. if (!cm.options.lineWrapping) {
  7463. from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
  7464. to = Pos(cur.line, cur.ch + 1);
  7465. }
  7466. cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin};
  7467. }
  7468. // When an operation has its scrollToPos property set, and another
  7469. // scroll action is applied before the end of the operation, this
  7470. // 'simulates' scrolling that position into view in a cheap way, so
  7471. // that the effect of intermediate scroll commands is not ignored.
  7472. function resolveScrollToPos(cm) {
  7473. var range$$1 = cm.curOp.scrollToPos;
  7474. if (range$$1) {
  7475. cm.curOp.scrollToPos = null;
  7476. var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
  7477. var sPos = calculateScrollPos(cm, {
  7478. left: Math.min(from.left, to.left),
  7479. top: Math.min(from.top, to.top) - range$$1.margin,
  7480. right: Math.max(from.right, to.right),
  7481. bottom: Math.max(from.bottom, to.bottom) + range$$1.margin
  7482. });
  7483. cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  7484. }
  7485. }
  7486. // Operations are used to wrap a series of changes to the editor
  7487. // state in such a way that each change won't have to update the
  7488. // cursor and display (which would be awkward, slow, and
  7489. // error-prone). Instead, display updates are batched and then all
  7490. // combined and executed at once.
  7491. var nextOpId = 0;
  7492. // Start a new operation.
  7493. function startOperation(cm) {
  7494. cm.curOp = {
  7495. cm: cm,
  7496. viewChanged: false, // Flag that indicates that lines might need to be redrawn
  7497. startHeight: cm.doc.height, // Used to detect need to update scrollbar
  7498. forceUpdate: false, // Used to force a redraw
  7499. updateInput: null, // Whether to reset the input textarea
  7500. typing: false, // Whether this reset should be careful to leave existing text (for compositing)
  7501. changeObjs: null, // Accumulated changes, for firing change events
  7502. cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
  7503. cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
  7504. selectionChanged: false, // Whether the selection needs to be redrawn
  7505. updateMaxLine: false, // Set when the widest line needs to be determined anew
  7506. scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
  7507. scrollToPos: null, // Used to scroll to a specific position
  7508. focus: false,
  7509. id: ++nextOpId // Unique ID
  7510. };
  7511. pushOperation(cm.curOp);
  7512. }
  7513. // Finish an operation, updating the display and signalling delayed events
  7514. function endOperation(cm) {
  7515. var op = cm.curOp;
  7516. finishOperation(op, function (group) {
  7517. for (var i = 0; i < group.ops.length; i++)
  7518. { group.ops[i].cm.curOp = null; }
  7519. endOperations(group);
  7520. });
  7521. }
  7522. // The DOM updates done when an operation finishes are batched so
  7523. // that the minimum number of relayouts are required.
  7524. function endOperations(group) {
  7525. var ops = group.ops;
  7526. for (var i = 0; i < ops.length; i++) // Read DOM
  7527. { endOperation_R1(ops[i]); }
  7528. for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
  7529. { endOperation_W1(ops[i$1]); }
  7530. for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
  7531. { endOperation_R2(ops[i$2]); }
  7532. for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
  7533. { endOperation_W2(ops[i$3]); }
  7534. for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
  7535. { endOperation_finish(ops[i$4]); }
  7536. }
  7537. function endOperation_R1(op) {
  7538. var cm = op.cm, display = cm.display;
  7539. maybeClipScrollbars(cm);
  7540. if (op.updateMaxLine) { findMaxLine(cm); }
  7541. op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
  7542. op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
  7543. op.scrollToPos.to.line >= display.viewTo) ||
  7544. display.maxLineChanged && cm.options.lineWrapping;
  7545. op.update = op.mustUpdate &&
  7546. new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
  7547. }
  7548. function endOperation_W1(op) {
  7549. op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
  7550. }
  7551. function endOperation_R2(op) {
  7552. var cm = op.cm, display = cm.display;
  7553. if (op.updatedDisplay) { updateHeightsInViewport(cm); }
  7554. op.barMeasure = measureForScrollbars(cm);
  7555. // If the max line changed since it was last measured, measure it,
  7556. // and ensure the document's width matches it.
  7557. // updateDisplay_W2 will use these properties to do the actual resizing
  7558. if (display.maxLineChanged && !cm.options.lineWrapping) {
  7559. op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
  7560. cm.display.sizerWidth = op.adjustWidthTo;
  7561. op.barMeasure.scrollWidth =
  7562. Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
  7563. op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
  7564. }
  7565. if (op.updatedDisplay || op.selectionChanged)
  7566. { op.preparedSelection = display.input.prepareSelection(op.focus); }
  7567. }
  7568. function endOperation_W2(op) {
  7569. var cm = op.cm;
  7570. if (op.adjustWidthTo != null) {
  7571. cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
  7572. if (op.maxScrollLeft < cm.doc.scrollLeft)
  7573. { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
  7574. cm.display.maxLineChanged = false;
  7575. }
  7576. var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus());
  7577. if (op.preparedSelection)
  7578. { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
  7579. if (op.updatedDisplay || op.startHeight != cm.doc.height)
  7580. { updateScrollbars(cm, op.barMeasure); }
  7581. if (op.updatedDisplay)
  7582. { setDocumentHeight(cm, op.barMeasure); }
  7583. if (op.selectionChanged) { restartBlink(cm); }
  7584. if (cm.state.focused && op.updateInput)
  7585. { cm.display.input.reset(op.typing); }
  7586. if (takeFocus) { ensureFocus(op.cm); }
  7587. }
  7588. function endOperation_finish(op) {
  7589. var cm = op.cm, display = cm.display, doc = cm.doc;
  7590. if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
  7591. // Abort mouse wheel delta measurement, when scrolling explicitly
  7592. if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
  7593. { display.wheelStartX = display.wheelStartY = null; }
  7594. // Propagate the scroll position to the actual DOM scroller
  7595. if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
  7596. doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
  7597. display.scrollbars.setScrollTop(doc.scrollTop);
  7598. display.scroller.scrollTop = doc.scrollTop;
  7599. }
  7600. if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
  7601. doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
  7602. display.scrollbars.setScrollLeft(doc.scrollLeft);
  7603. display.scroller.scrollLeft = doc.scrollLeft;
  7604. alignHorizontally(cm);
  7605. }
  7606. // If we need to scroll a specific position into view, do so.
  7607. if (op.scrollToPos) {
  7608. var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
  7609. clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
  7610. maybeScrollWindow(cm, rect);
  7611. }
  7612. // Fire events for markers that are hidden/unidden by editing or
  7613. // undoing
  7614. var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
  7615. if (hidden) { for (var i = 0; i < hidden.length; ++i)
  7616. { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
  7617. if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
  7618. { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
  7619. if (display.wrapper.offsetHeight)
  7620. { doc.scrollTop = cm.display.scroller.scrollTop; }
  7621. // Fire change events, and delayed event handlers
  7622. if (op.changeObjs)
  7623. { signal(cm, "changes", cm, op.changeObjs); }
  7624. if (op.update)
  7625. { op.update.finish(); }
  7626. }
  7627. // Run the given function in an operation
  7628. function runInOp(cm, f) {
  7629. if (cm.curOp) { return f() }
  7630. startOperation(cm);
  7631. try { return f() }
  7632. finally { endOperation(cm); }
  7633. }
  7634. // Wraps a function in an operation. Returns the wrapped function.
  7635. function operation(cm, f) {
  7636. return function() {
  7637. if (cm.curOp) { return f.apply(cm, arguments) }
  7638. startOperation(cm);
  7639. try { return f.apply(cm, arguments) }
  7640. finally { endOperation(cm); }
  7641. }
  7642. }
  7643. // Used to add methods to editor and doc instances, wrapping them in
  7644. // operations.
  7645. function methodOp(f) {
  7646. return function() {
  7647. if (this.curOp) { return f.apply(this, arguments) }
  7648. startOperation(this);
  7649. try { return f.apply(this, arguments) }
  7650. finally { endOperation(this); }
  7651. }
  7652. }
  7653. function docMethodOp(f) {
  7654. return function() {
  7655. var cm = this.cm;
  7656. if (!cm || cm.curOp) { return f.apply(this, arguments) }
  7657. startOperation(cm);
  7658. try { return f.apply(this, arguments) }
  7659. finally { endOperation(cm); }
  7660. }
  7661. }
  7662. // Updates the display.view data structure for a given change to the
  7663. // document. From and to are in pre-change coordinates. Lendiff is
  7664. // the amount of lines added or subtracted by the change. This is
  7665. // used for changes that span multiple lines, or change the way
  7666. // lines are divided into visual lines. regLineChange (below)
  7667. // registers single-line changes.
  7668. function regChange(cm, from, to, lendiff) {
  7669. if (from == null) { from = cm.doc.first; }
  7670. if (to == null) { to = cm.doc.first + cm.doc.size; }
  7671. if (!lendiff) { lendiff = 0; }
  7672. var display = cm.display;
  7673. if (lendiff && to < display.viewTo &&
  7674. (display.updateLineNumbers == null || display.updateLineNumbers > from))
  7675. { display.updateLineNumbers = from; }
  7676. cm.curOp.viewChanged = true;
  7677. if (from >= display.viewTo) { // Change after
  7678. if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
  7679. { resetView(cm); }
  7680. } else if (to <= display.viewFrom) { // Change before
  7681. if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
  7682. resetView(cm);
  7683. } else {
  7684. display.viewFrom += lendiff;
  7685. display.viewTo += lendiff;
  7686. }
  7687. } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
  7688. resetView(cm);
  7689. } else if (from <= display.viewFrom) { // Top overlap
  7690. var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
  7691. if (cut) {
  7692. display.view = display.view.slice(cut.index);
  7693. display.viewFrom = cut.lineN;
  7694. display.viewTo += lendiff;
  7695. } else {
  7696. resetView(cm);
  7697. }
  7698. } else if (to >= display.viewTo) { // Bottom overlap
  7699. var cut$1 = viewCuttingPoint(cm, from, from, -1);
  7700. if (cut$1) {
  7701. display.view = display.view.slice(0, cut$1.index);
  7702. display.viewTo = cut$1.lineN;
  7703. } else {
  7704. resetView(cm);
  7705. }
  7706. } else { // Gap in the middle
  7707. var cutTop = viewCuttingPoint(cm, from, from, -1);
  7708. var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
  7709. if (cutTop && cutBot) {
  7710. display.view = display.view.slice(0, cutTop.index)
  7711. .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
  7712. .concat(display.view.slice(cutBot.index));
  7713. display.viewTo += lendiff;
  7714. } else {
  7715. resetView(cm);
  7716. }
  7717. }
  7718. var ext = display.externalMeasured;
  7719. if (ext) {
  7720. if (to < ext.lineN)
  7721. { ext.lineN += lendiff; }
  7722. else if (from < ext.lineN + ext.size)
  7723. { display.externalMeasured = null; }
  7724. }
  7725. }
  7726. // Register a change to a single line. Type must be one of "text",
  7727. // "gutter", "class", "widget"
  7728. function regLineChange(cm, line, type) {
  7729. cm.curOp.viewChanged = true;
  7730. var display = cm.display, ext = cm.display.externalMeasured;
  7731. if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
  7732. { display.externalMeasured = null; }
  7733. if (line < display.viewFrom || line >= display.viewTo) { return }
  7734. var lineView = display.view[findViewIndex(cm, line)];
  7735. if (lineView.node == null) { return }
  7736. var arr = lineView.changes || (lineView.changes = []);
  7737. if (indexOf(arr, type) == -1) { arr.push(type); }
  7738. }
  7739. // Clear the view.
  7740. function resetView(cm) {
  7741. cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
  7742. cm.display.view = [];
  7743. cm.display.viewOffset = 0;
  7744. }
  7745. function viewCuttingPoint(cm, oldN, newN, dir) {
  7746. var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
  7747. if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
  7748. { return {index: index, lineN: newN} }
  7749. var n = cm.display.viewFrom;
  7750. for (var i = 0; i < index; i++)
  7751. { n += view[i].size; }
  7752. if (n != oldN) {
  7753. if (dir > 0) {
  7754. if (index == view.length - 1) { return null }
  7755. diff = (n + view[index].size) - oldN;
  7756. index++;
  7757. } else {
  7758. diff = n - oldN;
  7759. }
  7760. oldN += diff; newN += diff;
  7761. }
  7762. while (visualLineNo(cm.doc, newN) != newN) {
  7763. if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
  7764. newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
  7765. index += dir;
  7766. }
  7767. return {index: index, lineN: newN}
  7768. }
  7769. // Force the view to cover a given range, adding empty view element
  7770. // or clipping off existing ones as needed.
  7771. function adjustView(cm, from, to) {
  7772. var display = cm.display, view = display.view;
  7773. if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
  7774. display.view = buildViewArray(cm, from, to);
  7775. display.viewFrom = from;
  7776. } else {
  7777. if (display.viewFrom > from)
  7778. { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
  7779. else if (display.viewFrom < from)
  7780. { display.view = display.view.slice(findViewIndex(cm, from)); }
  7781. display.viewFrom = from;
  7782. if (display.viewTo < to)
  7783. { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
  7784. else if (display.viewTo > to)
  7785. { display.view = display.view.slice(0, findViewIndex(cm, to)); }
  7786. }
  7787. display.viewTo = to;
  7788. }
  7789. // Count the number of lines in the view whose DOM representation is
  7790. // out of date (or nonexistent).
  7791. function countDirtyView(cm) {
  7792. var view = cm.display.view, dirty = 0;
  7793. for (var i = 0; i < view.length; i++) {
  7794. var lineView = view[i];
  7795. if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
  7796. }
  7797. return dirty
  7798. }
  7799. // HIGHLIGHT WORKER
  7800. function startWorker(cm, time) {
  7801. if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
  7802. { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
  7803. }
  7804. function highlightWorker(cm) {
  7805. var doc = cm.doc;
  7806. if (doc.frontier < doc.first) { doc.frontier = doc.first; }
  7807. if (doc.frontier >= cm.display.viewTo) { return }
  7808. var end = +new Date + cm.options.workTime;
  7809. var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
  7810. var changedLines = [];
  7811. doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
  7812. if (doc.frontier >= cm.display.viewFrom) { // Visible
  7813. var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
  7814. var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
  7815. line.styles = highlighted.styles;
  7816. var oldCls = line.styleClasses, newCls = highlighted.classes;
  7817. if (newCls) { line.styleClasses = newCls; }
  7818. else if (oldCls) { line.styleClasses = null; }
  7819. var ischange = !oldStyles || oldStyles.length != line.styles.length ||
  7820. oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
  7821. for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
  7822. if (ischange) { changedLines.push(doc.frontier); }
  7823. line.stateAfter = tooLong ? state : copyState(doc.mode, state);
  7824. } else {
  7825. if (line.text.length <= cm.options.maxHighlightLength)
  7826. { processLine(cm, line.text, state); }
  7827. line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
  7828. }
  7829. ++doc.frontier;
  7830. if (+new Date > end) {
  7831. startWorker(cm, cm.options.workDelay);
  7832. return true
  7833. }
  7834. });
  7835. if (changedLines.length) { runInOp(cm, function () {
  7836. for (var i = 0; i < changedLines.length; i++)
  7837. { regLineChange(cm, changedLines[i], "text"); }
  7838. }); }
  7839. }
  7840. // DISPLAY DRAWING
  7841. var DisplayUpdate = function(cm, viewport, force) {
  7842. var display = cm.display;
  7843. this.viewport = viewport;
  7844. // Store some values that we'll need later (but don't want to force a relayout for)
  7845. this.visible = visibleLines(display, cm.doc, viewport);
  7846. this.editorIsHidden = !display.wrapper.offsetWidth;
  7847. this.wrapperHeight = display.wrapper.clientHeight;
  7848. this.wrapperWidth = display.wrapper.clientWidth;
  7849. this.oldDisplayWidth = displayWidth(cm);
  7850. this.force = force;
  7851. this.dims = getDimensions(cm);
  7852. this.events = [];
  7853. };
  7854. DisplayUpdate.prototype.signal = function (emitter, type) {
  7855. if (hasHandler(emitter, type))
  7856. { this.events.push(arguments); }
  7857. };
  7858. DisplayUpdate.prototype.finish = function () {
  7859. var this$1 = this;
  7860. for (var i = 0; i < this.events.length; i++)
  7861. { signal.apply(null, this$1.events[i]); }
  7862. };
  7863. function maybeClipScrollbars(cm) {
  7864. var display = cm.display;
  7865. if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
  7866. display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
  7867. display.heightForcer.style.height = scrollGap(cm) + "px";
  7868. display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
  7869. display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
  7870. display.scrollbarsClipped = true;
  7871. }
  7872. }
  7873. // Does the actual updating of the line display. Bails out
  7874. // (returning false) when there is nothing to be done and forced is
  7875. // false.
  7876. function updateDisplayIfNeeded(cm, update) {
  7877. var display = cm.display, doc = cm.doc;
  7878. if (update.editorIsHidden) {
  7879. resetView(cm);
  7880. return false
  7881. }
  7882. // Bail out if the visible area is already rendered and nothing changed.
  7883. if (!update.force &&
  7884. update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
  7885. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
  7886. display.renderedView == display.view && countDirtyView(cm) == 0)
  7887. { return false }
  7888. if (maybeUpdateLineNumberWidth(cm)) {
  7889. resetView(cm);
  7890. update.dims = getDimensions(cm);
  7891. }
  7892. // Compute a suitable new viewport (from & to)
  7893. var end = doc.first + doc.size;
  7894. var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
  7895. var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
  7896. if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
  7897. if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
  7898. if (sawCollapsedSpans) {
  7899. from = visualLineNo(cm.doc, from);
  7900. to = visualLineEndNo(cm.doc, to);
  7901. }
  7902. var different = from != display.viewFrom || to != display.viewTo ||
  7903. display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
  7904. adjustView(cm, from, to);
  7905. display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
  7906. // Position the mover div to align with the current scroll position
  7907. cm.display.mover.style.top = display.viewOffset + "px";
  7908. var toUpdate = countDirtyView(cm);
  7909. if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
  7910. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
  7911. { return false }
  7912. // For big changes, we hide the enclosing element during the
  7913. // update, since that speeds up the operations on most browsers.
  7914. var focused = activeElt();
  7915. if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
  7916. patchDisplay(cm, display.updateLineNumbers, update.dims);
  7917. if (toUpdate > 4) { display.lineDiv.style.display = ""; }
  7918. display.renderedView = display.view;
  7919. // There might have been a widget with a focused element that got
  7920. // hidden or updated, if so re-focus it.
  7921. if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus(); }
  7922. // Prevent selection and cursors from interfering with the scroll
  7923. // width and height.
  7924. removeChildren(display.cursorDiv);
  7925. removeChildren(display.selectionDiv);
  7926. display.gutters.style.height = display.sizer.style.minHeight = 0;
  7927. if (different) {
  7928. display.lastWrapHeight = update.wrapperHeight;
  7929. display.lastWrapWidth = update.wrapperWidth;
  7930. startWorker(cm, 400);
  7931. }
  7932. display.updateLineNumbers = null;
  7933. return true
  7934. }
  7935. function postUpdateDisplay(cm, update) {
  7936. var viewport = update.viewport;
  7937. for (var first = true;; first = false) {
  7938. if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
  7939. // Clip forced viewport to actual scrollable area.
  7940. if (viewport && viewport.top != null)
  7941. { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
  7942. // Updated line heights might result in the drawn area not
  7943. // actually covering the viewport. Keep looping until it does.
  7944. update.visible = visibleLines(cm.display, cm.doc, viewport);
  7945. if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
  7946. { break }
  7947. }
  7948. if (!updateDisplayIfNeeded(cm, update)) { break }
  7949. updateHeightsInViewport(cm);
  7950. var barMeasure = measureForScrollbars(cm);
  7951. updateSelection(cm);
  7952. updateScrollbars(cm, barMeasure);
  7953. setDocumentHeight(cm, barMeasure);
  7954. }
  7955. update.signal(cm, "update", cm);
  7956. if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
  7957. update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
  7958. cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
  7959. }
  7960. }
  7961. function updateDisplaySimple(cm, viewport) {
  7962. var update = new DisplayUpdate(cm, viewport);
  7963. if (updateDisplayIfNeeded(cm, update)) {
  7964. updateHeightsInViewport(cm);
  7965. postUpdateDisplay(cm, update);
  7966. var barMeasure = measureForScrollbars(cm);
  7967. updateSelection(cm);
  7968. updateScrollbars(cm, barMeasure);
  7969. setDocumentHeight(cm, barMeasure);
  7970. update.finish();
  7971. }
  7972. }
  7973. // Sync the actual display DOM structure with display.view, removing
  7974. // nodes for lines that are no longer in view, and creating the ones
  7975. // that are not there yet, and updating the ones that are out of
  7976. // date.
  7977. function patchDisplay(cm, updateNumbersFrom, dims) {
  7978. var display = cm.display, lineNumbers = cm.options.lineNumbers;
  7979. var container = display.lineDiv, cur = container.firstChild;
  7980. function rm(node) {
  7981. var next = node.nextSibling;
  7982. // Works around a throw-scroll bug in OS X Webkit
  7983. if (webkit && mac && cm.display.currentWheelTarget == node)
  7984. { node.style.display = "none"; }
  7985. else
  7986. { node.parentNode.removeChild(node); }
  7987. return next
  7988. }
  7989. var view = display.view, lineN = display.viewFrom;
  7990. // Loop over the elements in the view, syncing cur (the DOM nodes
  7991. // in display.lineDiv) with the view as we go.
  7992. for (var i = 0; i < view.length; i++) {
  7993. var lineView = view[i];
  7994. if (lineView.hidden) {
  7995. } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
  7996. var node = buildLineElement(cm, lineView, lineN, dims);
  7997. container.insertBefore(node, cur);
  7998. } else { // Already drawn
  7999. while (cur != lineView.node) { cur = rm(cur); }
  8000. var updateNumber = lineNumbers && updateNumbersFrom != null &&
  8001. updateNumbersFrom <= lineN && lineView.lineNumber;
  8002. if (lineView.changes) {
  8003. if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
  8004. updateLineForChanges(cm, lineView, lineN, dims);
  8005. }
  8006. if (updateNumber) {
  8007. removeChildren(lineView.lineNumber);
  8008. lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
  8009. }
  8010. cur = lineView.node.nextSibling;
  8011. }
  8012. lineN += lineView.size;
  8013. }
  8014. while (cur) { cur = rm(cur); }
  8015. }
  8016. function updateGutterSpace(cm) {
  8017. var width = cm.display.gutters.offsetWidth;
  8018. cm.display.sizer.style.marginLeft = width + "px";
  8019. }
  8020. function setDocumentHeight(cm, measure) {
  8021. cm.display.sizer.style.minHeight = measure.docHeight + "px";
  8022. cm.display.heightForcer.style.top = measure.docHeight + "px";
  8023. cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
  8024. }
  8025. // Rebuild the gutter elements, ensure the margin to the left of the
  8026. // code matches their width.
  8027. function updateGutters(cm) {
  8028. var gutters = cm.display.gutters, specs = cm.options.gutters;
  8029. removeChildren(gutters);
  8030. var i = 0;
  8031. for (; i < specs.length; ++i) {
  8032. var gutterClass = specs[i];
  8033. var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
  8034. if (gutterClass == "CodeMirror-linenumbers") {
  8035. cm.display.lineGutter = gElt;
  8036. gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
  8037. }
  8038. }
  8039. gutters.style.display = i ? "" : "none";
  8040. updateGutterSpace(cm);
  8041. }
  8042. // Make sure the gutters options contains the element
  8043. // "CodeMirror-linenumbers" when the lineNumbers option is true.
  8044. function setGuttersForLineNumbers(options) {
  8045. var found = indexOf(options.gutters, "CodeMirror-linenumbers");
  8046. if (found == -1 && options.lineNumbers) {
  8047. options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
  8048. } else if (found > -1 && !options.lineNumbers) {
  8049. options.gutters = options.gutters.slice(0);
  8050. options.gutters.splice(found, 1);
  8051. }
  8052. }
  8053. // Selection objects are immutable. A new one is created every time
  8054. // the selection changes. A selection is one or more non-overlapping
  8055. // (and non-touching) ranges, sorted, and an integer that indicates
  8056. // which one is the primary selection (the one that's scrolled into
  8057. // view, that getCursor returns, etc).
  8058. var Selection = function(ranges, primIndex) {
  8059. this.ranges = ranges;
  8060. this.primIndex = primIndex;
  8061. };
  8062. Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
  8063. Selection.prototype.equals = function (other) {
  8064. var this$1 = this;
  8065. if (other == this) { return true }
  8066. if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
  8067. for (var i = 0; i < this.ranges.length; i++) {
  8068. var here = this$1.ranges[i], there = other.ranges[i];
  8069. if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
  8070. }
  8071. return true
  8072. };
  8073. Selection.prototype.deepCopy = function () {
  8074. var this$1 = this;
  8075. var out = [];
  8076. for (var i = 0; i < this.ranges.length; i++)
  8077. { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
  8078. return new Selection(out, this.primIndex)
  8079. };
  8080. Selection.prototype.somethingSelected = function () {
  8081. var this$1 = this;
  8082. for (var i = 0; i < this.ranges.length; i++)
  8083. { if (!this$1.ranges[i].empty()) { return true } }
  8084. return false
  8085. };
  8086. Selection.prototype.contains = function (pos, end) {
  8087. var this$1 = this;
  8088. if (!end) { end = pos; }
  8089. for (var i = 0; i < this.ranges.length; i++) {
  8090. var range = this$1.ranges[i];
  8091. if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
  8092. { return i }
  8093. }
  8094. return -1
  8095. };
  8096. var Range = function(anchor, head) {
  8097. this.anchor = anchor; this.head = head;
  8098. };
  8099. Range.prototype.from = function () { return minPos(this.anchor, this.head) };
  8100. Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
  8101. Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
  8102. // Take an unsorted, potentially overlapping set of ranges, and
  8103. // build a selection out of it. 'Consumes' ranges array (modifying
  8104. // it).
  8105. function normalizeSelection(ranges, primIndex) {
  8106. var prim = ranges[primIndex];
  8107. ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
  8108. primIndex = indexOf(ranges, prim);
  8109. for (var i = 1; i < ranges.length; i++) {
  8110. var cur = ranges[i], prev = ranges[i - 1];
  8111. if (cmp(prev.to(), cur.from()) >= 0) {
  8112. var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
  8113. var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
  8114. if (i <= primIndex) { --primIndex; }
  8115. ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
  8116. }
  8117. }
  8118. return new Selection(ranges, primIndex)
  8119. }
  8120. function simpleSelection(anchor, head) {
  8121. return new Selection([new Range(anchor, head || anchor)], 0)
  8122. }
  8123. // Compute the position of the end of a change (its 'to' property
  8124. // refers to the pre-change end).
  8125. function changeEnd(change) {
  8126. if (!change.text) { return change.to }
  8127. return Pos(change.from.line + change.text.length - 1,
  8128. lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
  8129. }
  8130. // Adjust a position to refer to the post-change position of the
  8131. // same text, or the end of the change if the change covers it.
  8132. function adjustForChange(pos, change) {
  8133. if (cmp(pos, change.from) < 0) { return pos }
  8134. if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
  8135. var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
  8136. if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
  8137. return Pos(line, ch)
  8138. }
  8139. function computeSelAfterChange(doc, change) {
  8140. var out = [];
  8141. for (var i = 0; i < doc.sel.ranges.length; i++) {
  8142. var range = doc.sel.ranges[i];
  8143. out.push(new Range(adjustForChange(range.anchor, change),
  8144. adjustForChange(range.head, change)));
  8145. }
  8146. return normalizeSelection(out, doc.sel.primIndex)
  8147. }
  8148. function offsetPos(pos, old, nw) {
  8149. if (pos.line == old.line)
  8150. { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
  8151. else
  8152. { return Pos(nw.line + (pos.line - old.line), pos.ch) }
  8153. }
  8154. // Used by replaceSelections to allow moving the selection to the
  8155. // start or around the replaced test. Hint may be "start" or "around".
  8156. function computeReplacedSel(doc, changes, hint) {
  8157. var out = [];
  8158. var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
  8159. for (var i = 0; i < changes.length; i++) {
  8160. var change = changes[i];
  8161. var from = offsetPos(change.from, oldPrev, newPrev);
  8162. var to = offsetPos(changeEnd(change), oldPrev, newPrev);
  8163. oldPrev = change.to;
  8164. newPrev = to;
  8165. if (hint == "around") {
  8166. var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
  8167. out[i] = new Range(inv ? to : from, inv ? from : to);
  8168. } else {
  8169. out[i] = new Range(from, from);
  8170. }
  8171. }
  8172. return new Selection(out, doc.sel.primIndex)
  8173. }
  8174. // Used to get the editor into a consistent state again when options change.
  8175. function loadMode(cm) {
  8176. cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
  8177. resetModeState(cm);
  8178. }
  8179. function resetModeState(cm) {
  8180. cm.doc.iter(function (line) {
  8181. if (line.stateAfter) { line.stateAfter = null; }
  8182. if (line.styles) { line.styles = null; }
  8183. });
  8184. cm.doc.frontier = cm.doc.first;
  8185. startWorker(cm, 100);
  8186. cm.state.modeGen++;
  8187. if (cm.curOp) { regChange(cm); }
  8188. }
  8189. // DOCUMENT DATA STRUCTURE
  8190. // By default, updates that start and end at the beginning of a line
  8191. // are treated specially, in order to make the association of line
  8192. // widgets and marker elements with the text behave more intuitive.
  8193. function isWholeLineUpdate(doc, change) {
  8194. return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
  8195. (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
  8196. }
  8197. // Perform a change on the document data structure.
  8198. function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
  8199. function spansFor(n) {return markedSpans ? markedSpans[n] : null}
  8200. function update(line, text, spans) {
  8201. updateLine(line, text, spans, estimateHeight$$1);
  8202. signalLater(line, "change", line, change);
  8203. }
  8204. function linesFor(start, end) {
  8205. var result = [];
  8206. for (var i = start; i < end; ++i)
  8207. { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
  8208. return result
  8209. }
  8210. var from = change.from, to = change.to, text = change.text;
  8211. var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
  8212. var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
  8213. // Adjust the line structure
  8214. if (change.full) {
  8215. doc.insert(0, linesFor(0, text.length));
  8216. doc.remove(text.length, doc.size - text.length);
  8217. } else if (isWholeLineUpdate(doc, change)) {
  8218. // This is a whole-line replace. Treated specially to make
  8219. // sure line objects move the way they are supposed to.
  8220. var added = linesFor(0, text.length - 1);
  8221. update(lastLine, lastLine.text, lastSpans);
  8222. if (nlines) { doc.remove(from.line, nlines); }
  8223. if (added.length) { doc.insert(from.line, added); }
  8224. } else if (firstLine == lastLine) {
  8225. if (text.length == 1) {
  8226. update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
  8227. } else {
  8228. var added$1 = linesFor(1, text.length - 1);
  8229. added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
  8230. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  8231. doc.insert(from.line + 1, added$1);
  8232. }
  8233. } else if (text.length == 1) {
  8234. update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
  8235. doc.remove(from.line + 1, nlines);
  8236. } else {
  8237. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  8238. update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
  8239. var added$2 = linesFor(1, text.length - 1);
  8240. if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
  8241. doc.insert(from.line + 1, added$2);
  8242. }
  8243. signalLater(doc, "change", doc, change);
  8244. }
  8245. // Call f for all linked documents.
  8246. function linkedDocs(doc, f, sharedHistOnly) {
  8247. function propagate(doc, skip, sharedHist) {
  8248. if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
  8249. var rel = doc.linked[i];
  8250. if (rel.doc == skip) { continue }
  8251. var shared = sharedHist && rel.sharedHist;
  8252. if (sharedHistOnly && !shared) { continue }
  8253. f(rel.doc, shared);
  8254. propagate(rel.doc, doc, shared);
  8255. } }
  8256. }
  8257. propagate(doc, null, true);
  8258. }
  8259. // Attach a document to an editor.
  8260. function attachDoc(cm, doc) {
  8261. if (doc.cm) { throw new Error("This document is already in use.") }
  8262. cm.doc = doc;
  8263. doc.cm = cm;
  8264. estimateLineHeights(cm);
  8265. loadMode(cm);
  8266. setDirectionClass(cm);
  8267. if (!cm.options.lineWrapping) { findMaxLine(cm); }
  8268. cm.options.mode = doc.modeOption;
  8269. regChange(cm);
  8270. }
  8271. function setDirectionClass(cm) {
  8272. (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
  8273. }
  8274. function directionChanged(cm) {
  8275. runInOp(cm, function () {
  8276. setDirectionClass(cm);
  8277. regChange(cm);
  8278. });
  8279. }
  8280. function History(startGen) {
  8281. // Arrays of change events and selections. Doing something adds an
  8282. // event to done and clears undo. Undoing moves events from done
  8283. // to undone, redoing moves them in the other direction.
  8284. this.done = []; this.undone = [];
  8285. this.undoDepth = Infinity;
  8286. // Used to track when changes can be merged into a single undo
  8287. // event
  8288. this.lastModTime = this.lastSelTime = 0;
  8289. this.lastOp = this.lastSelOp = null;
  8290. this.lastOrigin = this.lastSelOrigin = null;
  8291. // Used by the isClean() method
  8292. this.generation = this.maxGeneration = startGen || 1;
  8293. }
  8294. // Create a history change event from an updateDoc-style change
  8295. // object.
  8296. function historyChangeFromChange(doc, change) {
  8297. var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
  8298. attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
  8299. linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
  8300. return histChange
  8301. }
  8302. // Pop all selection events off the end of a history array. Stop at
  8303. // a change event.
  8304. function clearSelectionEvents(array) {
  8305. while (array.length) {
  8306. var last = lst(array);
  8307. if (last.ranges) { array.pop(); }
  8308. else { break }
  8309. }
  8310. }
  8311. // Find the top change event in the history. Pop off selection
  8312. // events that are in the way.
  8313. function lastChangeEvent(hist, force) {
  8314. if (force) {
  8315. clearSelectionEvents(hist.done);
  8316. return lst(hist.done)
  8317. } else if (hist.done.length && !lst(hist.done).ranges) {
  8318. return lst(hist.done)
  8319. } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
  8320. hist.done.pop();
  8321. return lst(hist.done)
  8322. }
  8323. }
  8324. // Register a change in the history. Merges changes that are within
  8325. // a single operation, or are close together with an origin that
  8326. // allows merging (starting with "+") into a single event.
  8327. function addChangeToHistory(doc, change, selAfter, opId) {
  8328. var hist = doc.history;
  8329. hist.undone.length = 0;
  8330. var time = +new Date, cur;
  8331. var last;
  8332. if ((hist.lastOp == opId ||
  8333. hist.lastOrigin == change.origin && change.origin &&
  8334. ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
  8335. change.origin.charAt(0) == "*")) &&
  8336. (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
  8337. // Merge this change into the last event
  8338. last = lst(cur.changes);
  8339. if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
  8340. // Optimized case for simple insertion -- don't want to add
  8341. // new changesets for every character typed
  8342. last.to = changeEnd(change);
  8343. } else {
  8344. // Add new sub-event
  8345. cur.changes.push(historyChangeFromChange(doc, change));
  8346. }
  8347. } else {
  8348. // Can not be merged, start a new event.
  8349. var before = lst(hist.done);
  8350. if (!before || !before.ranges)
  8351. { pushSelectionToHistory(doc.sel, hist.done); }
  8352. cur = {changes: [historyChangeFromChange(doc, change)],
  8353. generation: hist.generation};
  8354. hist.done.push(cur);
  8355. while (hist.done.length > hist.undoDepth) {
  8356. hist.done.shift();
  8357. if (!hist.done[0].ranges) { hist.done.shift(); }
  8358. }
  8359. }
  8360. hist.done.push(selAfter);
  8361. hist.generation = ++hist.maxGeneration;
  8362. hist.lastModTime = hist.lastSelTime = time;
  8363. hist.lastOp = hist.lastSelOp = opId;
  8364. hist.lastOrigin = hist.lastSelOrigin = change.origin;
  8365. if (!last) { signal(doc, "historyAdded"); }
  8366. }
  8367. function selectionEventCanBeMerged(doc, origin, prev, sel) {
  8368. var ch = origin.charAt(0);
  8369. return ch == "*" ||
  8370. ch == "+" &&
  8371. prev.ranges.length == sel.ranges.length &&
  8372. prev.somethingSelected() == sel.somethingSelected() &&
  8373. new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
  8374. }
  8375. // Called whenever the selection changes, sets the new selection as
  8376. // the pending selection in the history, and pushes the old pending
  8377. // selection into the 'done' array when it was significantly
  8378. // different (in number of selected ranges, emptiness, or time).
  8379. function addSelectionToHistory(doc, sel, opId, options) {
  8380. var hist = doc.history, origin = options && options.origin;
  8381. // A new event is started when the previous origin does not match
  8382. // the current, or the origins don't allow matching. Origins
  8383. // starting with * are always merged, those starting with + are
  8384. // merged when similar and close together in time.
  8385. if (opId == hist.lastSelOp ||
  8386. (origin && hist.lastSelOrigin == origin &&
  8387. (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
  8388. selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
  8389. { hist.done[hist.done.length - 1] = sel; }
  8390. else
  8391. { pushSelectionToHistory(sel, hist.done); }
  8392. hist.lastSelTime = +new Date;
  8393. hist.lastSelOrigin = origin;
  8394. hist.lastSelOp = opId;
  8395. if (options && options.clearRedo !== false)
  8396. { clearSelectionEvents(hist.undone); }
  8397. }
  8398. function pushSelectionToHistory(sel, dest) {
  8399. var top = lst(dest);
  8400. if (!(top && top.ranges && top.equals(sel)))
  8401. { dest.push(sel); }
  8402. }
  8403. // Used to store marked span information in the history.
  8404. function attachLocalSpans(doc, change, from, to) {
  8405. var existing = change["spans_" + doc.id], n = 0;
  8406. doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
  8407. if (line.markedSpans)
  8408. { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
  8409. ++n;
  8410. });
  8411. }
  8412. // When un/re-doing restores text containing marked spans, those
  8413. // that have been explicitly cleared should not be restored.
  8414. function removeClearedSpans(spans) {
  8415. if (!spans) { return null }
  8416. var out;
  8417. for (var i = 0; i < spans.length; ++i) {
  8418. if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
  8419. else if (out) { out.push(spans[i]); }
  8420. }
  8421. return !out ? spans : out.length ? out : null
  8422. }
  8423. // Retrieve and filter the old marked spans stored in a change event.
  8424. function getOldSpans(doc, change) {
  8425. var found = change["spans_" + doc.id];
  8426. if (!found) { return null }
  8427. var nw = [];
  8428. for (var i = 0; i < change.text.length; ++i)
  8429. { nw.push(removeClearedSpans(found[i])); }
  8430. return nw
  8431. }
  8432. // Used for un/re-doing changes from the history. Combines the
  8433. // result of computing the existing spans with the set of spans that
  8434. // existed in the history (so that deleting around a span and then
  8435. // undoing brings back the span).
  8436. function mergeOldSpans(doc, change) {
  8437. var old = getOldSpans(doc, change);
  8438. var stretched = stretchSpansOverChange(doc, change);
  8439. if (!old) { return stretched }
  8440. if (!stretched) { return old }
  8441. for (var i = 0; i < old.length; ++i) {
  8442. var oldCur = old[i], stretchCur = stretched[i];
  8443. if (oldCur && stretchCur) {
  8444. spans: for (var j = 0; j < stretchCur.length; ++j) {
  8445. var span = stretchCur[j];
  8446. for (var k = 0; k < oldCur.length; ++k)
  8447. { if (oldCur[k].marker == span.marker) { continue spans } }
  8448. oldCur.push(span);
  8449. }
  8450. } else if (stretchCur) {
  8451. old[i] = stretchCur;
  8452. }
  8453. }
  8454. return old
  8455. }
  8456. // Used both to provide a JSON-safe object in .getHistory, and, when
  8457. // detaching a document, to split the history in two
  8458. function copyHistoryArray(events, newGroup, instantiateSel) {
  8459. var copy = [];
  8460. for (var i = 0; i < events.length; ++i) {
  8461. var event = events[i];
  8462. if (event.ranges) {
  8463. copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
  8464. continue
  8465. }
  8466. var changes = event.changes, newChanges = [];
  8467. copy.push({changes: newChanges});
  8468. for (var j = 0; j < changes.length; ++j) {
  8469. var change = changes[j], m = (void 0);
  8470. newChanges.push({from: change.from, to: change.to, text: change.text});
  8471. if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
  8472. if (indexOf(newGroup, Number(m[1])) > -1) {
  8473. lst(newChanges)[prop] = change[prop];
  8474. delete change[prop];
  8475. }
  8476. } } }
  8477. }
  8478. }
  8479. return copy
  8480. }
  8481. // The 'scroll' parameter given to many of these indicated whether
  8482. // the new cursor position should be scrolled into view after
  8483. // modifying the selection.
  8484. // If shift is held or the extend flag is set, extends a range to
  8485. // include a given position (and optionally a second position).
  8486. // Otherwise, simply returns the range between the given positions.
  8487. // Used for cursor motion and such.
  8488. function extendRange(doc, range, head, other) {
  8489. if (doc.cm && doc.cm.display.shift || doc.extend) {
  8490. var anchor = range.anchor;
  8491. if (other) {
  8492. var posBefore = cmp(head, anchor) < 0;
  8493. if (posBefore != (cmp(other, anchor) < 0)) {
  8494. anchor = head;
  8495. head = other;
  8496. } else if (posBefore != (cmp(head, other) < 0)) {
  8497. head = other;
  8498. }
  8499. }
  8500. return new Range(anchor, head)
  8501. } else {
  8502. return new Range(other || head, head)
  8503. }
  8504. }
  8505. // Extend the primary selection range, discard the rest.
  8506. function extendSelection(doc, head, other, options) {
  8507. setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
  8508. }
  8509. // Extend all selections (pos is an array of selections with length
  8510. // equal the number of selections)
  8511. function extendSelections(doc, heads, options) {
  8512. var out = [];
  8513. for (var i = 0; i < doc.sel.ranges.length; i++)
  8514. { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); }
  8515. var newSel = normalizeSelection(out, doc.sel.primIndex);
  8516. setSelection(doc, newSel, options);
  8517. }
  8518. // Updates a single range in the selection.
  8519. function replaceOneSelection(doc, i, range, options) {
  8520. var ranges = doc.sel.ranges.slice(0);
  8521. ranges[i] = range;
  8522. setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
  8523. }
  8524. // Reset the selection to a single range.
  8525. function setSimpleSelection(doc, anchor, head, options) {
  8526. setSelection(doc, simpleSelection(anchor, head), options);
  8527. }
  8528. // Give beforeSelectionChange handlers a change to influence a
  8529. // selection update.
  8530. function filterSelectionChange(doc, sel, options) {
  8531. var obj = {
  8532. ranges: sel.ranges,
  8533. update: function(ranges) {
  8534. var this$1 = this;
  8535. this.ranges = [];
  8536. for (var i = 0; i < ranges.length; i++)
  8537. { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
  8538. clipPos(doc, ranges[i].head)); }
  8539. },
  8540. origin: options && options.origin
  8541. };
  8542. signal(doc, "beforeSelectionChange", doc, obj);
  8543. if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
  8544. if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
  8545. else { return sel }
  8546. }
  8547. function setSelectionReplaceHistory(doc, sel, options) {
  8548. var done = doc.history.done, last = lst(done);
  8549. if (last && last.ranges) {
  8550. done[done.length - 1] = sel;
  8551. setSelectionNoUndo(doc, sel, options);
  8552. } else {
  8553. setSelection(doc, sel, options);
  8554. }
  8555. }
  8556. // Set a new selection.
  8557. function setSelection(doc, sel, options) {
  8558. setSelectionNoUndo(doc, sel, options);
  8559. addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
  8560. }
  8561. function setSelectionNoUndo(doc, sel, options) {
  8562. if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
  8563. { sel = filterSelectionChange(doc, sel, options); }
  8564. var bias = options && options.bias ||
  8565. (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
  8566. setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
  8567. if (!(options && options.scroll === false) && doc.cm)
  8568. { ensureCursorVisible(doc.cm); }
  8569. }
  8570. function setSelectionInner(doc, sel) {
  8571. if (sel.equals(doc.sel)) { return }
  8572. doc.sel = sel;
  8573. if (doc.cm) {
  8574. doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
  8575. signalCursorActivity(doc.cm);
  8576. }
  8577. signalLater(doc, "cursorActivity", doc);
  8578. }
  8579. // Verify that the selection does not partially select any atomic
  8580. // marked ranges.
  8581. function reCheckSelection(doc) {
  8582. setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
  8583. }
  8584. // Return a selection that does not partially select any atomic
  8585. // ranges.
  8586. function skipAtomicInSelection(doc, sel, bias, mayClear) {
  8587. var out;
  8588. for (var i = 0; i < sel.ranges.length; i++) {
  8589. var range = sel.ranges[i];
  8590. var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
  8591. var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
  8592. var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
  8593. if (out || newAnchor != range.anchor || newHead != range.head) {
  8594. if (!out) { out = sel.ranges.slice(0, i); }
  8595. out[i] = new Range(newAnchor, newHead);
  8596. }
  8597. }
  8598. return out ? normalizeSelection(out, sel.primIndex) : sel
  8599. }
  8600. function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
  8601. var line = getLine(doc, pos.line);
  8602. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  8603. var sp = line.markedSpans[i], m = sp.marker;
  8604. if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
  8605. (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
  8606. if (mayClear) {
  8607. signal(m, "beforeCursorEnter");
  8608. if (m.explicitlyCleared) {
  8609. if (!line.markedSpans) { break }
  8610. else {--i; continue}
  8611. }
  8612. }
  8613. if (!m.atomic) { continue }
  8614. if (oldPos) {
  8615. var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
  8616. if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
  8617. { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
  8618. if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
  8619. { return skipAtomicInner(doc, near, pos, dir, mayClear) }
  8620. }
  8621. var far = m.find(dir < 0 ? -1 : 1);
  8622. if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
  8623. { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
  8624. return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
  8625. }
  8626. } }
  8627. return pos
  8628. }
  8629. // Ensure a given position is not inside an atomic range.
  8630. function skipAtomic(doc, pos, oldPos, bias, mayClear) {
  8631. var dir = bias || 1;
  8632. var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
  8633. (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
  8634. skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
  8635. (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
  8636. if (!found) {
  8637. doc.cantEdit = true;
  8638. return Pos(doc.first, 0)
  8639. }
  8640. return found
  8641. }
  8642. function movePos(doc, pos, dir, line) {
  8643. if (dir < 0 && pos.ch == 0) {
  8644. if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
  8645. else { return null }
  8646. } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
  8647. if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
  8648. else { return null }
  8649. } else {
  8650. return new Pos(pos.line, pos.ch + dir)
  8651. }
  8652. }
  8653. function selectAll(cm) {
  8654. cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
  8655. }
  8656. // UPDATING
  8657. // Allow "beforeChange" event handlers to influence a change
  8658. function filterChange(doc, change, update) {
  8659. var obj = {
  8660. canceled: false,
  8661. from: change.from,
  8662. to: change.to,
  8663. text: change.text,
  8664. origin: change.origin,
  8665. cancel: function () { return obj.canceled = true; }
  8666. };
  8667. if (update) { obj.update = function (from, to, text, origin) {
  8668. if (from) { obj.from = clipPos(doc, from); }
  8669. if (to) { obj.to = clipPos(doc, to); }
  8670. if (text) { obj.text = text; }
  8671. if (origin !== undefined) { obj.origin = origin; }
  8672. }; }
  8673. signal(doc, "beforeChange", doc, obj);
  8674. if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
  8675. if (obj.canceled) { return null }
  8676. return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
  8677. }
  8678. // Apply a change to a document, and add it to the document's
  8679. // history, and propagating it to all linked documents.
  8680. function makeChange(doc, change, ignoreReadOnly) {
  8681. if (doc.cm) {
  8682. if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
  8683. if (doc.cm.state.suppressEdits) { return }
  8684. }
  8685. if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
  8686. change = filterChange(doc, change, true);
  8687. if (!change) { return }
  8688. }
  8689. // Possibly split or suppress the update based on the presence
  8690. // of read-only spans in its range.
  8691. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
  8692. if (split) {
  8693. for (var i = split.length - 1; i >= 0; --i)
  8694. { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); }
  8695. } else {
  8696. makeChangeInner(doc, change);
  8697. }
  8698. }
  8699. function makeChangeInner(doc, change) {
  8700. if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
  8701. var selAfter = computeSelAfterChange(doc, change);
  8702. addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
  8703. makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
  8704. var rebased = [];
  8705. linkedDocs(doc, function (doc, sharedHist) {
  8706. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  8707. rebaseHist(doc.history, change);
  8708. rebased.push(doc.history);
  8709. }
  8710. makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
  8711. });
  8712. }
  8713. // Revert a change stored in a document's history.
  8714. function makeChangeFromHistory(doc, type, allowSelectionOnly) {
  8715. if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
  8716. var hist = doc.history, event, selAfter = doc.sel;
  8717. var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
  8718. // Verify that there is a useable event (so that ctrl-z won't
  8719. // needlessly clear selection events)
  8720. var i = 0;
  8721. for (; i < source.length; i++) {
  8722. event = source[i];
  8723. if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
  8724. { break }
  8725. }
  8726. if (i == source.length) { return }
  8727. hist.lastOrigin = hist.lastSelOrigin = null;
  8728. for (;;) {
  8729. event = source.pop();
  8730. if (event.ranges) {
  8731. pushSelectionToHistory(event, dest);
  8732. if (allowSelectionOnly && !event.equals(doc.sel)) {
  8733. setSelection(doc, event, {clearRedo: false});
  8734. return
  8735. }
  8736. selAfter = event;
  8737. }
  8738. else { break }
  8739. }
  8740. // Build up a reverse change object to add to the opposite history
  8741. // stack (redo when undoing, and vice versa).
  8742. var antiChanges = [];
  8743. pushSelectionToHistory(selAfter, dest);
  8744. dest.push({changes: antiChanges, generation: hist.generation});
  8745. hist.generation = event.generation || ++hist.maxGeneration;
  8746. var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
  8747. var loop = function ( i ) {
  8748. var change = event.changes[i];
  8749. change.origin = type;
  8750. if (filter && !filterChange(doc, change, false)) {
  8751. source.length = 0;
  8752. return {}
  8753. }
  8754. antiChanges.push(historyChangeFromChange(doc, change));
  8755. var after = i ? computeSelAfterChange(doc, change) : lst(source);
  8756. makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
  8757. if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
  8758. var rebased = [];
  8759. // Propagate to the linked documents
  8760. linkedDocs(doc, function (doc, sharedHist) {
  8761. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  8762. rebaseHist(doc.history, change);
  8763. rebased.push(doc.history);
  8764. }
  8765. makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
  8766. });
  8767. };
  8768. for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
  8769. var returned = loop( i$1 );
  8770. if ( returned ) return returned.v;
  8771. }
  8772. }
  8773. // Sub-views need their line numbers shifted when text is added
  8774. // above or below them in the parent document.
  8775. function shiftDoc(doc, distance) {
  8776. if (distance == 0) { return }
  8777. doc.first += distance;
  8778. doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
  8779. Pos(range.anchor.line + distance, range.anchor.ch),
  8780. Pos(range.head.line + distance, range.head.ch)
  8781. ); }), doc.sel.primIndex);
  8782. if (doc.cm) {
  8783. regChange(doc.cm, doc.first, doc.first - distance, distance);
  8784. for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
  8785. { regLineChange(doc.cm, l, "gutter"); }
  8786. }
  8787. }
  8788. // More lower-level change function, handling only a single document
  8789. // (not linked ones).
  8790. function makeChangeSingleDoc(doc, change, selAfter, spans) {
  8791. if (doc.cm && !doc.cm.curOp)
  8792. { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
  8793. if (change.to.line < doc.first) {
  8794. shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
  8795. return
  8796. }
  8797. if (change.from.line > doc.lastLine()) { return }
  8798. // Clip the change to the size of this doc
  8799. if (change.from.line < doc.first) {
  8800. var shift = change.text.length - 1 - (doc.first - change.from.line);
  8801. shiftDoc(doc, shift);
  8802. change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
  8803. text: [lst(change.text)], origin: change.origin};
  8804. }
  8805. var last = doc.lastLine();
  8806. if (change.to.line > last) {
  8807. change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
  8808. text: [change.text[0]], origin: change.origin};
  8809. }
  8810. change.removed = getBetween(doc, change.from, change.to);
  8811. if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
  8812. if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
  8813. else { updateDoc(doc, change, spans); }
  8814. setSelectionNoUndo(doc, selAfter, sel_dontScroll);
  8815. }
  8816. // Handle the interaction of a change to a document with the editor
  8817. // that this document is part of.
  8818. function makeChangeSingleDocInEditor(cm, change, spans) {
  8819. var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
  8820. var recomputeMaxLength = false, checkWidthStart = from.line;
  8821. if (!cm.options.lineWrapping) {
  8822. checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
  8823. doc.iter(checkWidthStart, to.line + 1, function (line) {
  8824. if (line == display.maxLine) {
  8825. recomputeMaxLength = true;
  8826. return true
  8827. }
  8828. });
  8829. }
  8830. if (doc.sel.contains(change.from, change.to) > -1)
  8831. { signalCursorActivity(cm); }
  8832. updateDoc(doc, change, spans, estimateHeight(cm));
  8833. if (!cm.options.lineWrapping) {
  8834. doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
  8835. var len = lineLength(line);
  8836. if (len > display.maxLineLength) {
  8837. display.maxLine = line;
  8838. display.maxLineLength = len;
  8839. display.maxLineChanged = true;
  8840. recomputeMaxLength = false;
  8841. }
  8842. });
  8843. if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
  8844. }
  8845. // Adjust frontier, schedule worker
  8846. doc.frontier = Math.min(doc.frontier, from.line);
  8847. startWorker(cm, 400);
  8848. var lendiff = change.text.length - (to.line - from.line) - 1;
  8849. // Remember that these lines changed, for updating the display
  8850. if (change.full)
  8851. { regChange(cm); }
  8852. else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
  8853. { regLineChange(cm, from.line, "text"); }
  8854. else
  8855. { regChange(cm, from.line, to.line + 1, lendiff); }
  8856. var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
  8857. if (changeHandler || changesHandler) {
  8858. var obj = {
  8859. from: from, to: to,
  8860. text: change.text,
  8861. removed: change.removed,
  8862. origin: change.origin
  8863. };
  8864. if (changeHandler) { signalLater(cm, "change", cm, obj); }
  8865. if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
  8866. }
  8867. cm.display.selForContextMenu = null;
  8868. }
  8869. function replaceRange(doc, code, from, to, origin) {
  8870. if (!to) { to = from; }
  8871. if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
  8872. if (typeof code == "string") { code = doc.splitLines(code); }
  8873. makeChange(doc, {from: from, to: to, text: code, origin: origin});
  8874. }
  8875. // Rebasing/resetting history to deal with externally-sourced changes
  8876. function rebaseHistSelSingle(pos, from, to, diff) {
  8877. if (to < pos.line) {
  8878. pos.line += diff;
  8879. } else if (from < pos.line) {
  8880. pos.line = from;
  8881. pos.ch = 0;
  8882. }
  8883. }
  8884. // Tries to rebase an array of history events given a change in the
  8885. // document. If the change touches the same lines as the event, the
  8886. // event, and everything 'behind' it, is discarded. If the change is
  8887. // before the event, the event's positions are updated. Uses a
  8888. // copy-on-write scheme for the positions, to avoid having to
  8889. // reallocate them all on every rebase, but also avoid problems with
  8890. // shared position objects being unsafely updated.
  8891. function rebaseHistArray(array, from, to, diff) {
  8892. for (var i = 0; i < array.length; ++i) {
  8893. var sub = array[i], ok = true;
  8894. if (sub.ranges) {
  8895. if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
  8896. for (var j = 0; j < sub.ranges.length; j++) {
  8897. rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
  8898. rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
  8899. }
  8900. continue
  8901. }
  8902. for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
  8903. var cur = sub.changes[j$1];
  8904. if (to < cur.from.line) {
  8905. cur.from = Pos(cur.from.line + diff, cur.from.ch);
  8906. cur.to = Pos(cur.to.line + diff, cur.to.ch);
  8907. } else if (from <= cur.to.line) {
  8908. ok = false;
  8909. break
  8910. }
  8911. }
  8912. if (!ok) {
  8913. array.splice(0, i + 1);
  8914. i = 0;
  8915. }
  8916. }
  8917. }
  8918. function rebaseHist(hist, change) {
  8919. var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
  8920. rebaseHistArray(hist.done, from, to, diff);
  8921. rebaseHistArray(hist.undone, from, to, diff);
  8922. }
  8923. // Utility for applying a change to a line by handle or number,
  8924. // returning the number and optionally registering the line as
  8925. // changed.
  8926. function changeLine(doc, handle, changeType, op) {
  8927. var no = handle, line = handle;
  8928. if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
  8929. else { no = lineNo(handle); }
  8930. if (no == null) { return null }
  8931. if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
  8932. return line
  8933. }
  8934. // The document is represented as a BTree consisting of leaves, with
  8935. // chunk of lines in them, and branches, with up to ten leaves or
  8936. // other branch nodes below them. The top node is always a branch
  8937. // node, and is the document object itself (meaning it has
  8938. // additional methods and properties).
  8939. //
  8940. // All nodes have parent links. The tree is used both to go from
  8941. // line numbers to line objects, and to go from objects to numbers.
  8942. // It also indexes by height, and is used to convert between height
  8943. // and line object, and to find the total height of the document.
  8944. //
  8945. // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
  8946. var LeafChunk = function(lines) {
  8947. var this$1 = this;
  8948. this.lines = lines;
  8949. this.parent = null;
  8950. var height = 0;
  8951. for (var i = 0; i < lines.length; ++i) {
  8952. lines[i].parent = this$1;
  8953. height += lines[i].height;
  8954. }
  8955. this.height = height;
  8956. };
  8957. LeafChunk.prototype.chunkSize = function () { return this.lines.length };
  8958. // Remove the n lines at offset 'at'.
  8959. LeafChunk.prototype.removeInner = function (at, n) {
  8960. var this$1 = this;
  8961. for (var i = at, e = at + n; i < e; ++i) {
  8962. var line = this$1.lines[i];
  8963. this$1.height -= line.height;
  8964. cleanUpLine(line);
  8965. signalLater(line, "delete");
  8966. }
  8967. this.lines.splice(at, n);
  8968. };
  8969. // Helper used to collapse a small branch into a single leaf.
  8970. LeafChunk.prototype.collapse = function (lines) {
  8971. lines.push.apply(lines, this.lines);
  8972. };
  8973. // Insert the given array of lines at offset 'at', count them as
  8974. // having the given height.
  8975. LeafChunk.prototype.insertInner = function (at, lines, height) {
  8976. var this$1 = this;
  8977. this.height += height;
  8978. this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
  8979. for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
  8980. };
  8981. // Used to iterate over a part of the tree.
  8982. LeafChunk.prototype.iterN = function (at, n, op) {
  8983. var this$1 = this;
  8984. for (var e = at + n; at < e; ++at)
  8985. { if (op(this$1.lines[at])) { return true } }
  8986. };
  8987. var BranchChunk = function(children) {
  8988. var this$1 = this;
  8989. this.children = children;
  8990. var size = 0, height = 0;
  8991. for (var i = 0; i < children.length; ++i) {
  8992. var ch = children[i];
  8993. size += ch.chunkSize(); height += ch.height;
  8994. ch.parent = this$1;
  8995. }
  8996. this.size = size;
  8997. this.height = height;
  8998. this.parent = null;
  8999. };
  9000. BranchChunk.prototype.chunkSize = function () { return this.size };
  9001. BranchChunk.prototype.removeInner = function (at, n) {
  9002. var this$1 = this;
  9003. this.size -= n;
  9004. for (var i = 0; i < this.children.length; ++i) {
  9005. var child = this$1.children[i], sz = child.chunkSize();
  9006. if (at < sz) {
  9007. var rm = Math.min(n, sz - at), oldHeight = child.height;
  9008. child.removeInner(at, rm);
  9009. this$1.height -= oldHeight - child.height;
  9010. if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
  9011. if ((n -= rm) == 0) { break }
  9012. at = 0;
  9013. } else { at -= sz; }
  9014. }
  9015. // If the result is smaller than 25 lines, ensure that it is a
  9016. // single leaf node.
  9017. if (this.size - n < 25 &&
  9018. (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
  9019. var lines = [];
  9020. this.collapse(lines);
  9021. this.children = [new LeafChunk(lines)];
  9022. this.children[0].parent = this;
  9023. }
  9024. };
  9025. BranchChunk.prototype.collapse = function (lines) {
  9026. var this$1 = this;
  9027. for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
  9028. };
  9029. BranchChunk.prototype.insertInner = function (at, lines, height) {
  9030. var this$1 = this;
  9031. this.size += lines.length;
  9032. this.height += height;
  9033. for (var i = 0; i < this.children.length; ++i) {
  9034. var child = this$1.children[i], sz = child.chunkSize();
  9035. if (at <= sz) {
  9036. child.insertInner(at, lines, height);
  9037. if (child.lines && child.lines.length > 50) {
  9038. // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
  9039. // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
  9040. var remaining = child.lines.length % 25 + 25;
  9041. for (var pos = remaining; pos < child.lines.length;) {
  9042. var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
  9043. child.height -= leaf.height;
  9044. this$1.children.splice(++i, 0, leaf);
  9045. leaf.parent = this$1;
  9046. }
  9047. child.lines = child.lines.slice(0, remaining);
  9048. this$1.maybeSpill();
  9049. }
  9050. break
  9051. }
  9052. at -= sz;
  9053. }
  9054. };
  9055. // When a node has grown, check whether it should be split.
  9056. BranchChunk.prototype.maybeSpill = function () {
  9057. if (this.children.length <= 10) { return }
  9058. var me = this;
  9059. do {
  9060. var spilled = me.children.splice(me.children.length - 5, 5);
  9061. var sibling = new BranchChunk(spilled);
  9062. if (!me.parent) { // Become the parent node
  9063. var copy = new BranchChunk(me.children);
  9064. copy.parent = me;
  9065. me.children = [copy, sibling];
  9066. me = copy;
  9067. } else {
  9068. me.size -= sibling.size;
  9069. me.height -= sibling.height;
  9070. var myIndex = indexOf(me.parent.children, me);
  9071. me.parent.children.splice(myIndex + 1, 0, sibling);
  9072. }
  9073. sibling.parent = me.parent;
  9074. } while (me.children.length > 10)
  9075. me.parent.maybeSpill();
  9076. };
  9077. BranchChunk.prototype.iterN = function (at, n, op) {
  9078. var this$1 = this;
  9079. for (var i = 0; i < this.children.length; ++i) {
  9080. var child = this$1.children[i], sz = child.chunkSize();
  9081. if (at < sz) {
  9082. var used = Math.min(n, sz - at);
  9083. if (child.iterN(at, used, op)) { return true }
  9084. if ((n -= used) == 0) { break }
  9085. at = 0;
  9086. } else { at -= sz; }
  9087. }
  9088. };
  9089. // Line widgets are block elements displayed above or below a line.
  9090. var LineWidget = function(doc, node, options) {
  9091. var this$1 = this;
  9092. if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
  9093. { this$1[opt] = options[opt]; } } }
  9094. this.doc = doc;
  9095. this.node = node;
  9096. };
  9097. LineWidget.prototype.clear = function () {
  9098. var this$1 = this;
  9099. var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
  9100. if (no == null || !ws) { return }
  9101. for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
  9102. if (!ws.length) { line.widgets = null; }
  9103. var height = widgetHeight(this);
  9104. updateLineHeight(line, Math.max(0, line.height - height));
  9105. if (cm) {
  9106. runInOp(cm, function () {
  9107. adjustScrollWhenAboveVisible(cm, line, -height);
  9108. regLineChange(cm, no, "widget");
  9109. });
  9110. signalLater(cm, "lineWidgetCleared", cm, this, no);
  9111. }
  9112. };
  9113. LineWidget.prototype.changed = function () {
  9114. var this$1 = this;
  9115. var oldH = this.height, cm = this.doc.cm, line = this.line;
  9116. this.height = null;
  9117. var diff = widgetHeight(this) - oldH;
  9118. if (!diff) { return }
  9119. updateLineHeight(line, line.height + diff);
  9120. if (cm) {
  9121. runInOp(cm, function () {
  9122. cm.curOp.forceUpdate = true;
  9123. adjustScrollWhenAboveVisible(cm, line, diff);
  9124. signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
  9125. });
  9126. }
  9127. };
  9128. eventMixin(LineWidget);
  9129. function adjustScrollWhenAboveVisible(cm, line, diff) {
  9130. if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
  9131. { addToScrollPos(cm, null, diff); }
  9132. }
  9133. function addLineWidget(doc, handle, node, options) {
  9134. var widget = new LineWidget(doc, node, options);
  9135. var cm = doc.cm;
  9136. if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
  9137. changeLine(doc, handle, "widget", function (line) {
  9138. var widgets = line.widgets || (line.widgets = []);
  9139. if (widget.insertAt == null) { widgets.push(widget); }
  9140. else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
  9141. widget.line = line;
  9142. if (cm && !lineIsHidden(doc, line)) {
  9143. var aboveVisible = heightAtLine(line) < doc.scrollTop;
  9144. updateLineHeight(line, line.height + widgetHeight(widget));
  9145. if (aboveVisible) { addToScrollPos(cm, null, widget.height); }
  9146. cm.curOp.forceUpdate = true;
  9147. }
  9148. return true
  9149. });
  9150. signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle));
  9151. return widget
  9152. }
  9153. // TEXTMARKERS
  9154. // Created with markText and setBookmark methods. A TextMarker is a
  9155. // handle that can be used to clear or find a marked position in the
  9156. // document. Line objects hold arrays (markedSpans) containing
  9157. // {from, to, marker} object pointing to such marker objects, and
  9158. // indicating that such a marker is present on that line. Multiple
  9159. // lines may point to the same marker when it spans across lines.
  9160. // The spans will have null for their from/to properties when the
  9161. // marker continues beyond the start/end of the line. Markers have
  9162. // links back to the lines they currently touch.
  9163. // Collapsed markers have unique ids, in order to be able to order
  9164. // them, which is needed for uniquely determining an outer marker
  9165. // when they overlap (they may nest, but not partially overlap).
  9166. var nextMarkerId = 0;
  9167. var TextMarker = function(doc, type) {
  9168. this.lines = [];
  9169. this.type = type;
  9170. this.doc = doc;
  9171. this.id = ++nextMarkerId;
  9172. };
  9173. // Clear the marker.
  9174. TextMarker.prototype.clear = function () {
  9175. var this$1 = this;
  9176. if (this.explicitlyCleared) { return }
  9177. var cm = this.doc.cm, withOp = cm && !cm.curOp;
  9178. if (withOp) { startOperation(cm); }
  9179. if (hasHandler(this, "clear")) {
  9180. var found = this.find();
  9181. if (found) { signalLater(this, "clear", found.from, found.to); }
  9182. }
  9183. var min = null, max = null;
  9184. for (var i = 0; i < this.lines.length; ++i) {
  9185. var line = this$1.lines[i];
  9186. var span = getMarkedSpanFor(line.markedSpans, this$1);
  9187. if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
  9188. else if (cm) {
  9189. if (span.to != null) { max = lineNo(line); }
  9190. if (span.from != null) { min = lineNo(line); }
  9191. }
  9192. line.markedSpans = removeMarkedSpan(line.markedSpans, span);
  9193. if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
  9194. { updateLineHeight(line, textHeight(cm.display)); }
  9195. }
  9196. if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
  9197. var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
  9198. if (len > cm.display.maxLineLength) {
  9199. cm.display.maxLine = visual;
  9200. cm.display.maxLineLength = len;
  9201. cm.display.maxLineChanged = true;
  9202. }
  9203. } }
  9204. if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
  9205. this.lines.length = 0;
  9206. this.explicitlyCleared = true;
  9207. if (this.atomic && this.doc.cantEdit) {
  9208. this.doc.cantEdit = false;
  9209. if (cm) { reCheckSelection(cm.doc); }
  9210. }
  9211. if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
  9212. if (withOp) { endOperation(cm); }
  9213. if (this.parent) { this.parent.clear(); }
  9214. };
  9215. // Find the position of the marker in the document. Returns a {from,
  9216. // to} object by default. Side can be passed to get a specific side
  9217. // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
  9218. // Pos objects returned contain a line object, rather than a line
  9219. // number (used to prevent looking up the same line twice).
  9220. TextMarker.prototype.find = function (side, lineObj) {
  9221. var this$1 = this;
  9222. if (side == null && this.type == "bookmark") { side = 1; }
  9223. var from, to;
  9224. for (var i = 0; i < this.lines.length; ++i) {
  9225. var line = this$1.lines[i];
  9226. var span = getMarkedSpanFor(line.markedSpans, this$1);
  9227. if (span.from != null) {
  9228. from = Pos(lineObj ? line : lineNo(line), span.from);
  9229. if (side == -1) { return from }
  9230. }
  9231. if (span.to != null) {
  9232. to = Pos(lineObj ? line : lineNo(line), span.to);
  9233. if (side == 1) { return to }
  9234. }
  9235. }
  9236. return from && {from: from, to: to}
  9237. };
  9238. // Signals that the marker's widget changed, and surrounding layout
  9239. // should be recomputed.
  9240. TextMarker.prototype.changed = function () {
  9241. var this$1 = this;
  9242. var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
  9243. if (!pos || !cm) { return }
  9244. runInOp(cm, function () {
  9245. var line = pos.line, lineN = lineNo(pos.line);
  9246. var view = findViewForLine(cm, lineN);
  9247. if (view) {
  9248. clearLineMeasurementCacheFor(view);
  9249. cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
  9250. }
  9251. cm.curOp.updateMaxLine = true;
  9252. if (!lineIsHidden(widget.doc, line) && widget.height != null) {
  9253. var oldHeight = widget.height;
  9254. widget.height = null;
  9255. var dHeight = widgetHeight(widget) - oldHeight;
  9256. if (dHeight)
  9257. { updateLineHeight(line, line.height + dHeight); }
  9258. }
  9259. signalLater(cm, "markerChanged", cm, this$1);
  9260. });
  9261. };
  9262. TextMarker.prototype.attachLine = function (line) {
  9263. if (!this.lines.length && this.doc.cm) {
  9264. var op = this.doc.cm.curOp;
  9265. if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
  9266. { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
  9267. }
  9268. this.lines.push(line);
  9269. };
  9270. TextMarker.prototype.detachLine = function (line) {
  9271. this.lines.splice(indexOf(this.lines, line), 1);
  9272. if (!this.lines.length && this.doc.cm) {
  9273. var op = this.doc.cm.curOp;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
  9274. }
  9275. };
  9276. eventMixin(TextMarker);
  9277. // Create a marker, wire it up to the right lines, and
  9278. function markText(doc, from, to, options, type) {
  9279. // Shared markers (across linked documents) are handled separately
  9280. // (markTextShared will call out to this again, once per
  9281. // document).
  9282. if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
  9283. // Ensure we are in an operation.
  9284. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
  9285. var marker = new TextMarker(doc, type), diff = cmp(from, to);
  9286. if (options) { copyObj(options, marker, false); }
  9287. // Don't connect empty markers unless clearWhenEmpty is false
  9288. if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
  9289. { return marker }
  9290. if (marker.replacedWith) {
  9291. // Showing up as a widget implies collapsed (widget replaces text)
  9292. marker.collapsed = true;
  9293. marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
  9294. if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
  9295. if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
  9296. }
  9297. if (marker.collapsed) {
  9298. if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
  9299. from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
  9300. { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
  9301. seeCollapsedSpans();
  9302. }
  9303. if (marker.addToHistory)
  9304. { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
  9305. var curLine = from.line, cm = doc.cm, updateMaxLine;
  9306. doc.iter(curLine, to.line + 1, function (line) {
  9307. if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
  9308. { updateMaxLine = true; }
  9309. if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
  9310. addMarkedSpan(line, new MarkedSpan(marker,
  9311. curLine == from.line ? from.ch : null,
  9312. curLine == to.line ? to.ch : null));
  9313. ++curLine;
  9314. });
  9315. // lineIsHidden depends on the presence of the spans, so needs a second pass
  9316. if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
  9317. if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
  9318. }); }
  9319. if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
  9320. if (marker.readOnly) {
  9321. seeReadOnlySpans();
  9322. if (doc.history.done.length || doc.history.undone.length)
  9323. { doc.clearHistory(); }
  9324. }
  9325. if (marker.collapsed) {
  9326. marker.id = ++nextMarkerId;
  9327. marker.atomic = true;
  9328. }
  9329. if (cm) {
  9330. // Sync editor state
  9331. if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
  9332. if (marker.collapsed)
  9333. { regChange(cm, from.line, to.line + 1); }
  9334. else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
  9335. { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
  9336. if (marker.atomic) { reCheckSelection(cm.doc); }
  9337. signalLater(cm, "markerAdded", cm, marker);
  9338. }
  9339. return marker
  9340. }
  9341. // SHARED TEXTMARKERS
  9342. // A shared marker spans multiple linked documents. It is
  9343. // implemented as a meta-marker-object controlling multiple normal
  9344. // markers.
  9345. var SharedTextMarker = function(markers, primary) {
  9346. var this$1 = this;
  9347. this.markers = markers;
  9348. this.primary = primary;
  9349. for (var i = 0; i < markers.length; ++i)
  9350. { markers[i].parent = this$1; }
  9351. };
  9352. SharedTextMarker.prototype.clear = function () {
  9353. var this$1 = this;
  9354. if (this.explicitlyCleared) { return }
  9355. this.explicitlyCleared = true;
  9356. for (var i = 0; i < this.markers.length; ++i)
  9357. { this$1.markers[i].clear(); }
  9358. signalLater(this, "clear");
  9359. };
  9360. SharedTextMarker.prototype.find = function (side, lineObj) {
  9361. return this.primary.find(side, lineObj)
  9362. };
  9363. eventMixin(SharedTextMarker);
  9364. function markTextShared(doc, from, to, options, type) {
  9365. options = copyObj(options);
  9366. options.shared = false;
  9367. var markers = [markText(doc, from, to, options, type)], primary = markers[0];
  9368. var widget = options.widgetNode;
  9369. linkedDocs(doc, function (doc) {
  9370. if (widget) { options.widgetNode = widget.cloneNode(true); }
  9371. markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
  9372. for (var i = 0; i < doc.linked.length; ++i)
  9373. { if (doc.linked[i].isParent) { return } }
  9374. primary = lst(markers);
  9375. });
  9376. return new SharedTextMarker(markers, primary)
  9377. }
  9378. function findSharedMarkers(doc) {
  9379. return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
  9380. }
  9381. function copySharedMarkers(doc, markers) {
  9382. for (var i = 0; i < markers.length; i++) {
  9383. var marker = markers[i], pos = marker.find();
  9384. var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
  9385. if (cmp(mFrom, mTo)) {
  9386. var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
  9387. marker.markers.push(subMark);
  9388. subMark.parent = marker;
  9389. }
  9390. }
  9391. }
  9392. function detachSharedMarkers(markers) {
  9393. var loop = function ( i ) {
  9394. var marker = markers[i], linked = [marker.primary.doc];
  9395. linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
  9396. for (var j = 0; j < marker.markers.length; j++) {
  9397. var subMarker = marker.markers[j];
  9398. if (indexOf(linked, subMarker.doc) == -1) {
  9399. subMarker.parent = null;
  9400. marker.markers.splice(j--, 1);
  9401. }
  9402. }
  9403. };
  9404. for (var i = 0; i < markers.length; i++) loop( i );
  9405. }
  9406. var nextDocId = 0;
  9407. var Doc = function(text, mode, firstLine, lineSep, direction) {
  9408. if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
  9409. if (firstLine == null) { firstLine = 0; }
  9410. BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
  9411. this.first = firstLine;
  9412. this.scrollTop = this.scrollLeft = 0;
  9413. this.cantEdit = false;
  9414. this.cleanGeneration = 1;
  9415. this.frontier = firstLine;
  9416. var start = Pos(firstLine, 0);
  9417. this.sel = simpleSelection(start);
  9418. this.history = new History(null);
  9419. this.id = ++nextDocId;
  9420. this.modeOption = mode;
  9421. this.lineSep = lineSep;
  9422. this.direction = (direction == "rtl") ? "rtl" : "ltr";
  9423. this.extend = false;
  9424. if (typeof text == "string") { text = this.splitLines(text); }
  9425. updateDoc(this, {from: start, to: start, text: text});
  9426. setSelection(this, simpleSelection(start), sel_dontScroll);
  9427. };
  9428. Doc.prototype = createObj(BranchChunk.prototype, {
  9429. constructor: Doc,
  9430. // Iterate over the document. Supports two forms -- with only one
  9431. // argument, it calls that for each line in the document. With
  9432. // three, it iterates over the range given by the first two (with
  9433. // the second being non-inclusive).
  9434. iter: function(from, to, op) {
  9435. if (op) { this.iterN(from - this.first, to - from, op); }
  9436. else { this.iterN(this.first, this.first + this.size, from); }
  9437. },
  9438. // Non-public interface for adding and removing lines.
  9439. insert: function(at, lines) {
  9440. var height = 0;
  9441. for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
  9442. this.insertInner(at - this.first, lines, height);
  9443. },
  9444. remove: function(at, n) { this.removeInner(at - this.first, n); },
  9445. // From here, the methods are part of the public interface. Most
  9446. // are also available from CodeMirror (editor) instances.
  9447. getValue: function(lineSep) {
  9448. var lines = getLines(this, this.first, this.first + this.size);
  9449. if (lineSep === false) { return lines }
  9450. return lines.join(lineSep || this.lineSeparator())
  9451. },
  9452. setValue: docMethodOp(function(code) {
  9453. var top = Pos(this.first, 0), last = this.first + this.size - 1;
  9454. makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
  9455. text: this.splitLines(code), origin: "setValue", full: true}, true);
  9456. setSelection(this, simpleSelection(top));
  9457. }),
  9458. replaceRange: function(code, from, to, origin) {
  9459. from = clipPos(this, from);
  9460. to = to ? clipPos(this, to) : from;
  9461. replaceRange(this, code, from, to, origin);
  9462. },
  9463. getRange: function(from, to, lineSep) {
  9464. var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
  9465. if (lineSep === false) { return lines }
  9466. return lines.join(lineSep || this.lineSeparator())
  9467. },
  9468. getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
  9469. getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
  9470. getLineNumber: function(line) {return lineNo(line)},
  9471. getLineHandleVisualStart: function(line) {
  9472. if (typeof line == "number") { line = getLine(this, line); }
  9473. return visualLine(line)
  9474. },
  9475. lineCount: function() {return this.size},
  9476. firstLine: function() {return this.first},
  9477. lastLine: function() {return this.first + this.size - 1},
  9478. clipPos: function(pos) {return clipPos(this, pos)},
  9479. getCursor: function(start) {
  9480. var range$$1 = this.sel.primary(), pos;
  9481. if (start == null || start == "head") { pos = range$$1.head; }
  9482. else if (start == "anchor") { pos = range$$1.anchor; }
  9483. else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
  9484. else { pos = range$$1.from(); }
  9485. return pos
  9486. },
  9487. listSelections: function() { return this.sel.ranges },
  9488. somethingSelected: function() {return this.sel.somethingSelected()},
  9489. setCursor: docMethodOp(function(line, ch, options) {
  9490. setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
  9491. }),
  9492. setSelection: docMethodOp(function(anchor, head, options) {
  9493. setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
  9494. }),
  9495. extendSelection: docMethodOp(function(head, other, options) {
  9496. extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
  9497. }),
  9498. extendSelections: docMethodOp(function(heads, options) {
  9499. extendSelections(this, clipPosArray(this, heads), options);
  9500. }),
  9501. extendSelectionsBy: docMethodOp(function(f, options) {
  9502. var heads = map(this.sel.ranges, f);
  9503. extendSelections(this, clipPosArray(this, heads), options);
  9504. }),
  9505. setSelections: docMethodOp(function(ranges, primary, options) {
  9506. var this$1 = this;
  9507. if (!ranges.length) { return }
  9508. var out = [];
  9509. for (var i = 0; i < ranges.length; i++)
  9510. { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
  9511. clipPos(this$1, ranges[i].head)); }
  9512. if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
  9513. setSelection(this, normalizeSelection(out, primary), options);
  9514. }),
  9515. addSelection: docMethodOp(function(anchor, head, options) {
  9516. var ranges = this.sel.ranges.slice(0);
  9517. ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
  9518. setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);
  9519. }),
  9520. getSelection: function(lineSep) {
  9521. var this$1 = this;
  9522. var ranges = this.sel.ranges, lines;
  9523. for (var i = 0; i < ranges.length; i++) {
  9524. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  9525. lines = lines ? lines.concat(sel) : sel;
  9526. }
  9527. if (lineSep === false) { return lines }
  9528. else { return lines.join(lineSep || this.lineSeparator()) }
  9529. },
  9530. getSelections: function(lineSep) {
  9531. var this$1 = this;
  9532. var parts = [], ranges = this.sel.ranges;
  9533. for (var i = 0; i < ranges.length; i++) {
  9534. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  9535. if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
  9536. parts[i] = sel;
  9537. }
  9538. return parts
  9539. },
  9540. replaceSelection: function(code, collapse, origin) {
  9541. var dup = [];
  9542. for (var i = 0; i < this.sel.ranges.length; i++)
  9543. { dup[i] = code; }
  9544. this.replaceSelections(dup, collapse, origin || "+input");
  9545. },
  9546. replaceSelections: docMethodOp(function(code, collapse, origin) {
  9547. var this$1 = this;
  9548. var changes = [], sel = this.sel;
  9549. for (var i = 0; i < sel.ranges.length; i++) {
  9550. var range$$1 = sel.ranges[i];
  9551. changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
  9552. }
  9553. var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
  9554. for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
  9555. { makeChange(this$1, changes[i$1]); }
  9556. if (newSel) { setSelectionReplaceHistory(this, newSel); }
  9557. else if (this.cm) { ensureCursorVisible(this.cm); }
  9558. }),
  9559. undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
  9560. redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
  9561. undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
  9562. redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
  9563. setExtending: function(val) {this.extend = val;},
  9564. getExtending: function() {return this.extend},
  9565. historySize: function() {
  9566. var hist = this.history, done = 0, undone = 0;
  9567. for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
  9568. for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
  9569. return {undo: done, redo: undone}
  9570. },
  9571. clearHistory: function() {this.history = new History(this.history.maxGeneration);},
  9572. markClean: function() {
  9573. this.cleanGeneration = this.changeGeneration(true);
  9574. },
  9575. changeGeneration: function(forceSplit) {
  9576. if (forceSplit)
  9577. { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
  9578. return this.history.generation
  9579. },
  9580. isClean: function (gen) {
  9581. return this.history.generation == (gen || this.cleanGeneration)
  9582. },
  9583. getHistory: function() {
  9584. return {done: copyHistoryArray(this.history.done),
  9585. undone: copyHistoryArray(this.history.undone)}
  9586. },
  9587. setHistory: function(histData) {
  9588. var hist = this.history = new History(this.history.maxGeneration);
  9589. hist.done = copyHistoryArray(histData.done.slice(0), null, true);
  9590. hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
  9591. },
  9592. setGutterMarker: docMethodOp(function(line, gutterID, value) {
  9593. return changeLine(this, line, "gutter", function (line) {
  9594. var markers = line.gutterMarkers || (line.gutterMarkers = {});
  9595. markers[gutterID] = value;
  9596. if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
  9597. return true
  9598. })
  9599. }),
  9600. clearGutter: docMethodOp(function(gutterID) {
  9601. var this$1 = this;
  9602. this.iter(function (line) {
  9603. if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
  9604. changeLine(this$1, line, "gutter", function () {
  9605. line.gutterMarkers[gutterID] = null;
  9606. if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
  9607. return true
  9608. });
  9609. }
  9610. });
  9611. }),
  9612. lineInfo: function(line) {
  9613. var n;
  9614. if (typeof line == "number") {
  9615. if (!isLine(this, line)) { return null }
  9616. n = line;
  9617. line = getLine(this, line);
  9618. if (!line) { return null }
  9619. } else {
  9620. n = lineNo(line);
  9621. if (n == null) { return null }
  9622. }
  9623. return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
  9624. textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
  9625. widgets: line.widgets}
  9626. },
  9627. addLineClass: docMethodOp(function(handle, where, cls) {
  9628. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  9629. var prop = where == "text" ? "textClass"
  9630. : where == "background" ? "bgClass"
  9631. : where == "gutter" ? "gutterClass" : "wrapClass";
  9632. if (!line[prop]) { line[prop] = cls; }
  9633. else if (classTest(cls).test(line[prop])) { return false }
  9634. else { line[prop] += " " + cls; }
  9635. return true
  9636. })
  9637. }),
  9638. removeLineClass: docMethodOp(function(handle, where, cls) {
  9639. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  9640. var prop = where == "text" ? "textClass"
  9641. : where == "background" ? "bgClass"
  9642. : where == "gutter" ? "gutterClass" : "wrapClass";
  9643. var cur = line[prop];
  9644. if (!cur) { return false }
  9645. else if (cls == null) { line[prop] = null; }
  9646. else {
  9647. var found = cur.match(classTest(cls));
  9648. if (!found) { return false }
  9649. var end = found.index + found[0].length;
  9650. line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
  9651. }
  9652. return true
  9653. })
  9654. }),
  9655. addLineWidget: docMethodOp(function(handle, node, options) {
  9656. return addLineWidget(this, handle, node, options)
  9657. }),
  9658. removeLineWidget: function(widget) { widget.clear(); },
  9659. markText: function(from, to, options) {
  9660. return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
  9661. },
  9662. setBookmark: function(pos, options) {
  9663. var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
  9664. insertLeft: options && options.insertLeft,
  9665. clearWhenEmpty: false, shared: options && options.shared,
  9666. handleMouseEvents: options && options.handleMouseEvents};
  9667. pos = clipPos(this, pos);
  9668. return markText(this, pos, pos, realOpts, "bookmark")
  9669. },
  9670. findMarksAt: function(pos) {
  9671. pos = clipPos(this, pos);
  9672. var markers = [], spans = getLine(this, pos.line).markedSpans;
  9673. if (spans) { for (var i = 0; i < spans.length; ++i) {
  9674. var span = spans[i];
  9675. if ((span.from == null || span.from <= pos.ch) &&
  9676. (span.to == null || span.to >= pos.ch))
  9677. { markers.push(span.marker.parent || span.marker); }
  9678. } }
  9679. return markers
  9680. },
  9681. findMarks: function(from, to, filter) {
  9682. from = clipPos(this, from); to = clipPos(this, to);
  9683. var found = [], lineNo$$1 = from.line;
  9684. this.iter(from.line, to.line + 1, function (line) {
  9685. var spans = line.markedSpans;
  9686. if (spans) { for (var i = 0; i < spans.length; i++) {
  9687. var span = spans[i];
  9688. if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
  9689. span.from == null && lineNo$$1 != from.line ||
  9690. span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
  9691. (!filter || filter(span.marker)))
  9692. { found.push(span.marker.parent || span.marker); }
  9693. } }
  9694. ++lineNo$$1;
  9695. });
  9696. return found
  9697. },
  9698. getAllMarks: function() {
  9699. var markers = [];
  9700. this.iter(function (line) {
  9701. var sps = line.markedSpans;
  9702. if (sps) { for (var i = 0; i < sps.length; ++i)
  9703. { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
  9704. });
  9705. return markers
  9706. },
  9707. posFromIndex: function(off) {
  9708. var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
  9709. this.iter(function (line) {
  9710. var sz = line.text.length + sepSize;
  9711. if (sz > off) { ch = off; return true }
  9712. off -= sz;
  9713. ++lineNo$$1;
  9714. });
  9715. return clipPos(this, Pos(lineNo$$1, ch))
  9716. },
  9717. indexFromPos: function (coords) {
  9718. coords = clipPos(this, coords);
  9719. var index = coords.ch;
  9720. if (coords.line < this.first || coords.ch < 0) { return 0 }
  9721. var sepSize = this.lineSeparator().length;
  9722. this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
  9723. index += line.text.length + sepSize;
  9724. });
  9725. return index
  9726. },
  9727. copy: function(copyHistory) {
  9728. var doc = new Doc(getLines(this, this.first, this.first + this.size),
  9729. this.modeOption, this.first, this.lineSep, this.direction);
  9730. doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
  9731. doc.sel = this.sel;
  9732. doc.extend = false;
  9733. if (copyHistory) {
  9734. doc.history.undoDepth = this.history.undoDepth;
  9735. doc.setHistory(this.getHistory());
  9736. }
  9737. return doc
  9738. },
  9739. linkedDoc: function(options) {
  9740. if (!options) { options = {}; }
  9741. var from = this.first, to = this.first + this.size;
  9742. if (options.from != null && options.from > from) { from = options.from; }
  9743. if (options.to != null && options.to < to) { to = options.to; }
  9744. var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
  9745. if (options.sharedHist) { copy.history = this.history
  9746. ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
  9747. copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
  9748. copySharedMarkers(copy, findSharedMarkers(this));
  9749. return copy
  9750. },
  9751. unlinkDoc: function(other) {
  9752. var this$1 = this;
  9753. if (other instanceof CodeMirror$1) { other = other.doc; }
  9754. if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
  9755. var link = this$1.linked[i];
  9756. if (link.doc != other) { continue }
  9757. this$1.linked.splice(i, 1);
  9758. other.unlinkDoc(this$1);
  9759. detachSharedMarkers(findSharedMarkers(this$1));
  9760. break
  9761. } }
  9762. // If the histories were shared, split them again
  9763. if (other.history == this.history) {
  9764. var splitIds = [other.id];
  9765. linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
  9766. other.history = new History(null);
  9767. other.history.done = copyHistoryArray(this.history.done, splitIds);
  9768. other.history.undone = copyHistoryArray(this.history.undone, splitIds);
  9769. }
  9770. },
  9771. iterLinkedDocs: function(f) {linkedDocs(this, f);},
  9772. getMode: function() {return this.mode},
  9773. getEditor: function() {return this.cm},
  9774. splitLines: function(str) {
  9775. if (this.lineSep) { return str.split(this.lineSep) }
  9776. return splitLinesAuto(str)
  9777. },
  9778. lineSeparator: function() { return this.lineSep || "\n" },
  9779. setDirection: docMethodOp(function (dir) {
  9780. if (dir != "rtl") { dir = "ltr"; }
  9781. if (dir == this.direction) { return }
  9782. this.direction = dir;
  9783. this.iter(function (line) { return line.order = null; });
  9784. if (this.cm) { directionChanged(this.cm); }
  9785. })
  9786. });
  9787. // Public alias.
  9788. Doc.prototype.eachLine = Doc.prototype.iter;
  9789. // Kludge to work around strange IE behavior where it'll sometimes
  9790. // re-fire a series of drag-related events right after the drop (#1551)
  9791. var lastDrop = 0;
  9792. function onDrop(e) {
  9793. var cm = this;
  9794. clearDragCursor(cm);
  9795. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
  9796. { return }
  9797. e_preventDefault(e);
  9798. if (ie) { lastDrop = +new Date; }
  9799. var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
  9800. if (!pos || cm.isReadOnly()) { return }
  9801. // Might be a file drop, in which case we simply extract the text
  9802. // and insert it.
  9803. if (files && files.length && window.FileReader && window.File) {
  9804. var n = files.length, text = Array(n), read = 0;
  9805. var loadFile = function (file, i) {
  9806. if (cm.options.allowDropFileTypes &&
  9807. indexOf(cm.options.allowDropFileTypes, file.type) == -1)
  9808. { return }
  9809. var reader = new FileReader;
  9810. reader.onload = operation(cm, function () {
  9811. var content = reader.result;
  9812. if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
  9813. text[i] = content;
  9814. if (++read == n) {
  9815. pos = clipPos(cm.doc, pos);
  9816. var change = {from: pos, to: pos,
  9817. text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
  9818. origin: "paste"};
  9819. makeChange(cm.doc, change);
  9820. setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
  9821. }
  9822. });
  9823. reader.readAsText(file);
  9824. };
  9825. for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
  9826. } else { // Normal drop
  9827. // Don't do a replace if the drop happened inside of the selected text.
  9828. if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
  9829. cm.state.draggingText(e);
  9830. // Ensure the editor is re-focused
  9831. setTimeout(function () { return cm.display.input.focus(); }, 20);
  9832. return
  9833. }
  9834. try {
  9835. var text$1 = e.dataTransfer.getData("Text");
  9836. if (text$1) {
  9837. var selected;
  9838. if (cm.state.draggingText && !cm.state.draggingText.copy)
  9839. { selected = cm.listSelections(); }
  9840. setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
  9841. if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
  9842. { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
  9843. cm.replaceSelection(text$1, "around", "paste");
  9844. cm.display.input.focus();
  9845. }
  9846. }
  9847. catch(e){}
  9848. }
  9849. }
  9850. function onDragStart(cm, e) {
  9851. if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
  9852. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
  9853. e.dataTransfer.setData("Text", cm.getSelection());
  9854. e.dataTransfer.effectAllowed = "copyMove";
  9855. // Use dummy image instead of default browsers image.
  9856. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
  9857. if (e.dataTransfer.setDragImage && !safari) {
  9858. var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
  9859. img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
  9860. if (presto) {
  9861. img.width = img.height = 1;
  9862. cm.display.wrapper.appendChild(img);
  9863. // Force a relayout, or Opera won't use our image for some obscure reason
  9864. img._top = img.offsetTop;
  9865. }
  9866. e.dataTransfer.setDragImage(img, 0, 0);
  9867. if (presto) { img.parentNode.removeChild(img); }
  9868. }
  9869. }
  9870. function onDragOver(cm, e) {
  9871. var pos = posFromMouse(cm, e);
  9872. if (!pos) { return }
  9873. var frag = document.createDocumentFragment();
  9874. drawSelectionCursor(cm, pos, frag);
  9875. if (!cm.display.dragCursor) {
  9876. cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
  9877. cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
  9878. }
  9879. removeChildrenAndAdd(cm.display.dragCursor, frag);
  9880. }
  9881. function clearDragCursor(cm) {
  9882. if (cm.display.dragCursor) {
  9883. cm.display.lineSpace.removeChild(cm.display.dragCursor);
  9884. cm.display.dragCursor = null;
  9885. }
  9886. }
  9887. // These must be handled carefully, because naively registering a
  9888. // handler for each editor will cause the editors to never be
  9889. // garbage collected.
  9890. function forEachCodeMirror(f) {
  9891. if (!document.body.getElementsByClassName) { return }
  9892. var byClass = document.body.getElementsByClassName("CodeMirror");
  9893. for (var i = 0; i < byClass.length; i++) {
  9894. var cm = byClass[i].CodeMirror;
  9895. if (cm) { f(cm); }
  9896. }
  9897. }
  9898. var globalsRegistered = false;
  9899. function ensureGlobalHandlers() {
  9900. if (globalsRegistered) { return }
  9901. registerGlobalHandlers();
  9902. globalsRegistered = true;
  9903. }
  9904. function registerGlobalHandlers() {
  9905. // When the window resizes, we need to refresh active editors.
  9906. var resizeTimer;
  9907. on(window, "resize", function () {
  9908. if (resizeTimer == null) { resizeTimer = setTimeout(function () {
  9909. resizeTimer = null;
  9910. forEachCodeMirror(onResize);
  9911. }, 100); }
  9912. });
  9913. // When the window loses focus, we want to show the editor as blurred
  9914. on(window, "blur", function () { return forEachCodeMirror(onBlur); });
  9915. }
  9916. // Called when the window resizes
  9917. function onResize(cm) {
  9918. var d = cm.display;
  9919. if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
  9920. { return }
  9921. // Might be a text scaling operation, clear size caches.
  9922. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  9923. d.scrollbarsClipped = false;
  9924. cm.setSize();
  9925. }
  9926. var keyNames = {
  9927. 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
  9928. 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
  9929. 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
  9930. 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
  9931. 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
  9932. 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
  9933. 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
  9934. 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
  9935. };
  9936. // Number keys
  9937. for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
  9938. // Alphabetic keys
  9939. for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
  9940. // Function keys
  9941. for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
  9942. var keyMap = {};
  9943. keyMap.basic = {
  9944. "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
  9945. "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
  9946. "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
  9947. "Tab": "defaultTab", "Shift-Tab": "indentAuto",
  9948. "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
  9949. "Esc": "singleSelection"
  9950. };
  9951. // Note that the save and find-related commands aren't defined by
  9952. // default. User code or addons can define them. Unknown commands
  9953. // are simply ignored.
  9954. keyMap.pcDefault = {
  9955. "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
  9956. "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
  9957. "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
  9958. "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
  9959. "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
  9960. "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
  9961. "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
  9962. fallthrough: "basic"
  9963. };
  9964. // Very basic readline/emacs-style bindings, which are standard on Mac.
  9965. keyMap.emacsy = {
  9966. "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
  9967. "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
  9968. "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
  9969. "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
  9970. "Ctrl-O": "openLine"
  9971. };
  9972. keyMap.macDefault = {
  9973. "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
  9974. "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
  9975. "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
  9976. "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
  9977. "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
  9978. "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
  9979. "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
  9980. fallthrough: ["basic", "emacsy"]
  9981. };
  9982. keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
  9983. // KEYMAP DISPATCH
  9984. function normalizeKeyName(name) {
  9985. var parts = name.split(/-(?!$)/);
  9986. name = parts[parts.length - 1];
  9987. var alt, ctrl, shift, cmd;
  9988. for (var i = 0; i < parts.length - 1; i++) {
  9989. var mod = parts[i];
  9990. if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
  9991. else if (/^a(lt)?$/i.test(mod)) { alt = true; }
  9992. else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
  9993. else if (/^s(hift)?$/i.test(mod)) { shift = true; }
  9994. else { throw new Error("Unrecognized modifier name: " + mod) }
  9995. }
  9996. if (alt) { name = "Alt-" + name; }
  9997. if (ctrl) { name = "Ctrl-" + name; }
  9998. if (cmd) { name = "Cmd-" + name; }
  9999. if (shift) { name = "Shift-" + name; }
  10000. return name
  10001. }
  10002. // This is a kludge to keep keymaps mostly working as raw objects
  10003. // (backwards compatibility) while at the same time support features
  10004. // like normalization and multi-stroke key bindings. It compiles a
  10005. // new normalized keymap, and then updates the old object to reflect
  10006. // this.
  10007. function normalizeKeyMap(keymap) {
  10008. var copy = {};
  10009. for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
  10010. var value = keymap[keyname];
  10011. if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
  10012. if (value == "...") { delete keymap[keyname]; continue }
  10013. var keys = map(keyname.split(" "), normalizeKeyName);
  10014. for (var i = 0; i < keys.length; i++) {
  10015. var val = (void 0), name = (void 0);
  10016. if (i == keys.length - 1) {
  10017. name = keys.join(" ");
  10018. val = value;
  10019. } else {
  10020. name = keys.slice(0, i + 1).join(" ");
  10021. val = "...";
  10022. }
  10023. var prev = copy[name];
  10024. if (!prev) { copy[name] = val; }
  10025. else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
  10026. }
  10027. delete keymap[keyname];
  10028. } }
  10029. for (var prop in copy) { keymap[prop] = copy[prop]; }
  10030. return keymap
  10031. }
  10032. function lookupKey(key, map$$1, handle, context) {
  10033. map$$1 = getKeyMap(map$$1);
  10034. var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
  10035. if (found === false) { return "nothing" }
  10036. if (found === "...") { return "multi" }
  10037. if (found != null && handle(found)) { return "handled" }
  10038. if (map$$1.fallthrough) {
  10039. if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
  10040. { return lookupKey(key, map$$1.fallthrough, handle, context) }
  10041. for (var i = 0; i < map$$1.fallthrough.length; i++) {
  10042. var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
  10043. if (result) { return result }
  10044. }
  10045. }
  10046. }
  10047. // Modifier key presses don't count as 'real' key presses for the
  10048. // purpose of keymap fallthrough.
  10049. function isModifierKey(value) {
  10050. var name = typeof value == "string" ? value : keyNames[value.keyCode];
  10051. return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
  10052. }
  10053. // Look up the name of a key as indicated by an event object.
  10054. function keyName(event, noShift) {
  10055. if (presto && event.keyCode == 34 && event["char"]) { return false }
  10056. var base = keyNames[event.keyCode], name = base;
  10057. if (name == null || event.altGraphKey) { return false }
  10058. if (event.altKey && base != "Alt") { name = "Alt-" + name; }
  10059. if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
  10060. if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
  10061. if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
  10062. return name
  10063. }
  10064. function getKeyMap(val) {
  10065. return typeof val == "string" ? keyMap[val] : val
  10066. }
  10067. // Helper for deleting text near the selection(s), used to implement
  10068. // backspace, delete, and similar functionality.
  10069. function deleteNearSelection(cm, compute) {
  10070. var ranges = cm.doc.sel.ranges, kill = [];
  10071. // Build up a set of ranges to kill first, merging overlapping
  10072. // ranges.
  10073. for (var i = 0; i < ranges.length; i++) {
  10074. var toKill = compute(ranges[i]);
  10075. while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
  10076. var replaced = kill.pop();
  10077. if (cmp(replaced.from, toKill.from) < 0) {
  10078. toKill.from = replaced.from;
  10079. break
  10080. }
  10081. }
  10082. kill.push(toKill);
  10083. }
  10084. // Next, remove those actual ranges.
  10085. runInOp(cm, function () {
  10086. for (var i = kill.length - 1; i >= 0; i--)
  10087. { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
  10088. ensureCursorVisible(cm);
  10089. });
  10090. }
  10091. // Commands are parameter-less actions that can be performed on an
  10092. // editor, mostly used for keybindings.
  10093. var commands = {
  10094. selectAll: selectAll,
  10095. singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
  10096. killLine: function (cm) { return deleteNearSelection(cm, function (range) {
  10097. if (range.empty()) {
  10098. var len = getLine(cm.doc, range.head.line).text.length;
  10099. if (range.head.ch == len && range.head.line < cm.lastLine())
  10100. { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
  10101. else
  10102. { return {from: range.head, to: Pos(range.head.line, len)} }
  10103. } else {
  10104. return {from: range.from(), to: range.to()}
  10105. }
  10106. }); },
  10107. deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  10108. from: Pos(range.from().line, 0),
  10109. to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
  10110. }); }); },
  10111. delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  10112. from: Pos(range.from().line, 0), to: range.from()
  10113. }); }); },
  10114. delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
  10115. var top = cm.charCoords(range.head, "div").top + 5;
  10116. var leftPos = cm.coordsChar({left: 0, top: top}, "div");
  10117. return {from: leftPos, to: range.from()}
  10118. }); },
  10119. delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
  10120. var top = cm.charCoords(range.head, "div").top + 5;
  10121. var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
  10122. return {from: range.from(), to: rightPos }
  10123. }); },
  10124. undo: function (cm) { return cm.undo(); },
  10125. redo: function (cm) { return cm.redo(); },
  10126. undoSelection: function (cm) { return cm.undoSelection(); },
  10127. redoSelection: function (cm) { return cm.redoSelection(); },
  10128. goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
  10129. goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
  10130. goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
  10131. {origin: "+move", bias: 1}
  10132. ); },
  10133. goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
  10134. {origin: "+move", bias: 1}
  10135. ); },
  10136. goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
  10137. {origin: "+move", bias: -1}
  10138. ); },
  10139. goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
  10140. var top = cm.charCoords(range.head, "div").top + 5;
  10141. return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
  10142. }, sel_move); },
  10143. goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
  10144. var top = cm.charCoords(range.head, "div").top + 5;
  10145. return cm.coordsChar({left: 0, top: top}, "div")
  10146. }, sel_move); },
  10147. goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
  10148. var top = cm.charCoords(range.head, "div").top + 5;
  10149. var pos = cm.coordsChar({left: 0, top: top}, "div");
  10150. if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
  10151. return pos
  10152. }, sel_move); },
  10153. goLineUp: function (cm) { return cm.moveV(-1, "line"); },
  10154. goLineDown: function (cm) { return cm.moveV(1, "line"); },
  10155. goPageUp: function (cm) { return cm.moveV(-1, "page"); },
  10156. goPageDown: function (cm) { return cm.moveV(1, "page"); },
  10157. goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
  10158. goCharRight: function (cm) { return cm.moveH(1, "char"); },
  10159. goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
  10160. goColumnRight: function (cm) { return cm.moveH(1, "column"); },
  10161. goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
  10162. goGroupRight: function (cm) { return cm.moveH(1, "group"); },
  10163. goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
  10164. goWordRight: function (cm) { return cm.moveH(1, "word"); },
  10165. delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
  10166. delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
  10167. delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
  10168. delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
  10169. delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
  10170. delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
  10171. indentAuto: function (cm) { return cm.indentSelection("smart"); },
  10172. indentMore: function (cm) { return cm.indentSelection("add"); },
  10173. indentLess: function (cm) { return cm.indentSelection("subtract"); },
  10174. insertTab: function (cm) { return cm.replaceSelection("\t"); },
  10175. insertSoftTab: function (cm) {
  10176. var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
  10177. for (var i = 0; i < ranges.length; i++) {
  10178. var pos = ranges[i].from();
  10179. var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
  10180. spaces.push(spaceStr(tabSize - col % tabSize));
  10181. }
  10182. cm.replaceSelections(spaces);
  10183. },
  10184. defaultTab: function (cm) {
  10185. if (cm.somethingSelected()) { cm.indentSelection("add"); }
  10186. else { cm.execCommand("insertTab"); }
  10187. },
  10188. // Swap the two chars left and right of each selection's head.
  10189. // Move cursor behind the two swapped characters afterwards.
  10190. //
  10191. // Doesn't consider line feeds a character.
  10192. // Doesn't scan more than one line above to find a character.
  10193. // Doesn't do anything on an empty line.
  10194. // Doesn't do anything with non-empty selections.
  10195. transposeChars: function (cm) { return runInOp(cm, function () {
  10196. var ranges = cm.listSelections(), newSel = [];
  10197. for (var i = 0; i < ranges.length; i++) {
  10198. if (!ranges[i].empty()) { continue }
  10199. var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
  10200. if (line) {
  10201. if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
  10202. if (cur.ch > 0) {
  10203. cur = new Pos(cur.line, cur.ch + 1);
  10204. cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
  10205. Pos(cur.line, cur.ch - 2), cur, "+transpose");
  10206. } else if (cur.line > cm.doc.first) {
  10207. var prev = getLine(cm.doc, cur.line - 1).text;
  10208. if (prev) {
  10209. cur = new Pos(cur.line, 1);
  10210. cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
  10211. prev.charAt(prev.length - 1),
  10212. Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
  10213. }
  10214. }
  10215. }
  10216. newSel.push(new Range(cur, cur));
  10217. }
  10218. cm.setSelections(newSel);
  10219. }); },
  10220. newlineAndIndent: function (cm) { return runInOp(cm, function () {
  10221. var sels = cm.listSelections();
  10222. for (var i = sels.length - 1; i >= 0; i--)
  10223. { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
  10224. sels = cm.listSelections();
  10225. for (var i$1 = 0; i$1 < sels.length; i$1++)
  10226. { cm.indentLine(sels[i$1].from().line, null, true); }
  10227. ensureCursorVisible(cm);
  10228. }); },
  10229. openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
  10230. toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
  10231. };
  10232. function lineStart(cm, lineN) {
  10233. var line = getLine(cm.doc, lineN);
  10234. var visual = visualLine(line);
  10235. if (visual != line) { lineN = lineNo(visual); }
  10236. return endOfLine(true, cm, visual, lineN, 1)
  10237. }
  10238. function lineEnd(cm, lineN) {
  10239. var line = getLine(cm.doc, lineN);
  10240. var visual = visualLineEnd(line);
  10241. if (visual != line) { lineN = lineNo(visual); }
  10242. return endOfLine(true, cm, line, lineN, -1)
  10243. }
  10244. function lineStartSmart(cm, pos) {
  10245. var start = lineStart(cm, pos.line);
  10246. var line = getLine(cm.doc, start.line);
  10247. var order = getOrder(line, cm.doc.direction);
  10248. if (!order || order[0].level == 0) {
  10249. var firstNonWS = Math.max(0, line.text.search(/\S/));
  10250. var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
  10251. return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
  10252. }
  10253. return start
  10254. }
  10255. // Run a handler that was bound to a key.
  10256. function doHandleBinding(cm, bound, dropShift) {
  10257. if (typeof bound == "string") {
  10258. bound = commands[bound];
  10259. if (!bound) { return false }
  10260. }
  10261. // Ensure previous input has been read, so that the handler sees a
  10262. // consistent view of the document
  10263. cm.display.input.ensurePolled();
  10264. var prevShift = cm.display.shift, done = false;
  10265. try {
  10266. if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
  10267. if (dropShift) { cm.display.shift = false; }
  10268. done = bound(cm) != Pass;
  10269. } finally {
  10270. cm.display.shift = prevShift;
  10271. cm.state.suppressEdits = false;
  10272. }
  10273. return done
  10274. }
  10275. function lookupKeyForEditor(cm, name, handle) {
  10276. for (var i = 0; i < cm.state.keyMaps.length; i++) {
  10277. var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
  10278. if (result) { return result }
  10279. }
  10280. return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
  10281. || lookupKey(name, cm.options.keyMap, handle, cm)
  10282. }
  10283. var stopSeq = new Delayed;
  10284. function dispatchKey(cm, name, e, handle) {
  10285. var seq = cm.state.keySeq;
  10286. if (seq) {
  10287. if (isModifierKey(name)) { return "handled" }
  10288. stopSeq.set(50, function () {
  10289. if (cm.state.keySeq == seq) {
  10290. cm.state.keySeq = null;
  10291. cm.display.input.reset();
  10292. }
  10293. });
  10294. name = seq + " " + name;
  10295. }
  10296. var result = lookupKeyForEditor(cm, name, handle);
  10297. if (result == "multi")
  10298. { cm.state.keySeq = name; }
  10299. if (result == "handled")
  10300. { signalLater(cm, "keyHandled", cm, name, e); }
  10301. if (result == "handled" || result == "multi") {
  10302. e_preventDefault(e);
  10303. restartBlink(cm);
  10304. }
  10305. if (seq && !result && /\'$/.test(name)) {
  10306. e_preventDefault(e);
  10307. return true
  10308. }
  10309. return !!result
  10310. }
  10311. // Handle a key from the keydown event.
  10312. function handleKeyBinding(cm, e) {
  10313. var name = keyName(e, true);
  10314. if (!name) { return false }
  10315. if (e.shiftKey && !cm.state.keySeq) {
  10316. // First try to resolve full name (including 'Shift-'). Failing
  10317. // that, see if there is a cursor-motion command (starting with
  10318. // 'go') bound to the keyname without 'Shift-'.
  10319. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
  10320. || dispatchKey(cm, name, e, function (b) {
  10321. if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
  10322. { return doHandleBinding(cm, b) }
  10323. })
  10324. } else {
  10325. return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
  10326. }
  10327. }
  10328. // Handle a key from the keypress event
  10329. function handleCharBinding(cm, e, ch) {
  10330. return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
  10331. }
  10332. var lastStoppedKey = null;
  10333. function onKeyDown(e) {
  10334. var cm = this;
  10335. cm.curOp.focus = activeElt();
  10336. if (signalDOMEvent(cm, e)) { return }
  10337. // IE does strange things with escape.
  10338. if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
  10339. var code = e.keyCode;
  10340. cm.display.shift = code == 16 || e.shiftKey;
  10341. var handled = handleKeyBinding(cm, e);
  10342. if (presto) {
  10343. lastStoppedKey = handled ? code : null;
  10344. // Opera has no cut event... we try to at least catch the key combo
  10345. if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
  10346. { cm.replaceSelection("", null, "cut"); }
  10347. }
  10348. // Turn mouse into crosshair when Alt is held on Mac.
  10349. if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
  10350. { showCrossHair(cm); }
  10351. }
  10352. function showCrossHair(cm) {
  10353. var lineDiv = cm.display.lineDiv;
  10354. addClass(lineDiv, "CodeMirror-crosshair");
  10355. function up(e) {
  10356. if (e.keyCode == 18 || !e.altKey) {
  10357. rmClass(lineDiv, "CodeMirror-crosshair");
  10358. off(document, "keyup", up);
  10359. off(document, "mouseover", up);
  10360. }
  10361. }
  10362. on(document, "keyup", up);
  10363. on(document, "mouseover", up);
  10364. }
  10365. function onKeyUp(e) {
  10366. if (e.keyCode == 16) { this.doc.sel.shift = false; }
  10367. signalDOMEvent(this, e);
  10368. }
  10369. function onKeyPress(e) {
  10370. var cm = this;
  10371. if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
  10372. var keyCode = e.keyCode, charCode = e.charCode;
  10373. if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
  10374. if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
  10375. var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
  10376. // Some browsers fire keypress events for backspace
  10377. if (ch == "\x08") { return }
  10378. if (handleCharBinding(cm, e, ch)) { return }
  10379. cm.display.input.onKeyPress(e);
  10380. }
  10381. // A mouse down can be a single click, double click, triple click,
  10382. // start of selection drag, start of text drag, new cursor
  10383. // (ctrl-click), rectangle drag (alt-drag), or xwin
  10384. // middle-click-paste. Or it might be a click on something we should
  10385. // not interfere with, such as a scrollbar or widget.
  10386. function onMouseDown(e) {
  10387. var cm = this, display = cm.display;
  10388. if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
  10389. display.input.ensurePolled();
  10390. display.shift = e.shiftKey;
  10391. if (eventInWidget(display, e)) {
  10392. if (!webkit) {
  10393. // Briefly turn off draggability, to allow widgets to do
  10394. // normal dragging things.
  10395. display.scroller.draggable = false;
  10396. setTimeout(function () { return display.scroller.draggable = true; }, 100);
  10397. }
  10398. return
  10399. }
  10400. if (clickInGutter(cm, e)) { return }
  10401. var start = posFromMouse(cm, e);
  10402. window.focus();
  10403. switch (e_button(e)) {
  10404. case 1:
  10405. // #3261: make sure, that we're not starting a second selection
  10406. if (cm.state.selectingText)
  10407. { cm.state.selectingText(e); }
  10408. else if (start)
  10409. { leftButtonDown(cm, e, start); }
  10410. else if (e_target(e) == display.scroller)
  10411. { e_preventDefault(e); }
  10412. break
  10413. case 2:
  10414. if (webkit) { cm.state.lastMiddleDown = +new Date; }
  10415. if (start) { extendSelection(cm.doc, start); }
  10416. setTimeout(function () { return display.input.focus(); }, 20);
  10417. e_preventDefault(e);
  10418. break
  10419. case 3:
  10420. if (captureRightClick) { onContextMenu(cm, e); }
  10421. else { delayBlurEvent(cm); }
  10422. break
  10423. }
  10424. }
  10425. var lastClick;
  10426. var lastDoubleClick;
  10427. function leftButtonDown(cm, e, start) {
  10428. if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
  10429. else { cm.curOp.focus = activeElt(); }
  10430. var now = +new Date, type;
  10431. if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
  10432. type = "triple";
  10433. } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
  10434. type = "double";
  10435. lastDoubleClick = {time: now, pos: start};
  10436. } else {
  10437. type = "single";
  10438. lastClick = {time: now, pos: start};
  10439. }
  10440. var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
  10441. if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
  10442. type == "single" && (contained = sel.contains(start)) > -1 &&
  10443. (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
  10444. (cmp(contained.to(), start) > 0 || start.xRel < 0))
  10445. { leftButtonStartDrag(cm, e, start, modifier); }
  10446. else
  10447. { leftButtonSelect(cm, e, start, type, modifier); }
  10448. }
  10449. // Start a text drag. When it ends, see if any dragging actually
  10450. // happen, and treat as a click if it didn't.
  10451. function leftButtonStartDrag(cm, e, start, modifier) {
  10452. var display = cm.display, startTime = +new Date;
  10453. var dragEnd = operation(cm, function (e2) {
  10454. if (webkit) { display.scroller.draggable = false; }
  10455. cm.state.draggingText = false;
  10456. off(document, "mouseup", dragEnd);
  10457. off(display.scroller, "drop", dragEnd);
  10458. if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
  10459. e_preventDefault(e2);
  10460. if (!modifier && +new Date - 200 < startTime)
  10461. { extendSelection(cm.doc, start); }
  10462. // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
  10463. if (webkit || ie && ie_version == 9)
  10464. { setTimeout(function () {document.body.focus(); display.input.focus();}, 20); }
  10465. else
  10466. { display.input.focus(); }
  10467. }
  10468. });
  10469. // Let the drag handler handle this.
  10470. if (webkit) { display.scroller.draggable = true; }
  10471. cm.state.draggingText = dragEnd;
  10472. dragEnd.copy = mac ? e.altKey : e.ctrlKey;
  10473. // IE's approach to draggable
  10474. if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
  10475. on(document, "mouseup", dragEnd);
  10476. on(display.scroller, "drop", dragEnd);
  10477. }
  10478. // Normal selection, as opposed to text dragging.
  10479. function leftButtonSelect(cm, e, start, type, addNew) {
  10480. var display = cm.display, doc = cm.doc;
  10481. e_preventDefault(e);
  10482. var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
  10483. if (addNew && !e.shiftKey) {
  10484. ourIndex = doc.sel.contains(start);
  10485. if (ourIndex > -1)
  10486. { ourRange = ranges[ourIndex]; }
  10487. else
  10488. { ourRange = new Range(start, start); }
  10489. } else {
  10490. ourRange = doc.sel.primary();
  10491. ourIndex = doc.sel.primIndex;
  10492. }
  10493. if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
  10494. type = "rect";
  10495. if (!addNew) { ourRange = new Range(start, start); }
  10496. start = posFromMouse(cm, e, true, true);
  10497. ourIndex = -1;
  10498. } else if (type == "double") {
  10499. var word = cm.findWordAt(start);
  10500. if (cm.display.shift || doc.extend)
  10501. { ourRange = extendRange(doc, ourRange, word.anchor, word.head); }
  10502. else
  10503. { ourRange = word; }
  10504. } else if (type == "triple") {
  10505. var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
  10506. if (cm.display.shift || doc.extend)
  10507. { ourRange = extendRange(doc, ourRange, line.anchor, line.head); }
  10508. else
  10509. { ourRange = line; }
  10510. } else {
  10511. ourRange = extendRange(doc, ourRange, start);
  10512. }
  10513. if (!addNew) {
  10514. ourIndex = 0;
  10515. setSelection(doc, new Selection([ourRange], 0), sel_mouse);
  10516. startSel = doc.sel;
  10517. } else if (ourIndex == -1) {
  10518. ourIndex = ranges.length;
  10519. setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
  10520. {scroll: false, origin: "*mouse"});
  10521. } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
  10522. setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
  10523. {scroll: false, origin: "*mouse"});
  10524. startSel = doc.sel;
  10525. } else {
  10526. replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
  10527. }
  10528. var lastPos = start;
  10529. function extendTo(pos) {
  10530. if (cmp(lastPos, pos) == 0) { return }
  10531. lastPos = pos;
  10532. if (type == "rect") {
  10533. var ranges = [], tabSize = cm.options.tabSize;
  10534. var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
  10535. var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
  10536. var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
  10537. for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
  10538. line <= end; line++) {
  10539. var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
  10540. if (left == right)
  10541. { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
  10542. else if (text.length > leftPos)
  10543. { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
  10544. }
  10545. if (!ranges.length) { ranges.push(new Range(start, start)); }
  10546. setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
  10547. {origin: "*mouse", scroll: false});
  10548. cm.scrollIntoView(pos);
  10549. } else {
  10550. var oldRange = ourRange;
  10551. var anchor = oldRange.anchor, head = pos;
  10552. if (type != "single") {
  10553. var range$$1;
  10554. if (type == "double")
  10555. { range$$1 = cm.findWordAt(pos); }
  10556. else
  10557. { range$$1 = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); }
  10558. if (cmp(range$$1.anchor, anchor) > 0) {
  10559. head = range$$1.head;
  10560. anchor = minPos(oldRange.from(), range$$1.anchor);
  10561. } else {
  10562. head = range$$1.anchor;
  10563. anchor = maxPos(oldRange.to(), range$$1.head);
  10564. }
  10565. }
  10566. var ranges$1 = startSel.ranges.slice(0);
  10567. ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);
  10568. setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);
  10569. }
  10570. }
  10571. var editorSize = display.wrapper.getBoundingClientRect();
  10572. // Used to ensure timeout re-tries don't fire when another extend
  10573. // happened in the meantime (clearTimeout isn't reliable -- at
  10574. // least on Chrome, the timeouts still happen even when cleared,
  10575. // if the clear happens after their scheduled firing time).
  10576. var counter = 0;
  10577. function extend(e) {
  10578. var curCount = ++counter;
  10579. var cur = posFromMouse(cm, e, true, type == "rect");
  10580. if (!cur) { return }
  10581. if (cmp(cur, lastPos) != 0) {
  10582. cm.curOp.focus = activeElt();
  10583. extendTo(cur);
  10584. var visible = visibleLines(display, doc);
  10585. if (cur.line >= visible.to || cur.line < visible.from)
  10586. { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
  10587. } else {
  10588. var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
  10589. if (outside) { setTimeout(operation(cm, function () {
  10590. if (counter != curCount) { return }
  10591. display.scroller.scrollTop += outside;
  10592. extend(e);
  10593. }), 50); }
  10594. }
  10595. }
  10596. function done(e) {
  10597. cm.state.selectingText = false;
  10598. counter = Infinity;
  10599. e_preventDefault(e);
  10600. display.input.focus();
  10601. off(document, "mousemove", move);
  10602. off(document, "mouseup", up);
  10603. doc.history.lastSelOrigin = null;
  10604. }
  10605. var move = operation(cm, function (e) {
  10606. if (!e_button(e)) { done(e); }
  10607. else { extend(e); }
  10608. });
  10609. var up = operation(cm, done);
  10610. cm.state.selectingText = up;
  10611. on(document, "mousemove", move);
  10612. on(document, "mouseup", up);
  10613. }
  10614. // Determines whether an event happened in the gutter, and fires the
  10615. // handlers for the corresponding event.
  10616. function gutterEvent(cm, e, type, prevent) {
  10617. var mX, mY;
  10618. try { mX = e.clientX; mY = e.clientY; }
  10619. catch(e) { return false }
  10620. if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
  10621. if (prevent) { e_preventDefault(e); }
  10622. var display = cm.display;
  10623. var lineBox = display.lineDiv.getBoundingClientRect();
  10624. if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
  10625. mY -= lineBox.top - display.viewOffset;
  10626. for (var i = 0; i < cm.options.gutters.length; ++i) {
  10627. var g = display.gutters.childNodes[i];
  10628. if (g && g.getBoundingClientRect().right >= mX) {
  10629. var line = lineAtHeight(cm.doc, mY);
  10630. var gutter = cm.options.gutters[i];
  10631. signal(cm, type, cm, line, gutter, e);
  10632. return e_defaultPrevented(e)
  10633. }
  10634. }
  10635. }
  10636. function clickInGutter(cm, e) {
  10637. return gutterEvent(cm, e, "gutterClick", true)
  10638. }
  10639. // CONTEXT MENU HANDLING
  10640. // To make the context menu work, we need to briefly unhide the
  10641. // textarea (making it as unobtrusive as possible) to let the
  10642. // right-click take effect on it.
  10643. function onContextMenu(cm, e) {
  10644. if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
  10645. if (signalDOMEvent(cm, e, "contextmenu")) { return }
  10646. cm.display.input.onContextMenu(e);
  10647. }
  10648. function contextMenuInGutter(cm, e) {
  10649. if (!hasHandler(cm, "gutterContextMenu")) { return false }
  10650. return gutterEvent(cm, e, "gutterContextMenu", false)
  10651. }
  10652. function themeChanged(cm) {
  10653. cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
  10654. cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
  10655. clearCaches(cm);
  10656. }
  10657. var Init = {toString: function(){return "CodeMirror.Init"}};
  10658. var defaults = {};
  10659. var optionHandlers = {};
  10660. function defineOptions(CodeMirror) {
  10661. var optionHandlers = CodeMirror.optionHandlers;
  10662. function option(name, deflt, handle, notOnInit) {
  10663. CodeMirror.defaults[name] = deflt;
  10664. if (handle) { optionHandlers[name] =
  10665. notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
  10666. }
  10667. CodeMirror.defineOption = option;
  10668. // Passed to option handlers when there is no old value.
  10669. CodeMirror.Init = Init;
  10670. // These two are, on init, called from the constructor because they
  10671. // have to be initialized before the editor can start at all.
  10672. option("value", "", function (cm, val) { return cm.setValue(val); }, true);
  10673. option("mode", null, function (cm, val) {
  10674. cm.doc.modeOption = val;
  10675. loadMode(cm);
  10676. }, true);
  10677. option("indentUnit", 2, loadMode, true);
  10678. option("indentWithTabs", false);
  10679. option("smartIndent", true);
  10680. option("tabSize", 4, function (cm) {
  10681. resetModeState(cm);
  10682. clearCaches(cm);
  10683. regChange(cm);
  10684. }, true);
  10685. option("lineSeparator", null, function (cm, val) {
  10686. cm.doc.lineSep = val;
  10687. if (!val) { return }
  10688. var newBreaks = [], lineNo = cm.doc.first;
  10689. cm.doc.iter(function (line) {
  10690. for (var pos = 0;;) {
  10691. var found = line.text.indexOf(val, pos);
  10692. if (found == -1) { break }
  10693. pos = found + val.length;
  10694. newBreaks.push(Pos(lineNo, found));
  10695. }
  10696. lineNo++;
  10697. });
  10698. for (var i = newBreaks.length - 1; i >= 0; i--)
  10699. { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
  10700. });
  10701. option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
  10702. cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
  10703. if (old != Init) { cm.refresh(); }
  10704. });
  10705. option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
  10706. option("electricChars", true);
  10707. option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
  10708. throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
  10709. }, true);
  10710. option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
  10711. option("rtlMoveVisually", !windows);
  10712. option("wholeLineUpdateBefore", true);
  10713. option("theme", "default", function (cm) {
  10714. themeChanged(cm);
  10715. guttersChanged(cm);
  10716. }, true);
  10717. option("keyMap", "default", function (cm, val, old) {
  10718. var next = getKeyMap(val);
  10719. var prev = old != Init && getKeyMap(old);
  10720. if (prev && prev.detach) { prev.detach(cm, next); }
  10721. if (next.attach) { next.attach(cm, prev || null); }
  10722. });
  10723. option("extraKeys", null);
  10724. option("lineWrapping", false, wrappingChanged, true);
  10725. option("gutters", [], function (cm) {
  10726. setGuttersForLineNumbers(cm.options);
  10727. guttersChanged(cm);
  10728. }, true);
  10729. option("fixedGutter", true, function (cm, val) {
  10730. cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
  10731. cm.refresh();
  10732. }, true);
  10733. option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
  10734. option("scrollbarStyle", "native", function (cm) {
  10735. initScrollbars(cm);
  10736. updateScrollbars(cm);
  10737. cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
  10738. cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
  10739. }, true);
  10740. option("lineNumbers", false, function (cm) {
  10741. setGuttersForLineNumbers(cm.options);
  10742. guttersChanged(cm);
  10743. }, true);
  10744. option("firstLineNumber", 1, guttersChanged, true);
  10745. option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true);
  10746. option("showCursorWhenSelecting", false, updateSelection, true);
  10747. option("resetSelectionOnContextMenu", true);
  10748. option("lineWiseCopyCut", true);
  10749. option("readOnly", false, function (cm, val) {
  10750. if (val == "nocursor") {
  10751. onBlur(cm);
  10752. cm.display.input.blur();
  10753. cm.display.disabled = true;
  10754. } else {
  10755. cm.display.disabled = false;
  10756. }
  10757. cm.display.input.readOnlyChanged(val);
  10758. });
  10759. option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
  10760. option("dragDrop", true, dragDropChanged);
  10761. option("allowDropFileTypes", null);
  10762. option("cursorBlinkRate", 530);
  10763. option("cursorScrollMargin", 0);
  10764. option("cursorHeight", 1, updateSelection, true);
  10765. option("singleCursorHeightPerLine", true, updateSelection, true);
  10766. option("workTime", 100);
  10767. option("workDelay", 100);
  10768. option("flattenSpans", true, resetModeState, true);
  10769. option("addModeClass", false, resetModeState, true);
  10770. option("pollInterval", 100);
  10771. option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
  10772. option("historyEventDelay", 1250);
  10773. option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
  10774. option("maxHighlightLength", 10000, resetModeState, true);
  10775. option("moveInputWithCursor", true, function (cm, val) {
  10776. if (!val) { cm.display.input.resetPosition(); }
  10777. });
  10778. option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
  10779. option("autofocus", null);
  10780. option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
  10781. }
  10782. function guttersChanged(cm) {
  10783. updateGutters(cm);
  10784. regChange(cm);
  10785. alignHorizontally(cm);
  10786. }
  10787. function dragDropChanged(cm, value, old) {
  10788. var wasOn = old && old != Init;
  10789. if (!value != !wasOn) {
  10790. var funcs = cm.display.dragFunctions;
  10791. var toggle = value ? on : off;
  10792. toggle(cm.display.scroller, "dragstart", funcs.start);
  10793. toggle(cm.display.scroller, "dragenter", funcs.enter);
  10794. toggle(cm.display.scroller, "dragover", funcs.over);
  10795. toggle(cm.display.scroller, "dragleave", funcs.leave);
  10796. toggle(cm.display.scroller, "drop", funcs.drop);
  10797. }
  10798. }
  10799. function wrappingChanged(cm) {
  10800. if (cm.options.lineWrapping) {
  10801. addClass(cm.display.wrapper, "CodeMirror-wrap");
  10802. cm.display.sizer.style.minWidth = "";
  10803. cm.display.sizerWidth = null;
  10804. } else {
  10805. rmClass(cm.display.wrapper, "CodeMirror-wrap");
  10806. findMaxLine(cm);
  10807. }
  10808. estimateLineHeights(cm);
  10809. regChange(cm);
  10810. clearCaches(cm);
  10811. setTimeout(function () { return updateScrollbars(cm); }, 100);
  10812. }
  10813. // A CodeMirror instance represents an editor. This is the object
  10814. // that user code is usually dealing with.
  10815. function CodeMirror$1(place, options) {
  10816. var this$1 = this;
  10817. if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }
  10818. this.options = options = options ? copyObj(options) : {};
  10819. // Determine effective options based on given values and defaults.
  10820. copyObj(defaults, options, false);
  10821. setGuttersForLineNumbers(options);
  10822. var doc = options.value;
  10823. if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
  10824. this.doc = doc;
  10825. var input = new CodeMirror$1.inputStyles[options.inputStyle](this);
  10826. var display = this.display = new Display(place, doc, input);
  10827. display.wrapper.CodeMirror = this;
  10828. updateGutters(this);
  10829. themeChanged(this);
  10830. if (options.lineWrapping)
  10831. { this.display.wrapper.className += " CodeMirror-wrap"; }
  10832. initScrollbars(this);
  10833. this.state = {
  10834. keyMaps: [], // stores maps added by addKeyMap
  10835. overlays: [], // highlighting overlays, as added by addOverlay
  10836. modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
  10837. overwrite: false,
  10838. delayingBlurEvent: false,
  10839. focused: false,
  10840. suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
  10841. pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
  10842. selectingText: false,
  10843. draggingText: false,
  10844. highlight: new Delayed(), // stores highlight worker timeout
  10845. keySeq: null, // Unfinished key sequence
  10846. specialChars: null
  10847. };
  10848. if (options.autofocus && !mobile) { display.input.focus(); }
  10849. // Override magic textarea content restore that IE sometimes does
  10850. // on our hidden textarea on reload
  10851. if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
  10852. registerEventHandlers(this);
  10853. ensureGlobalHandlers();
  10854. startOperation(this);
  10855. this.curOp.forceUpdate = true;
  10856. attachDoc(this, doc);
  10857. if ((options.autofocus && !mobile) || this.hasFocus())
  10858. { setTimeout(bind(onFocus, this), 20); }
  10859. else
  10860. { onBlur(this); }
  10861. for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
  10862. { optionHandlers[opt](this$1, options[opt], Init); } }
  10863. maybeUpdateLineNumberWidth(this);
  10864. if (options.finishInit) { options.finishInit(this); }
  10865. for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
  10866. endOperation(this);
  10867. // Suppress optimizelegibility in Webkit, since it breaks text
  10868. // measuring on line wrapping boundaries.
  10869. if (webkit && options.lineWrapping &&
  10870. getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
  10871. { display.lineDiv.style.textRendering = "auto"; }
  10872. }
  10873. // The default configuration options.
  10874. CodeMirror$1.defaults = defaults;
  10875. // Functions to run when options are changed.
  10876. CodeMirror$1.optionHandlers = optionHandlers;
  10877. // Attach the necessary event handlers when initializing the editor
  10878. function registerEventHandlers(cm) {
  10879. var d = cm.display;
  10880. on(d.scroller, "mousedown", operation(cm, onMouseDown));
  10881. // Older IE's will not fire a second mousedown for a double click
  10882. if (ie && ie_version < 11)
  10883. { on(d.scroller, "dblclick", operation(cm, function (e) {
  10884. if (signalDOMEvent(cm, e)) { return }
  10885. var pos = posFromMouse(cm, e);
  10886. if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
  10887. e_preventDefault(e);
  10888. var word = cm.findWordAt(pos);
  10889. extendSelection(cm.doc, word.anchor, word.head);
  10890. })); }
  10891. else
  10892. { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
  10893. // Some browsers fire contextmenu *after* opening the menu, at
  10894. // which point we can't mess with it anymore. Context menu is
  10895. // handled in onMouseDown for these browsers.
  10896. if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); }
  10897. // Used to suppress mouse event handling when a touch happens
  10898. var touchFinished, prevTouch = {end: 0};
  10899. function finishTouch() {
  10900. if (d.activeTouch) {
  10901. touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
  10902. prevTouch = d.activeTouch;
  10903. prevTouch.end = +new Date;
  10904. }
  10905. }
  10906. function isMouseLikeTouchEvent(e) {
  10907. if (e.touches.length != 1) { return false }
  10908. var touch = e.touches[0];
  10909. return touch.radiusX <= 1 && touch.radiusY <= 1
  10910. }
  10911. function farAway(touch, other) {
  10912. if (other.left == null) { return true }
  10913. var dx = other.left - touch.left, dy = other.top - touch.top;
  10914. return dx * dx + dy * dy > 20 * 20
  10915. }
  10916. on(d.scroller, "touchstart", function (e) {
  10917. if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
  10918. d.input.ensurePolled();
  10919. clearTimeout(touchFinished);
  10920. var now = +new Date;
  10921. d.activeTouch = {start: now, moved: false,
  10922. prev: now - prevTouch.end <= 300 ? prevTouch : null};
  10923. if (e.touches.length == 1) {
  10924. d.activeTouch.left = e.touches[0].pageX;
  10925. d.activeTouch.top = e.touches[0].pageY;
  10926. }
  10927. }
  10928. });
  10929. on(d.scroller, "touchmove", function () {
  10930. if (d.activeTouch) { d.activeTouch.moved = true; }
  10931. });
  10932. on(d.scroller, "touchend", function (e) {
  10933. var touch = d.activeTouch;
  10934. if (touch && !eventInWidget(d, e) && touch.left != null &&
  10935. !touch.moved && new Date - touch.start < 300) {
  10936. var pos = cm.coordsChar(d.activeTouch, "page"), range;
  10937. if (!touch.prev || farAway(touch, touch.prev)) // Single tap
  10938. { range = new Range(pos, pos); }
  10939. else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
  10940. { range = cm.findWordAt(pos); }
  10941. else // Triple tap
  10942. { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
  10943. cm.setSelection(range.anchor, range.head);
  10944. cm.focus();
  10945. e_preventDefault(e);
  10946. }
  10947. finishTouch();
  10948. });
  10949. on(d.scroller, "touchcancel", finishTouch);
  10950. // Sync scrolling between fake scrollbars and real scrollable
  10951. // area, ensure viewport is updated when scrolling.
  10952. on(d.scroller, "scroll", function () {
  10953. if (d.scroller.clientHeight) {
  10954. setScrollTop(cm, d.scroller.scrollTop);
  10955. setScrollLeft(cm, d.scroller.scrollLeft, true);
  10956. signal(cm, "scroll", cm);
  10957. }
  10958. });
  10959. // Listen to wheel events in order to try and update the viewport on time.
  10960. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
  10961. on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
  10962. // Prevent wrapper from ever scrolling
  10963. on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
  10964. d.dragFunctions = {
  10965. enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
  10966. over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
  10967. start: function (e) { return onDragStart(cm, e); },
  10968. drop: operation(cm, onDrop),
  10969. leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
  10970. };
  10971. var inp = d.input.getField();
  10972. on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
  10973. on(inp, "keydown", operation(cm, onKeyDown));
  10974. on(inp, "keypress", operation(cm, onKeyPress));
  10975. on(inp, "focus", function (e) { return onFocus(cm, e); });
  10976. on(inp, "blur", function (e) { return onBlur(cm, e); });
  10977. }
  10978. var initHooks = [];
  10979. CodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); };
  10980. // Indent the given line. The how parameter can be "smart",
  10981. // "add"/null, "subtract", or "prev". When aggressive is false
  10982. // (typically set to true for forced single-line indents), empty
  10983. // lines are not indented, and places where the mode returns Pass
  10984. // are left alone.
  10985. function indentLine(cm, n, how, aggressive) {
  10986. var doc = cm.doc, state;
  10987. if (how == null) { how = "add"; }
  10988. if (how == "smart") {
  10989. // Fall back to "prev" when the mode doesn't have an indentation
  10990. // method.
  10991. if (!doc.mode.indent) { how = "prev"; }
  10992. else { state = getStateBefore(cm, n); }
  10993. }
  10994. var tabSize = cm.options.tabSize;
  10995. var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
  10996. if (line.stateAfter) { line.stateAfter = null; }
  10997. var curSpaceString = line.text.match(/^\s*/)[0], indentation;
  10998. if (!aggressive && !/\S/.test(line.text)) {
  10999. indentation = 0;
  11000. how = "not";
  11001. } else if (how == "smart") {
  11002. indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
  11003. if (indentation == Pass || indentation > 150) {
  11004. if (!aggressive) { return }
  11005. how = "prev";
  11006. }
  11007. }
  11008. if (how == "prev") {
  11009. if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
  11010. else { indentation = 0; }
  11011. } else if (how == "add") {
  11012. indentation = curSpace + cm.options.indentUnit;
  11013. } else if (how == "subtract") {
  11014. indentation = curSpace - cm.options.indentUnit;
  11015. } else if (typeof how == "number") {
  11016. indentation = curSpace + how;
  11017. }
  11018. indentation = Math.max(0, indentation);
  11019. var indentString = "", pos = 0;
  11020. if (cm.options.indentWithTabs)
  11021. { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
  11022. if (pos < indentation) { indentString += spaceStr(indentation - pos); }
  11023. if (indentString != curSpaceString) {
  11024. replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
  11025. line.stateAfter = null;
  11026. return true
  11027. } else {
  11028. // Ensure that, if the cursor was in the whitespace at the start
  11029. // of the line, it is moved to the end of that space.
  11030. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
  11031. var range = doc.sel.ranges[i$1];
  11032. if (range.head.line == n && range.head.ch < curSpaceString.length) {
  11033. var pos$1 = Pos(n, curSpaceString.length);
  11034. replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
  11035. break
  11036. }
  11037. }
  11038. }
  11039. }
  11040. // This will be set to a {lineWise: bool, text: [string]} object, so
  11041. // that, when pasting, we know what kind of selections the copied
  11042. // text was made out of.
  11043. var lastCopied = null;
  11044. function setLastCopied(newLastCopied) {
  11045. lastCopied = newLastCopied;
  11046. }
  11047. function applyTextInput(cm, inserted, deleted, sel, origin) {
  11048. var doc = cm.doc;
  11049. cm.display.shift = false;
  11050. if (!sel) { sel = doc.sel; }
  11051. var paste = cm.state.pasteIncoming || origin == "paste";
  11052. var textLines = splitLinesAuto(inserted), multiPaste = null;
  11053. // When pasing N lines into N selections, insert one line per selection
  11054. if (paste && sel.ranges.length > 1) {
  11055. if (lastCopied && lastCopied.text.join("\n") == inserted) {
  11056. if (sel.ranges.length % lastCopied.text.length == 0) {
  11057. multiPaste = [];
  11058. for (var i = 0; i < lastCopied.text.length; i++)
  11059. { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
  11060. }
  11061. } else if (textLines.length == sel.ranges.length) {
  11062. multiPaste = map(textLines, function (l) { return [l]; });
  11063. }
  11064. }
  11065. var updateInput;
  11066. // Normal behavior is to insert the new text into every selection
  11067. for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
  11068. var range$$1 = sel.ranges[i$1];
  11069. var from = range$$1.from(), to = range$$1.to();
  11070. if (range$$1.empty()) {
  11071. if (deleted && deleted > 0) // Handle deletion
  11072. { from = Pos(from.line, from.ch - deleted); }
  11073. else if (cm.state.overwrite && !paste) // Handle overwrite
  11074. { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
  11075. else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
  11076. { from = to = Pos(from.line, 0); }
  11077. }
  11078. updateInput = cm.curOp.updateInput;
  11079. var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
  11080. origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
  11081. makeChange(cm.doc, changeEvent);
  11082. signalLater(cm, "inputRead", cm, changeEvent);
  11083. }
  11084. if (inserted && !paste)
  11085. { triggerElectric(cm, inserted); }
  11086. ensureCursorVisible(cm);
  11087. cm.curOp.updateInput = updateInput;
  11088. cm.curOp.typing = true;
  11089. cm.state.pasteIncoming = cm.state.cutIncoming = false;
  11090. }
  11091. function handlePaste(e, cm) {
  11092. var pasted = e.clipboardData && e.clipboardData.getData("Text");
  11093. if (pasted) {
  11094. e.preventDefault();
  11095. if (!cm.isReadOnly() && !cm.options.disableInput)
  11096. { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
  11097. return true
  11098. }
  11099. }
  11100. function triggerElectric(cm, inserted) {
  11101. // When an 'electric' character is inserted, immediately trigger a reindent
  11102. if (!cm.options.electricChars || !cm.options.smartIndent) { return }
  11103. var sel = cm.doc.sel;
  11104. for (var i = sel.ranges.length - 1; i >= 0; i--) {
  11105. var range$$1 = sel.ranges[i];
  11106. if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
  11107. var mode = cm.getModeAt(range$$1.head);
  11108. var indented = false;
  11109. if (mode.electricChars) {
  11110. for (var j = 0; j < mode.electricChars.length; j++)
  11111. { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
  11112. indented = indentLine(cm, range$$1.head.line, "smart");
  11113. break
  11114. } }
  11115. } else if (mode.electricInput) {
  11116. if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
  11117. { indented = indentLine(cm, range$$1.head.line, "smart"); }
  11118. }
  11119. if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
  11120. }
  11121. }
  11122. function copyableRanges(cm) {
  11123. var text = [], ranges = [];
  11124. for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
  11125. var line = cm.doc.sel.ranges[i].head.line;
  11126. var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
  11127. ranges.push(lineRange);
  11128. text.push(cm.getRange(lineRange.anchor, lineRange.head));
  11129. }
  11130. return {text: text, ranges: ranges}
  11131. }
  11132. function disableBrowserMagic(field, spellcheck) {
  11133. field.setAttribute("autocorrect", "off");
  11134. field.setAttribute("autocapitalize", "off");
  11135. field.setAttribute("spellcheck", !!spellcheck);
  11136. }
  11137. function hiddenTextarea() {
  11138. var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
  11139. var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
  11140. // The textarea is kept positioned near the cursor to prevent the
  11141. // fact that it'll be scrolled into view on input from scrolling
  11142. // our fake cursor out of view. On webkit, when wrap=off, paste is
  11143. // very slow. So make the area wide instead.
  11144. if (webkit) { te.style.width = "1000px"; }
  11145. else { te.setAttribute("wrap", "off"); }
  11146. // If border: 0; -- iOS fails to open keyboard (issue #1287)
  11147. if (ios) { te.style.border = "1px solid black"; }
  11148. disableBrowserMagic(te);
  11149. return div
  11150. }
  11151. // The publicly visible API. Note that methodOp(f) means
  11152. // 'wrap f in an operation, performed on its `this` parameter'.
  11153. // This is not the complete set of editor methods. Most of the
  11154. // methods defined on the Doc type are also injected into
  11155. // CodeMirror.prototype, for backwards compatibility and
  11156. // convenience.
  11157. var addEditorMethods = function(CodeMirror) {
  11158. var optionHandlers = CodeMirror.optionHandlers;
  11159. var helpers = CodeMirror.helpers = {};
  11160. CodeMirror.prototype = {
  11161. constructor: CodeMirror,
  11162. focus: function(){window.focus(); this.display.input.focus();},
  11163. setOption: function(option, value) {
  11164. var options = this.options, old = options[option];
  11165. if (options[option] == value && option != "mode") { return }
  11166. options[option] = value;
  11167. if (optionHandlers.hasOwnProperty(option))
  11168. { operation(this, optionHandlers[option])(this, value, old); }
  11169. signal(this, "optionChange", this, option);
  11170. },
  11171. getOption: function(option) {return this.options[option]},
  11172. getDoc: function() {return this.doc},
  11173. addKeyMap: function(map$$1, bottom) {
  11174. this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
  11175. },
  11176. removeKeyMap: function(map$$1) {
  11177. var maps = this.state.keyMaps;
  11178. for (var i = 0; i < maps.length; ++i)
  11179. { if (maps[i] == map$$1 || maps[i].name == map$$1) {
  11180. maps.splice(i, 1);
  11181. return true
  11182. } }
  11183. },
  11184. addOverlay: methodOp(function(spec, options) {
  11185. var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
  11186. if (mode.startState) { throw new Error("Overlays may not be stateful.") }
  11187. insertSorted(this.state.overlays,
  11188. {mode: mode, modeSpec: spec, opaque: options && options.opaque,
  11189. priority: (options && options.priority) || 0},
  11190. function (overlay) { return overlay.priority; });
  11191. this.state.modeGen++;
  11192. regChange(this);
  11193. }),
  11194. removeOverlay: methodOp(function(spec) {
  11195. var this$1 = this;
  11196. var overlays = this.state.overlays;
  11197. for (var i = 0; i < overlays.length; ++i) {
  11198. var cur = overlays[i].modeSpec;
  11199. if (cur == spec || typeof spec == "string" && cur.name == spec) {
  11200. overlays.splice(i, 1);
  11201. this$1.state.modeGen++;
  11202. regChange(this$1);
  11203. return
  11204. }
  11205. }
  11206. }),
  11207. indentLine: methodOp(function(n, dir, aggressive) {
  11208. if (typeof dir != "string" && typeof dir != "number") {
  11209. if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
  11210. else { dir = dir ? "add" : "subtract"; }
  11211. }
  11212. if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
  11213. }),
  11214. indentSelection: methodOp(function(how) {
  11215. var this$1 = this;
  11216. var ranges = this.doc.sel.ranges, end = -1;
  11217. for (var i = 0; i < ranges.length; i++) {
  11218. var range$$1 = ranges[i];
  11219. if (!range$$1.empty()) {
  11220. var from = range$$1.from(), to = range$$1.to();
  11221. var start = Math.max(end, from.line);
  11222. end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
  11223. for (var j = start; j < end; ++j)
  11224. { indentLine(this$1, j, how); }
  11225. var newRanges = this$1.doc.sel.ranges;
  11226. if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
  11227. { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
  11228. } else if (range$$1.head.line > end) {
  11229. indentLine(this$1, range$$1.head.line, how, true);
  11230. end = range$$1.head.line;
  11231. if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
  11232. }
  11233. }
  11234. }),
  11235. // Fetch the parser token for a given character. Useful for hacks
  11236. // that want to inspect the mode state (say, for completion).
  11237. getTokenAt: function(pos, precise) {
  11238. return takeToken(this, pos, precise)
  11239. },
  11240. getLineTokens: function(line, precise) {
  11241. return takeToken(this, Pos(line), precise, true)
  11242. },
  11243. getTokenTypeAt: function(pos) {
  11244. pos = clipPos(this.doc, pos);
  11245. var styles = getLineStyles(this, getLine(this.doc, pos.line));
  11246. var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
  11247. var type;
  11248. if (ch == 0) { type = styles[2]; }
  11249. else { for (;;) {
  11250. var mid = (before + after) >> 1;
  11251. if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
  11252. else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
  11253. else { type = styles[mid * 2 + 2]; break }
  11254. } }
  11255. var cut = type ? type.indexOf("overlay ") : -1;
  11256. return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
  11257. },
  11258. getModeAt: function(pos) {
  11259. var mode = this.doc.mode;
  11260. if (!mode.innerMode) { return mode }
  11261. return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
  11262. },
  11263. getHelper: function(pos, type) {
  11264. return this.getHelpers(pos, type)[0]
  11265. },
  11266. getHelpers: function(pos, type) {
  11267. var this$1 = this;
  11268. var found = [];
  11269. if (!helpers.hasOwnProperty(type)) { return found }
  11270. var help = helpers[type], mode = this.getModeAt(pos);
  11271. if (typeof mode[type] == "string") {
  11272. if (help[mode[type]]) { found.push(help[mode[type]]); }
  11273. } else if (mode[type]) {
  11274. for (var i = 0; i < mode[type].length; i++) {
  11275. var val = help[mode[type][i]];
  11276. if (val) { found.push(val); }
  11277. }
  11278. } else if (mode.helperType && help[mode.helperType]) {
  11279. found.push(help[mode.helperType]);
  11280. } else if (help[mode.name]) {
  11281. found.push(help[mode.name]);
  11282. }
  11283. for (var i$1 = 0; i$1 < help._global.length; i$1++) {
  11284. var cur = help._global[i$1];
  11285. if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
  11286. { found.push(cur.val); }
  11287. }
  11288. return found
  11289. },
  11290. getStateAfter: function(line, precise) {
  11291. var doc = this.doc;
  11292. line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
  11293. return getStateBefore(this, line + 1, precise)
  11294. },
  11295. cursorCoords: function(start, mode) {
  11296. var pos, range$$1 = this.doc.sel.primary();
  11297. if (start == null) { pos = range$$1.head; }
  11298. else if (typeof start == "object") { pos = clipPos(this.doc, start); }
  11299. else { pos = start ? range$$1.from() : range$$1.to(); }
  11300. return cursorCoords(this, pos, mode || "page")
  11301. },
  11302. charCoords: function(pos, mode) {
  11303. return charCoords(this, clipPos(this.doc, pos), mode || "page")
  11304. },
  11305. coordsChar: function(coords, mode) {
  11306. coords = fromCoordSystem(this, coords, mode || "page");
  11307. return coordsChar(this, coords.left, coords.top)
  11308. },
  11309. lineAtHeight: function(height, mode) {
  11310. height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
  11311. return lineAtHeight(this.doc, height + this.display.viewOffset)
  11312. },
  11313. heightAtLine: function(line, mode, includeWidgets) {
  11314. var end = false, lineObj;
  11315. if (typeof line == "number") {
  11316. var last = this.doc.first + this.doc.size - 1;
  11317. if (line < this.doc.first) { line = this.doc.first; }
  11318. else if (line > last) { line = last; end = true; }
  11319. lineObj = getLine(this.doc, line);
  11320. } else {
  11321. lineObj = line;
  11322. }
  11323. return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
  11324. (end ? this.doc.height - heightAtLine(lineObj) : 0)
  11325. },
  11326. defaultTextHeight: function() { return textHeight(this.display) },
  11327. defaultCharWidth: function() { return charWidth(this.display) },
  11328. getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
  11329. addWidget: function(pos, node, scroll, vert, horiz) {
  11330. var display = this.display;
  11331. pos = cursorCoords(this, clipPos(this.doc, pos));
  11332. var top = pos.bottom, left = pos.left;
  11333. node.style.position = "absolute";
  11334. node.setAttribute("cm-ignore-events", "true");
  11335. this.display.input.setUneditable(node);
  11336. display.sizer.appendChild(node);
  11337. if (vert == "over") {
  11338. top = pos.top;
  11339. } else if (vert == "above" || vert == "near") {
  11340. var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
  11341. hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
  11342. // Default to positioning above (if specified and possible); otherwise default to positioning below
  11343. if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
  11344. { top = pos.top - node.offsetHeight; }
  11345. else if (pos.bottom + node.offsetHeight <= vspace)
  11346. { top = pos.bottom; }
  11347. if (left + node.offsetWidth > hspace)
  11348. { left = hspace - node.offsetWidth; }
  11349. }
  11350. node.style.top = top + "px";
  11351. node.style.left = node.style.right = "";
  11352. if (horiz == "right") {
  11353. left = display.sizer.clientWidth - node.offsetWidth;
  11354. node.style.right = "0px";
  11355. } else {
  11356. if (horiz == "left") { left = 0; }
  11357. else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
  11358. node.style.left = left + "px";
  11359. }
  11360. if (scroll)
  11361. { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
  11362. },
  11363. triggerOnKeyDown: methodOp(onKeyDown),
  11364. triggerOnKeyPress: methodOp(onKeyPress),
  11365. triggerOnKeyUp: onKeyUp,
  11366. execCommand: function(cmd) {
  11367. if (commands.hasOwnProperty(cmd))
  11368. { return commands[cmd].call(null, this) }
  11369. },
  11370. triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
  11371. findPosH: function(from, amount, unit, visually) {
  11372. var this$1 = this;
  11373. var dir = 1;
  11374. if (amount < 0) { dir = -1; amount = -amount; }
  11375. var cur = clipPos(this.doc, from);
  11376. for (var i = 0; i < amount; ++i) {
  11377. cur = findPosH(this$1.doc, cur, dir, unit, visually);
  11378. if (cur.hitSide) { break }
  11379. }
  11380. return cur
  11381. },
  11382. moveH: methodOp(function(dir, unit) {
  11383. var this$1 = this;
  11384. this.extendSelectionsBy(function (range$$1) {
  11385. if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
  11386. { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
  11387. else
  11388. { return dir < 0 ? range$$1.from() : range$$1.to() }
  11389. }, sel_move);
  11390. }),
  11391. deleteH: methodOp(function(dir, unit) {
  11392. var sel = this.doc.sel, doc = this.doc;
  11393. if (sel.somethingSelected())
  11394. { doc.replaceSelection("", null, "+delete"); }
  11395. else
  11396. { deleteNearSelection(this, function (range$$1) {
  11397. var other = findPosH(doc, range$$1.head, dir, unit, false);
  11398. return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
  11399. }); }
  11400. }),
  11401. findPosV: function(from, amount, unit, goalColumn) {
  11402. var this$1 = this;
  11403. var dir = 1, x = goalColumn;
  11404. if (amount < 0) { dir = -1; amount = -amount; }
  11405. var cur = clipPos(this.doc, from);
  11406. for (var i = 0; i < amount; ++i) {
  11407. var coords = cursorCoords(this$1, cur, "div");
  11408. if (x == null) { x = coords.left; }
  11409. else { coords.left = x; }
  11410. cur = findPosV(this$1, coords, dir, unit);
  11411. if (cur.hitSide) { break }
  11412. }
  11413. return cur
  11414. },
  11415. moveV: methodOp(function(dir, unit) {
  11416. var this$1 = this;
  11417. var doc = this.doc, goals = [];
  11418. var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
  11419. doc.extendSelectionsBy(function (range$$1) {
  11420. if (collapse)
  11421. { return dir < 0 ? range$$1.from() : range$$1.to() }
  11422. var headPos = cursorCoords(this$1, range$$1.head, "div");
  11423. if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
  11424. goals.push(headPos.left);
  11425. var pos = findPosV(this$1, headPos, dir, unit);
  11426. if (unit == "page" && range$$1 == doc.sel.primary())
  11427. { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top); }
  11428. return pos
  11429. }, sel_move);
  11430. if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
  11431. { doc.sel.ranges[i].goalColumn = goals[i]; } }
  11432. }),
  11433. // Find the word at the given position (as returned by coordsChar).
  11434. findWordAt: function(pos) {
  11435. var doc = this.doc, line = getLine(doc, pos.line).text;
  11436. var start = pos.ch, end = pos.ch;
  11437. if (line) {
  11438. var helper = this.getHelper(pos, "wordChars");
  11439. if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
  11440. var startChar = line.charAt(start);
  11441. var check = isWordChar(startChar, helper)
  11442. ? function (ch) { return isWordChar(ch, helper); }
  11443. : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
  11444. : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
  11445. while (start > 0 && check(line.charAt(start - 1))) { --start; }
  11446. while (end < line.length && check(line.charAt(end))) { ++end; }
  11447. }
  11448. return new Range(Pos(pos.line, start), Pos(pos.line, end))
  11449. },
  11450. toggleOverwrite: function(value) {
  11451. if (value != null && value == this.state.overwrite) { return }
  11452. if (this.state.overwrite = !this.state.overwrite)
  11453. { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  11454. else
  11455. { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  11456. signal(this, "overwriteToggle", this, this.state.overwrite);
  11457. },
  11458. hasFocus: function() { return this.display.input.getField() == activeElt() },
  11459. isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
  11460. scrollTo: methodOp(function(x, y) {
  11461. if (x != null || y != null) { resolveScrollToPos(this); }
  11462. if (x != null) { this.curOp.scrollLeft = x; }
  11463. if (y != null) { this.curOp.scrollTop = y; }
  11464. }),
  11465. getScrollInfo: function() {
  11466. var scroller = this.display.scroller;
  11467. return {left: scroller.scrollLeft, top: scroller.scrollTop,
  11468. height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
  11469. width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
  11470. clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
  11471. },
  11472. scrollIntoView: methodOp(function(range$$1, margin) {
  11473. if (range$$1 == null) {
  11474. range$$1 = {from: this.doc.sel.primary().head, to: null};
  11475. if (margin == null) { margin = this.options.cursorScrollMargin; }
  11476. } else if (typeof range$$1 == "number") {
  11477. range$$1 = {from: Pos(range$$1, 0), to: null};
  11478. } else if (range$$1.from == null) {
  11479. range$$1 = {from: range$$1, to: null};
  11480. }
  11481. if (!range$$1.to) { range$$1.to = range$$1.from; }
  11482. range$$1.margin = margin || 0;
  11483. if (range$$1.from.line != null) {
  11484. resolveScrollToPos(this);
  11485. this.curOp.scrollToPos = range$$1;
  11486. } else {
  11487. var sPos = calculateScrollPos(this, {
  11488. left: Math.min(range$$1.from.left, range$$1.to.left),
  11489. top: Math.min(range$$1.from.top, range$$1.to.top) - range$$1.margin,
  11490. right: Math.max(range$$1.from.right, range$$1.to.right),
  11491. bottom: Math.max(range$$1.from.bottom, range$$1.to.bottom) + range$$1.margin
  11492. });
  11493. this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  11494. }
  11495. }),
  11496. setSize: methodOp(function(width, height) {
  11497. var this$1 = this;
  11498. var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
  11499. if (width != null) { this.display.wrapper.style.width = interpret(width); }
  11500. if (height != null) { this.display.wrapper.style.height = interpret(height); }
  11501. if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
  11502. var lineNo$$1 = this.display.viewFrom;
  11503. this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
  11504. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
  11505. { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
  11506. ++lineNo$$1;
  11507. });
  11508. this.curOp.forceUpdate = true;
  11509. signal(this, "refresh", this);
  11510. }),
  11511. operation: function(f){return runInOp(this, f)},
  11512. refresh: methodOp(function() {
  11513. var oldHeight = this.display.cachedTextHeight;
  11514. regChange(this);
  11515. this.curOp.forceUpdate = true;
  11516. clearCaches(this);
  11517. this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
  11518. updateGutterSpace(this);
  11519. if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
  11520. { estimateLineHeights(this); }
  11521. signal(this, "refresh", this);
  11522. }),
  11523. swapDoc: methodOp(function(doc) {
  11524. var old = this.doc;
  11525. old.cm = null;
  11526. attachDoc(this, doc);
  11527. clearCaches(this);
  11528. this.display.input.reset();
  11529. this.scrollTo(doc.scrollLeft, doc.scrollTop);
  11530. this.curOp.forceScroll = true;
  11531. signalLater(this, "swapDoc", this, old);
  11532. return old
  11533. }),
  11534. getInputField: function(){return this.display.input.getField()},
  11535. getWrapperElement: function(){return this.display.wrapper},
  11536. getScrollerElement: function(){return this.display.scroller},
  11537. getGutterElement: function(){return this.display.gutters}
  11538. };
  11539. eventMixin(CodeMirror);
  11540. CodeMirror.registerHelper = function(type, name, value) {
  11541. if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
  11542. helpers[type][name] = value;
  11543. };
  11544. CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
  11545. CodeMirror.registerHelper(type, name, value);
  11546. helpers[type]._global.push({pred: predicate, val: value});
  11547. };
  11548. };
  11549. // Used for horizontal relative motion. Dir is -1 or 1 (left or
  11550. // right), unit can be "char", "column" (like char, but doesn't
  11551. // cross line boundaries), "word" (across next word), or "group" (to
  11552. // the start of next group of word or non-word-non-whitespace
  11553. // chars). The visually param controls whether, in right-to-left
  11554. // text, direction 1 means to move towards the next index in the
  11555. // string, or towards the character to the right of the current
  11556. // position. The resulting position will have a hitSide=true
  11557. // property if it reached the end of the document.
  11558. function findPosH(doc, pos, dir, unit, visually) {
  11559. var oldPos = pos;
  11560. var origDir = dir;
  11561. var lineObj = getLine(doc, pos.line);
  11562. function findNextLine() {
  11563. var l = pos.line + dir;
  11564. if (l < doc.first || l >= doc.first + doc.size) { return false }
  11565. pos = new Pos(l, pos.ch, pos.sticky);
  11566. return lineObj = getLine(doc, l)
  11567. }
  11568. function moveOnce(boundToLine) {
  11569. var next;
  11570. if (visually) {
  11571. next = moveVisually(doc.cm, lineObj, pos, dir);
  11572. } else {
  11573. next = moveLogically(lineObj, pos, dir);
  11574. }
  11575. if (next == null) {
  11576. if (!boundToLine && findNextLine())
  11577. { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
  11578. else
  11579. { return false }
  11580. } else {
  11581. pos = next;
  11582. }
  11583. return true
  11584. }
  11585. if (unit == "char") {
  11586. moveOnce();
  11587. } else if (unit == "column") {
  11588. moveOnce(true);
  11589. } else if (unit == "word" || unit == "group") {
  11590. var sawType = null, group = unit == "group";
  11591. var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
  11592. for (var first = true;; first = false) {
  11593. if (dir < 0 && !moveOnce(!first)) { break }
  11594. var cur = lineObj.text.charAt(pos.ch) || "\n";
  11595. var type = isWordChar(cur, helper) ? "w"
  11596. : group && cur == "\n" ? "n"
  11597. : !group || /\s/.test(cur) ? null
  11598. : "p";
  11599. if (group && !first && !type) { type = "s"; }
  11600. if (sawType && sawType != type) {
  11601. if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
  11602. break
  11603. }
  11604. if (type) { sawType = type; }
  11605. if (dir > 0 && !moveOnce(!first)) { break }
  11606. }
  11607. }
  11608. var result = skipAtomic(doc, pos, oldPos, origDir, true);
  11609. if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
  11610. return result
  11611. }
  11612. // For relative vertical movement. Dir may be -1 or 1. Unit can be
  11613. // "page" or "line". The resulting position will have a hitSide=true
  11614. // property if it reached the end of the document.
  11615. function findPosV(cm, pos, dir, unit) {
  11616. var doc = cm.doc, x = pos.left, y;
  11617. if (unit == "page") {
  11618. var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
  11619. var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
  11620. y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
  11621. } else if (unit == "line") {
  11622. y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
  11623. }
  11624. var target;
  11625. for (;;) {
  11626. target = coordsChar(cm, x, y);
  11627. if (!target.outside) { break }
  11628. if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
  11629. y += dir * 5;
  11630. }
  11631. return target
  11632. }
  11633. // CONTENTEDITABLE INPUT STYLE
  11634. var ContentEditableInput = function(cm) {
  11635. this.cm = cm;
  11636. this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
  11637. this.polling = new Delayed();
  11638. this.composing = null;
  11639. this.gracePeriod = false;
  11640. this.readDOMTimeout = null;
  11641. };
  11642. ContentEditableInput.prototype.init = function (display) {
  11643. var this$1 = this;
  11644. var input = this, cm = input.cm;
  11645. var div = input.div = display.lineDiv;
  11646. disableBrowserMagic(div, cm.options.spellcheck);
  11647. on(div, "paste", function (e) {
  11648. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  11649. // IE doesn't fire input events, so we schedule a read for the pasted content in this way
  11650. if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
  11651. });
  11652. on(div, "compositionstart", function (e) {
  11653. this$1.composing = {data: e.data, done: false};
  11654. });
  11655. on(div, "compositionupdate", function (e) {
  11656. if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
  11657. });
  11658. on(div, "compositionend", function (e) {
  11659. if (this$1.composing) {
  11660. if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
  11661. this$1.composing.done = true;
  11662. }
  11663. });
  11664. on(div, "touchstart", function () { return input.forceCompositionEnd(); });
  11665. on(div, "input", function () {
  11666. if (!this$1.composing) { this$1.readFromDOMSoon(); }
  11667. });
  11668. function onCopyCut(e) {
  11669. if (signalDOMEvent(cm, e)) { return }
  11670. if (cm.somethingSelected()) {
  11671. setLastCopied({lineWise: false, text: cm.getSelections()});
  11672. if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
  11673. } else if (!cm.options.lineWiseCopyCut) {
  11674. return
  11675. } else {
  11676. var ranges = copyableRanges(cm);
  11677. setLastCopied({lineWise: true, text: ranges.text});
  11678. if (e.type == "cut") {
  11679. cm.operation(function () {
  11680. cm.setSelections(ranges.ranges, 0, sel_dontScroll);
  11681. cm.replaceSelection("", null, "cut");
  11682. });
  11683. }
  11684. }
  11685. if (e.clipboardData) {
  11686. e.clipboardData.clearData();
  11687. var content = lastCopied.text.join("\n");
  11688. // iOS exposes the clipboard API, but seems to discard content inserted into it
  11689. e.clipboardData.setData("Text", content);
  11690. if (e.clipboardData.getData("Text") == content) {
  11691. e.preventDefault();
  11692. return
  11693. }
  11694. }
  11695. // Old-fashioned briefly-focus-a-textarea hack
  11696. var kludge = hiddenTextarea(), te = kludge.firstChild;
  11697. cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
  11698. te.value = lastCopied.text.join("\n");
  11699. var hadFocus = document.activeElement;
  11700. selectInput(te);
  11701. setTimeout(function () {
  11702. cm.display.lineSpace.removeChild(kludge);
  11703. hadFocus.focus();
  11704. if (hadFocus == div) { input.showPrimarySelection(); }
  11705. }, 50);
  11706. }
  11707. on(div, "copy", onCopyCut);
  11708. on(div, "cut", onCopyCut);
  11709. };
  11710. ContentEditableInput.prototype.prepareSelection = function () {
  11711. var result = prepareSelection(this.cm, false);
  11712. result.focus = this.cm.state.focused;
  11713. return result
  11714. };
  11715. ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
  11716. if (!info || !this.cm.display.view.length) { return }
  11717. if (info.focus || takeFocus) { this.showPrimarySelection(); }
  11718. this.showMultipleSelections(info);
  11719. };
  11720. ContentEditableInput.prototype.showPrimarySelection = function () {
  11721. var sel = window.getSelection(), prim = this.cm.doc.sel.primary();
  11722. var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);
  11723. var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);
  11724. if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
  11725. cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&
  11726. cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)
  11727. { return }
  11728. var start = posToDOM(this.cm, prim.from());
  11729. var end = posToDOM(this.cm, prim.to());
  11730. if (!start && !end) {
  11731. sel.removeAllRanges();
  11732. return
  11733. }
  11734. var view = this.cm.display.view;
  11735. var old = sel.rangeCount && sel.getRangeAt(0);
  11736. if (!start) {
  11737. start = {node: view[0].measure.map[2], offset: 0};
  11738. } else if (!end) { // FIXME dangerously hacky
  11739. var measure = view[view.length - 1].measure;
  11740. var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
  11741. end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};
  11742. }
  11743. var rng;
  11744. try { rng = range(start.node, start.offset, end.offset, end.node); }
  11745. catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
  11746. if (rng) {
  11747. if (!gecko && this.cm.state.focused) {
  11748. sel.collapse(start.node, start.offset);
  11749. if (!rng.collapsed) {
  11750. sel.removeAllRanges();
  11751. sel.addRange(rng);
  11752. }
  11753. } else {
  11754. sel.removeAllRanges();
  11755. sel.addRange(rng);
  11756. }
  11757. if (old && sel.anchorNode == null) { sel.addRange(old); }
  11758. else if (gecko) { this.startGracePeriod(); }
  11759. }
  11760. this.rememberSelection();
  11761. };
  11762. ContentEditableInput.prototype.startGracePeriod = function () {
  11763. var this$1 = this;
  11764. clearTimeout(this.gracePeriod);
  11765. this.gracePeriod = setTimeout(function () {
  11766. this$1.gracePeriod = false;
  11767. if (this$1.selectionChanged())
  11768. { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
  11769. }, 20);
  11770. };
  11771. ContentEditableInput.prototype.showMultipleSelections = function (info) {
  11772. removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
  11773. removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
  11774. };
  11775. ContentEditableInput.prototype.rememberSelection = function () {
  11776. var sel = window.getSelection();
  11777. this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
  11778. this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
  11779. };
  11780. ContentEditableInput.prototype.selectionInEditor = function () {
  11781. var sel = window.getSelection();
  11782. if (!sel.rangeCount) { return false }
  11783. var node = sel.getRangeAt(0).commonAncestorContainer;
  11784. return contains(this.div, node)
  11785. };
  11786. ContentEditableInput.prototype.focus = function () {
  11787. if (this.cm.options.readOnly != "nocursor") {
  11788. if (!this.selectionInEditor())
  11789. { this.showSelection(this.prepareSelection(), true); }
  11790. this.div.focus();
  11791. }
  11792. };
  11793. ContentEditableInput.prototype.blur = function () { this.div.blur(); };
  11794. ContentEditableInput.prototype.getField = function () { return this.div };
  11795. ContentEditableInput.prototype.supportsTouch = function () { return true };
  11796. ContentEditableInput.prototype.receivedFocus = function () {
  11797. var input = this;
  11798. if (this.selectionInEditor())
  11799. { this.pollSelection(); }
  11800. else
  11801. { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
  11802. function poll() {
  11803. if (input.cm.state.focused) {
  11804. input.pollSelection();
  11805. input.polling.set(input.cm.options.pollInterval, poll);
  11806. }
  11807. }
  11808. this.polling.set(this.cm.options.pollInterval, poll);
  11809. };
  11810. ContentEditableInput.prototype.selectionChanged = function () {
  11811. var sel = window.getSelection();
  11812. return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
  11813. sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
  11814. };
  11815. ContentEditableInput.prototype.pollSelection = function () {
  11816. if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
  11817. var sel = window.getSelection(), cm = this.cm;
  11818. // On Android Chrome (version 56, at least), backspacing into an
  11819. // uneditable block element will put the cursor in that element,
  11820. // and then, because it's not editable, hide the virtual keyboard.
  11821. // Because Android doesn't allow us to actually detect backspace
  11822. // presses in a sane way, this code checks for when that happens
  11823. // and simulates a backspace press in this case.
  11824. if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
  11825. this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
  11826. this.blur();
  11827. this.focus();
  11828. return
  11829. }
  11830. if (this.composing) { return }
  11831. this.rememberSelection();
  11832. var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
  11833. var head = domToPos(cm, sel.focusNode, sel.focusOffset);
  11834. if (anchor && head) { runInOp(cm, function () {
  11835. setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
  11836. if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
  11837. }); }
  11838. };
  11839. ContentEditableInput.prototype.pollContent = function () {
  11840. if (this.readDOMTimeout != null) {
  11841. clearTimeout(this.readDOMTimeout);
  11842. this.readDOMTimeout = null;
  11843. }
  11844. var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
  11845. var from = sel.from(), to = sel.to();
  11846. if (from.ch == 0 && from.line > cm.firstLine())
  11847. { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
  11848. if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
  11849. { to = Pos(to.line + 1, 0); }
  11850. if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
  11851. var fromIndex, fromLine, fromNode;
  11852. if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
  11853. fromLine = lineNo(display.view[0].line);
  11854. fromNode = display.view[0].node;
  11855. } else {
  11856. fromLine = lineNo(display.view[fromIndex].line);
  11857. fromNode = display.view[fromIndex - 1].node.nextSibling;
  11858. }
  11859. var toIndex = findViewIndex(cm, to.line);
  11860. var toLine, toNode;
  11861. if (toIndex == display.view.length - 1) {
  11862. toLine = display.viewTo - 1;
  11863. toNode = display.lineDiv.lastChild;
  11864. } else {
  11865. toLine = lineNo(display.view[toIndex + 1].line) - 1;
  11866. toNode = display.view[toIndex + 1].node.previousSibling;
  11867. }
  11868. if (!fromNode) { return false }
  11869. var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
  11870. var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
  11871. while (newText.length > 1 && oldText.length > 1) {
  11872. if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
  11873. else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
  11874. else { break }
  11875. }
  11876. var cutFront = 0, cutEnd = 0;
  11877. var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
  11878. while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
  11879. { ++cutFront; }
  11880. var newBot = lst(newText), oldBot = lst(oldText);
  11881. var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
  11882. oldBot.length - (oldText.length == 1 ? cutFront : 0));
  11883. while (cutEnd < maxCutEnd &&
  11884. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
  11885. { ++cutEnd; }
  11886. // Try to move start of change to start of selection if ambiguous
  11887. if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
  11888. while (cutFront && cutFront > from.ch &&
  11889. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
  11890. cutFront--;
  11891. cutEnd++;
  11892. }
  11893. }
  11894. newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
  11895. newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
  11896. var chFrom = Pos(fromLine, cutFront);
  11897. var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
  11898. if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
  11899. replaceRange(cm.doc, newText, chFrom, chTo, "+input");
  11900. return true
  11901. }
  11902. };
  11903. ContentEditableInput.prototype.ensurePolled = function () {
  11904. this.forceCompositionEnd();
  11905. };
  11906. ContentEditableInput.prototype.reset = function () {
  11907. this.forceCompositionEnd();
  11908. };
  11909. ContentEditableInput.prototype.forceCompositionEnd = function () {
  11910. if (!this.composing) { return }
  11911. clearTimeout(this.readDOMTimeout);
  11912. this.composing = null;
  11913. this.updateFromDOM();
  11914. this.div.blur();
  11915. this.div.focus();
  11916. };
  11917. ContentEditableInput.prototype.readFromDOMSoon = function () {
  11918. var this$1 = this;
  11919. if (this.readDOMTimeout != null) { return }
  11920. this.readDOMTimeout = setTimeout(function () {
  11921. this$1.readDOMTimeout = null;
  11922. if (this$1.composing) {
  11923. if (this$1.composing.done) { this$1.composing = null; }
  11924. else { return }
  11925. }
  11926. this$1.updateFromDOM();
  11927. }, 80);
  11928. };
  11929. ContentEditableInput.prototype.updateFromDOM = function () {
  11930. var this$1 = this;
  11931. if (this.cm.isReadOnly() || !this.pollContent())
  11932. { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
  11933. };
  11934. ContentEditableInput.prototype.setUneditable = function (node) {
  11935. node.contentEditable = "false";
  11936. };
  11937. ContentEditableInput.prototype.onKeyPress = function (e) {
  11938. if (e.charCode == 0) { return }
  11939. e.preventDefault();
  11940. if (!this.cm.isReadOnly())
  11941. { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
  11942. };
  11943. ContentEditableInput.prototype.readOnlyChanged = function (val) {
  11944. this.div.contentEditable = String(val != "nocursor");
  11945. };
  11946. ContentEditableInput.prototype.onContextMenu = function () {};
  11947. ContentEditableInput.prototype.resetPosition = function () {};
  11948. ContentEditableInput.prototype.needsContentAttribute = true;
  11949. function posToDOM(cm, pos) {
  11950. var view = findViewForLine(cm, pos.line);
  11951. if (!view || view.hidden) { return null }
  11952. var line = getLine(cm.doc, pos.line);
  11953. var info = mapFromLineView(view, line, pos.line);
  11954. var order = getOrder(line, cm.doc.direction), side = "left";
  11955. if (order) {
  11956. var partPos = getBidiPartAt(order, pos.ch);
  11957. side = partPos % 2 ? "right" : "left";
  11958. }
  11959. var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
  11960. result.offset = result.collapse == "right" ? result.end : result.start;
  11961. return result
  11962. }
  11963. function isInGutter(node) {
  11964. for (var scan = node; scan; scan = scan.parentNode)
  11965. { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
  11966. return false
  11967. }
  11968. function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
  11969. function domTextBetween(cm, from, to, fromLine, toLine) {
  11970. var text = "", closing = false, lineSep = cm.doc.lineSeparator();
  11971. function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
  11972. function close() {
  11973. if (closing) {
  11974. text += lineSep;
  11975. closing = false;
  11976. }
  11977. }
  11978. function addText(str) {
  11979. if (str) {
  11980. close();
  11981. text += str;
  11982. }
  11983. }
  11984. function walk(node) {
  11985. if (node.nodeType == 1) {
  11986. var cmText = node.getAttribute("cm-text");
  11987. if (cmText != null) {
  11988. addText(cmText || node.textContent.replace(/\u200b/g, ""));
  11989. return
  11990. }
  11991. var markerID = node.getAttribute("cm-marker"), range$$1;
  11992. if (markerID) {
  11993. var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
  11994. if (found.length && (range$$1 = found[0].find()))
  11995. { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
  11996. return
  11997. }
  11998. if (node.getAttribute("contenteditable") == "false") { return }
  11999. var isBlock = /^(pre|div|p)$/i.test(node.nodeName);
  12000. if (isBlock) { close(); }
  12001. for (var i = 0; i < node.childNodes.length; i++)
  12002. { walk(node.childNodes[i]); }
  12003. if (isBlock) { closing = true; }
  12004. } else if (node.nodeType == 3) {
  12005. addText(node.nodeValue);
  12006. }
  12007. }
  12008. for (;;) {
  12009. walk(from);
  12010. if (from == to) { break }
  12011. from = from.nextSibling;
  12012. }
  12013. return text
  12014. }
  12015. function domToPos(cm, node, offset) {
  12016. var lineNode;
  12017. if (node == cm.display.lineDiv) {
  12018. lineNode = cm.display.lineDiv.childNodes[offset];
  12019. if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
  12020. node = null; offset = 0;
  12021. } else {
  12022. for (lineNode = node;; lineNode = lineNode.parentNode) {
  12023. if (!lineNode || lineNode == cm.display.lineDiv) { return null }
  12024. if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
  12025. }
  12026. }
  12027. for (var i = 0; i < cm.display.view.length; i++) {
  12028. var lineView = cm.display.view[i];
  12029. if (lineView.node == lineNode)
  12030. { return locateNodeInLineView(lineView, node, offset) }
  12031. }
  12032. }
  12033. function locateNodeInLineView(lineView, node, offset) {
  12034. var wrapper = lineView.text.firstChild, bad = false;
  12035. if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
  12036. if (node == wrapper) {
  12037. bad = true;
  12038. node = wrapper.childNodes[offset];
  12039. offset = 0;
  12040. if (!node) {
  12041. var line = lineView.rest ? lst(lineView.rest) : lineView.line;
  12042. return badPos(Pos(lineNo(line), line.text.length), bad)
  12043. }
  12044. }
  12045. var textNode = node.nodeType == 3 ? node : null, topNode = node;
  12046. if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
  12047. textNode = node.firstChild;
  12048. if (offset) { offset = textNode.nodeValue.length; }
  12049. }
  12050. while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
  12051. var measure = lineView.measure, maps = measure.maps;
  12052. function find(textNode, topNode, offset) {
  12053. for (var i = -1; i < (maps ? maps.length : 0); i++) {
  12054. var map$$1 = i < 0 ? measure.map : maps[i];
  12055. for (var j = 0; j < map$$1.length; j += 3) {
  12056. var curNode = map$$1[j + 2];
  12057. if (curNode == textNode || curNode == topNode) {
  12058. var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
  12059. var ch = map$$1[j] + offset;
  12060. if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
  12061. return Pos(line, ch)
  12062. }
  12063. }
  12064. }
  12065. }
  12066. var found = find(textNode, topNode, offset);
  12067. if (found) { return badPos(found, bad) }
  12068. // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
  12069. for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
  12070. found = find(after, after.firstChild, 0);
  12071. if (found)
  12072. { return badPos(Pos(found.line, found.ch - dist), bad) }
  12073. else
  12074. { dist += after.textContent.length; }
  12075. }
  12076. for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
  12077. found = find(before, before.firstChild, -1);
  12078. if (found)
  12079. { return badPos(Pos(found.line, found.ch + dist$1), bad) }
  12080. else
  12081. { dist$1 += before.textContent.length; }
  12082. }
  12083. }
  12084. // TEXTAREA INPUT STYLE
  12085. var TextareaInput = function(cm) {
  12086. this.cm = cm;
  12087. // See input.poll and input.reset
  12088. this.prevInput = "";
  12089. // Flag that indicates whether we expect input to appear real soon
  12090. // now (after some event like 'keypress' or 'input') and are
  12091. // polling intensively.
  12092. this.pollingFast = false;
  12093. // Self-resetting timeout for the poller
  12094. this.polling = new Delayed();
  12095. // Tracks when input.reset has punted to just putting a short
  12096. // string into the textarea instead of the full selection.
  12097. this.inaccurateSelection = false;
  12098. // Used to work around IE issue with selection being forgotten when focus moves away from textarea
  12099. this.hasSelection = false;
  12100. this.composing = null;
  12101. };
  12102. TextareaInput.prototype.init = function (display) {
  12103. var this$1 = this;
  12104. var input = this, cm = this.cm;
  12105. // Wraps and hides input textarea
  12106. var div = this.wrapper = hiddenTextarea();
  12107. // The semihidden textarea that is focused when the editor is
  12108. // focused, and receives input.
  12109. var te = this.textarea = div.firstChild;
  12110. display.wrapper.insertBefore(div, display.wrapper.firstChild);
  12111. // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
  12112. if (ios) { te.style.width = "0px"; }
  12113. on(te, "input", function () {
  12114. if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
  12115. input.poll();
  12116. });
  12117. on(te, "paste", function (e) {
  12118. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  12119. cm.state.pasteIncoming = true;
  12120. input.fastPoll();
  12121. });
  12122. function prepareCopyCut(e) {
  12123. if (signalDOMEvent(cm, e)) { return }
  12124. if (cm.somethingSelected()) {
  12125. setLastCopied({lineWise: false, text: cm.getSelections()});
  12126. if (input.inaccurateSelection) {
  12127. input.prevInput = "";
  12128. input.inaccurateSelection = false;
  12129. te.value = lastCopied.text.join("\n");
  12130. selectInput(te);
  12131. }
  12132. } else if (!cm.options.lineWiseCopyCut) {
  12133. return
  12134. } else {
  12135. var ranges = copyableRanges(cm);
  12136. setLastCopied({lineWise: true, text: ranges.text});
  12137. if (e.type == "cut") {
  12138. cm.setSelections(ranges.ranges, null, sel_dontScroll);
  12139. } else {
  12140. input.prevInput = "";
  12141. te.value = ranges.text.join("\n");
  12142. selectInput(te);
  12143. }
  12144. }
  12145. if (e.type == "cut") { cm.state.cutIncoming = true; }
  12146. }
  12147. on(te, "cut", prepareCopyCut);
  12148. on(te, "copy", prepareCopyCut);
  12149. on(display.scroller, "paste", function (e) {
  12150. if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
  12151. cm.state.pasteIncoming = true;
  12152. input.focus();
  12153. });
  12154. // Prevent normal selection in the editor (we handle our own)
  12155. on(display.lineSpace, "selectstart", function (e) {
  12156. if (!eventInWidget(display, e)) { e_preventDefault(e); }
  12157. });
  12158. on(te, "compositionstart", function () {
  12159. var start = cm.getCursor("from");
  12160. if (input.composing) { input.composing.range.clear(); }
  12161. input.composing = {
  12162. start: start,
  12163. range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
  12164. };
  12165. });
  12166. on(te, "compositionend", function () {
  12167. if (input.composing) {
  12168. input.poll();
  12169. input.composing.range.clear();
  12170. input.composing = null;
  12171. }
  12172. });
  12173. };
  12174. TextareaInput.prototype.prepareSelection = function () {
  12175. // Redraw the selection and/or cursor
  12176. var cm = this.cm, display = cm.display, doc = cm.doc;
  12177. var result = prepareSelection(cm);
  12178. // Move the hidden textarea near the cursor to prevent scrolling artifacts
  12179. if (cm.options.moveInputWithCursor) {
  12180. var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
  12181. var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
  12182. result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
  12183. headPos.top + lineOff.top - wrapOff.top));
  12184. result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
  12185. headPos.left + lineOff.left - wrapOff.left));
  12186. }
  12187. return result
  12188. };
  12189. TextareaInput.prototype.showSelection = function (drawn) {
  12190. var cm = this.cm, display = cm.display;
  12191. removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
  12192. removeChildrenAndAdd(display.selectionDiv, drawn.selection);
  12193. if (drawn.teTop != null) {
  12194. this.wrapper.style.top = drawn.teTop + "px";
  12195. this.wrapper.style.left = drawn.teLeft + "px";
  12196. }
  12197. };
  12198. // Reset the input to correspond to the selection (or to be empty,
  12199. // when not typing and nothing is selected)
  12200. TextareaInput.prototype.reset = function (typing) {
  12201. if (this.contextMenuPending) { return }
  12202. var minimal, selected, cm = this.cm, doc = cm.doc;
  12203. if (cm.somethingSelected()) {
  12204. this.prevInput = "";
  12205. var range$$1 = doc.sel.primary();
  12206. minimal = hasCopyEvent &&
  12207. (range$$1.to().line - range$$1.from().line > 100 || (selected = cm.getSelection()).length > 1000);
  12208. var content = minimal ? "-" : selected || cm.getSelection();
  12209. this.textarea.value = content;
  12210. if (cm.state.focused) { selectInput(this.textarea); }
  12211. if (ie && ie_version >= 9) { this.hasSelection = content; }
  12212. } else if (!typing) {
  12213. this.prevInput = this.textarea.value = "";
  12214. if (ie && ie_version >= 9) { this.hasSelection = null; }
  12215. }
  12216. this.inaccurateSelection = minimal;
  12217. };
  12218. TextareaInput.prototype.getField = function () { return this.textarea };
  12219. TextareaInput.prototype.supportsTouch = function () { return false };
  12220. TextareaInput.prototype.focus = function () {
  12221. if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
  12222. try { this.textarea.focus(); }
  12223. catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
  12224. }
  12225. };
  12226. TextareaInput.prototype.blur = function () { this.textarea.blur(); };
  12227. TextareaInput.prototype.resetPosition = function () {
  12228. this.wrapper.style.top = this.wrapper.style.left = 0;
  12229. };
  12230. TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
  12231. // Poll for input changes, using the normal rate of polling. This
  12232. // runs as long as the editor is focused.
  12233. TextareaInput.prototype.slowPoll = function () {
  12234. var this$1 = this;
  12235. if (this.pollingFast) { return }
  12236. this.polling.set(this.cm.options.pollInterval, function () {
  12237. this$1.poll();
  12238. if (this$1.cm.state.focused) { this$1.slowPoll(); }
  12239. });
  12240. };
  12241. // When an event has just come in that is likely to add or change
  12242. // something in the input textarea, we poll faster, to ensure that
  12243. // the change appears on the screen quickly.
  12244. TextareaInput.prototype.fastPoll = function () {
  12245. var missed = false, input = this;
  12246. input.pollingFast = true;
  12247. function p() {
  12248. var changed = input.poll();
  12249. if (!changed && !missed) {missed = true; input.polling.set(60, p);}
  12250. else {input.pollingFast = false; input.slowPoll();}
  12251. }
  12252. input.polling.set(20, p);
  12253. };
  12254. // Read input from the textarea, and update the document to match.
  12255. // When something is selected, it is present in the textarea, and
  12256. // selected (unless it is huge, in which case a placeholder is
  12257. // used). When nothing is selected, the cursor sits after previously
  12258. // seen text (can be empty), which is stored in prevInput (we must
  12259. // not reset the textarea when typing, because that breaks IME).
  12260. TextareaInput.prototype.poll = function () {
  12261. var this$1 = this;
  12262. var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
  12263. // Since this is called a *lot*, try to bail out as cheaply as
  12264. // possible when it is clear that nothing happened. hasSelection
  12265. // will be the case when there is a lot of text in the textarea,
  12266. // in which case reading its value would be expensive.
  12267. if (this.contextMenuPending || !cm.state.focused ||
  12268. (hasSelection(input) && !prevInput && !this.composing) ||
  12269. cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
  12270. { return false }
  12271. var text = input.value;
  12272. // If nothing changed, bail.
  12273. if (text == prevInput && !cm.somethingSelected()) { return false }
  12274. // Work around nonsensical selection resetting in IE9/10, and
  12275. // inexplicable appearance of private area unicode characters on
  12276. // some key combos in Mac (#2689).
  12277. if (ie && ie_version >= 9 && this.hasSelection === text ||
  12278. mac && /[\uf700-\uf7ff]/.test(text)) {
  12279. cm.display.input.reset();
  12280. return false
  12281. }
  12282. if (cm.doc.sel == cm.display.selForContextMenu) {
  12283. var first = text.charCodeAt(0);
  12284. if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
  12285. if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
  12286. }
  12287. // Find the part of the input that is actually new
  12288. var same = 0, l = Math.min(prevInput.length, text.length);
  12289. while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
  12290. runInOp(cm, function () {
  12291. applyTextInput(cm, text.slice(same), prevInput.length - same,
  12292. null, this$1.composing ? "*compose" : null);
  12293. // Don't leave long text in the textarea, since it makes further polling slow
  12294. if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
  12295. else { this$1.prevInput = text; }
  12296. if (this$1.composing) {
  12297. this$1.composing.range.clear();
  12298. this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
  12299. {className: "CodeMirror-composing"});
  12300. }
  12301. });
  12302. return true
  12303. };
  12304. TextareaInput.prototype.ensurePolled = function () {
  12305. if (this.pollingFast && this.poll()) { this.pollingFast = false; }
  12306. };
  12307. TextareaInput.prototype.onKeyPress = function () {
  12308. if (ie && ie_version >= 9) { this.hasSelection = null; }
  12309. this.fastPoll();
  12310. };
  12311. TextareaInput.prototype.onContextMenu = function (e) {
  12312. var input = this, cm = input.cm, display = cm.display, te = input.textarea;
  12313. var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
  12314. if (!pos || presto) { return } // Opera is difficult.
  12315. // Reset the current text selection only if the click is done outside of the selection
  12316. // and 'resetSelectionOnContextMenu' option is true.
  12317. var reset = cm.options.resetSelectionOnContextMenu;
  12318. if (reset && cm.doc.sel.contains(pos) == -1)
  12319. { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
  12320. var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
  12321. input.wrapper.style.cssText = "position: absolute";
  12322. var wrapperBox = input.wrapper.getBoundingClientRect();
  12323. 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);";
  12324. var oldScrollY;
  12325. if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
  12326. display.input.focus();
  12327. if (webkit) { window.scrollTo(null, oldScrollY); }
  12328. display.input.reset();
  12329. // Adds "Select all" to context menu in FF
  12330. if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
  12331. input.contextMenuPending = true;
  12332. display.selForContextMenu = cm.doc.sel;
  12333. clearTimeout(display.detectingSelectAll);
  12334. // Select-all will be greyed out if there's nothing to select, so
  12335. // this adds a zero-width space so that we can later check whether
  12336. // it got selected.
  12337. function prepareSelectAllHack() {
  12338. if (te.selectionStart != null) {
  12339. var selected = cm.somethingSelected();
  12340. var extval = "\u200b" + (selected ? te.value : "");
  12341. te.value = "\u21da"; // Used to catch context-menu undo
  12342. te.value = extval;
  12343. input.prevInput = selected ? "" : "\u200b";
  12344. te.selectionStart = 1; te.selectionEnd = extval.length;
  12345. // Re-set this, in case some other handler touched the
  12346. // selection in the meantime.
  12347. display.selForContextMenu = cm.doc.sel;
  12348. }
  12349. }
  12350. function rehide() {
  12351. input.contextMenuPending = false;
  12352. input.wrapper.style.cssText = oldWrapperCSS;
  12353. te.style.cssText = oldCSS;
  12354. if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
  12355. // Try to detect the user choosing select-all
  12356. if (te.selectionStart != null) {
  12357. if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
  12358. var i = 0, poll = function () {
  12359. if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
  12360. te.selectionEnd > 0 && input.prevInput == "\u200b") {
  12361. operation(cm, selectAll)(cm);
  12362. } else if (i++ < 10) {
  12363. display.detectingSelectAll = setTimeout(poll, 500);
  12364. } else {
  12365. display.selForContextMenu = null;
  12366. display.input.reset();
  12367. }
  12368. };
  12369. display.detectingSelectAll = setTimeout(poll, 200);
  12370. }
  12371. }
  12372. if (ie && ie_version >= 9) { prepareSelectAllHack(); }
  12373. if (captureRightClick) {
  12374. e_stop(e);
  12375. var mouseup = function () {
  12376. off(window, "mouseup", mouseup);
  12377. setTimeout(rehide, 20);
  12378. };
  12379. on(window, "mouseup", mouseup);
  12380. } else {
  12381. setTimeout(rehide, 50);
  12382. }
  12383. };
  12384. TextareaInput.prototype.readOnlyChanged = function (val) {
  12385. if (!val) { this.reset(); }
  12386. };
  12387. TextareaInput.prototype.setUneditable = function () {};
  12388. TextareaInput.prototype.needsContentAttribute = false;
  12389. function fromTextArea(textarea, options) {
  12390. options = options ? copyObj(options) : {};
  12391. options.value = textarea.value;
  12392. if (!options.tabindex && textarea.tabIndex)
  12393. { options.tabindex = textarea.tabIndex; }
  12394. if (!options.placeholder && textarea.placeholder)
  12395. { options.placeholder = textarea.placeholder; }
  12396. // Set autofocus to true if this textarea is focused, or if it has
  12397. // autofocus and no other element is focused.
  12398. if (options.autofocus == null) {
  12399. var hasFocus = activeElt();
  12400. options.autofocus = hasFocus == textarea ||
  12401. textarea.getAttribute("autofocus") != null && hasFocus == document.body;
  12402. }
  12403. function save() {textarea.value = cm.getValue();}
  12404. var realSubmit;
  12405. if (textarea.form) {
  12406. on(textarea.form, "submit", save);
  12407. // Deplorable hack to make the submit method do the right thing.
  12408. if (!options.leaveSubmitMethodAlone) {
  12409. var form = textarea.form;
  12410. realSubmit = form.submit;
  12411. try {
  12412. var wrappedSubmit = form.submit = function () {
  12413. save();
  12414. form.submit = realSubmit;
  12415. form.submit();
  12416. form.submit = wrappedSubmit;
  12417. };
  12418. } catch(e) {}
  12419. }
  12420. }
  12421. options.finishInit = function (cm) {
  12422. cm.save = save;
  12423. cm.getTextArea = function () { return textarea; };
  12424. cm.toTextArea = function () {
  12425. cm.toTextArea = isNaN; // Prevent this from being ran twice
  12426. save();
  12427. textarea.parentNode.removeChild(cm.getWrapperElement());
  12428. textarea.style.display = "";
  12429. if (textarea.form) {
  12430. off(textarea.form, "submit", save);
  12431. if (typeof textarea.form.submit == "function")
  12432. { textarea.form.submit = realSubmit; }
  12433. }
  12434. };
  12435. };
  12436. textarea.style.display = "none";
  12437. var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
  12438. options);
  12439. return cm
  12440. }
  12441. function addLegacyProps(CodeMirror) {
  12442. CodeMirror.off = off;
  12443. CodeMirror.on = on;
  12444. CodeMirror.wheelEventPixels = wheelEventPixels;
  12445. CodeMirror.Doc = Doc;
  12446. CodeMirror.splitLines = splitLinesAuto;
  12447. CodeMirror.countColumn = countColumn;
  12448. CodeMirror.findColumn = findColumn;
  12449. CodeMirror.isWordChar = isWordCharBasic;
  12450. CodeMirror.Pass = Pass;
  12451. CodeMirror.signal = signal;
  12452. CodeMirror.Line = Line;
  12453. CodeMirror.changeEnd = changeEnd;
  12454. CodeMirror.scrollbarModel = scrollbarModel;
  12455. CodeMirror.Pos = Pos;
  12456. CodeMirror.cmpPos = cmp;
  12457. CodeMirror.modes = modes;
  12458. CodeMirror.mimeModes = mimeModes;
  12459. CodeMirror.resolveMode = resolveMode;
  12460. CodeMirror.getMode = getMode;
  12461. CodeMirror.modeExtensions = modeExtensions;
  12462. CodeMirror.extendMode = extendMode;
  12463. CodeMirror.copyState = copyState;
  12464. CodeMirror.startState = startState;
  12465. CodeMirror.innerMode = innerMode;
  12466. CodeMirror.commands = commands;
  12467. CodeMirror.keyMap = keyMap;
  12468. CodeMirror.keyName = keyName;
  12469. CodeMirror.isModifierKey = isModifierKey;
  12470. CodeMirror.lookupKey = lookupKey;
  12471. CodeMirror.normalizeKeyMap = normalizeKeyMap;
  12472. CodeMirror.StringStream = StringStream;
  12473. CodeMirror.SharedTextMarker = SharedTextMarker;
  12474. CodeMirror.TextMarker = TextMarker;
  12475. CodeMirror.LineWidget = LineWidget;
  12476. CodeMirror.e_preventDefault = e_preventDefault;
  12477. CodeMirror.e_stopPropagation = e_stopPropagation;
  12478. CodeMirror.e_stop = e_stop;
  12479. CodeMirror.addClass = addClass;
  12480. CodeMirror.contains = contains;
  12481. CodeMirror.rmClass = rmClass;
  12482. CodeMirror.keyNames = keyNames;
  12483. }
  12484. // EDITOR CONSTRUCTOR
  12485. defineOptions(CodeMirror$1);
  12486. addEditorMethods(CodeMirror$1);
  12487. // Set up methods on CodeMirror's prototype to redirect to the editor's document.
  12488. var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
  12489. for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
  12490. { CodeMirror$1.prototype[prop] = (function(method) {
  12491. return function() {return method.apply(this.doc, arguments)}
  12492. })(Doc.prototype[prop]); } }
  12493. eventMixin(Doc);
  12494. // INPUT HANDLING
  12495. CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
  12496. // MODE DEFINITION AND QUERYING
  12497. // Extra arguments are stored as the mode's dependencies, which is
  12498. // used by (legacy) mechanisms like loadmode.js to automatically
  12499. // load a mode. (Preferred mechanism is the require/define calls.)
  12500. CodeMirror$1.defineMode = function(name/*, mode, …*/) {
  12501. if (!CodeMirror$1.defaults.mode && name != "null") { CodeMirror$1.defaults.mode = name; }
  12502. defineMode.apply(this, arguments);
  12503. };
  12504. CodeMirror$1.defineMIME = defineMIME;
  12505. // Minimal default mode.
  12506. CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
  12507. CodeMirror$1.defineMIME("text/plain", "null");
  12508. // EXTENSIONS
  12509. CodeMirror$1.defineExtension = function (name, func) {
  12510. CodeMirror$1.prototype[name] = func;
  12511. };
  12512. CodeMirror$1.defineDocExtension = function (name, func) {
  12513. Doc.prototype[name] = func;
  12514. };
  12515. CodeMirror$1.fromTextArea = fromTextArea;
  12516. addLegacyProps(CodeMirror$1);
  12517. CodeMirror$1.version = "5.25.0";
  12518. return CodeMirror$1;
  12519. })));
  12520. /***/ }),
  12521. /* 50 */
  12522. /***/ (function(module, exports, __webpack_require__) {
  12523. "use strict";
  12524. /**
  12525. * Copyright (c) 2013-present, Facebook, Inc.
  12526. * All rights reserved.
  12527. *
  12528. * This source code is licensed under the BSD-style license found in the
  12529. * LICENSE file in the root directory of this source tree. An additional grant
  12530. * of patent rights can be found in the PATENTS file in the same directory.
  12531. *
  12532. * @typechecks
  12533. *
  12534. */
  12535. /*eslint-disable no-self-compare */
  12536. var hasOwnProperty = Object.prototype.hasOwnProperty;
  12537. /**
  12538. * inlined Object.is polyfill to avoid requiring consumers ship their own
  12539. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  12540. */
  12541. function is(x, y) {
  12542. // SameValue algorithm
  12543. if (x === y) {
  12544. // Steps 1-5, 7-10
  12545. // Steps 6.b-6.e: +0 != -0
  12546. // Added the nonzero y check to make Flow happy, but it is redundant
  12547. return x !== 0 || y !== 0 || 1 / x === 1 / y;
  12548. } else {
  12549. // Step 6.a: NaN == NaN
  12550. return x !== x && y !== y;
  12551. }
  12552. }
  12553. /**
  12554. * Performs equality by iterating through keys on an object and returning false
  12555. * when any key has values which are not strictly equal between the arguments.
  12556. * Returns true when the values of all keys are strictly equal.
  12557. */
  12558. function shallowEqual(objA, objB) {
  12559. if (is(objA, objB)) {
  12560. return true;
  12561. }
  12562. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  12563. return false;
  12564. }
  12565. var keysA = Object.keys(objA);
  12566. var keysB = Object.keys(objB);
  12567. if (keysA.length !== keysB.length) {
  12568. return false;
  12569. }
  12570. // Test for A's keys different from B.
  12571. for (var i = 0; i < keysA.length; i++) {
  12572. if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
  12573. return false;
  12574. }
  12575. }
  12576. return true;
  12577. }
  12578. module.exports = shallowEqual;
  12579. /***/ }),
  12580. /* 51 */
  12581. /***/ (function(module, exports, __webpack_require__) {
  12582. "use strict";
  12583. /**
  12584. * Copyright 2013-present, Facebook, Inc.
  12585. * All rights reserved.
  12586. *
  12587. * This source code is licensed under the BSD-style license found in the
  12588. * LICENSE file in the root directory of this source tree. An additional grant
  12589. * of patent rights can be found in the PATENTS file in the same directory.
  12590. *
  12591. */
  12592. var DOMLazyTree = __webpack_require__(18);
  12593. var Danger = __webpack_require__(156);
  12594. var ReactDOMComponentTree = __webpack_require__(5);
  12595. var ReactInstrumentation = __webpack_require__(11);
  12596. var createMicrosoftUnsafeLocalFunction = __webpack_require__(60);
  12597. var setInnerHTML = __webpack_require__(35);
  12598. var setTextContent = __webpack_require__(94);
  12599. function getNodeAfter(parentNode, node) {
  12600. // Special case for text components, which return [open, close] comments
  12601. // from getHostNode.
  12602. if (Array.isArray(node)) {
  12603. node = node[1];
  12604. }
  12605. return node ? node.nextSibling : parentNode.firstChild;
  12606. }
  12607. /**
  12608. * Inserts `childNode` as a child of `parentNode` at the `index`.
  12609. *
  12610. * @param {DOMElement} parentNode Parent node in which to insert.
  12611. * @param {DOMElement} childNode Child node to insert.
  12612. * @param {number} index Index at which to insert the child.
  12613. * @internal
  12614. */
  12615. var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
  12616. // We rely exclusively on `insertBefore(node, null)` instead of also using
  12617. // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
  12618. // we are careful to use `null`.)
  12619. parentNode.insertBefore(childNode, referenceNode);
  12620. });
  12621. function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
  12622. DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
  12623. }
  12624. function moveChild(parentNode, childNode, referenceNode) {
  12625. if (Array.isArray(childNode)) {
  12626. moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
  12627. } else {
  12628. insertChildAt(parentNode, childNode, referenceNode);
  12629. }
  12630. }
  12631. function removeChild(parentNode, childNode) {
  12632. if (Array.isArray(childNode)) {
  12633. var closingComment = childNode[1];
  12634. childNode = childNode[0];
  12635. removeDelimitedText(parentNode, childNode, closingComment);
  12636. parentNode.removeChild(closingComment);
  12637. }
  12638. parentNode.removeChild(childNode);
  12639. }
  12640. function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
  12641. var node = openingComment;
  12642. while (true) {
  12643. var nextNode = node.nextSibling;
  12644. insertChildAt(parentNode, node, referenceNode);
  12645. if (node === closingComment) {
  12646. break;
  12647. }
  12648. node = nextNode;
  12649. }
  12650. }
  12651. function removeDelimitedText(parentNode, startNode, closingComment) {
  12652. while (true) {
  12653. var node = startNode.nextSibling;
  12654. if (node === closingComment) {
  12655. // The closing comment is removed by ReactMultiChild.
  12656. break;
  12657. } else {
  12658. parentNode.removeChild(node);
  12659. }
  12660. }
  12661. }
  12662. function replaceDelimitedText(openingComment, closingComment, stringText) {
  12663. var parentNode = openingComment.parentNode;
  12664. var nodeAfterComment = openingComment.nextSibling;
  12665. if (nodeAfterComment === closingComment) {
  12666. // There are no text nodes between the opening and closing comments; insert
  12667. // a new one if stringText isn't empty.
  12668. if (stringText) {
  12669. insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
  12670. }
  12671. } else {
  12672. if (stringText) {
  12673. // Set the text content of the first node after the opening comment, and
  12674. // remove all following nodes up until the closing comment.
  12675. setTextContent(nodeAfterComment, stringText);
  12676. removeDelimitedText(parentNode, nodeAfterComment, closingComment);
  12677. } else {
  12678. removeDelimitedText(parentNode, openingComment, closingComment);
  12679. }
  12680. }
  12681. if (false) {
  12682. ReactInstrumentation.debugTool.onHostOperation({
  12683. instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID,
  12684. type: 'replace text',
  12685. payload: stringText
  12686. });
  12687. }
  12688. }
  12689. var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
  12690. if (false) {
  12691. dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
  12692. Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
  12693. if (prevInstance._debugID !== 0) {
  12694. ReactInstrumentation.debugTool.onHostOperation({
  12695. instanceID: prevInstance._debugID,
  12696. type: 'replace with',
  12697. payload: markup.toString()
  12698. });
  12699. } else {
  12700. var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
  12701. if (nextInstance._debugID !== 0) {
  12702. ReactInstrumentation.debugTool.onHostOperation({
  12703. instanceID: nextInstance._debugID,
  12704. type: 'mount',
  12705. payload: markup.toString()
  12706. });
  12707. }
  12708. }
  12709. };
  12710. }
  12711. /**
  12712. * Operations for updating with DOM children.
  12713. */
  12714. var DOMChildrenOperations = {
  12715. dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
  12716. replaceDelimitedText: replaceDelimitedText,
  12717. /**
  12718. * Updates a component's children by processing a series of updates. The
  12719. * update configurations are each expected to have a `parentNode` property.
  12720. *
  12721. * @param {array<object>} updates List of update configurations.
  12722. * @internal
  12723. */
  12724. processUpdates: function (parentNode, updates) {
  12725. if (false) {
  12726. var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
  12727. }
  12728. for (var k = 0; k < updates.length; k++) {
  12729. var update = updates[k];
  12730. switch (update.type) {
  12731. case 'INSERT_MARKUP':
  12732. insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
  12733. if (false) {
  12734. ReactInstrumentation.debugTool.onHostOperation({
  12735. instanceID: parentNodeDebugID,
  12736. type: 'insert child',
  12737. payload: { toIndex: update.toIndex, content: update.content.toString() }
  12738. });
  12739. }
  12740. break;
  12741. case 'MOVE_EXISTING':
  12742. moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
  12743. if (false) {
  12744. ReactInstrumentation.debugTool.onHostOperation({
  12745. instanceID: parentNodeDebugID,
  12746. type: 'move child',
  12747. payload: { fromIndex: update.fromIndex, toIndex: update.toIndex }
  12748. });
  12749. }
  12750. break;
  12751. case 'SET_MARKUP':
  12752. setInnerHTML(parentNode, update.content);
  12753. if (false) {
  12754. ReactInstrumentation.debugTool.onHostOperation({
  12755. instanceID: parentNodeDebugID,
  12756. type: 'replace children',
  12757. payload: update.content.toString()
  12758. });
  12759. }
  12760. break;
  12761. case 'TEXT_CONTENT':
  12762. setTextContent(parentNode, update.content);
  12763. if (false) {
  12764. ReactInstrumentation.debugTool.onHostOperation({
  12765. instanceID: parentNodeDebugID,
  12766. type: 'replace text',
  12767. payload: update.content.toString()
  12768. });
  12769. }
  12770. break;
  12771. case 'REMOVE_NODE':
  12772. removeChild(parentNode, update.fromNode);
  12773. if (false) {
  12774. ReactInstrumentation.debugTool.onHostOperation({
  12775. instanceID: parentNodeDebugID,
  12776. type: 'remove child',
  12777. payload: { fromIndex: update.fromIndex }
  12778. });
  12779. }
  12780. break;
  12781. }
  12782. }
  12783. }
  12784. };
  12785. module.exports = DOMChildrenOperations;
  12786. /***/ }),
  12787. /* 52 */
  12788. /***/ (function(module, exports, __webpack_require__) {
  12789. "use strict";
  12790. /**
  12791. * Copyright 2013-present, Facebook, Inc.
  12792. * All rights reserved.
  12793. *
  12794. * This source code is licensed under the BSD-style license found in the
  12795. * LICENSE file in the root directory of this source tree. An additional grant
  12796. * of patent rights can be found in the PATENTS file in the same directory.
  12797. *
  12798. */
  12799. var DOMNamespaces = {
  12800. html: 'http://www.w3.org/1999/xhtml',
  12801. mathml: 'http://www.w3.org/1998/Math/MathML',
  12802. svg: 'http://www.w3.org/2000/svg'
  12803. };
  12804. module.exports = DOMNamespaces;
  12805. /***/ }),
  12806. /* 53 */
  12807. /***/ (function(module, exports, __webpack_require__) {
  12808. "use strict";
  12809. /**
  12810. * Copyright 2013-present, Facebook, Inc.
  12811. * All rights reserved.
  12812. *
  12813. * This source code is licensed under the BSD-style license found in the
  12814. * LICENSE file in the root directory of this source tree. An additional grant
  12815. * of patent rights can be found in the PATENTS file in the same directory.
  12816. *
  12817. *
  12818. */
  12819. var _prodInvariant = __webpack_require__(2);
  12820. var invariant = __webpack_require__(0);
  12821. /**
  12822. * Injectable ordering of event plugins.
  12823. */
  12824. var eventPluginOrder = null;
  12825. /**
  12826. * Injectable mapping from names to event plugin modules.
  12827. */
  12828. var namesToPlugins = {};
  12829. /**
  12830. * Recomputes the plugin list using the injected plugins and plugin ordering.
  12831. *
  12832. * @private
  12833. */
  12834. function recomputePluginOrdering() {
  12835. if (!eventPluginOrder) {
  12836. // Wait until an `eventPluginOrder` is injected.
  12837. return;
  12838. }
  12839. for (var pluginName in namesToPlugins) {
  12840. var pluginModule = namesToPlugins[pluginName];
  12841. var pluginIndex = eventPluginOrder.indexOf(pluginName);
  12842. !(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;
  12843. if (EventPluginRegistry.plugins[pluginIndex]) {
  12844. continue;
  12845. }
  12846. !pluginModule.extractEvents ? false ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
  12847. EventPluginRegistry.plugins[pluginIndex] = pluginModule;
  12848. var publishedEvents = pluginModule.eventTypes;
  12849. for (var eventName in publishedEvents) {
  12850. !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;
  12851. }
  12852. }
  12853. }
  12854. /**
  12855. * Publishes an event so that it can be dispatched by the supplied plugin.
  12856. *
  12857. * @param {object} dispatchConfig Dispatch configuration for the event.
  12858. * @param {object} PluginModule Plugin publishing the event.
  12859. * @return {boolean} True if the event was successfully published.
  12860. * @private
  12861. */
  12862. function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
  12863. !!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;
  12864. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  12865. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  12866. if (phasedRegistrationNames) {
  12867. for (var phaseName in phasedRegistrationNames) {
  12868. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  12869. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  12870. publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
  12871. }
  12872. }
  12873. return true;
  12874. } else if (dispatchConfig.registrationName) {
  12875. publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
  12876. return true;
  12877. }
  12878. return false;
  12879. }
  12880. /**
  12881. * Publishes a registration name that is used to identify dispatched events and
  12882. * can be used with `EventPluginHub.putListener` to register listeners.
  12883. *
  12884. * @param {string} registrationName Registration name to add.
  12885. * @param {object} PluginModule Plugin publishing the event.
  12886. * @private
  12887. */
  12888. function publishRegistrationName(registrationName, pluginModule, eventName) {
  12889. !!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;
  12890. EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
  12891. EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
  12892. if (false) {
  12893. var lowerCasedName = registrationName.toLowerCase();
  12894. EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
  12895. if (registrationName === 'onDoubleClick') {
  12896. EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
  12897. }
  12898. }
  12899. }
  12900. /**
  12901. * Registers plugins so that they can extract and dispatch events.
  12902. *
  12903. * @see {EventPluginHub}
  12904. */
  12905. var EventPluginRegistry = {
  12906. /**
  12907. * Ordered list of injected plugins.
  12908. */
  12909. plugins: [],
  12910. /**
  12911. * Mapping from event name to dispatch config
  12912. */
  12913. eventNameDispatchConfigs: {},
  12914. /**
  12915. * Mapping from registration name to plugin module
  12916. */
  12917. registrationNameModules: {},
  12918. /**
  12919. * Mapping from registration name to event name
  12920. */
  12921. registrationNameDependencies: {},
  12922. /**
  12923. * Mapping from lowercase registration names to the properly cased version,
  12924. * used to warn in the case of missing event handlers. Available
  12925. * only in __DEV__.
  12926. * @type {Object}
  12927. */
  12928. possibleRegistrationNames: false ? {} : null,
  12929. // Trust the developer to only use possibleRegistrationNames in __DEV__
  12930. /**
  12931. * Injects an ordering of plugins (by plugin name). This allows the ordering
  12932. * to be decoupled from injection of the actual plugins so that ordering is
  12933. * always deterministic regardless of packaging, on-the-fly injection, etc.
  12934. *
  12935. * @param {array} InjectedEventPluginOrder
  12936. * @internal
  12937. * @see {EventPluginHub.injection.injectEventPluginOrder}
  12938. */
  12939. injectEventPluginOrder: function (injectedEventPluginOrder) {
  12940. !!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;
  12941. // Clone the ordering so it cannot be dynamically mutated.
  12942. eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
  12943. recomputePluginOrdering();
  12944. },
  12945. /**
  12946. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  12947. * in the ordering injected by `injectEventPluginOrder`.
  12948. *
  12949. * Plugins can be injected as part of page initialization or on-the-fly.
  12950. *
  12951. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  12952. * @internal
  12953. * @see {EventPluginHub.injection.injectEventPluginsByName}
  12954. */
  12955. injectEventPluginsByName: function (injectedNamesToPlugins) {
  12956. var isOrderingDirty = false;
  12957. for (var pluginName in injectedNamesToPlugins) {
  12958. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  12959. continue;
  12960. }
  12961. var pluginModule = injectedNamesToPlugins[pluginName];
  12962. if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
  12963. !!namesToPlugins[pluginName] ? false ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
  12964. namesToPlugins[pluginName] = pluginModule;
  12965. isOrderingDirty = true;
  12966. }
  12967. }
  12968. if (isOrderingDirty) {
  12969. recomputePluginOrdering();
  12970. }
  12971. },
  12972. /**
  12973. * Looks up the plugin for the supplied event.
  12974. *
  12975. * @param {object} event A synthetic event.
  12976. * @return {?object} The plugin that created the supplied event.
  12977. * @internal
  12978. */
  12979. getPluginModuleForEvent: function (event) {
  12980. var dispatchConfig = event.dispatchConfig;
  12981. if (dispatchConfig.registrationName) {
  12982. return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
  12983. }
  12984. if (dispatchConfig.phasedRegistrationNames !== undefined) {
  12985. // pulling phasedRegistrationNames out of dispatchConfig helps Flow see
  12986. // that it is not undefined.
  12987. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  12988. for (var phase in phasedRegistrationNames) {
  12989. if (!phasedRegistrationNames.hasOwnProperty(phase)) {
  12990. continue;
  12991. }
  12992. var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]];
  12993. if (pluginModule) {
  12994. return pluginModule;
  12995. }
  12996. }
  12997. }
  12998. return null;
  12999. },
  13000. /**
  13001. * Exposed for unit testing.
  13002. * @private
  13003. */
  13004. _resetEventPlugins: function () {
  13005. eventPluginOrder = null;
  13006. for (var pluginName in namesToPlugins) {
  13007. if (namesToPlugins.hasOwnProperty(pluginName)) {
  13008. delete namesToPlugins[pluginName];
  13009. }
  13010. }
  13011. EventPluginRegistry.plugins.length = 0;
  13012. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  13013. for (var eventName in eventNameDispatchConfigs) {
  13014. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  13015. delete eventNameDispatchConfigs[eventName];
  13016. }
  13017. }
  13018. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  13019. for (var registrationName in registrationNameModules) {
  13020. if (registrationNameModules.hasOwnProperty(registrationName)) {
  13021. delete registrationNameModules[registrationName];
  13022. }
  13023. }
  13024. if (false) {
  13025. var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
  13026. for (var lowerCasedName in possibleRegistrationNames) {
  13027. if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
  13028. delete possibleRegistrationNames[lowerCasedName];
  13029. }
  13030. }
  13031. }
  13032. }
  13033. };
  13034. module.exports = EventPluginRegistry;
  13035. /***/ }),
  13036. /* 54 */
  13037. /***/ (function(module, exports, __webpack_require__) {
  13038. "use strict";
  13039. /**
  13040. * Copyright 2013-present, Facebook, Inc.
  13041. * All rights reserved.
  13042. *
  13043. * This source code is licensed under the BSD-style license found in the
  13044. * LICENSE file in the root directory of this source tree. An additional grant
  13045. * of patent rights can be found in the PATENTS file in the same directory.
  13046. *
  13047. */
  13048. var _prodInvariant = __webpack_require__(2);
  13049. var ReactErrorUtils = __webpack_require__(58);
  13050. var invariant = __webpack_require__(0);
  13051. var warning = __webpack_require__(1);
  13052. /**
  13053. * Injected dependencies:
  13054. */
  13055. /**
  13056. * - `ComponentTree`: [required] Module that can convert between React instances
  13057. * and actual node references.
  13058. */
  13059. var ComponentTree;
  13060. var TreeTraversal;
  13061. var injection = {
  13062. injectComponentTree: function (Injected) {
  13063. ComponentTree = Injected;
  13064. if (false) {
  13065. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
  13066. }
  13067. },
  13068. injectTreeTraversal: function (Injected) {
  13069. TreeTraversal = Injected;
  13070. if (false) {
  13071. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
  13072. }
  13073. }
  13074. };
  13075. function isEndish(topLevelType) {
  13076. return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
  13077. }
  13078. function isMoveish(topLevelType) {
  13079. return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
  13080. }
  13081. function isStartish(topLevelType) {
  13082. return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
  13083. }
  13084. var validateEventDispatches;
  13085. if (false) {
  13086. validateEventDispatches = function (event) {
  13087. var dispatchListeners = event._dispatchListeners;
  13088. var dispatchInstances = event._dispatchInstances;
  13089. var listenersIsArr = Array.isArray(dispatchListeners);
  13090. var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
  13091. var instancesIsArr = Array.isArray(dispatchInstances);
  13092. var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
  13093. process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
  13094. };
  13095. }
  13096. /**
  13097. * Dispatch the event to the listener.
  13098. * @param {SyntheticEvent} event SyntheticEvent to handle
  13099. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  13100. * @param {function} listener Application-level callback
  13101. * @param {*} inst Internal component instance
  13102. */
  13103. function executeDispatch(event, simulated, listener, inst) {
  13104. var type = event.type || 'unknown-event';
  13105. event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
  13106. if (simulated) {
  13107. ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
  13108. } else {
  13109. ReactErrorUtils.invokeGuardedCallback(type, listener, event);
  13110. }
  13111. event.currentTarget = null;
  13112. }
  13113. /**
  13114. * Standard/simple iteration through an event's collected dispatches.
  13115. */
  13116. function executeDispatchesInOrder(event, simulated) {
  13117. var dispatchListeners = event._dispatchListeners;
  13118. var dispatchInstances = event._dispatchInstances;
  13119. if (false) {
  13120. validateEventDispatches(event);
  13121. }
  13122. if (Array.isArray(dispatchListeners)) {
  13123. for (var i = 0; i < dispatchListeners.length; i++) {
  13124. if (event.isPropagationStopped()) {
  13125. break;
  13126. }
  13127. // Listeners and Instances are two parallel arrays that are always in sync.
  13128. executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
  13129. }
  13130. } else if (dispatchListeners) {
  13131. executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
  13132. }
  13133. event._dispatchListeners = null;
  13134. event._dispatchInstances = null;
  13135. }
  13136. /**
  13137. * Standard/simple iteration through an event's collected dispatches, but stops
  13138. * at the first dispatch execution returning true, and returns that id.
  13139. *
  13140. * @return {?string} id of the first dispatch execution who's listener returns
  13141. * true, or null if no listener returned true.
  13142. */
  13143. function executeDispatchesInOrderStopAtTrueImpl(event) {
  13144. var dispatchListeners = event._dispatchListeners;
  13145. var dispatchInstances = event._dispatchInstances;
  13146. if (false) {
  13147. validateEventDispatches(event);
  13148. }
  13149. if (Array.isArray(dispatchListeners)) {
  13150. for (var i = 0; i < dispatchListeners.length; i++) {
  13151. if (event.isPropagationStopped()) {
  13152. break;
  13153. }
  13154. // Listeners and Instances are two parallel arrays that are always in sync.
  13155. if (dispatchListeners[i](event, dispatchInstances[i])) {
  13156. return dispatchInstances[i];
  13157. }
  13158. }
  13159. } else if (dispatchListeners) {
  13160. if (dispatchListeners(event, dispatchInstances)) {
  13161. return dispatchInstances;
  13162. }
  13163. }
  13164. return null;
  13165. }
  13166. /**
  13167. * @see executeDispatchesInOrderStopAtTrueImpl
  13168. */
  13169. function executeDispatchesInOrderStopAtTrue(event) {
  13170. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  13171. event._dispatchInstances = null;
  13172. event._dispatchListeners = null;
  13173. return ret;
  13174. }
  13175. /**
  13176. * Execution of a "direct" dispatch - there must be at most one dispatch
  13177. * accumulated on the event or it is considered an error. It doesn't really make
  13178. * sense for an event with multiple dispatches (bubbled) to keep track of the
  13179. * return values at each dispatch execution, but it does tend to make sense when
  13180. * dealing with "direct" dispatches.
  13181. *
  13182. * @return {*} The return value of executing the single dispatch.
  13183. */
  13184. function executeDirectDispatch(event) {
  13185. if (false) {
  13186. validateEventDispatches(event);
  13187. }
  13188. var dispatchListener = event._dispatchListeners;
  13189. var dispatchInstance = event._dispatchInstances;
  13190. !!Array.isArray(dispatchListener) ? false ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
  13191. event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
  13192. var res = dispatchListener ? dispatchListener(event) : null;
  13193. event.currentTarget = null;
  13194. event._dispatchListeners = null;
  13195. event._dispatchInstances = null;
  13196. return res;
  13197. }
  13198. /**
  13199. * @param {SyntheticEvent} event
  13200. * @return {boolean} True iff number of dispatches accumulated is greater than 0.
  13201. */
  13202. function hasDispatches(event) {
  13203. return !!event._dispatchListeners;
  13204. }
  13205. /**
  13206. * General utilities that are useful in creating custom Event Plugins.
  13207. */
  13208. var EventPluginUtils = {
  13209. isEndish: isEndish,
  13210. isMoveish: isMoveish,
  13211. isStartish: isStartish,
  13212. executeDirectDispatch: executeDirectDispatch,
  13213. executeDispatchesInOrder: executeDispatchesInOrder,
  13214. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  13215. hasDispatches: hasDispatches,
  13216. getInstanceFromNode: function (node) {
  13217. return ComponentTree.getInstanceFromNode(node);
  13218. },
  13219. getNodeFromInstance: function (node) {
  13220. return ComponentTree.getNodeFromInstance(node);
  13221. },
  13222. isAncestor: function (a, b) {
  13223. return TreeTraversal.isAncestor(a, b);
  13224. },
  13225. getLowestCommonAncestor: function (a, b) {
  13226. return TreeTraversal.getLowestCommonAncestor(a, b);
  13227. },
  13228. getParentInstance: function (inst) {
  13229. return TreeTraversal.getParentInstance(inst);
  13230. },
  13231. traverseTwoPhase: function (target, fn, arg) {
  13232. return TreeTraversal.traverseTwoPhase(target, fn, arg);
  13233. },
  13234. traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
  13235. return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
  13236. },
  13237. injection: injection
  13238. };
  13239. module.exports = EventPluginUtils;
  13240. /***/ }),
  13241. /* 55 */
  13242. /***/ (function(module, exports, __webpack_require__) {
  13243. "use strict";
  13244. /**
  13245. * Copyright 2013-present, Facebook, Inc.
  13246. * All rights reserved.
  13247. *
  13248. * This source code is licensed under the BSD-style license found in the
  13249. * LICENSE file in the root directory of this source tree. An additional grant
  13250. * of patent rights can be found in the PATENTS file in the same directory.
  13251. *
  13252. *
  13253. */
  13254. /**
  13255. * Escape and wrap key so it is safe to use as a reactid
  13256. *
  13257. * @param {string} key to be escaped.
  13258. * @return {string} the escaped key.
  13259. */
  13260. function escape(key) {
  13261. var escapeRegex = /[=:]/g;
  13262. var escaperLookup = {
  13263. '=': '=0',
  13264. ':': '=2'
  13265. };
  13266. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  13267. return escaperLookup[match];
  13268. });
  13269. return '$' + escapedString;
  13270. }
  13271. /**
  13272. * Unescape and unwrap key for human-readable display
  13273. *
  13274. * @param {string} key to unescape.
  13275. * @return {string} the unescaped key.
  13276. */
  13277. function unescape(key) {
  13278. var unescapeRegex = /(=0|=2)/g;
  13279. var unescaperLookup = {
  13280. '=0': '=',
  13281. '=2': ':'
  13282. };
  13283. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  13284. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  13285. return unescaperLookup[match];
  13286. });
  13287. }
  13288. var KeyEscapeUtils = {
  13289. escape: escape,
  13290. unescape: unescape
  13291. };
  13292. module.exports = KeyEscapeUtils;
  13293. /***/ }),
  13294. /* 56 */
  13295. /***/ (function(module, exports, __webpack_require__) {
  13296. "use strict";
  13297. /**
  13298. * Copyright 2013-present, Facebook, Inc.
  13299. * All rights reserved.
  13300. *
  13301. * This source code is licensed under the BSD-style license found in the
  13302. * LICENSE file in the root directory of this source tree. An additional grant
  13303. * of patent rights can be found in the PATENTS file in the same directory.
  13304. *
  13305. */
  13306. var _prodInvariant = __webpack_require__(2);
  13307. var ReactPropTypesSecret = __webpack_require__(185);
  13308. var propTypesFactory = __webpack_require__(75);
  13309. var React = __webpack_require__(21);
  13310. var PropTypes = propTypesFactory(React.isValidElement);
  13311. var invariant = __webpack_require__(0);
  13312. var warning = __webpack_require__(1);
  13313. var hasReadOnlyValue = {
  13314. 'button': true,
  13315. 'checkbox': true,
  13316. 'image': true,
  13317. 'hidden': true,
  13318. 'radio': true,
  13319. 'reset': true,
  13320. 'submit': true
  13321. };
  13322. function _assertSingleLink(inputProps) {
  13323. !(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;
  13324. }
  13325. function _assertValueLink(inputProps) {
  13326. _assertSingleLink(inputProps);
  13327. !(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;
  13328. }
  13329. function _assertCheckedLink(inputProps) {
  13330. _assertSingleLink(inputProps);
  13331. !(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;
  13332. }
  13333. var propTypes = {
  13334. value: function (props, propName, componentName) {
  13335. if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
  13336. return null;
  13337. }
  13338. 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`.');
  13339. },
  13340. checked: function (props, propName, componentName) {
  13341. if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
  13342. return null;
  13343. }
  13344. 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`.');
  13345. },
  13346. onChange: PropTypes.func
  13347. };
  13348. var loggedTypeFailures = {};
  13349. function getDeclarationErrorAddendum(owner) {
  13350. if (owner) {
  13351. var name = owner.getName();
  13352. if (name) {
  13353. return ' Check the render method of `' + name + '`.';
  13354. }
  13355. }
  13356. return '';
  13357. }
  13358. /**
  13359. * Provide a linked `value` attribute for controlled forms. You should not use
  13360. * this outside of the ReactDOM controlled form components.
  13361. */
  13362. var LinkedValueUtils = {
  13363. checkPropTypes: function (tagName, props, owner) {
  13364. for (var propName in propTypes) {
  13365. if (propTypes.hasOwnProperty(propName)) {
  13366. var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
  13367. }
  13368. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  13369. // Only monitor this failure once because there tends to be a lot of the
  13370. // same error.
  13371. loggedTypeFailures[error.message] = true;
  13372. var addendum = getDeclarationErrorAddendum(owner);
  13373. false ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
  13374. }
  13375. }
  13376. },
  13377. /**
  13378. * @param {object} inputProps Props for form component
  13379. * @return {*} current value of the input either from value prop or link.
  13380. */
  13381. getValue: function (inputProps) {
  13382. if (inputProps.valueLink) {
  13383. _assertValueLink(inputProps);
  13384. return inputProps.valueLink.value;
  13385. }
  13386. return inputProps.value;
  13387. },
  13388. /**
  13389. * @param {object} inputProps Props for form component
  13390. * @return {*} current checked status of the input either from checked prop
  13391. * or link.
  13392. */
  13393. getChecked: function (inputProps) {
  13394. if (inputProps.checkedLink) {
  13395. _assertCheckedLink(inputProps);
  13396. return inputProps.checkedLink.value;
  13397. }
  13398. return inputProps.checked;
  13399. },
  13400. /**
  13401. * @param {object} inputProps Props for form component
  13402. * @param {SyntheticEvent} event change event to handle
  13403. */
  13404. executeOnChange: function (inputProps, event) {
  13405. if (inputProps.valueLink) {
  13406. _assertValueLink(inputProps);
  13407. return inputProps.valueLink.requestChange(event.target.value);
  13408. } else if (inputProps.checkedLink) {
  13409. _assertCheckedLink(inputProps);
  13410. return inputProps.checkedLink.requestChange(event.target.checked);
  13411. } else if (inputProps.onChange) {
  13412. return inputProps.onChange.call(undefined, event);
  13413. }
  13414. }
  13415. };
  13416. module.exports = LinkedValueUtils;
  13417. /***/ }),
  13418. /* 57 */
  13419. /***/ (function(module, exports, __webpack_require__) {
  13420. "use strict";
  13421. /**
  13422. * Copyright 2014-present, Facebook, Inc.
  13423. * All rights reserved.
  13424. *
  13425. * This source code is licensed under the BSD-style license found in the
  13426. * LICENSE file in the root directory of this source tree. An additional grant
  13427. * of patent rights can be found in the PATENTS file in the same directory.
  13428. *
  13429. *
  13430. */
  13431. var _prodInvariant = __webpack_require__(2);
  13432. var invariant = __webpack_require__(0);
  13433. var injected = false;
  13434. var ReactComponentEnvironment = {
  13435. /**
  13436. * Optionally injectable hook for swapping out mount images in the middle of
  13437. * the tree.
  13438. */
  13439. replaceNodeWithMarkup: null,
  13440. /**
  13441. * Optionally injectable hook for processing a queue of child updates. Will
  13442. * later move into MultiChildComponents.
  13443. */
  13444. processChildrenUpdates: null,
  13445. injection: {
  13446. injectEnvironment: function (environment) {
  13447. !!injected ? false ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
  13448. ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
  13449. ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
  13450. injected = true;
  13451. }
  13452. }
  13453. };
  13454. module.exports = ReactComponentEnvironment;
  13455. /***/ }),
  13456. /* 58 */
  13457. /***/ (function(module, exports, __webpack_require__) {
  13458. "use strict";
  13459. /**
  13460. * Copyright 2013-present, Facebook, Inc.
  13461. * All rights reserved.
  13462. *
  13463. * This source code is licensed under the BSD-style license found in the
  13464. * LICENSE file in the root directory of this source tree. An additional grant
  13465. * of patent rights can be found in the PATENTS file in the same directory.
  13466. *
  13467. *
  13468. */
  13469. var caughtError = null;
  13470. /**
  13471. * Call a function while guarding against errors that happens within it.
  13472. *
  13473. * @param {String} name of the guard to use for logging or debugging
  13474. * @param {Function} func The function to invoke
  13475. * @param {*} a First argument
  13476. * @param {*} b Second argument
  13477. */
  13478. function invokeGuardedCallback(name, func, a) {
  13479. try {
  13480. func(a);
  13481. } catch (x) {
  13482. if (caughtError === null) {
  13483. caughtError = x;
  13484. }
  13485. }
  13486. }
  13487. var ReactErrorUtils = {
  13488. invokeGuardedCallback: invokeGuardedCallback,
  13489. /**
  13490. * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
  13491. * handler are sure to be rethrown by rethrowCaughtError.
  13492. */
  13493. invokeGuardedCallbackWithCatch: invokeGuardedCallback,
  13494. /**
  13495. * During execution of guarded functions we will capture the first error which
  13496. * we will rethrow to be handled by the top level error handler.
  13497. */
  13498. rethrowCaughtError: function () {
  13499. if (caughtError) {
  13500. var error = caughtError;
  13501. caughtError = null;
  13502. throw error;
  13503. }
  13504. }
  13505. };
  13506. if (false) {
  13507. /**
  13508. * To help development we can get better devtools integration by simulating a
  13509. * real browser event.
  13510. */
  13511. if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
  13512. var fakeNode = document.createElement('react');
  13513. ReactErrorUtils.invokeGuardedCallback = function (name, func, a) {
  13514. var boundFunc = func.bind(null, a);
  13515. var evtType = 'react-' + name;
  13516. fakeNode.addEventListener(evtType, boundFunc, false);
  13517. var evt = document.createEvent('Event');
  13518. evt.initEvent(evtType, false, false);
  13519. fakeNode.dispatchEvent(evt);
  13520. fakeNode.removeEventListener(evtType, boundFunc, false);
  13521. };
  13522. }
  13523. }
  13524. module.exports = ReactErrorUtils;
  13525. /***/ }),
  13526. /* 59 */
  13527. /***/ (function(module, exports, __webpack_require__) {
  13528. "use strict";
  13529. /**
  13530. * Copyright 2015-present, Facebook, Inc.
  13531. * All rights reserved.
  13532. *
  13533. * This source code is licensed under the BSD-style license found in the
  13534. * LICENSE file in the root directory of this source tree. An additional grant
  13535. * of patent rights can be found in the PATENTS file in the same directory.
  13536. *
  13537. */
  13538. var _prodInvariant = __webpack_require__(2);
  13539. var ReactCurrentOwner = __webpack_require__(14);
  13540. var ReactInstanceMap = __webpack_require__(28);
  13541. var ReactInstrumentation = __webpack_require__(11);
  13542. var ReactUpdates = __webpack_require__(12);
  13543. var invariant = __webpack_require__(0);
  13544. var warning = __webpack_require__(1);
  13545. function enqueueUpdate(internalInstance) {
  13546. ReactUpdates.enqueueUpdate(internalInstance);
  13547. }
  13548. function formatUnexpectedArgument(arg) {
  13549. var type = typeof arg;
  13550. if (type !== 'object') {
  13551. return type;
  13552. }
  13553. var displayName = arg.constructor && arg.constructor.name || type;
  13554. var keys = Object.keys(arg);
  13555. if (keys.length > 0 && keys.length < 20) {
  13556. return displayName + ' (keys: ' + keys.join(', ') + ')';
  13557. }
  13558. return displayName;
  13559. }
  13560. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  13561. var internalInstance = ReactInstanceMap.get(publicInstance);
  13562. if (!internalInstance) {
  13563. if (false) {
  13564. var ctor = publicInstance.constructor;
  13565. // Only warn when we have a callerName. Otherwise we should be silent.
  13566. // We're probably calling from enqueueCallback. We don't want to warn
  13567. // there because we already warned for the corresponding lifecycle method.
  13568. 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;
  13569. }
  13570. return null;
  13571. }
  13572. if (false) {
  13573. 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;
  13574. }
  13575. return internalInstance;
  13576. }
  13577. /**
  13578. * ReactUpdateQueue allows for state updates to be scheduled into a later
  13579. * reconciliation step.
  13580. */
  13581. var ReactUpdateQueue = {
  13582. /**
  13583. * Checks whether or not this composite component is mounted.
  13584. * @param {ReactClass} publicInstance The instance we want to test.
  13585. * @return {boolean} True if mounted, false otherwise.
  13586. * @protected
  13587. * @final
  13588. */
  13589. isMounted: function (publicInstance) {
  13590. if (false) {
  13591. var owner = ReactCurrentOwner.current;
  13592. if (owner !== null) {
  13593. 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;
  13594. owner._warnedAboutRefsInRender = true;
  13595. }
  13596. }
  13597. var internalInstance = ReactInstanceMap.get(publicInstance);
  13598. if (internalInstance) {
  13599. // During componentWillMount and render this will still be null but after
  13600. // that will always render to something. At least for now. So we can use
  13601. // this hack.
  13602. return !!internalInstance._renderedComponent;
  13603. } else {
  13604. return false;
  13605. }
  13606. },
  13607. /**
  13608. * Enqueue a callback that will be executed after all the pending updates
  13609. * have processed.
  13610. *
  13611. * @param {ReactClass} publicInstance The instance to use as `this` context.
  13612. * @param {?function} callback Called after state is updated.
  13613. * @param {string} callerName Name of the calling function in the public API.
  13614. * @internal
  13615. */
  13616. enqueueCallback: function (publicInstance, callback, callerName) {
  13617. ReactUpdateQueue.validateCallback(callback, callerName);
  13618. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  13619. // Previously we would throw an error if we didn't have an internal
  13620. // instance. Since we want to make it a no-op instead, we mirror the same
  13621. // behavior we have in other enqueue* methods.
  13622. // We also need to ignore callbacks in componentWillMount. See
  13623. // enqueueUpdates.
  13624. if (!internalInstance) {
  13625. return null;
  13626. }
  13627. if (internalInstance._pendingCallbacks) {
  13628. internalInstance._pendingCallbacks.push(callback);
  13629. } else {
  13630. internalInstance._pendingCallbacks = [callback];
  13631. }
  13632. // TODO: The callback here is ignored when setState is called from
  13633. // componentWillMount. Either fix it or disallow doing so completely in
  13634. // favor of getInitialState. Alternatively, we can disallow
  13635. // componentWillMount during server-side rendering.
  13636. enqueueUpdate(internalInstance);
  13637. },
  13638. enqueueCallbackInternal: function (internalInstance, callback) {
  13639. if (internalInstance._pendingCallbacks) {
  13640. internalInstance._pendingCallbacks.push(callback);
  13641. } else {
  13642. internalInstance._pendingCallbacks = [callback];
  13643. }
  13644. enqueueUpdate(internalInstance);
  13645. },
  13646. /**
  13647. * Forces an update. This should only be invoked when it is known with
  13648. * certainty that we are **not** in a DOM transaction.
  13649. *
  13650. * You may want to call this when you know that some deeper aspect of the
  13651. * component's state has changed but `setState` was not called.
  13652. *
  13653. * This will not invoke `shouldComponentUpdate`, but it will invoke
  13654. * `componentWillUpdate` and `componentDidUpdate`.
  13655. *
  13656. * @param {ReactClass} publicInstance The instance that should rerender.
  13657. * @internal
  13658. */
  13659. enqueueForceUpdate: function (publicInstance) {
  13660. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
  13661. if (!internalInstance) {
  13662. return;
  13663. }
  13664. internalInstance._pendingForceUpdate = true;
  13665. enqueueUpdate(internalInstance);
  13666. },
  13667. /**
  13668. * Replaces all of the state. Always use this or `setState` to mutate state.
  13669. * You should treat `this.state` as immutable.
  13670. *
  13671. * There is no guarantee that `this.state` will be immediately updated, so
  13672. * accessing `this.state` after calling this method may return the old value.
  13673. *
  13674. * @param {ReactClass} publicInstance The instance that should rerender.
  13675. * @param {object} completeState Next state.
  13676. * @internal
  13677. */
  13678. enqueueReplaceState: function (publicInstance, completeState, callback) {
  13679. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
  13680. if (!internalInstance) {
  13681. return;
  13682. }
  13683. internalInstance._pendingStateQueue = [completeState];
  13684. internalInstance._pendingReplaceState = true;
  13685. // Future-proof 15.5
  13686. if (callback !== undefined && callback !== null) {
  13687. ReactUpdateQueue.validateCallback(callback, 'replaceState');
  13688. if (internalInstance._pendingCallbacks) {
  13689. internalInstance._pendingCallbacks.push(callback);
  13690. } else {
  13691. internalInstance._pendingCallbacks = [callback];
  13692. }
  13693. }
  13694. enqueueUpdate(internalInstance);
  13695. },
  13696. /**
  13697. * Sets a subset of the state. This only exists because _pendingState is
  13698. * internal. This provides a merging strategy that is not available to deep
  13699. * properties which is confusing. TODO: Expose pendingState or don't use it
  13700. * during the merge.
  13701. *
  13702. * @param {ReactClass} publicInstance The instance that should rerender.
  13703. * @param {object} partialState Next partial state to be merged with state.
  13704. * @internal
  13705. */
  13706. enqueueSetState: function (publicInstance, partialState) {
  13707. if (false) {
  13708. ReactInstrumentation.debugTool.onSetState();
  13709. process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
  13710. }
  13711. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
  13712. if (!internalInstance) {
  13713. return;
  13714. }
  13715. var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
  13716. queue.push(partialState);
  13717. enqueueUpdate(internalInstance);
  13718. },
  13719. enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
  13720. internalInstance._pendingElement = nextElement;
  13721. // TODO: introduce _pendingContext instead of setting it directly.
  13722. internalInstance._context = nextContext;
  13723. enqueueUpdate(internalInstance);
  13724. },
  13725. validateCallback: function (callback, callerName) {
  13726. !(!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;
  13727. }
  13728. };
  13729. module.exports = ReactUpdateQueue;
  13730. /***/ }),
  13731. /* 60 */
  13732. /***/ (function(module, exports, __webpack_require__) {
  13733. "use strict";
  13734. /**
  13735. * Copyright 2013-present, Facebook, Inc.
  13736. * All rights reserved.
  13737. *
  13738. * This source code is licensed under the BSD-style license found in the
  13739. * LICENSE file in the root directory of this source tree. An additional grant
  13740. * of patent rights can be found in the PATENTS file in the same directory.
  13741. *
  13742. */
  13743. /* globals MSApp */
  13744. /**
  13745. * Create a function which has 'unsafe' privileges (required by windows8 apps)
  13746. */
  13747. var createMicrosoftUnsafeLocalFunction = function (func) {
  13748. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  13749. return function (arg0, arg1, arg2, arg3) {
  13750. MSApp.execUnsafeLocalFunction(function () {
  13751. return func(arg0, arg1, arg2, arg3);
  13752. });
  13753. };
  13754. } else {
  13755. return func;
  13756. }
  13757. };
  13758. module.exports = createMicrosoftUnsafeLocalFunction;
  13759. /***/ }),
  13760. /* 61 */
  13761. /***/ (function(module, exports, __webpack_require__) {
  13762. "use strict";
  13763. /**
  13764. * Copyright 2013-present, Facebook, Inc.
  13765. * All rights reserved.
  13766. *
  13767. * This source code is licensed under the BSD-style license found in the
  13768. * LICENSE file in the root directory of this source tree. An additional grant
  13769. * of patent rights can be found in the PATENTS file in the same directory.
  13770. *
  13771. */
  13772. /**
  13773. * `charCode` represents the actual "character code" and is safe to use with
  13774. * `String.fromCharCode`. As such, only keys that correspond to printable
  13775. * characters produce a valid `charCode`, the only exception to this is Enter.
  13776. * The Tab-key is considered non-printable and does not have a `charCode`,
  13777. * presumably because it does not produce a tab-character in browsers.
  13778. *
  13779. * @param {object} nativeEvent Native browser event.
  13780. * @return {number} Normalized `charCode` property.
  13781. */
  13782. function getEventCharCode(nativeEvent) {
  13783. var charCode;
  13784. var keyCode = nativeEvent.keyCode;
  13785. if ('charCode' in nativeEvent) {
  13786. charCode = nativeEvent.charCode;
  13787. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  13788. if (charCode === 0 && keyCode === 13) {
  13789. charCode = 13;
  13790. }
  13791. } else {
  13792. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  13793. charCode = keyCode;
  13794. }
  13795. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  13796. // Must not discard the (non-)printable Enter-key.
  13797. if (charCode >= 32 || charCode === 13) {
  13798. return charCode;
  13799. }
  13800. return 0;
  13801. }
  13802. module.exports = getEventCharCode;
  13803. /***/ }),
  13804. /* 62 */
  13805. /***/ (function(module, exports, __webpack_require__) {
  13806. "use strict";
  13807. /**
  13808. * Copyright 2013-present, Facebook, Inc.
  13809. * All rights reserved.
  13810. *
  13811. * This source code is licensed under the BSD-style license found in the
  13812. * LICENSE file in the root directory of this source tree. An additional grant
  13813. * of patent rights can be found in the PATENTS file in the same directory.
  13814. *
  13815. */
  13816. /**
  13817. * Translation from modifier key to the associated property in the event.
  13818. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  13819. */
  13820. var modifierKeyToProp = {
  13821. 'Alt': 'altKey',
  13822. 'Control': 'ctrlKey',
  13823. 'Meta': 'metaKey',
  13824. 'Shift': 'shiftKey'
  13825. };
  13826. // IE8 does not implement getModifierState so we simply map it to the only
  13827. // modifier keys exposed by the event itself, does not support Lock-keys.
  13828. // Currently, all major browsers except Chrome seems to support Lock-keys.
  13829. function modifierStateGetter(keyArg) {
  13830. var syntheticEvent = this;
  13831. var nativeEvent = syntheticEvent.nativeEvent;
  13832. if (nativeEvent.getModifierState) {
  13833. return nativeEvent.getModifierState(keyArg);
  13834. }
  13835. var keyProp = modifierKeyToProp[keyArg];
  13836. return keyProp ? !!nativeEvent[keyProp] : false;
  13837. }
  13838. function getEventModifierState(nativeEvent) {
  13839. return modifierStateGetter;
  13840. }
  13841. module.exports = getEventModifierState;
  13842. /***/ }),
  13843. /* 63 */
  13844. /***/ (function(module, exports, __webpack_require__) {
  13845. "use strict";
  13846. /**
  13847. * Copyright 2013-present, Facebook, Inc.
  13848. * All rights reserved.
  13849. *
  13850. * This source code is licensed under the BSD-style license found in the
  13851. * LICENSE file in the root directory of this source tree. An additional grant
  13852. * of patent rights can be found in the PATENTS file in the same directory.
  13853. *
  13854. */
  13855. /**
  13856. * Gets the target node from a native browser event by accounting for
  13857. * inconsistencies in browser DOM APIs.
  13858. *
  13859. * @param {object} nativeEvent Native browser event.
  13860. * @return {DOMEventTarget} Target node.
  13861. */
  13862. function getEventTarget(nativeEvent) {
  13863. var target = nativeEvent.target || nativeEvent.srcElement || window;
  13864. // Normalize SVG <use> element events #4963
  13865. if (target.correspondingUseElement) {
  13866. target = target.correspondingUseElement;
  13867. }
  13868. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  13869. // @see http://www.quirksmode.org/js/events_properties.html
  13870. return target.nodeType === 3 ? target.parentNode : target;
  13871. }
  13872. module.exports = getEventTarget;
  13873. /***/ }),
  13874. /* 64 */
  13875. /***/ (function(module, exports, __webpack_require__) {
  13876. "use strict";
  13877. /**
  13878. * Copyright 2013-present, Facebook, Inc.
  13879. * All rights reserved.
  13880. *
  13881. * This source code is licensed under the BSD-style license found in the
  13882. * LICENSE file in the root directory of this source tree. An additional grant
  13883. * of patent rights can be found in the PATENTS file in the same directory.
  13884. *
  13885. */
  13886. var ExecutionEnvironment = __webpack_require__(8);
  13887. var useHasFeature;
  13888. if (ExecutionEnvironment.canUseDOM) {
  13889. useHasFeature = document.implementation && document.implementation.hasFeature &&
  13890. // always returns true in newer browsers as per the standard.
  13891. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  13892. document.implementation.hasFeature('', '') !== true;
  13893. }
  13894. /**
  13895. * Checks if an event is supported in the current execution environment.
  13896. *
  13897. * NOTE: This will not work correctly for non-generic events such as `change`,
  13898. * `reset`, `load`, `error`, and `select`.
  13899. *
  13900. * Borrows from Modernizr.
  13901. *
  13902. * @param {string} eventNameSuffix Event name, e.g. "click".
  13903. * @param {?boolean} capture Check if the capture phase is supported.
  13904. * @return {boolean} True if the event is supported.
  13905. * @internal
  13906. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  13907. */
  13908. function isEventSupported(eventNameSuffix, capture) {
  13909. if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
  13910. return false;
  13911. }
  13912. var eventName = 'on' + eventNameSuffix;
  13913. var isSupported = eventName in document;
  13914. if (!isSupported) {
  13915. var element = document.createElement('div');
  13916. element.setAttribute(eventName, 'return;');
  13917. isSupported = typeof element[eventName] === 'function';
  13918. }
  13919. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  13920. // This is the only way to test support for the `wheel` event in IE9+.
  13921. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  13922. }
  13923. return isSupported;
  13924. }
  13925. module.exports = isEventSupported;
  13926. /***/ }),
  13927. /* 65 */
  13928. /***/ (function(module, exports, __webpack_require__) {
  13929. "use strict";
  13930. /**
  13931. * Copyright 2013-present, Facebook, Inc.
  13932. * All rights reserved.
  13933. *
  13934. * This source code is licensed under the BSD-style license found in the
  13935. * LICENSE file in the root directory of this source tree. An additional grant
  13936. * of patent rights can be found in the PATENTS file in the same directory.
  13937. *
  13938. */
  13939. /**
  13940. * Given a `prevElement` and `nextElement`, determines if the existing
  13941. * instance should be updated as opposed to being destroyed or replaced by a new
  13942. * instance. Both arguments are elements. This ensures that this logic can
  13943. * operate on stateless trees without any backing instance.
  13944. *
  13945. * @param {?object} prevElement
  13946. * @param {?object} nextElement
  13947. * @return {boolean} True if the existing instance should be updated.
  13948. * @protected
  13949. */
  13950. function shouldUpdateReactComponent(prevElement, nextElement) {
  13951. var prevEmpty = prevElement === null || prevElement === false;
  13952. var nextEmpty = nextElement === null || nextElement === false;
  13953. if (prevEmpty || nextEmpty) {
  13954. return prevEmpty === nextEmpty;
  13955. }
  13956. var prevType = typeof prevElement;
  13957. var nextType = typeof nextElement;
  13958. if (prevType === 'string' || prevType === 'number') {
  13959. return nextType === 'string' || nextType === 'number';
  13960. } else {
  13961. return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
  13962. }
  13963. }
  13964. module.exports = shouldUpdateReactComponent;
  13965. /***/ }),
  13966. /* 66 */
  13967. /***/ (function(module, exports, __webpack_require__) {
  13968. "use strict";
  13969. /**
  13970. * Copyright 2015-present, Facebook, Inc.
  13971. * All rights reserved.
  13972. *
  13973. * This source code is licensed under the BSD-style license found in the
  13974. * LICENSE file in the root directory of this source tree. An additional grant
  13975. * of patent rights can be found in the PATENTS file in the same directory.
  13976. *
  13977. */
  13978. var _assign = __webpack_require__(3);
  13979. var emptyFunction = __webpack_require__(10);
  13980. var warning = __webpack_require__(1);
  13981. var validateDOMNesting = emptyFunction;
  13982. if (false) {
  13983. // This validation code was written based on the HTML5 parsing spec:
  13984. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  13985. //
  13986. // Note: this does not catch all invalid nesting, nor does it try to (as it's
  13987. // not clear what practical benefit doing so provides); instead, we warn only
  13988. // for cases where the parser will give a parse tree differing from what React
  13989. // intended. For example, <b><div></div></b> is invalid but we don't warn
  13990. // because it still parses correctly; we do warn for other cases like nested
  13991. // <p> tags where the beginning of the second element implicitly closes the
  13992. // first, causing a confusing mess.
  13993. // https://html.spec.whatwg.org/multipage/syntax.html#special
  13994. 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'];
  13995. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  13996. var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
  13997. // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
  13998. // TODO: Distinguish by namespace here -- for <title>, including it here
  13999. // errs on the side of fewer warnings
  14000. 'foreignObject', 'desc', 'title'];
  14001. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
  14002. var buttonScopeTags = inScopeTags.concat(['button']);
  14003. // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
  14004. var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
  14005. var emptyAncestorInfo = {
  14006. current: null,
  14007. formTag: null,
  14008. aTagInScope: null,
  14009. buttonTagInScope: null,
  14010. nobrTagInScope: null,
  14011. pTagInButtonScope: null,
  14012. listItemTagAutoclosing: null,
  14013. dlItemTagAutoclosing: null
  14014. };
  14015. var updatedAncestorInfo = function (oldInfo, tag, instance) {
  14016. var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
  14017. var info = { tag: tag, instance: instance };
  14018. if (inScopeTags.indexOf(tag) !== -1) {
  14019. ancestorInfo.aTagInScope = null;
  14020. ancestorInfo.buttonTagInScope = null;
  14021. ancestorInfo.nobrTagInScope = null;
  14022. }
  14023. if (buttonScopeTags.indexOf(tag) !== -1) {
  14024. ancestorInfo.pTagInButtonScope = null;
  14025. }
  14026. // See rules for 'li', 'dd', 'dt' start tags in
  14027. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  14028. if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
  14029. ancestorInfo.listItemTagAutoclosing = null;
  14030. ancestorInfo.dlItemTagAutoclosing = null;
  14031. }
  14032. ancestorInfo.current = info;
  14033. if (tag === 'form') {
  14034. ancestorInfo.formTag = info;
  14035. }
  14036. if (tag === 'a') {
  14037. ancestorInfo.aTagInScope = info;
  14038. }
  14039. if (tag === 'button') {
  14040. ancestorInfo.buttonTagInScope = info;
  14041. }
  14042. if (tag === 'nobr') {
  14043. ancestorInfo.nobrTagInScope = info;
  14044. }
  14045. if (tag === 'p') {
  14046. ancestorInfo.pTagInButtonScope = info;
  14047. }
  14048. if (tag === 'li') {
  14049. ancestorInfo.listItemTagAutoclosing = info;
  14050. }
  14051. if (tag === 'dd' || tag === 'dt') {
  14052. ancestorInfo.dlItemTagAutoclosing = info;
  14053. }
  14054. return ancestorInfo;
  14055. };
  14056. /**
  14057. * Returns whether
  14058. */
  14059. var isTagValidWithParent = function (tag, parentTag) {
  14060. // First, let's check if we're in an unusual parsing mode...
  14061. switch (parentTag) {
  14062. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
  14063. case 'select':
  14064. return tag === 'option' || tag === 'optgroup' || tag === '#text';
  14065. case 'optgroup':
  14066. return tag === 'option' || tag === '#text';
  14067. // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
  14068. // but
  14069. case 'option':
  14070. return tag === '#text';
  14071. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
  14072. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
  14073. // No special behavior since these rules fall back to "in body" mode for
  14074. // all except special table nodes which cause bad parsing behavior anyway.
  14075. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
  14076. case 'tr':
  14077. return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
  14078. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
  14079. case 'tbody':
  14080. case 'thead':
  14081. case 'tfoot':
  14082. return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
  14083. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
  14084. case 'colgroup':
  14085. return tag === 'col' || tag === 'template';
  14086. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
  14087. case 'table':
  14088. return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
  14089. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  14090. case 'head':
  14091. return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  14092. // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  14093. case 'html':
  14094. return tag === 'head' || tag === 'body';
  14095. case '#document':
  14096. return tag === 'html';
  14097. }
  14098. // Probably in the "in body" parsing mode, so we outlaw only tag combos
  14099. // where the parsing rules cause implicit opens or closes to be added.
  14100. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  14101. switch (tag) {
  14102. case 'h1':
  14103. case 'h2':
  14104. case 'h3':
  14105. case 'h4':
  14106. case 'h5':
  14107. case 'h6':
  14108. return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
  14109. case 'rp':
  14110. case 'rt':
  14111. return impliedEndTags.indexOf(parentTag) === -1;
  14112. case 'body':
  14113. case 'caption':
  14114. case 'col':
  14115. case 'colgroup':
  14116. case 'frame':
  14117. case 'head':
  14118. case 'html':
  14119. case 'tbody':
  14120. case 'td':
  14121. case 'tfoot':
  14122. case 'th':
  14123. case 'thead':
  14124. case 'tr':
  14125. // These tags are only valid with a few parents that have special child
  14126. // parsing rules -- if we're down here, then none of those matched and
  14127. // so we allow it only if we don't know what the parent is, as all other
  14128. // cases are invalid.
  14129. return parentTag == null;
  14130. }
  14131. return true;
  14132. };
  14133. /**
  14134. * Returns whether
  14135. */
  14136. var findInvalidAncestorForTag = function (tag, ancestorInfo) {
  14137. switch (tag) {
  14138. case 'address':
  14139. case 'article':
  14140. case 'aside':
  14141. case 'blockquote':
  14142. case 'center':
  14143. case 'details':
  14144. case 'dialog':
  14145. case 'dir':
  14146. case 'div':
  14147. case 'dl':
  14148. case 'fieldset':
  14149. case 'figcaption':
  14150. case 'figure':
  14151. case 'footer':
  14152. case 'header':
  14153. case 'hgroup':
  14154. case 'main':
  14155. case 'menu':
  14156. case 'nav':
  14157. case 'ol':
  14158. case 'p':
  14159. case 'section':
  14160. case 'summary':
  14161. case 'ul':
  14162. case 'pre':
  14163. case 'listing':
  14164. case 'table':
  14165. case 'hr':
  14166. case 'xmp':
  14167. case 'h1':
  14168. case 'h2':
  14169. case 'h3':
  14170. case 'h4':
  14171. case 'h5':
  14172. case 'h6':
  14173. return ancestorInfo.pTagInButtonScope;
  14174. case 'form':
  14175. return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
  14176. case 'li':
  14177. return ancestorInfo.listItemTagAutoclosing;
  14178. case 'dd':
  14179. case 'dt':
  14180. return ancestorInfo.dlItemTagAutoclosing;
  14181. case 'button':
  14182. return ancestorInfo.buttonTagInScope;
  14183. case 'a':
  14184. // Spec says something about storing a list of markers, but it sounds
  14185. // equivalent to this check.
  14186. return ancestorInfo.aTagInScope;
  14187. case 'nobr':
  14188. return ancestorInfo.nobrTagInScope;
  14189. }
  14190. return null;
  14191. };
  14192. /**
  14193. * Given a ReactCompositeComponent instance, return a list of its recursive
  14194. * owners, starting at the root and ending with the instance itself.
  14195. */
  14196. var findOwnerStack = function (instance) {
  14197. if (!instance) {
  14198. return [];
  14199. }
  14200. var stack = [];
  14201. do {
  14202. stack.push(instance);
  14203. } while (instance = instance._currentElement._owner);
  14204. stack.reverse();
  14205. return stack;
  14206. };
  14207. var didWarn = {};
  14208. validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) {
  14209. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  14210. var parentInfo = ancestorInfo.current;
  14211. var parentTag = parentInfo && parentInfo.tag;
  14212. if (childText != null) {
  14213. process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
  14214. childTag = '#text';
  14215. }
  14216. var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
  14217. var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
  14218. var problematic = invalidParent || invalidAncestor;
  14219. if (problematic) {
  14220. var ancestorTag = problematic.tag;
  14221. var ancestorInstance = problematic.instance;
  14222. var childOwner = childInstance && childInstance._currentElement._owner;
  14223. var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
  14224. var childOwners = findOwnerStack(childOwner);
  14225. var ancestorOwners = findOwnerStack(ancestorOwner);
  14226. var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
  14227. var i;
  14228. var deepestCommon = -1;
  14229. for (i = 0; i < minStackLen; i++) {
  14230. if (childOwners[i] === ancestorOwners[i]) {
  14231. deepestCommon = i;
  14232. } else {
  14233. break;
  14234. }
  14235. }
  14236. var UNKNOWN = '(unknown)';
  14237. var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
  14238. return inst.getName() || UNKNOWN;
  14239. });
  14240. var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
  14241. return inst.getName() || UNKNOWN;
  14242. });
  14243. var ownerInfo = [].concat(
  14244. // If the parent and child instances have a common owner ancestor, start
  14245. // with that -- otherwise we just start with the parent's owners.
  14246. deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
  14247. // If we're warning about an invalid (non-parent) ancestry, add '...'
  14248. invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
  14249. var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
  14250. if (didWarn[warnKey]) {
  14251. return;
  14252. }
  14253. didWarn[warnKey] = true;
  14254. var tagDisplayName = childTag;
  14255. var whitespaceInfo = '';
  14256. if (childTag === '#text') {
  14257. if (/\S/.test(childText)) {
  14258. tagDisplayName = 'Text nodes';
  14259. } else {
  14260. tagDisplayName = 'Whitespace text nodes';
  14261. whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.';
  14262. }
  14263. } else {
  14264. tagDisplayName = '<' + childTag + '>';
  14265. }
  14266. if (invalidParent) {
  14267. var info = '';
  14268. if (ancestorTag === 'table' && childTag === 'tr') {
  14269. info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
  14270. }
  14271. 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;
  14272. } else {
  14273. process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
  14274. }
  14275. }
  14276. };
  14277. validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
  14278. // For testing
  14279. validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
  14280. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  14281. var parentInfo = ancestorInfo.current;
  14282. var parentTag = parentInfo && parentInfo.tag;
  14283. return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
  14284. };
  14285. }
  14286. module.exports = validateDOMNesting;
  14287. /***/ }),
  14288. /* 67 */
  14289. /***/ (function(module, exports, __webpack_require__) {
  14290. "use strict";
  14291. /**
  14292. * Copyright 2013-present, Facebook, Inc.
  14293. * All rights reserved.
  14294. *
  14295. * This source code is licensed under the BSD-style license found in the
  14296. * LICENSE file in the root directory of this source tree. An additional grant
  14297. * of patent rights can be found in the PATENTS file in the same directory.
  14298. *
  14299. */
  14300. var _prodInvariant = __webpack_require__(23);
  14301. var ReactNoopUpdateQueue = __webpack_require__(68);
  14302. var canDefineProperty = __webpack_require__(98);
  14303. var emptyObject = __webpack_require__(25);
  14304. var invariant = __webpack_require__(0);
  14305. var warning = __webpack_require__(1);
  14306. /**
  14307. * Base class helpers for the updating state of a component.
  14308. */
  14309. function ReactComponent(props, context, updater) {
  14310. this.props = props;
  14311. this.context = context;
  14312. this.refs = emptyObject;
  14313. // We initialize the default updater but the real one gets injected by the
  14314. // renderer.
  14315. this.updater = updater || ReactNoopUpdateQueue;
  14316. }
  14317. ReactComponent.prototype.isReactComponent = {};
  14318. /**
  14319. * Sets a subset of the state. Always use this to mutate
  14320. * state. You should treat `this.state` as immutable.
  14321. *
  14322. * There is no guarantee that `this.state` will be immediately updated, so
  14323. * accessing `this.state` after calling this method may return the old value.
  14324. *
  14325. * There is no guarantee that calls to `setState` will run synchronously,
  14326. * as they may eventually be batched together. You can provide an optional
  14327. * callback that will be executed when the call to setState is actually
  14328. * completed.
  14329. *
  14330. * When a function is provided to setState, it will be called at some point in
  14331. * the future (not synchronously). It will be called with the up to date
  14332. * component arguments (state, props, context). These values can be different
  14333. * from this.* because your function may be called after receiveProps but before
  14334. * shouldComponentUpdate, and this new state, props, and context will not yet be
  14335. * assigned to this.
  14336. *
  14337. * @param {object|function} partialState Next partial state or function to
  14338. * produce next partial state to be merged with current state.
  14339. * @param {?function} callback Called after state is updated.
  14340. * @final
  14341. * @protected
  14342. */
  14343. ReactComponent.prototype.setState = function (partialState, callback) {
  14344. !(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;
  14345. this.updater.enqueueSetState(this, partialState);
  14346. if (callback) {
  14347. this.updater.enqueueCallback(this, callback, 'setState');
  14348. }
  14349. };
  14350. /**
  14351. * Forces an update. This should only be invoked when it is known with
  14352. * certainty that we are **not** in a DOM transaction.
  14353. *
  14354. * You may want to call this when you know that some deeper aspect of the
  14355. * component's state has changed but `setState` was not called.
  14356. *
  14357. * This will not invoke `shouldComponentUpdate`, but it will invoke
  14358. * `componentWillUpdate` and `componentDidUpdate`.
  14359. *
  14360. * @param {?function} callback Called after update is complete.
  14361. * @final
  14362. * @protected
  14363. */
  14364. ReactComponent.prototype.forceUpdate = function (callback) {
  14365. this.updater.enqueueForceUpdate(this);
  14366. if (callback) {
  14367. this.updater.enqueueCallback(this, callback, 'forceUpdate');
  14368. }
  14369. };
  14370. /**
  14371. * Deprecated APIs. These APIs used to exist on classic React classes but since
  14372. * we would like to deprecate them, we're not going to move them over to this
  14373. * modern base class. Instead, we define a getter that warns if it's accessed.
  14374. */
  14375. if (false) {
  14376. var deprecatedAPIs = {
  14377. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  14378. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  14379. };
  14380. var defineDeprecationWarning = function (methodName, info) {
  14381. if (canDefineProperty) {
  14382. Object.defineProperty(ReactComponent.prototype, methodName, {
  14383. get: function () {
  14384. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
  14385. return undefined;
  14386. }
  14387. });
  14388. }
  14389. };
  14390. for (var fnName in deprecatedAPIs) {
  14391. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  14392. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  14393. }
  14394. }
  14395. }
  14396. module.exports = ReactComponent;
  14397. /***/ }),
  14398. /* 68 */
  14399. /***/ (function(module, exports, __webpack_require__) {
  14400. "use strict";
  14401. /**
  14402. * Copyright 2015-present, Facebook, Inc.
  14403. * All rights reserved.
  14404. *
  14405. * This source code is licensed under the BSD-style license found in the
  14406. * LICENSE file in the root directory of this source tree. An additional grant
  14407. * of patent rights can be found in the PATENTS file in the same directory.
  14408. *
  14409. */
  14410. var warning = __webpack_require__(1);
  14411. function warnNoop(publicInstance, callerName) {
  14412. if (false) {
  14413. var constructor = publicInstance.constructor;
  14414. 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;
  14415. }
  14416. }
  14417. /**
  14418. * This is the abstract API for an update queue.
  14419. */
  14420. var ReactNoopUpdateQueue = {
  14421. /**
  14422. * Checks whether or not this composite component is mounted.
  14423. * @param {ReactClass} publicInstance The instance we want to test.
  14424. * @return {boolean} True if mounted, false otherwise.
  14425. * @protected
  14426. * @final
  14427. */
  14428. isMounted: function (publicInstance) {
  14429. return false;
  14430. },
  14431. /**
  14432. * Enqueue a callback that will be executed after all the pending updates
  14433. * have processed.
  14434. *
  14435. * @param {ReactClass} publicInstance The instance to use as `this` context.
  14436. * @param {?function} callback Called after state is updated.
  14437. * @internal
  14438. */
  14439. enqueueCallback: function (publicInstance, callback) {},
  14440. /**
  14441. * Forces an update. This should only be invoked when it is known with
  14442. * certainty that we are **not** in a DOM transaction.
  14443. *
  14444. * You may want to call this when you know that some deeper aspect of the
  14445. * component's state has changed but `setState` was not called.
  14446. *
  14447. * This will not invoke `shouldComponentUpdate`, but it will invoke
  14448. * `componentWillUpdate` and `componentDidUpdate`.
  14449. *
  14450. * @param {ReactClass} publicInstance The instance that should rerender.
  14451. * @internal
  14452. */
  14453. enqueueForceUpdate: function (publicInstance) {
  14454. warnNoop(publicInstance, 'forceUpdate');
  14455. },
  14456. /**
  14457. * Replaces all of the state. Always use this or `setState` to mutate state.
  14458. * You should treat `this.state` as immutable.
  14459. *
  14460. * There is no guarantee that `this.state` will be immediately updated, so
  14461. * accessing `this.state` after calling this method may return the old value.
  14462. *
  14463. * @param {ReactClass} publicInstance The instance that should rerender.
  14464. * @param {object} completeState Next state.
  14465. * @internal
  14466. */
  14467. enqueueReplaceState: function (publicInstance, completeState) {
  14468. warnNoop(publicInstance, 'replaceState');
  14469. },
  14470. /**
  14471. * Sets a subset of the state. This only exists because _pendingState is
  14472. * internal. This provides a merging strategy that is not available to deep
  14473. * properties which is confusing. TODO: Expose pendingState or don't use it
  14474. * during the merge.
  14475. *
  14476. * @param {ReactClass} publicInstance The instance that should rerender.
  14477. * @param {object} partialState Next partial state to be merged with state.
  14478. * @internal
  14479. */
  14480. enqueueSetState: function (publicInstance, partialState) {
  14481. warnNoop(publicInstance, 'setState');
  14482. }
  14483. };
  14484. module.exports = ReactNoopUpdateQueue;
  14485. /***/ }),
  14486. /* 69 */
  14487. /***/ (function(module, exports, __webpack_require__) {
  14488. "use strict";
  14489. exports.version = [3, 3, 2, 5193];
  14490. /***/ }),
  14491. /* 70 */
  14492. /***/ (function(module, exports, __webpack_require__) {
  14493. "use strict";
  14494. /**
  14495. * kw
  14496. * @author oldj
  14497. * @blog http://oldj.net
  14498. */
  14499. function kw2re(kw) {
  14500. // 模糊搜索
  14501. var r = void 0;
  14502. var m = void 0;
  14503. var flag = [];
  14504. if (kw === '/') {
  14505. return;
  14506. } else if (m = kw.match(/^\/([^\/]+)\/?(\w*)$/)) {
  14507. if (m[2].indexOf('i') > -1) {
  14508. flag.push('i');
  14509. }
  14510. // if (m[2].indexOf('g') > -1) {
  14511. flag.push('g');
  14512. // }
  14513. try {
  14514. r = new RegExp(m[1], flag.join(''));
  14515. } catch (e) {}
  14516. } else if (kw.indexOf('*') > -1) {
  14517. try {
  14518. r = new RegExp(kw.replace(/\*/g, '.*'), 'ig');
  14519. } catch (e) {}
  14520. }
  14521. return r;
  14522. }
  14523. exports.findPositions = function (kw, code) {
  14524. if (!kw || kw === '/') return [];
  14525. var r = kw2re(kw);
  14526. if (!r) {
  14527. try {
  14528. r = new RegExp(kw.replace(/([\.\?\*\+\^\$\(\)\-\[\]\{\}])/g, '\\$1'), 'ig');
  14529. } catch (e) {
  14530. console.log(e);
  14531. return [];
  14532. }
  14533. }
  14534. var indexes = [];
  14535. var lines = code.split('\n');
  14536. lines.map(function (ln, idx) {
  14537. var match = void 0;
  14538. var max_loop = 30;
  14539. while (match = r.exec(ln)) {
  14540. indexes.push([{ line: idx, ch: match.index }, { line: idx, ch: match.index + match[0].length }]);
  14541. max_loop--;
  14542. if (max_loop < 0) break;
  14543. }
  14544. });
  14545. return indexes;
  14546. };
  14547. exports.kw2re = kw2re;
  14548. /***/ }),
  14549. /* 71 */
  14550. /***/ (function(module, exports, __webpack_require__) {
  14551. "use strict";
  14552. /**
  14553. * Copyright (c) 2013-present, Facebook, Inc.
  14554. *
  14555. * Licensed under the Apache License, Version 2.0 (the "License");
  14556. * you may not use this file except in compliance with the License.
  14557. * You may obtain a copy of the License at
  14558. *
  14559. * http://www.apache.org/licenses/LICENSE-2.0
  14560. *
  14561. * Unless required by applicable law or agreed to in writing, software
  14562. * distributed under the License is distributed on an "AS IS" BASIS,
  14563. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14564. * See the License for the specific language governing permissions and
  14565. * limitations under the License.
  14566. *
  14567. * @typechecks
  14568. */
  14569. var emptyFunction = __webpack_require__(10);
  14570. /**
  14571. * Upstream version of event listener. Does not take into account specific
  14572. * nature of platform.
  14573. */
  14574. var EventListener = {
  14575. /**
  14576. * Listen to DOM events during the bubble phase.
  14577. *
  14578. * @param {DOMEventTarget} target DOM element to register listener on.
  14579. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14580. * @param {function} callback Callback function.
  14581. * @return {object} Object with a `remove` method.
  14582. */
  14583. listen: function listen(target, eventType, callback) {
  14584. if (target.addEventListener) {
  14585. target.addEventListener(eventType, callback, false);
  14586. return {
  14587. remove: function remove() {
  14588. target.removeEventListener(eventType, callback, false);
  14589. }
  14590. };
  14591. } else if (target.attachEvent) {
  14592. target.attachEvent('on' + eventType, callback);
  14593. return {
  14594. remove: function remove() {
  14595. target.detachEvent('on' + eventType, callback);
  14596. }
  14597. };
  14598. }
  14599. },
  14600. /**
  14601. * Listen to DOM events during the capture phase.
  14602. *
  14603. * @param {DOMEventTarget} target DOM element to register listener on.
  14604. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14605. * @param {function} callback Callback function.
  14606. * @return {object} Object with a `remove` method.
  14607. */
  14608. capture: function capture(target, eventType, callback) {
  14609. if (target.addEventListener) {
  14610. target.addEventListener(eventType, callback, true);
  14611. return {
  14612. remove: function remove() {
  14613. target.removeEventListener(eventType, callback, true);
  14614. }
  14615. };
  14616. } else {
  14617. if (false) {
  14618. 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.');
  14619. }
  14620. return {
  14621. remove: emptyFunction
  14622. };
  14623. }
  14624. },
  14625. registerDefault: function registerDefault() {}
  14626. };
  14627. module.exports = EventListener;
  14628. /***/ }),
  14629. /* 72 */
  14630. /***/ (function(module, exports, __webpack_require__) {
  14631. "use strict";
  14632. /**
  14633. * Copyright (c) 2013-present, Facebook, Inc.
  14634. * All rights reserved.
  14635. *
  14636. * This source code is licensed under the BSD-style license found in the
  14637. * LICENSE file in the root directory of this source tree. An additional grant
  14638. * of patent rights can be found in the PATENTS file in the same directory.
  14639. *
  14640. */
  14641. /**
  14642. * @param {DOMElement} node input/textarea to focus
  14643. */
  14644. function focusNode(node) {
  14645. // IE8 can throw "Can't move focus to the control because it is invisible,
  14646. // not enabled, or of a type that does not accept the focus." for all kinds of
  14647. // reasons that are too expensive and fragile to test.
  14648. try {
  14649. node.focus();
  14650. } catch (e) {}
  14651. }
  14652. module.exports = focusNode;
  14653. /***/ }),
  14654. /* 73 */
  14655. /***/ (function(module, exports, __webpack_require__) {
  14656. "use strict";
  14657. /**
  14658. * Copyright (c) 2013-present, Facebook, Inc.
  14659. * All rights reserved.
  14660. *
  14661. * This source code is licensed under the BSD-style license found in the
  14662. * LICENSE file in the root directory of this source tree. An additional grant
  14663. * of patent rights can be found in the PATENTS file in the same directory.
  14664. *
  14665. * @typechecks
  14666. */
  14667. /* eslint-disable fb-www/typeof-undefined */
  14668. /**
  14669. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  14670. * not safe to call document.activeElement if there is nothing focused.
  14671. *
  14672. * The activeElement will be null only if the document or document body is not
  14673. * yet defined.
  14674. *
  14675. * @param {?DOMDocument} doc Defaults to current document.
  14676. * @return {?DOMElement}
  14677. */
  14678. function getActiveElement(doc) /*?DOMElement*/{
  14679. doc = doc || (typeof document !== 'undefined' ? document : undefined);
  14680. if (typeof doc === 'undefined') {
  14681. return null;
  14682. }
  14683. try {
  14684. return doc.activeElement || doc.body;
  14685. } catch (e) {
  14686. return doc.body;
  14687. }
  14688. }
  14689. module.exports = getActiveElement;
  14690. /***/ }),
  14691. /* 74 */
  14692. /***/ (function(module, exports) {
  14693. // shim for using process in browser
  14694. var process = module.exports = {};
  14695. // cached from whatever global is present so that test runners that stub it
  14696. // don't break things. But we need to wrap it in a try catch in case it is
  14697. // wrapped in strict mode code which doesn't define any globals. It's inside a
  14698. // function because try/catches deoptimize in certain engines.
  14699. var cachedSetTimeout;
  14700. var cachedClearTimeout;
  14701. function defaultSetTimout() {
  14702. throw new Error('setTimeout has not been defined');
  14703. }
  14704. function defaultClearTimeout () {
  14705. throw new Error('clearTimeout has not been defined');
  14706. }
  14707. (function () {
  14708. try {
  14709. if (typeof setTimeout === 'function') {
  14710. cachedSetTimeout = setTimeout;
  14711. } else {
  14712. cachedSetTimeout = defaultSetTimout;
  14713. }
  14714. } catch (e) {
  14715. cachedSetTimeout = defaultSetTimout;
  14716. }
  14717. try {
  14718. if (typeof clearTimeout === 'function') {
  14719. cachedClearTimeout = clearTimeout;
  14720. } else {
  14721. cachedClearTimeout = defaultClearTimeout;
  14722. }
  14723. } catch (e) {
  14724. cachedClearTimeout = defaultClearTimeout;
  14725. }
  14726. } ())
  14727. function runTimeout(fun) {
  14728. if (cachedSetTimeout === setTimeout) {
  14729. //normal enviroments in sane situations
  14730. return setTimeout(fun, 0);
  14731. }
  14732. // if setTimeout wasn't available but was latter defined
  14733. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  14734. cachedSetTimeout = setTimeout;
  14735. return setTimeout(fun, 0);
  14736. }
  14737. try {
  14738. // when when somebody has screwed with setTimeout but no I.E. maddness
  14739. return cachedSetTimeout(fun, 0);
  14740. } catch(e){
  14741. try {
  14742. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14743. return cachedSetTimeout.call(null, fun, 0);
  14744. } catch(e){
  14745. // 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
  14746. return cachedSetTimeout.call(this, fun, 0);
  14747. }
  14748. }
  14749. }
  14750. function runClearTimeout(marker) {
  14751. if (cachedClearTimeout === clearTimeout) {
  14752. //normal enviroments in sane situations
  14753. return clearTimeout(marker);
  14754. }
  14755. // if clearTimeout wasn't available but was latter defined
  14756. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  14757. cachedClearTimeout = clearTimeout;
  14758. return clearTimeout(marker);
  14759. }
  14760. try {
  14761. // when when somebody has screwed with setTimeout but no I.E. maddness
  14762. return cachedClearTimeout(marker);
  14763. } catch (e){
  14764. try {
  14765. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14766. return cachedClearTimeout.call(null, marker);
  14767. } catch (e){
  14768. // 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.
  14769. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  14770. return cachedClearTimeout.call(this, marker);
  14771. }
  14772. }
  14773. }
  14774. var queue = [];
  14775. var draining = false;
  14776. var currentQueue;
  14777. var queueIndex = -1;
  14778. function cleanUpNextTick() {
  14779. if (!draining || !currentQueue) {
  14780. return;
  14781. }
  14782. draining = false;
  14783. if (currentQueue.length) {
  14784. queue = currentQueue.concat(queue);
  14785. } else {
  14786. queueIndex = -1;
  14787. }
  14788. if (queue.length) {
  14789. drainQueue();
  14790. }
  14791. }
  14792. function drainQueue() {
  14793. if (draining) {
  14794. return;
  14795. }
  14796. var timeout = runTimeout(cleanUpNextTick);
  14797. draining = true;
  14798. var len = queue.length;
  14799. while(len) {
  14800. currentQueue = queue;
  14801. queue = [];
  14802. while (++queueIndex < len) {
  14803. if (currentQueue) {
  14804. currentQueue[queueIndex].run();
  14805. }
  14806. }
  14807. queueIndex = -1;
  14808. len = queue.length;
  14809. }
  14810. currentQueue = null;
  14811. draining = false;
  14812. runClearTimeout(timeout);
  14813. }
  14814. process.nextTick = function (fun) {
  14815. var args = new Array(arguments.length - 1);
  14816. if (arguments.length > 1) {
  14817. for (var i = 1; i < arguments.length; i++) {
  14818. args[i - 1] = arguments[i];
  14819. }
  14820. }
  14821. queue.push(new Item(fun, args));
  14822. if (queue.length === 1 && !draining) {
  14823. runTimeout(drainQueue);
  14824. }
  14825. };
  14826. // v8 likes predictible objects
  14827. function Item(fun, array) {
  14828. this.fun = fun;
  14829. this.array = array;
  14830. }
  14831. Item.prototype.run = function () {
  14832. this.fun.apply(null, this.array);
  14833. };
  14834. process.title = 'browser';
  14835. process.browser = true;
  14836. process.env = {};
  14837. process.argv = [];
  14838. process.version = ''; // empty string to avoid regexp issues
  14839. process.versions = {};
  14840. function noop() {}
  14841. process.on = noop;
  14842. process.addListener = noop;
  14843. process.once = noop;
  14844. process.off = noop;
  14845. process.removeListener = noop;
  14846. process.removeAllListeners = noop;
  14847. process.emit = noop;
  14848. process.binding = function (name) {
  14849. throw new Error('process.binding is not supported');
  14850. };
  14851. process.cwd = function () { return '/' };
  14852. process.chdir = function (dir) {
  14853. throw new Error('process.chdir is not supported');
  14854. };
  14855. process.umask = function() { return 0; };
  14856. /***/ }),
  14857. /* 75 */
  14858. /***/ (function(module, exports, __webpack_require__) {
  14859. "use strict";
  14860. /**
  14861. * Copyright 2013-present, Facebook, Inc.
  14862. * All rights reserved.
  14863. *
  14864. * This source code is licensed under the BSD-style license found in the
  14865. * LICENSE file in the root directory of this source tree. An additional grant
  14866. * of patent rights can be found in the PATENTS file in the same directory.
  14867. */
  14868. // React 15.5 references this module, and assumes PropTypes are still callable in production.
  14869. // Therefore we re-export development-only version with all the PropTypes checks here.
  14870. // However if one is migrating to the `prop-types` npm library, they will go through the
  14871. // `index.js` entry point, and it will branch depending on the environment.
  14872. var factory = __webpack_require__(149);
  14873. module.exports = function(isValidElement) {
  14874. // It is still allowed in 15.5.
  14875. var throwOnDirectAccess = false;
  14876. return factory(isValidElement, throwOnDirectAccess);
  14877. };
  14878. /***/ }),
  14879. /* 76 */
  14880. /***/ (function(module, exports, __webpack_require__) {
  14881. "use strict";
  14882. /**
  14883. * Copyright 2013-present, Facebook, Inc.
  14884. * All rights reserved.
  14885. *
  14886. * This source code is licensed under the BSD-style license found in the
  14887. * LICENSE file in the root directory of this source tree. An additional grant
  14888. * of patent rights can be found in the PATENTS file in the same directory.
  14889. *
  14890. */
  14891. /**
  14892. * CSS properties which accept numbers but are not in units of "px".
  14893. */
  14894. var isUnitlessNumber = {
  14895. animationIterationCount: true,
  14896. borderImageOutset: true,
  14897. borderImageSlice: true,
  14898. borderImageWidth: true,
  14899. boxFlex: true,
  14900. boxFlexGroup: true,
  14901. boxOrdinalGroup: true,
  14902. columnCount: true,
  14903. flex: true,
  14904. flexGrow: true,
  14905. flexPositive: true,
  14906. flexShrink: true,
  14907. flexNegative: true,
  14908. flexOrder: true,
  14909. gridRow: true,
  14910. gridColumn: true,
  14911. fontWeight: true,
  14912. lineClamp: true,
  14913. lineHeight: true,
  14914. opacity: true,
  14915. order: true,
  14916. orphans: true,
  14917. tabSize: true,
  14918. widows: true,
  14919. zIndex: true,
  14920. zoom: true,
  14921. // SVG-related properties
  14922. fillOpacity: true,
  14923. floodOpacity: true,
  14924. stopOpacity: true,
  14925. strokeDasharray: true,
  14926. strokeDashoffset: true,
  14927. strokeMiterlimit: true,
  14928. strokeOpacity: true,
  14929. strokeWidth: true
  14930. };
  14931. /**
  14932. * @param {string} prefix vendor-specific prefix, eg: Webkit
  14933. * @param {string} key style name, eg: transitionDuration
  14934. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  14935. * WebkitTransitionDuration
  14936. */
  14937. function prefixKey(prefix, key) {
  14938. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  14939. }
  14940. /**
  14941. * Support style names that may come passed in prefixed by adding permutations
  14942. * of vendor prefixes.
  14943. */
  14944. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  14945. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  14946. // infinite loop, because it iterates over the newly added props too.
  14947. Object.keys(isUnitlessNumber).forEach(function (prop) {
  14948. prefixes.forEach(function (prefix) {
  14949. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  14950. });
  14951. });
  14952. /**
  14953. * Most style properties can be unset by doing .style[prop] = '' but IE8
  14954. * doesn't like doing that with shorthand properties so for the properties that
  14955. * IE8 breaks on, which are listed here, we instead unset each of the
  14956. * individual properties. See http://bugs.jquery.com/ticket/12385.
  14957. * The 4-value 'clock' properties like margin, padding, border-width seem to
  14958. * behave without any problems. Curiously, list-style works too without any
  14959. * special prodding.
  14960. */
  14961. var shorthandPropertyExpansions = {
  14962. background: {
  14963. backgroundAttachment: true,
  14964. backgroundColor: true,
  14965. backgroundImage: true,
  14966. backgroundPositionX: true,
  14967. backgroundPositionY: true,
  14968. backgroundRepeat: true
  14969. },
  14970. backgroundPosition: {
  14971. backgroundPositionX: true,
  14972. backgroundPositionY: true
  14973. },
  14974. border: {
  14975. borderWidth: true,
  14976. borderStyle: true,
  14977. borderColor: true
  14978. },
  14979. borderBottom: {
  14980. borderBottomWidth: true,
  14981. borderBottomStyle: true,
  14982. borderBottomColor: true
  14983. },
  14984. borderLeft: {
  14985. borderLeftWidth: true,
  14986. borderLeftStyle: true,
  14987. borderLeftColor: true
  14988. },
  14989. borderRight: {
  14990. borderRightWidth: true,
  14991. borderRightStyle: true,
  14992. borderRightColor: true
  14993. },
  14994. borderTop: {
  14995. borderTopWidth: true,
  14996. borderTopStyle: true,
  14997. borderTopColor: true
  14998. },
  14999. font: {
  15000. fontStyle: true,
  15001. fontVariant: true,
  15002. fontWeight: true,
  15003. fontSize: true,
  15004. lineHeight: true,
  15005. fontFamily: true
  15006. },
  15007. outline: {
  15008. outlineWidth: true,
  15009. outlineStyle: true,
  15010. outlineColor: true
  15011. }
  15012. };
  15013. var CSSProperty = {
  15014. isUnitlessNumber: isUnitlessNumber,
  15015. shorthandPropertyExpansions: shorthandPropertyExpansions
  15016. };
  15017. module.exports = CSSProperty;
  15018. /***/ }),
  15019. /* 77 */
  15020. /***/ (function(module, exports, __webpack_require__) {
  15021. "use strict";
  15022. /**
  15023. * Copyright 2013-present, Facebook, Inc.
  15024. * All rights reserved.
  15025. *
  15026. * This source code is licensed under the BSD-style license found in the
  15027. * LICENSE file in the root directory of this source tree. An additional grant
  15028. * of patent rights can be found in the PATENTS file in the same directory.
  15029. *
  15030. *
  15031. */
  15032. var _prodInvariant = __webpack_require__(2);
  15033. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15034. var PooledClass = __webpack_require__(16);
  15035. var invariant = __webpack_require__(0);
  15036. /**
  15037. * A specialized pseudo-event module to help keep track of components waiting to
  15038. * be notified when their DOM representations are available for use.
  15039. *
  15040. * This implements `PooledClass`, so you should never need to instantiate this.
  15041. * Instead, use `CallbackQueue.getPooled()`.
  15042. *
  15043. * @class ReactMountReady
  15044. * @implements PooledClass
  15045. * @internal
  15046. */
  15047. var CallbackQueue = function () {
  15048. function CallbackQueue(arg) {
  15049. _classCallCheck(this, CallbackQueue);
  15050. this._callbacks = null;
  15051. this._contexts = null;
  15052. this._arg = arg;
  15053. }
  15054. /**
  15055. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  15056. *
  15057. * @param {function} callback Invoked when `notifyAll` is invoked.
  15058. * @param {?object} context Context to call `callback` with.
  15059. * @internal
  15060. */
  15061. CallbackQueue.prototype.enqueue = function enqueue(callback, context) {
  15062. this._callbacks = this._callbacks || [];
  15063. this._callbacks.push(callback);
  15064. this._contexts = this._contexts || [];
  15065. this._contexts.push(context);
  15066. };
  15067. /**
  15068. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  15069. * the DOM representation of a component has been created or updated.
  15070. *
  15071. * @internal
  15072. */
  15073. CallbackQueue.prototype.notifyAll = function notifyAll() {
  15074. var callbacks = this._callbacks;
  15075. var contexts = this._contexts;
  15076. var arg = this._arg;
  15077. if (callbacks && contexts) {
  15078. !(callbacks.length === contexts.length) ? false ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0;
  15079. this._callbacks = null;
  15080. this._contexts = null;
  15081. for (var i = 0; i < callbacks.length; i++) {
  15082. callbacks[i].call(contexts[i], arg);
  15083. }
  15084. callbacks.length = 0;
  15085. contexts.length = 0;
  15086. }
  15087. };
  15088. CallbackQueue.prototype.checkpoint = function checkpoint() {
  15089. return this._callbacks ? this._callbacks.length : 0;
  15090. };
  15091. CallbackQueue.prototype.rollback = function rollback(len) {
  15092. if (this._callbacks && this._contexts) {
  15093. this._callbacks.length = len;
  15094. this._contexts.length = len;
  15095. }
  15096. };
  15097. /**
  15098. * Resets the internal queue.
  15099. *
  15100. * @internal
  15101. */
  15102. CallbackQueue.prototype.reset = function reset() {
  15103. this._callbacks = null;
  15104. this._contexts = null;
  15105. };
  15106. /**
  15107. * `PooledClass` looks for this.
  15108. */
  15109. CallbackQueue.prototype.destructor = function destructor() {
  15110. this.reset();
  15111. };
  15112. return CallbackQueue;
  15113. }();
  15114. module.exports = PooledClass.addPoolingTo(CallbackQueue);
  15115. /***/ }),
  15116. /* 78 */
  15117. /***/ (function(module, exports, __webpack_require__) {
  15118. "use strict";
  15119. /**
  15120. * Copyright 2013-present, Facebook, Inc.
  15121. * All rights reserved.
  15122. *
  15123. * This source code is licensed under the BSD-style license found in the
  15124. * LICENSE file in the root directory of this source tree. An additional grant
  15125. * of patent rights can be found in the PATENTS file in the same directory.
  15126. *
  15127. */
  15128. var DOMProperty = __webpack_require__(19);
  15129. var ReactDOMComponentTree = __webpack_require__(5);
  15130. var ReactInstrumentation = __webpack_require__(11);
  15131. var quoteAttributeValueForBrowser = __webpack_require__(212);
  15132. var warning = __webpack_require__(1);
  15133. var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
  15134. var illegalAttributeNameCache = {};
  15135. var validatedAttributeNameCache = {};
  15136. function isAttributeNameSafe(attributeName) {
  15137. if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
  15138. return true;
  15139. }
  15140. if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
  15141. return false;
  15142. }
  15143. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  15144. validatedAttributeNameCache[attributeName] = true;
  15145. return true;
  15146. }
  15147. illegalAttributeNameCache[attributeName] = true;
  15148. false ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
  15149. return false;
  15150. }
  15151. function shouldIgnoreValue(propertyInfo, value) {
  15152. return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
  15153. }
  15154. /**
  15155. * Operations for dealing with DOM properties.
  15156. */
  15157. var DOMPropertyOperations = {
  15158. /**
  15159. * Creates markup for the ID property.
  15160. *
  15161. * @param {string} id Unescaped ID.
  15162. * @return {string} Markup string.
  15163. */
  15164. createMarkupForID: function (id) {
  15165. return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
  15166. },
  15167. setAttributeForID: function (node, id) {
  15168. node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
  15169. },
  15170. createMarkupForRoot: function () {
  15171. return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
  15172. },
  15173. setAttributeForRoot: function (node) {
  15174. node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
  15175. },
  15176. /**
  15177. * Creates markup for a property.
  15178. *
  15179. * @param {string} name
  15180. * @param {*} value
  15181. * @return {?string} Markup string, or null if the property was invalid.
  15182. */
  15183. createMarkupForProperty: function (name, value) {
  15184. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  15185. if (propertyInfo) {
  15186. if (shouldIgnoreValue(propertyInfo, value)) {
  15187. return '';
  15188. }
  15189. var attributeName = propertyInfo.attributeName;
  15190. if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  15191. return attributeName + '=""';
  15192. }
  15193. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  15194. } else if (DOMProperty.isCustomAttribute(name)) {
  15195. if (value == null) {
  15196. return '';
  15197. }
  15198. return name + '=' + quoteAttributeValueForBrowser(value);
  15199. }
  15200. return null;
  15201. },
  15202. /**
  15203. * Creates markup for a custom property.
  15204. *
  15205. * @param {string} name
  15206. * @param {*} value
  15207. * @return {string} Markup string, or empty string if the property was invalid.
  15208. */
  15209. createMarkupForCustomAttribute: function (name, value) {
  15210. if (!isAttributeNameSafe(name) || value == null) {
  15211. return '';
  15212. }
  15213. return name + '=' + quoteAttributeValueForBrowser(value);
  15214. },
  15215. /**
  15216. * Sets the value for a property on a node.
  15217. *
  15218. * @param {DOMElement} node
  15219. * @param {string} name
  15220. * @param {*} value
  15221. */
  15222. setValueForProperty: function (node, name, value) {
  15223. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  15224. if (propertyInfo) {
  15225. var mutationMethod = propertyInfo.mutationMethod;
  15226. if (mutationMethod) {
  15227. mutationMethod(node, value);
  15228. } else if (shouldIgnoreValue(propertyInfo, value)) {
  15229. this.deleteValueForProperty(node, name);
  15230. return;
  15231. } else if (propertyInfo.mustUseProperty) {
  15232. // Contrary to `setAttribute`, object properties are properly
  15233. // `toString`ed by IE8/9.
  15234. node[propertyInfo.propertyName] = value;
  15235. } else {
  15236. var attributeName = propertyInfo.attributeName;
  15237. var namespace = propertyInfo.attributeNamespace;
  15238. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  15239. // ('' + value) makes it output the correct toString()-value.
  15240. if (namespace) {
  15241. node.setAttributeNS(namespace, attributeName, '' + value);
  15242. } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  15243. node.setAttribute(attributeName, '');
  15244. } else {
  15245. node.setAttribute(attributeName, '' + value);
  15246. }
  15247. }
  15248. } else if (DOMProperty.isCustomAttribute(name)) {
  15249. DOMPropertyOperations.setValueForAttribute(node, name, value);
  15250. return;
  15251. }
  15252. if (false) {
  15253. var payload = {};
  15254. payload[name] = value;
  15255. ReactInstrumentation.debugTool.onHostOperation({
  15256. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  15257. type: 'update attribute',
  15258. payload: payload
  15259. });
  15260. }
  15261. },
  15262. setValueForAttribute: function (node, name, value) {
  15263. if (!isAttributeNameSafe(name)) {
  15264. return;
  15265. }
  15266. if (value == null) {
  15267. node.removeAttribute(name);
  15268. } else {
  15269. node.setAttribute(name, '' + value);
  15270. }
  15271. if (false) {
  15272. var payload = {};
  15273. payload[name] = value;
  15274. ReactInstrumentation.debugTool.onHostOperation({
  15275. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  15276. type: 'update attribute',
  15277. payload: payload
  15278. });
  15279. }
  15280. },
  15281. /**
  15282. * Deletes an attributes from a node.
  15283. *
  15284. * @param {DOMElement} node
  15285. * @param {string} name
  15286. */
  15287. deleteValueForAttribute: function (node, name) {
  15288. node.removeAttribute(name);
  15289. if (false) {
  15290. ReactInstrumentation.debugTool.onHostOperation({
  15291. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  15292. type: 'remove attribute',
  15293. payload: name
  15294. });
  15295. }
  15296. },
  15297. /**
  15298. * Deletes the value for a property on a node.
  15299. *
  15300. * @param {DOMElement} node
  15301. * @param {string} name
  15302. */
  15303. deleteValueForProperty: function (node, name) {
  15304. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  15305. if (propertyInfo) {
  15306. var mutationMethod = propertyInfo.mutationMethod;
  15307. if (mutationMethod) {
  15308. mutationMethod(node, undefined);
  15309. } else if (propertyInfo.mustUseProperty) {
  15310. var propName = propertyInfo.propertyName;
  15311. if (propertyInfo.hasBooleanValue) {
  15312. node[propName] = false;
  15313. } else {
  15314. node[propName] = '';
  15315. }
  15316. } else {
  15317. node.removeAttribute(propertyInfo.attributeName);
  15318. }
  15319. } else if (DOMProperty.isCustomAttribute(name)) {
  15320. node.removeAttribute(name);
  15321. }
  15322. if (false) {
  15323. ReactInstrumentation.debugTool.onHostOperation({
  15324. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  15325. type: 'remove attribute',
  15326. payload: name
  15327. });
  15328. }
  15329. }
  15330. };
  15331. module.exports = DOMPropertyOperations;
  15332. /***/ }),
  15333. /* 79 */
  15334. /***/ (function(module, exports, __webpack_require__) {
  15335. "use strict";
  15336. /**
  15337. * Copyright 2015-present, Facebook, Inc.
  15338. * All rights reserved.
  15339. *
  15340. * This source code is licensed under the BSD-style license found in the
  15341. * LICENSE file in the root directory of this source tree. An additional grant
  15342. * of patent rights can be found in the PATENTS file in the same directory.
  15343. *
  15344. */
  15345. var ReactDOMComponentFlags = {
  15346. hasCachedChildNodes: 1 << 0
  15347. };
  15348. module.exports = ReactDOMComponentFlags;
  15349. /***/ }),
  15350. /* 80 */
  15351. /***/ (function(module, exports, __webpack_require__) {
  15352. "use strict";
  15353. /**
  15354. * Copyright 2013-present, Facebook, Inc.
  15355. * All rights reserved.
  15356. *
  15357. * This source code is licensed under the BSD-style license found in the
  15358. * LICENSE file in the root directory of this source tree. An additional grant
  15359. * of patent rights can be found in the PATENTS file in the same directory.
  15360. *
  15361. */
  15362. var _assign = __webpack_require__(3);
  15363. var LinkedValueUtils = __webpack_require__(56);
  15364. var ReactDOMComponentTree = __webpack_require__(5);
  15365. var ReactUpdates = __webpack_require__(12);
  15366. var warning = __webpack_require__(1);
  15367. var didWarnValueLink = false;
  15368. var didWarnValueDefaultValue = false;
  15369. function updateOptionsIfPendingUpdateAndMounted() {
  15370. if (this._rootNodeID && this._wrapperState.pendingUpdate) {
  15371. this._wrapperState.pendingUpdate = false;
  15372. var props = this._currentElement.props;
  15373. var value = LinkedValueUtils.getValue(props);
  15374. if (value != null) {
  15375. updateOptions(this, Boolean(props.multiple), value);
  15376. }
  15377. }
  15378. }
  15379. function getDeclarationErrorAddendum(owner) {
  15380. if (owner) {
  15381. var name = owner.getName();
  15382. if (name) {
  15383. return ' Check the render method of `' + name + '`.';
  15384. }
  15385. }
  15386. return '';
  15387. }
  15388. var valuePropNames = ['value', 'defaultValue'];
  15389. /**
  15390. * Validation function for `value` and `defaultValue`.
  15391. * @private
  15392. */
  15393. function checkSelectPropTypes(inst, props) {
  15394. var owner = inst._currentElement._owner;
  15395. LinkedValueUtils.checkPropTypes('select', props, owner);
  15396. if (props.valueLink !== undefined && !didWarnValueLink) {
  15397. false ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
  15398. didWarnValueLink = true;
  15399. }
  15400. for (var i = 0; i < valuePropNames.length; i++) {
  15401. var propName = valuePropNames[i];
  15402. if (props[propName] == null) {
  15403. continue;
  15404. }
  15405. var isArray = Array.isArray(props[propName]);
  15406. if (props.multiple && !isArray) {
  15407. false ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  15408. } else if (!props.multiple && isArray) {
  15409. false ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  15410. }
  15411. }
  15412. }
  15413. /**
  15414. * @param {ReactDOMComponent} inst
  15415. * @param {boolean} multiple
  15416. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  15417. * @private
  15418. */
  15419. function updateOptions(inst, multiple, propValue) {
  15420. var selectedValue, i;
  15421. var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
  15422. if (multiple) {
  15423. selectedValue = {};
  15424. for (i = 0; i < propValue.length; i++) {
  15425. selectedValue['' + propValue[i]] = true;
  15426. }
  15427. for (i = 0; i < options.length; i++) {
  15428. var selected = selectedValue.hasOwnProperty(options[i].value);
  15429. if (options[i].selected !== selected) {
  15430. options[i].selected = selected;
  15431. }
  15432. }
  15433. } else {
  15434. // Do not set `select.value` as exact behavior isn't consistent across all
  15435. // browsers for all cases.
  15436. selectedValue = '' + propValue;
  15437. for (i = 0; i < options.length; i++) {
  15438. if (options[i].value === selectedValue) {
  15439. options[i].selected = true;
  15440. return;
  15441. }
  15442. }
  15443. if (options.length) {
  15444. options[0].selected = true;
  15445. }
  15446. }
  15447. }
  15448. /**
  15449. * Implements a <select> host component that allows optionally setting the
  15450. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  15451. * stringable. If `multiple` is true, the prop must be an array of stringables.
  15452. *
  15453. * If `value` is not supplied (or null/undefined), user actions that change the
  15454. * selected option will trigger updates to the rendered options.
  15455. *
  15456. * If it is supplied (and not null/undefined), the rendered options will not
  15457. * update in response to user actions. Instead, the `value` prop must change in
  15458. * order for the rendered options to update.
  15459. *
  15460. * If `defaultValue` is provided, any options with the supplied values will be
  15461. * selected.
  15462. */
  15463. var ReactDOMSelect = {
  15464. getHostProps: function (inst, props) {
  15465. return _assign({}, props, {
  15466. onChange: inst._wrapperState.onChange,
  15467. value: undefined
  15468. });
  15469. },
  15470. mountWrapper: function (inst, props) {
  15471. if (false) {
  15472. checkSelectPropTypes(inst, props);
  15473. }
  15474. var value = LinkedValueUtils.getValue(props);
  15475. inst._wrapperState = {
  15476. pendingUpdate: false,
  15477. initialValue: value != null ? value : props.defaultValue,
  15478. listeners: null,
  15479. onChange: _handleChange.bind(inst),
  15480. wasMultiple: Boolean(props.multiple)
  15481. };
  15482. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  15483. 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;
  15484. didWarnValueDefaultValue = true;
  15485. }
  15486. },
  15487. getSelectValueContext: function (inst) {
  15488. // ReactDOMOption looks at this initial value so the initial generated
  15489. // markup has correct `selected` attributes
  15490. return inst._wrapperState.initialValue;
  15491. },
  15492. postUpdateWrapper: function (inst) {
  15493. var props = inst._currentElement.props;
  15494. // After the initial mount, we control selected-ness manually so don't pass
  15495. // this value down
  15496. inst._wrapperState.initialValue = undefined;
  15497. var wasMultiple = inst._wrapperState.wasMultiple;
  15498. inst._wrapperState.wasMultiple = Boolean(props.multiple);
  15499. var value = LinkedValueUtils.getValue(props);
  15500. if (value != null) {
  15501. inst._wrapperState.pendingUpdate = false;
  15502. updateOptions(inst, Boolean(props.multiple), value);
  15503. } else if (wasMultiple !== Boolean(props.multiple)) {
  15504. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  15505. if (props.defaultValue != null) {
  15506. updateOptions(inst, Boolean(props.multiple), props.defaultValue);
  15507. } else {
  15508. // Revert the select back to its default unselected state.
  15509. updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
  15510. }
  15511. }
  15512. }
  15513. };
  15514. function _handleChange(event) {
  15515. var props = this._currentElement.props;
  15516. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  15517. if (this._rootNodeID) {
  15518. this._wrapperState.pendingUpdate = true;
  15519. }
  15520. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  15521. return returnValue;
  15522. }
  15523. module.exports = ReactDOMSelect;
  15524. /***/ }),
  15525. /* 81 */
  15526. /***/ (function(module, exports, __webpack_require__) {
  15527. "use strict";
  15528. /**
  15529. * Copyright 2014-present, Facebook, Inc.
  15530. * All rights reserved.
  15531. *
  15532. * This source code is licensed under the BSD-style license found in the
  15533. * LICENSE file in the root directory of this source tree. An additional grant
  15534. * of patent rights can be found in the PATENTS file in the same directory.
  15535. *
  15536. */
  15537. var emptyComponentFactory;
  15538. var ReactEmptyComponentInjection = {
  15539. injectEmptyComponentFactory: function (factory) {
  15540. emptyComponentFactory = factory;
  15541. }
  15542. };
  15543. var ReactEmptyComponent = {
  15544. create: function (instantiate) {
  15545. return emptyComponentFactory(instantiate);
  15546. }
  15547. };
  15548. ReactEmptyComponent.injection = ReactEmptyComponentInjection;
  15549. module.exports = ReactEmptyComponent;
  15550. /***/ }),
  15551. /* 82 */
  15552. /***/ (function(module, exports, __webpack_require__) {
  15553. "use strict";
  15554. /**
  15555. * Copyright 2013-present, Facebook, Inc.
  15556. * All rights reserved.
  15557. *
  15558. * This source code is licensed under the BSD-style license found in the
  15559. * LICENSE file in the root directory of this source tree. An additional grant
  15560. * of patent rights can be found in the PATENTS file in the same directory.
  15561. *
  15562. *
  15563. */
  15564. var ReactFeatureFlags = {
  15565. // When true, call console.time() before and .timeEnd() after each top-level
  15566. // render (both initial renders and updates). Useful when looking at prod-mode
  15567. // timeline profiles in Chrome, for example.
  15568. logTopLevelRenders: false
  15569. };
  15570. module.exports = ReactFeatureFlags;
  15571. /***/ }),
  15572. /* 83 */
  15573. /***/ (function(module, exports, __webpack_require__) {
  15574. "use strict";
  15575. /**
  15576. * Copyright 2014-present, Facebook, Inc.
  15577. * All rights reserved.
  15578. *
  15579. * This source code is licensed under the BSD-style license found in the
  15580. * LICENSE file in the root directory of this source tree. An additional grant
  15581. * of patent rights can be found in the PATENTS file in the same directory.
  15582. *
  15583. */
  15584. var _prodInvariant = __webpack_require__(2);
  15585. var invariant = __webpack_require__(0);
  15586. var genericComponentClass = null;
  15587. var textComponentClass = null;
  15588. var ReactHostComponentInjection = {
  15589. // This accepts a class that receives the tag string. This is a catch all
  15590. // that can render any kind of tag.
  15591. injectGenericComponentClass: function (componentClass) {
  15592. genericComponentClass = componentClass;
  15593. },
  15594. // This accepts a text component class that takes the text string to be
  15595. // rendered as props.
  15596. injectTextComponentClass: function (componentClass) {
  15597. textComponentClass = componentClass;
  15598. }
  15599. };
  15600. /**
  15601. * Get a host internal component class for a specific tag.
  15602. *
  15603. * @param {ReactElement} element The element to create.
  15604. * @return {function} The internal class constructor function.
  15605. */
  15606. function createInternalComponent(element) {
  15607. !genericComponentClass ? false ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
  15608. return new genericComponentClass(element);
  15609. }
  15610. /**
  15611. * @param {ReactText} text
  15612. * @return {ReactComponent}
  15613. */
  15614. function createInstanceForText(text) {
  15615. return new textComponentClass(text);
  15616. }
  15617. /**
  15618. * @param {ReactComponent} component
  15619. * @return {boolean}
  15620. */
  15621. function isTextComponent(component) {
  15622. return component instanceof textComponentClass;
  15623. }
  15624. var ReactHostComponent = {
  15625. createInternalComponent: createInternalComponent,
  15626. createInstanceForText: createInstanceForText,
  15627. isTextComponent: isTextComponent,
  15628. injection: ReactHostComponentInjection
  15629. };
  15630. module.exports = ReactHostComponent;
  15631. /***/ }),
  15632. /* 84 */
  15633. /***/ (function(module, exports, __webpack_require__) {
  15634. "use strict";
  15635. /**
  15636. * Copyright 2013-present, Facebook, Inc.
  15637. * All rights reserved.
  15638. *
  15639. * This source code is licensed under the BSD-style license found in the
  15640. * LICENSE file in the root directory of this source tree. An additional grant
  15641. * of patent rights can be found in the PATENTS file in the same directory.
  15642. *
  15643. */
  15644. var ReactDOMSelection = __webpack_require__(172);
  15645. var containsNode = __webpack_require__(138);
  15646. var focusNode = __webpack_require__(72);
  15647. var getActiveElement = __webpack_require__(73);
  15648. function isInDocument(node) {
  15649. return containsNode(document.documentElement, node);
  15650. }
  15651. /**
  15652. * @ReactInputSelection: React input selection module. Based on Selection.js,
  15653. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  15654. * assume buttons have range selections allowed).
  15655. * Input selection module for React.
  15656. */
  15657. var ReactInputSelection = {
  15658. hasSelectionCapabilities: function (elem) {
  15659. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  15660. return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
  15661. },
  15662. getSelectionInformation: function () {
  15663. var focusedElem = getActiveElement();
  15664. return {
  15665. focusedElem: focusedElem,
  15666. selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
  15667. };
  15668. },
  15669. /**
  15670. * @restoreSelection: If any selection information was potentially lost,
  15671. * restore it. This is useful when performing operations that could remove dom
  15672. * nodes and place them back in, resulting in focus being lost.
  15673. */
  15674. restoreSelection: function (priorSelectionInformation) {
  15675. var curFocusedElem = getActiveElement();
  15676. var priorFocusedElem = priorSelectionInformation.focusedElem;
  15677. var priorSelectionRange = priorSelectionInformation.selectionRange;
  15678. if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  15679. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  15680. ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
  15681. }
  15682. focusNode(priorFocusedElem);
  15683. }
  15684. },
  15685. /**
  15686. * @getSelection: Gets the selection bounds of a focused textarea, input or
  15687. * contentEditable node.
  15688. * -@input: Look up selection bounds of this input
  15689. * -@return {start: selectionStart, end: selectionEnd}
  15690. */
  15691. getSelection: function (input) {
  15692. var selection;
  15693. if ('selectionStart' in input) {
  15694. // Modern browser with input or textarea.
  15695. selection = {
  15696. start: input.selectionStart,
  15697. end: input.selectionEnd
  15698. };
  15699. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  15700. // IE8 input.
  15701. var range = document.selection.createRange();
  15702. // There can only be one selection per document in IE, so it must
  15703. // be in our element.
  15704. if (range.parentElement() === input) {
  15705. selection = {
  15706. start: -range.moveStart('character', -input.value.length),
  15707. end: -range.moveEnd('character', -input.value.length)
  15708. };
  15709. }
  15710. } else {
  15711. // Content editable or old IE textarea.
  15712. selection = ReactDOMSelection.getOffsets(input);
  15713. }
  15714. return selection || { start: 0, end: 0 };
  15715. },
  15716. /**
  15717. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  15718. * the input.
  15719. * -@input Set selection bounds of this input or textarea
  15720. * -@offsets Object of same form that is returned from get*
  15721. */
  15722. setSelection: function (input, offsets) {
  15723. var start = offsets.start;
  15724. var end = offsets.end;
  15725. if (end === undefined) {
  15726. end = start;
  15727. }
  15728. if ('selectionStart' in input) {
  15729. input.selectionStart = start;
  15730. input.selectionEnd = Math.min(end, input.value.length);
  15731. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  15732. var range = input.createTextRange();
  15733. range.collapse(true);
  15734. range.moveStart('character', start);
  15735. range.moveEnd('character', end - start);
  15736. range.select();
  15737. } else {
  15738. ReactDOMSelection.setOffsets(input, offsets);
  15739. }
  15740. }
  15741. };
  15742. module.exports = ReactInputSelection;
  15743. /***/ }),
  15744. /* 85 */
  15745. /***/ (function(module, exports, __webpack_require__) {
  15746. "use strict";
  15747. /**
  15748. * Copyright 2013-present, Facebook, Inc.
  15749. * All rights reserved.
  15750. *
  15751. * This source code is licensed under the BSD-style license found in the
  15752. * LICENSE file in the root directory of this source tree. An additional grant
  15753. * of patent rights can be found in the PATENTS file in the same directory.
  15754. *
  15755. */
  15756. var _prodInvariant = __webpack_require__(2);
  15757. var DOMLazyTree = __webpack_require__(18);
  15758. var DOMProperty = __webpack_require__(19);
  15759. var React = __webpack_require__(21);
  15760. var ReactBrowserEventEmitter = __webpack_require__(31);
  15761. var ReactCurrentOwner = __webpack_require__(14);
  15762. var ReactDOMComponentTree = __webpack_require__(5);
  15763. var ReactDOMContainerInfo = __webpack_require__(166);
  15764. var ReactDOMFeatureFlags = __webpack_require__(168);
  15765. var ReactFeatureFlags = __webpack_require__(82);
  15766. var ReactInstanceMap = __webpack_require__(28);
  15767. var ReactInstrumentation = __webpack_require__(11);
  15768. var ReactMarkupChecksum = __webpack_require__(182);
  15769. var ReactReconciler = __webpack_require__(20);
  15770. var ReactUpdateQueue = __webpack_require__(59);
  15771. var ReactUpdates = __webpack_require__(12);
  15772. var emptyObject = __webpack_require__(25);
  15773. var instantiateReactComponent = __webpack_require__(92);
  15774. var invariant = __webpack_require__(0);
  15775. var setInnerHTML = __webpack_require__(35);
  15776. var shouldUpdateReactComponent = __webpack_require__(65);
  15777. var warning = __webpack_require__(1);
  15778. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  15779. var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
  15780. var ELEMENT_NODE_TYPE = 1;
  15781. var DOC_NODE_TYPE = 9;
  15782. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  15783. var instancesByReactRootID = {};
  15784. /**
  15785. * Finds the index of the first character
  15786. * that's not common between the two given strings.
  15787. *
  15788. * @return {number} the index of the character where the strings diverge
  15789. */
  15790. function firstDifferenceIndex(string1, string2) {
  15791. var minLen = Math.min(string1.length, string2.length);
  15792. for (var i = 0; i < minLen; i++) {
  15793. if (string1.charAt(i) !== string2.charAt(i)) {
  15794. return i;
  15795. }
  15796. }
  15797. return string1.length === string2.length ? -1 : minLen;
  15798. }
  15799. /**
  15800. * @param {DOMElement|DOMDocument} container DOM element that may contain
  15801. * a React component
  15802. * @return {?*} DOM element that may have the reactRoot ID, or null.
  15803. */
  15804. function getReactRootElementInContainer(container) {
  15805. if (!container) {
  15806. return null;
  15807. }
  15808. if (container.nodeType === DOC_NODE_TYPE) {
  15809. return container.documentElement;
  15810. } else {
  15811. return container.firstChild;
  15812. }
  15813. }
  15814. function internalGetID(node) {
  15815. // If node is something like a window, document, or text node, none of
  15816. // which support attributes or a .getAttribute method, gracefully return
  15817. // the empty string, as if the attribute were missing.
  15818. return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  15819. }
  15820. /**
  15821. * Mounts this component and inserts it into the DOM.
  15822. *
  15823. * @param {ReactComponent} componentInstance The instance to mount.
  15824. * @param {DOMElement} container DOM element to mount into.
  15825. * @param {ReactReconcileTransaction} transaction
  15826. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  15827. */
  15828. function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
  15829. var markerName;
  15830. if (ReactFeatureFlags.logTopLevelRenders) {
  15831. var wrappedElement = wrapperInstance._currentElement.props.child;
  15832. var type = wrappedElement.type;
  15833. markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
  15834. console.time(markerName);
  15835. }
  15836. var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
  15837. );
  15838. if (markerName) {
  15839. console.timeEnd(markerName);
  15840. }
  15841. wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
  15842. ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
  15843. }
  15844. /**
  15845. * Batched mount.
  15846. *
  15847. * @param {ReactComponent} componentInstance The instance to mount.
  15848. * @param {DOMElement} container DOM element to mount into.
  15849. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  15850. */
  15851. function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
  15852. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  15853. /* useCreateElement */
  15854. !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
  15855. transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
  15856. ReactUpdates.ReactReconcileTransaction.release(transaction);
  15857. }
  15858. /**
  15859. * Unmounts a component and removes it from the DOM.
  15860. *
  15861. * @param {ReactComponent} instance React component instance.
  15862. * @param {DOMElement} container DOM element to unmount from.
  15863. * @final
  15864. * @internal
  15865. * @see {ReactMount.unmountComponentAtNode}
  15866. */
  15867. function unmountComponentFromNode(instance, container, safely) {
  15868. if (false) {
  15869. ReactInstrumentation.debugTool.onBeginFlush();
  15870. }
  15871. ReactReconciler.unmountComponent(instance, safely);
  15872. if (false) {
  15873. ReactInstrumentation.debugTool.onEndFlush();
  15874. }
  15875. if (container.nodeType === DOC_NODE_TYPE) {
  15876. container = container.documentElement;
  15877. }
  15878. // http://jsperf.com/emptying-a-node
  15879. while (container.lastChild) {
  15880. container.removeChild(container.lastChild);
  15881. }
  15882. }
  15883. /**
  15884. * True if the supplied DOM node has a direct React-rendered child that is
  15885. * not a React root element. Useful for warning in `render`,
  15886. * `unmountComponentAtNode`, etc.
  15887. *
  15888. * @param {?DOMElement} node The candidate DOM node.
  15889. * @return {boolean} True if the DOM element contains a direct child that was
  15890. * rendered by React but is not a root element.
  15891. * @internal
  15892. */
  15893. function hasNonRootReactChild(container) {
  15894. var rootEl = getReactRootElementInContainer(container);
  15895. if (rootEl) {
  15896. var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
  15897. return !!(inst && inst._hostParent);
  15898. }
  15899. }
  15900. /**
  15901. * True if the supplied DOM node is a React DOM element and
  15902. * it has been rendered by another copy of React.
  15903. *
  15904. * @param {?DOMElement} node The candidate DOM node.
  15905. * @return {boolean} True if the DOM has been rendered by another copy of React
  15906. * @internal
  15907. */
  15908. function nodeIsRenderedByOtherInstance(container) {
  15909. var rootEl = getReactRootElementInContainer(container);
  15910. return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
  15911. }
  15912. /**
  15913. * True if the supplied DOM node is a valid node element.
  15914. *
  15915. * @param {?DOMElement} node The candidate DOM node.
  15916. * @return {boolean} True if the DOM is a valid DOM node.
  15917. * @internal
  15918. */
  15919. function isValidContainer(node) {
  15920. return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
  15921. }
  15922. /**
  15923. * True if the supplied DOM node is a valid React node element.
  15924. *
  15925. * @param {?DOMElement} node The candidate DOM node.
  15926. * @return {boolean} True if the DOM is a valid React DOM node.
  15927. * @internal
  15928. */
  15929. function isReactNode(node) {
  15930. return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
  15931. }
  15932. function getHostRootInstanceInContainer(container) {
  15933. var rootEl = getReactRootElementInContainer(container);
  15934. var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
  15935. return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
  15936. }
  15937. function getTopLevelWrapperInContainer(container) {
  15938. var root = getHostRootInstanceInContainer(container);
  15939. return root ? root._hostContainerInfo._topLevelWrapper : null;
  15940. }
  15941. /**
  15942. * Temporary (?) hack so that we can store all top-level pending updates on
  15943. * composites instead of having to worry about different types of components
  15944. * here.
  15945. */
  15946. var topLevelRootCounter = 1;
  15947. var TopLevelWrapper = function () {
  15948. this.rootID = topLevelRootCounter++;
  15949. };
  15950. TopLevelWrapper.prototype.isReactComponent = {};
  15951. if (false) {
  15952. TopLevelWrapper.displayName = 'TopLevelWrapper';
  15953. }
  15954. TopLevelWrapper.prototype.render = function () {
  15955. return this.props.child;
  15956. };
  15957. TopLevelWrapper.isReactTopLevelWrapper = true;
  15958. /**
  15959. * Mounting is the process of initializing a React component by creating its
  15960. * representative DOM elements and inserting them into a supplied `container`.
  15961. * Any prior content inside `container` is destroyed in the process.
  15962. *
  15963. * ReactMount.render(
  15964. * component,
  15965. * document.getElementById('container')
  15966. * );
  15967. *
  15968. * <div id="container"> <-- Supplied `container`.
  15969. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  15970. * // ... component.
  15971. * </div>
  15972. * </div>
  15973. *
  15974. * Inside of `container`, the first element rendered is the "reactRoot".
  15975. */
  15976. var ReactMount = {
  15977. TopLevelWrapper: TopLevelWrapper,
  15978. /**
  15979. * Used by devtools. The keys are not important.
  15980. */
  15981. _instancesByReactRootID: instancesByReactRootID,
  15982. /**
  15983. * This is a hook provided to support rendering React components while
  15984. * ensuring that the apparent scroll position of its `container` does not
  15985. * change.
  15986. *
  15987. * @param {DOMElement} container The `container` being rendered into.
  15988. * @param {function} renderCallback This must be called once to do the render.
  15989. */
  15990. scrollMonitor: function (container, renderCallback) {
  15991. renderCallback();
  15992. },
  15993. /**
  15994. * Take a component that's already mounted into the DOM and replace its props
  15995. * @param {ReactComponent} prevComponent component instance already in the DOM
  15996. * @param {ReactElement} nextElement component instance to render
  15997. * @param {DOMElement} container container to render into
  15998. * @param {?function} callback function triggered on completion
  15999. */
  16000. _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) {
  16001. ReactMount.scrollMonitor(container, function () {
  16002. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
  16003. if (callback) {
  16004. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  16005. }
  16006. });
  16007. return prevComponent;
  16008. },
  16009. /**
  16010. * Render a new component into the DOM. Hooked by hooks!
  16011. *
  16012. * @param {ReactElement} nextElement element to render
  16013. * @param {DOMElement} container container to render into
  16014. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  16015. * @return {ReactComponent} nextComponent
  16016. */
  16017. _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
  16018. // Various parts of our code (such as ReactCompositeComponent's
  16019. // _renderValidatedComponent) assume that calls to render aren't nested;
  16020. // verify that that's the case.
  16021. 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;
  16022. !isValidContainer(container) ? false ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;
  16023. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  16024. var componentInstance = instantiateReactComponent(nextElement, false);
  16025. // The initial render is synchronous but any updates that happen during
  16026. // rendering, in componentWillMount or componentDidMount, will be batched
  16027. // according to the current batching strategy.
  16028. ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
  16029. var wrapperID = componentInstance._instance.rootID;
  16030. instancesByReactRootID[wrapperID] = componentInstance;
  16031. return componentInstance;
  16032. },
  16033. /**
  16034. * Renders a React component into the DOM in the supplied `container`.
  16035. *
  16036. * If the React component was previously rendered into `container`, this will
  16037. * perform an update on it and only mutate the DOM as necessary to reflect the
  16038. * latest React component.
  16039. *
  16040. * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
  16041. * @param {ReactElement} nextElement Component element to render.
  16042. * @param {DOMElement} container DOM element to render into.
  16043. * @param {?function} callback function triggered on completion
  16044. * @return {ReactComponent} Component instance rendered in `container`.
  16045. */
  16046. renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  16047. !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? false ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
  16048. return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
  16049. },
  16050. _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  16051. ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
  16052. !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 />.' :
  16053. // Check if it quacks like an element
  16054. 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;
  16055. 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;
  16056. var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement });
  16057. var nextContext;
  16058. if (parentComponent) {
  16059. var parentInst = ReactInstanceMap.get(parentComponent);
  16060. nextContext = parentInst._processChildContext(parentInst._context);
  16061. } else {
  16062. nextContext = emptyObject;
  16063. }
  16064. var prevComponent = getTopLevelWrapperInContainer(container);
  16065. if (prevComponent) {
  16066. var prevWrappedElement = prevComponent._currentElement;
  16067. var prevElement = prevWrappedElement.props.child;
  16068. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  16069. var publicInst = prevComponent._renderedComponent.getPublicInstance();
  16070. var updatedCallback = callback && function () {
  16071. callback.call(publicInst);
  16072. };
  16073. ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);
  16074. return publicInst;
  16075. } else {
  16076. ReactMount.unmountComponentAtNode(container);
  16077. }
  16078. }
  16079. var reactRootElement = getReactRootElementInContainer(container);
  16080. var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
  16081. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  16082. if (false) {
  16083. 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;
  16084. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  16085. var rootElementSibling = reactRootElement;
  16086. while (rootElementSibling) {
  16087. if (internalGetID(rootElementSibling)) {
  16088. 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;
  16089. break;
  16090. }
  16091. rootElementSibling = rootElementSibling.nextSibling;
  16092. }
  16093. }
  16094. }
  16095. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
  16096. var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();
  16097. if (callback) {
  16098. callback.call(component);
  16099. }
  16100. return component;
  16101. },
  16102. /**
  16103. * Renders a React component into the DOM in the supplied `container`.
  16104. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
  16105. *
  16106. * If the React component was previously rendered into `container`, this will
  16107. * perform an update on it and only mutate the DOM as necessary to reflect the
  16108. * latest React component.
  16109. *
  16110. * @param {ReactElement} nextElement Component element to render.
  16111. * @param {DOMElement} container DOM element to render into.
  16112. * @param {?function} callback function triggered on completion
  16113. * @return {ReactComponent} Component instance rendered in `container`.
  16114. */
  16115. render: function (nextElement, container, callback) {
  16116. return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
  16117. },
  16118. /**
  16119. * Unmounts and destroys the React component rendered in the `container`.
  16120. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
  16121. *
  16122. * @param {DOMElement} container DOM element containing a React component.
  16123. * @return {boolean} True if a component was found in and unmounted from
  16124. * `container`
  16125. */
  16126. unmountComponentAtNode: function (container) {
  16127. // Various parts of our code (such as ReactCompositeComponent's
  16128. // _renderValidatedComponent) assume that calls to render aren't nested;
  16129. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  16130. // render but we still don't expect to be in a render call here.)
  16131. 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;
  16132. !isValidContainer(container) ? false ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
  16133. if (false) {
  16134. 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;
  16135. }
  16136. var prevComponent = getTopLevelWrapperInContainer(container);
  16137. if (!prevComponent) {
  16138. // Check if the node being unmounted was rendered by React, but isn't a
  16139. // root node.
  16140. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  16141. // Check if the container itself is a React root node.
  16142. var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
  16143. if (false) {
  16144. 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;
  16145. }
  16146. return false;
  16147. }
  16148. delete instancesByReactRootID[prevComponent._instance.rootID];
  16149. ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
  16150. return true;
  16151. },
  16152. _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
  16153. !isValidContainer(container) ? false ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;
  16154. if (shouldReuseMarkup) {
  16155. var rootElement = getReactRootElementInContainer(container);
  16156. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  16157. ReactDOMComponentTree.precacheNode(instance, rootElement);
  16158. return;
  16159. } else {
  16160. var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  16161. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  16162. var rootMarkup = rootElement.outerHTML;
  16163. rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
  16164. var normalizedMarkup = markup;
  16165. if (false) {
  16166. // because rootMarkup is retrieved from the DOM, various normalizations
  16167. // will have occurred which will not be present in `markup`. Here,
  16168. // insert markup into a <div> or <iframe> depending on the container
  16169. // type to perform the same normalizations before comparing.
  16170. var normalizer;
  16171. if (container.nodeType === ELEMENT_NODE_TYPE) {
  16172. normalizer = document.createElement('div');
  16173. normalizer.innerHTML = markup;
  16174. normalizedMarkup = normalizer.innerHTML;
  16175. } else {
  16176. normalizer = document.createElement('iframe');
  16177. document.body.appendChild(normalizer);
  16178. normalizer.contentDocument.write(markup);
  16179. normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
  16180. document.body.removeChild(normalizer);
  16181. }
  16182. }
  16183. var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
  16184. var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  16185. !(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;
  16186. if (false) {
  16187. 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;
  16188. }
  16189. }
  16190. }
  16191. !(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;
  16192. if (transaction.useCreateElement) {
  16193. while (container.lastChild) {
  16194. container.removeChild(container.lastChild);
  16195. }
  16196. DOMLazyTree.insertTreeBefore(container, markup, null);
  16197. } else {
  16198. setInnerHTML(container, markup);
  16199. ReactDOMComponentTree.precacheNode(instance, container.firstChild);
  16200. }
  16201. if (false) {
  16202. var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
  16203. if (hostNode._debugID !== 0) {
  16204. ReactInstrumentation.debugTool.onHostOperation({
  16205. instanceID: hostNode._debugID,
  16206. type: 'mount',
  16207. payload: markup.toString()
  16208. });
  16209. }
  16210. }
  16211. }
  16212. };
  16213. module.exports = ReactMount;
  16214. /***/ }),
  16215. /* 86 */
  16216. /***/ (function(module, exports, __webpack_require__) {
  16217. "use strict";
  16218. /**
  16219. * Copyright 2013-present, Facebook, Inc.
  16220. * All rights reserved.
  16221. *
  16222. * This source code is licensed under the BSD-style license found in the
  16223. * LICENSE file in the root directory of this source tree. An additional grant
  16224. * of patent rights can be found in the PATENTS file in the same directory.
  16225. *
  16226. *
  16227. */
  16228. var _prodInvariant = __webpack_require__(2);
  16229. var React = __webpack_require__(21);
  16230. var invariant = __webpack_require__(0);
  16231. var ReactNodeTypes = {
  16232. HOST: 0,
  16233. COMPOSITE: 1,
  16234. EMPTY: 2,
  16235. getType: function (node) {
  16236. if (node === null || node === false) {
  16237. return ReactNodeTypes.EMPTY;
  16238. } else if (React.isValidElement(node)) {
  16239. if (typeof node.type === 'function') {
  16240. return ReactNodeTypes.COMPOSITE;
  16241. } else {
  16242. return ReactNodeTypes.HOST;
  16243. }
  16244. }
  16245. true ? false ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
  16246. }
  16247. };
  16248. module.exports = ReactNodeTypes;
  16249. /***/ }),
  16250. /* 87 */
  16251. /***/ (function(module, exports, __webpack_require__) {
  16252. "use strict";
  16253. /**
  16254. * Copyright 2013-present, Facebook, Inc.
  16255. * All rights reserved.
  16256. *
  16257. * This source code is licensed under the BSD-style license found in the
  16258. * LICENSE file in the root directory of this source tree. An additional grant
  16259. * of patent rights can be found in the PATENTS file in the same directory.
  16260. *
  16261. */
  16262. var ViewportMetrics = {
  16263. currentScrollLeft: 0,
  16264. currentScrollTop: 0,
  16265. refreshScrollValues: function (scrollPosition) {
  16266. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  16267. ViewportMetrics.currentScrollTop = scrollPosition.y;
  16268. }
  16269. };
  16270. module.exports = ViewportMetrics;
  16271. /***/ }),
  16272. /* 88 */
  16273. /***/ (function(module, exports, __webpack_require__) {
  16274. "use strict";
  16275. /**
  16276. * Copyright 2014-present, Facebook, Inc.
  16277. * All rights reserved.
  16278. *
  16279. * This source code is licensed under the BSD-style license found in the
  16280. * LICENSE file in the root directory of this source tree. An additional grant
  16281. * of patent rights can be found in the PATENTS file in the same directory.
  16282. *
  16283. *
  16284. */
  16285. var _prodInvariant = __webpack_require__(2);
  16286. var invariant = __webpack_require__(0);
  16287. /**
  16288. * Accumulates items that must not be null or undefined into the first one. This
  16289. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  16290. * API cleanness. Since `current` can be null before being passed in and not
  16291. * null after this function, make sure to assign it back to `current`:
  16292. *
  16293. * `a = accumulateInto(a, b);`
  16294. *
  16295. * This API should be sparingly used. Try `accumulate` for something cleaner.
  16296. *
  16297. * @return {*|array<*>} An accumulation of items.
  16298. */
  16299. function accumulateInto(current, next) {
  16300. !(next != null) ? false ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
  16301. if (current == null) {
  16302. return next;
  16303. }
  16304. // Both are not empty. Warning: Never call x.concat(y) when you are not
  16305. // certain that x is an Array (x could be a string with concat method).
  16306. if (Array.isArray(current)) {
  16307. if (Array.isArray(next)) {
  16308. current.push.apply(current, next);
  16309. return current;
  16310. }
  16311. current.push(next);
  16312. return current;
  16313. }
  16314. if (Array.isArray(next)) {
  16315. // A bit too dangerous to mutate `next`.
  16316. return [current].concat(next);
  16317. }
  16318. return [current, next];
  16319. }
  16320. module.exports = accumulateInto;
  16321. /***/ }),
  16322. /* 89 */
  16323. /***/ (function(module, exports, __webpack_require__) {
  16324. "use strict";
  16325. /**
  16326. * Copyright 2013-present, Facebook, Inc.
  16327. * All rights reserved.
  16328. *
  16329. * This source code is licensed under the BSD-style license found in the
  16330. * LICENSE file in the root directory of this source tree. An additional grant
  16331. * of patent rights can be found in the PATENTS file in the same directory.
  16332. *
  16333. *
  16334. */
  16335. /**
  16336. * @param {array} arr an "accumulation" of items which is either an Array or
  16337. * a single item. Useful when paired with the `accumulate` module. This is a
  16338. * simple utility that allows us to reason about a collection of items, but
  16339. * handling the case when there is exactly one item (and we do not need to
  16340. * allocate an array).
  16341. */
  16342. function forEachAccumulated(arr, cb, scope) {
  16343. if (Array.isArray(arr)) {
  16344. arr.forEach(cb, scope);
  16345. } else if (arr) {
  16346. cb.call(scope, arr);
  16347. }
  16348. }
  16349. module.exports = forEachAccumulated;
  16350. /***/ }),
  16351. /* 90 */
  16352. /***/ (function(module, exports, __webpack_require__) {
  16353. "use strict";
  16354. /**
  16355. * Copyright 2013-present, Facebook, Inc.
  16356. * All rights reserved.
  16357. *
  16358. * This source code is licensed under the BSD-style license found in the
  16359. * LICENSE file in the root directory of this source tree. An additional grant
  16360. * of patent rights can be found in the PATENTS file in the same directory.
  16361. *
  16362. */
  16363. var ReactNodeTypes = __webpack_require__(86);
  16364. function getHostComponentFromComposite(inst) {
  16365. var type;
  16366. while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
  16367. inst = inst._renderedComponent;
  16368. }
  16369. if (type === ReactNodeTypes.HOST) {
  16370. return inst._renderedComponent;
  16371. } else if (type === ReactNodeTypes.EMPTY) {
  16372. return null;
  16373. }
  16374. }
  16375. module.exports = getHostComponentFromComposite;
  16376. /***/ }),
  16377. /* 91 */
  16378. /***/ (function(module, exports, __webpack_require__) {
  16379. "use strict";
  16380. /**
  16381. * Copyright 2013-present, Facebook, Inc.
  16382. * All rights reserved.
  16383. *
  16384. * This source code is licensed under the BSD-style license found in the
  16385. * LICENSE file in the root directory of this source tree. An additional grant
  16386. * of patent rights can be found in the PATENTS file in the same directory.
  16387. *
  16388. */
  16389. var ExecutionEnvironment = __webpack_require__(8);
  16390. var contentKey = null;
  16391. /**
  16392. * Gets the key used to access text content on a DOM node.
  16393. *
  16394. * @return {?string} Key used to access text content.
  16395. * @internal
  16396. */
  16397. function getTextContentAccessor() {
  16398. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  16399. // Prefer textContent to innerText because many browsers support both but
  16400. // SVG <text> elements don't support innerText even when <div> does.
  16401. contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
  16402. }
  16403. return contentKey;
  16404. }
  16405. module.exports = getTextContentAccessor;
  16406. /***/ }),
  16407. /* 92 */
  16408. /***/ (function(module, exports, __webpack_require__) {
  16409. "use strict";
  16410. /**
  16411. * Copyright 2013-present, Facebook, Inc.
  16412. * All rights reserved.
  16413. *
  16414. * This source code is licensed under the BSD-style license found in the
  16415. * LICENSE file in the root directory of this source tree. An additional grant
  16416. * of patent rights can be found in the PATENTS file in the same directory.
  16417. *
  16418. */
  16419. var _prodInvariant = __webpack_require__(2),
  16420. _assign = __webpack_require__(3);
  16421. var ReactCompositeComponent = __webpack_require__(163);
  16422. var ReactEmptyComponent = __webpack_require__(81);
  16423. var ReactHostComponent = __webpack_require__(83);
  16424. var getNextDebugID = __webpack_require__(224);
  16425. var invariant = __webpack_require__(0);
  16426. var warning = __webpack_require__(1);
  16427. // To avoid a cyclic dependency, we create the final class in this module
  16428. var ReactCompositeComponentWrapper = function (element) {
  16429. this.construct(element);
  16430. };
  16431. function getDeclarationErrorAddendum(owner) {
  16432. if (owner) {
  16433. var name = owner.getName();
  16434. if (name) {
  16435. return ' Check the render method of `' + name + '`.';
  16436. }
  16437. }
  16438. return '';
  16439. }
  16440. /**
  16441. * Check if the type reference is a known internal type. I.e. not a user
  16442. * provided composite type.
  16443. *
  16444. * @param {function} type
  16445. * @return {boolean} Returns true if this is a valid internal type.
  16446. */
  16447. function isInternalComponentType(type) {
  16448. return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
  16449. }
  16450. /**
  16451. * Given a ReactNode, create an instance that will actually be mounted.
  16452. *
  16453. * @param {ReactNode} node
  16454. * @param {boolean} shouldHaveDebugID
  16455. * @return {object} A new instance of the element's constructor.
  16456. * @protected
  16457. */
  16458. function instantiateReactComponent(node, shouldHaveDebugID) {
  16459. var instance;
  16460. if (node === null || node === false) {
  16461. instance = ReactEmptyComponent.create(instantiateReactComponent);
  16462. } else if (typeof node === 'object') {
  16463. var element = node;
  16464. var type = element.type;
  16465. if (typeof type !== 'function' && typeof type !== 'string') {
  16466. var info = '';
  16467. if (false) {
  16468. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  16469. info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
  16470. }
  16471. }
  16472. info += getDeclarationErrorAddendum(element._owner);
  16473. 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;
  16474. }
  16475. // Special case string values
  16476. if (typeof element.type === 'string') {
  16477. instance = ReactHostComponent.createInternalComponent(element);
  16478. } else if (isInternalComponentType(element.type)) {
  16479. // This is temporarily available for custom components that are not string
  16480. // representations. I.e. ART. Once those are updated to use the string
  16481. // representation, we can drop this code path.
  16482. instance = new element.type(element);
  16483. // We renamed this. Allow the old name for compat. :(
  16484. if (!instance.getHostNode) {
  16485. instance.getHostNode = instance.getNativeNode;
  16486. }
  16487. } else {
  16488. instance = new ReactCompositeComponentWrapper(element);
  16489. }
  16490. } else if (typeof node === 'string' || typeof node === 'number') {
  16491. instance = ReactHostComponent.createInstanceForText(node);
  16492. } else {
  16493. true ? false ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0;
  16494. }
  16495. if (false) {
  16496. 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;
  16497. }
  16498. // These two fields are used by the DOM and ART diffing algorithms
  16499. // respectively. Instead of using expandos on components, we should be
  16500. // storing the state needed by the diffing algorithms elsewhere.
  16501. instance._mountIndex = 0;
  16502. instance._mountImage = null;
  16503. if (false) {
  16504. instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0;
  16505. }
  16506. // Internal instances should fully constructed at this point, so they should
  16507. // not get any new fields added to them at this point.
  16508. if (false) {
  16509. if (Object.preventExtensions) {
  16510. Object.preventExtensions(instance);
  16511. }
  16512. }
  16513. return instance;
  16514. }
  16515. _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, {
  16516. _instantiateReactComponent: instantiateReactComponent
  16517. });
  16518. module.exports = instantiateReactComponent;
  16519. /***/ }),
  16520. /* 93 */
  16521. /***/ (function(module, exports, __webpack_require__) {
  16522. "use strict";
  16523. /**
  16524. * Copyright 2013-present, Facebook, Inc.
  16525. * All rights reserved.
  16526. *
  16527. * This source code is licensed under the BSD-style license found in the
  16528. * LICENSE file in the root directory of this source tree. An additional grant
  16529. * of patent rights can be found in the PATENTS file in the same directory.
  16530. *
  16531. *
  16532. */
  16533. /**
  16534. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  16535. */
  16536. var supportedInputTypes = {
  16537. 'color': true,
  16538. 'date': true,
  16539. 'datetime': true,
  16540. 'datetime-local': true,
  16541. 'email': true,
  16542. 'month': true,
  16543. 'number': true,
  16544. 'password': true,
  16545. 'range': true,
  16546. 'search': true,
  16547. 'tel': true,
  16548. 'text': true,
  16549. 'time': true,
  16550. 'url': true,
  16551. 'week': true
  16552. };
  16553. function isTextInputElement(elem) {
  16554. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  16555. if (nodeName === 'input') {
  16556. return !!supportedInputTypes[elem.type];
  16557. }
  16558. if (nodeName === 'textarea') {
  16559. return true;
  16560. }
  16561. return false;
  16562. }
  16563. module.exports = isTextInputElement;
  16564. /***/ }),
  16565. /* 94 */
  16566. /***/ (function(module, exports, __webpack_require__) {
  16567. "use strict";
  16568. /**
  16569. * Copyright 2013-present, Facebook, Inc.
  16570. * All rights reserved.
  16571. *
  16572. * This source code is licensed under the BSD-style license found in the
  16573. * LICENSE file in the root directory of this source tree. An additional grant
  16574. * of patent rights can be found in the PATENTS file in the same directory.
  16575. *
  16576. */
  16577. var ExecutionEnvironment = __webpack_require__(8);
  16578. var escapeTextContentForBrowser = __webpack_require__(34);
  16579. var setInnerHTML = __webpack_require__(35);
  16580. /**
  16581. * Set the textContent property of a node, ensuring that whitespace is preserved
  16582. * even in IE8. innerText is a poor substitute for textContent and, among many
  16583. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  16584. * as it should.
  16585. *
  16586. * @param {DOMElement} node
  16587. * @param {string} text
  16588. * @internal
  16589. */
  16590. var setTextContent = function (node, text) {
  16591. if (text) {
  16592. var firstChild = node.firstChild;
  16593. if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) {
  16594. firstChild.nodeValue = text;
  16595. return;
  16596. }
  16597. }
  16598. node.textContent = text;
  16599. };
  16600. if (ExecutionEnvironment.canUseDOM) {
  16601. if (!('textContent' in document.documentElement)) {
  16602. setTextContent = function (node, text) {
  16603. if (node.nodeType === 3) {
  16604. node.nodeValue = text;
  16605. return;
  16606. }
  16607. setInnerHTML(node, escapeTextContentForBrowser(text));
  16608. };
  16609. }
  16610. }
  16611. module.exports = setTextContent;
  16612. /***/ }),
  16613. /* 95 */
  16614. /***/ (function(module, exports, __webpack_require__) {
  16615. "use strict";
  16616. /**
  16617. * Copyright 2013-present, Facebook, Inc.
  16618. * All rights reserved.
  16619. *
  16620. * This source code is licensed under the BSD-style license found in the
  16621. * LICENSE file in the root directory of this source tree. An additional grant
  16622. * of patent rights can be found in the PATENTS file in the same directory.
  16623. *
  16624. */
  16625. var _prodInvariant = __webpack_require__(2);
  16626. var ReactCurrentOwner = __webpack_require__(14);
  16627. var REACT_ELEMENT_TYPE = __webpack_require__(178);
  16628. var getIteratorFn = __webpack_require__(209);
  16629. var invariant = __webpack_require__(0);
  16630. var KeyEscapeUtils = __webpack_require__(55);
  16631. var warning = __webpack_require__(1);
  16632. var SEPARATOR = '.';
  16633. var SUBSEPARATOR = ':';
  16634. /**
  16635. * This is inlined from ReactElement since this file is shared between
  16636. * isomorphic and renderers. We could extract this to a
  16637. *
  16638. */
  16639. /**
  16640. * TODO: Test that a single child and an array with one item have the same key
  16641. * pattern.
  16642. */
  16643. var didWarnAboutMaps = false;
  16644. /**
  16645. * Generate a key string that identifies a component within a set.
  16646. *
  16647. * @param {*} component A component that could contain a manual key.
  16648. * @param {number} index Index that is used if a manual key is not provided.
  16649. * @return {string}
  16650. */
  16651. function getComponentKey(component, index) {
  16652. // Do some typechecking here since we call this blindly. We want to ensure
  16653. // that we don't block potential future ES APIs.
  16654. if (component && typeof component === 'object' && component.key != null) {
  16655. // Explicit key
  16656. return KeyEscapeUtils.escape(component.key);
  16657. }
  16658. // Implicit key determined by the index in the set
  16659. return index.toString(36);
  16660. }
  16661. /**
  16662. * @param {?*} children Children tree container.
  16663. * @param {!string} nameSoFar Name of the key path so far.
  16664. * @param {!function} callback Callback to invoke with each child found.
  16665. * @param {?*} traverseContext Used to pass information throughout the traversal
  16666. * process.
  16667. * @return {!number} The number of children in this subtree.
  16668. */
  16669. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  16670. var type = typeof children;
  16671. if (type === 'undefined' || type === 'boolean') {
  16672. // All of the above are perceived as null.
  16673. children = null;
  16674. }
  16675. if (children === null || type === 'string' || type === 'number' ||
  16676. // The following is inlined from ReactElement. This means we can optimize
  16677. // some checks. React Fiber also inlines this logic for similar purposes.
  16678. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  16679. callback(traverseContext, children,
  16680. // If it's the only child, treat the name as if it was wrapped in an array
  16681. // so that it's consistent if the number of children grows.
  16682. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  16683. return 1;
  16684. }
  16685. var child;
  16686. var nextName;
  16687. var subtreeCount = 0; // Count of children found in the current subtree.
  16688. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  16689. if (Array.isArray(children)) {
  16690. for (var i = 0; i < children.length; i++) {
  16691. child = children[i];
  16692. nextName = nextNamePrefix + getComponentKey(child, i);
  16693. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16694. }
  16695. } else {
  16696. var iteratorFn = getIteratorFn(children);
  16697. if (iteratorFn) {
  16698. var iterator = iteratorFn.call(children);
  16699. var step;
  16700. if (iteratorFn !== children.entries) {
  16701. var ii = 0;
  16702. while (!(step = iterator.next()).done) {
  16703. child = step.value;
  16704. nextName = nextNamePrefix + getComponentKey(child, ii++);
  16705. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16706. }
  16707. } else {
  16708. if (false) {
  16709. var mapsAsChildrenAddendum = '';
  16710. if (ReactCurrentOwner.current) {
  16711. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  16712. if (mapsAsChildrenOwnerName) {
  16713. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  16714. }
  16715. }
  16716. 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;
  16717. didWarnAboutMaps = true;
  16718. }
  16719. // Iterator will provide entry [k,v] tuples rather than values.
  16720. while (!(step = iterator.next()).done) {
  16721. var entry = step.value;
  16722. if (entry) {
  16723. child = entry[1];
  16724. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  16725. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  16726. }
  16727. }
  16728. }
  16729. } else if (type === 'object') {
  16730. var addendum = '';
  16731. if (false) {
  16732. 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.';
  16733. if (children._isReactElement) {
  16734. 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.';
  16735. }
  16736. if (ReactCurrentOwner.current) {
  16737. var name = ReactCurrentOwner.current.getName();
  16738. if (name) {
  16739. addendum += ' Check the render method of `' + name + '`.';
  16740. }
  16741. }
  16742. }
  16743. var childrenString = String(children);
  16744. 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;
  16745. }
  16746. }
  16747. return subtreeCount;
  16748. }
  16749. /**
  16750. * Traverses children that are typically specified as `props.children`, but
  16751. * might also be specified through attributes:
  16752. *
  16753. * - `traverseAllChildren(this.props.children, ...)`
  16754. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  16755. *
  16756. * The `traverseContext` is an optional argument that is passed through the
  16757. * entire traversal. It can be used to store accumulations or anything else that
  16758. * the callback might find relevant.
  16759. *
  16760. * @param {?*} children Children tree object.
  16761. * @param {!function} callback To invoke upon traversing each child.
  16762. * @param {?*} traverseContext Context for traversal.
  16763. * @return {!number} The number of children in this subtree.
  16764. */
  16765. function traverseAllChildren(children, callback, traverseContext) {
  16766. if (children == null) {
  16767. return 0;
  16768. }
  16769. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  16770. }
  16771. module.exports = traverseAllChildren;
  16772. /***/ }),
  16773. /* 96 */
  16774. /***/ (function(module, exports, __webpack_require__) {
  16775. "use strict";
  16776. /**
  16777. * Copyright 2016-present, Facebook, Inc.
  16778. * All rights reserved.
  16779. *
  16780. * This source code is licensed under the BSD-style license found in the
  16781. * LICENSE file in the root directory of this source tree. An additional grant
  16782. * of patent rights can be found in the PATENTS file in the same directory.
  16783. *
  16784. *
  16785. */
  16786. var _prodInvariant = __webpack_require__(23);
  16787. var ReactCurrentOwner = __webpack_require__(14);
  16788. var invariant = __webpack_require__(0);
  16789. var warning = __webpack_require__(1);
  16790. function isNative(fn) {
  16791. // Based on isNative() from Lodash
  16792. var funcToString = Function.prototype.toString;
  16793. var hasOwnProperty = Object.prototype.hasOwnProperty;
  16794. var reIsNative = RegExp('^' + funcToString
  16795. // Take an example native function source for comparison
  16796. .call(hasOwnProperty)
  16797. // Strip regex characters so we can use it for regex
  16798. .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
  16799. // Remove hasOwnProperty from the template to make it generic
  16800. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
  16801. try {
  16802. var source = funcToString.call(fn);
  16803. return reIsNative.test(source);
  16804. } catch (err) {
  16805. return false;
  16806. }
  16807. }
  16808. var canUseCollections =
  16809. // Array.from
  16810. typeof Array.from === 'function' &&
  16811. // Map
  16812. typeof Map === 'function' && isNative(Map) &&
  16813. // Map.prototype.keys
  16814. Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
  16815. // Set
  16816. typeof Set === 'function' && isNative(Set) &&
  16817. // Set.prototype.keys
  16818. Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
  16819. var setItem;
  16820. var getItem;
  16821. var removeItem;
  16822. var getItemIDs;
  16823. var addRoot;
  16824. var removeRoot;
  16825. var getRootIDs;
  16826. if (canUseCollections) {
  16827. var itemMap = new Map();
  16828. var rootIDSet = new Set();
  16829. setItem = function (id, item) {
  16830. itemMap.set(id, item);
  16831. };
  16832. getItem = function (id) {
  16833. return itemMap.get(id);
  16834. };
  16835. removeItem = function (id) {
  16836. itemMap['delete'](id);
  16837. };
  16838. getItemIDs = function () {
  16839. return Array.from(itemMap.keys());
  16840. };
  16841. addRoot = function (id) {
  16842. rootIDSet.add(id);
  16843. };
  16844. removeRoot = function (id) {
  16845. rootIDSet['delete'](id);
  16846. };
  16847. getRootIDs = function () {
  16848. return Array.from(rootIDSet.keys());
  16849. };
  16850. } else {
  16851. var itemByKey = {};
  16852. var rootByKey = {};
  16853. // Use non-numeric keys to prevent V8 performance issues:
  16854. // https://github.com/facebook/react/pull/7232
  16855. var getKeyFromID = function (id) {
  16856. return '.' + id;
  16857. };
  16858. var getIDFromKey = function (key) {
  16859. return parseInt(key.substr(1), 10);
  16860. };
  16861. setItem = function (id, item) {
  16862. var key = getKeyFromID(id);
  16863. itemByKey[key] = item;
  16864. };
  16865. getItem = function (id) {
  16866. var key = getKeyFromID(id);
  16867. return itemByKey[key];
  16868. };
  16869. removeItem = function (id) {
  16870. var key = getKeyFromID(id);
  16871. delete itemByKey[key];
  16872. };
  16873. getItemIDs = function () {
  16874. return Object.keys(itemByKey).map(getIDFromKey);
  16875. };
  16876. addRoot = function (id) {
  16877. var key = getKeyFromID(id);
  16878. rootByKey[key] = true;
  16879. };
  16880. removeRoot = function (id) {
  16881. var key = getKeyFromID(id);
  16882. delete rootByKey[key];
  16883. };
  16884. getRootIDs = function () {
  16885. return Object.keys(rootByKey).map(getIDFromKey);
  16886. };
  16887. }
  16888. var unmountedIDs = [];
  16889. function purgeDeep(id) {
  16890. var item = getItem(id);
  16891. if (item) {
  16892. var childIDs = item.childIDs;
  16893. removeItem(id);
  16894. childIDs.forEach(purgeDeep);
  16895. }
  16896. }
  16897. function describeComponentFrame(name, source, ownerName) {
  16898. return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
  16899. }
  16900. function getDisplayName(element) {
  16901. if (element == null) {
  16902. return '#empty';
  16903. } else if (typeof element === 'string' || typeof element === 'number') {
  16904. return '#text';
  16905. } else if (typeof element.type === 'string') {
  16906. return element.type;
  16907. } else {
  16908. return element.type.displayName || element.type.name || 'Unknown';
  16909. }
  16910. }
  16911. function describeID(id) {
  16912. var name = ReactComponentTreeHook.getDisplayName(id);
  16913. var element = ReactComponentTreeHook.getElement(id);
  16914. var ownerID = ReactComponentTreeHook.getOwnerID(id);
  16915. var ownerName;
  16916. if (ownerID) {
  16917. ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
  16918. }
  16919. false ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
  16920. return describeComponentFrame(name, element && element._source, ownerName);
  16921. }
  16922. var ReactComponentTreeHook = {
  16923. onSetChildren: function (id, nextChildIDs) {
  16924. var item = getItem(id);
  16925. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  16926. item.childIDs = nextChildIDs;
  16927. for (var i = 0; i < nextChildIDs.length; i++) {
  16928. var nextChildID = nextChildIDs[i];
  16929. var nextChild = getItem(nextChildID);
  16930. !nextChild ? false ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
  16931. !(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;
  16932. !nextChild.isMounted ? false ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
  16933. if (nextChild.parentID == null) {
  16934. nextChild.parentID = id;
  16935. // TODO: This shouldn't be necessary but mounting a new root during in
  16936. // componentWillMount currently causes not-yet-mounted components to
  16937. // be purged from our tree data so their parent id is missing.
  16938. }
  16939. !(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;
  16940. }
  16941. },
  16942. onBeforeMountComponent: function (id, element, parentID) {
  16943. var item = {
  16944. element: element,
  16945. parentID: parentID,
  16946. text: null,
  16947. childIDs: [],
  16948. isMounted: false,
  16949. updateCount: 0
  16950. };
  16951. setItem(id, item);
  16952. },
  16953. onBeforeUpdateComponent: function (id, element) {
  16954. var item = getItem(id);
  16955. if (!item || !item.isMounted) {
  16956. // We may end up here as a result of setState() in componentWillUnmount().
  16957. // In this case, ignore the element.
  16958. return;
  16959. }
  16960. item.element = element;
  16961. },
  16962. onMountComponent: function (id) {
  16963. var item = getItem(id);
  16964. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  16965. item.isMounted = true;
  16966. var isRoot = item.parentID === 0;
  16967. if (isRoot) {
  16968. addRoot(id);
  16969. }
  16970. },
  16971. onUpdateComponent: function (id) {
  16972. var item = getItem(id);
  16973. if (!item || !item.isMounted) {
  16974. // We may end up here as a result of setState() in componentWillUnmount().
  16975. // In this case, ignore the element.
  16976. return;
  16977. }
  16978. item.updateCount++;
  16979. },
  16980. onUnmountComponent: function (id) {
  16981. var item = getItem(id);
  16982. if (item) {
  16983. // We need to check if it exists.
  16984. // `item` might not exist if it is inside an error boundary, and a sibling
  16985. // error boundary child threw while mounting. Then this instance never
  16986. // got a chance to mount, but it still gets an unmounting event during
  16987. // the error boundary cleanup.
  16988. item.isMounted = false;
  16989. var isRoot = item.parentID === 0;
  16990. if (isRoot) {
  16991. removeRoot(id);
  16992. }
  16993. }
  16994. unmountedIDs.push(id);
  16995. },
  16996. purgeUnmountedComponents: function () {
  16997. if (ReactComponentTreeHook._preventPurging) {
  16998. // Should only be used for testing.
  16999. return;
  17000. }
  17001. for (var i = 0; i < unmountedIDs.length; i++) {
  17002. var id = unmountedIDs[i];
  17003. purgeDeep(id);
  17004. }
  17005. unmountedIDs.length = 0;
  17006. },
  17007. isMounted: function (id) {
  17008. var item = getItem(id);
  17009. return item ? item.isMounted : false;
  17010. },
  17011. getCurrentStackAddendum: function (topElement) {
  17012. var info = '';
  17013. if (topElement) {
  17014. var name = getDisplayName(topElement);
  17015. var owner = topElement._owner;
  17016. info += describeComponentFrame(name, topElement._source, owner && owner.getName());
  17017. }
  17018. var currentOwner = ReactCurrentOwner.current;
  17019. var id = currentOwner && currentOwner._debugID;
  17020. info += ReactComponentTreeHook.getStackAddendumByID(id);
  17021. return info;
  17022. },
  17023. getStackAddendumByID: function (id) {
  17024. var info = '';
  17025. while (id) {
  17026. info += describeID(id);
  17027. id = ReactComponentTreeHook.getParentID(id);
  17028. }
  17029. return info;
  17030. },
  17031. getChildIDs: function (id) {
  17032. var item = getItem(id);
  17033. return item ? item.childIDs : [];
  17034. },
  17035. getDisplayName: function (id) {
  17036. var element = ReactComponentTreeHook.getElement(id);
  17037. if (!element) {
  17038. return null;
  17039. }
  17040. return getDisplayName(element);
  17041. },
  17042. getElement: function (id) {
  17043. var item = getItem(id);
  17044. return item ? item.element : null;
  17045. },
  17046. getOwnerID: function (id) {
  17047. var element = ReactComponentTreeHook.getElement(id);
  17048. if (!element || !element._owner) {
  17049. return null;
  17050. }
  17051. return element._owner._debugID;
  17052. },
  17053. getParentID: function (id) {
  17054. var item = getItem(id);
  17055. return item ? item.parentID : null;
  17056. },
  17057. getSource: function (id) {
  17058. var item = getItem(id);
  17059. var element = item ? item.element : null;
  17060. var source = element != null ? element._source : null;
  17061. return source;
  17062. },
  17063. getText: function (id) {
  17064. var element = ReactComponentTreeHook.getElement(id);
  17065. if (typeof element === 'string') {
  17066. return element;
  17067. } else if (typeof element === 'number') {
  17068. return '' + element;
  17069. } else {
  17070. return null;
  17071. }
  17072. },
  17073. getUpdateCount: function (id) {
  17074. var item = getItem(id);
  17075. return item ? item.updateCount : 0;
  17076. },
  17077. getRootIDs: getRootIDs,
  17078. getRegisteredIDs: getItemIDs
  17079. };
  17080. module.exports = ReactComponentTreeHook;
  17081. /***/ }),
  17082. /* 97 */
  17083. /***/ (function(module, exports, __webpack_require__) {
  17084. "use strict";
  17085. /**
  17086. * Copyright 2014-present, Facebook, Inc.
  17087. * All rights reserved.
  17088. *
  17089. * This source code is licensed under the BSD-style license found in the
  17090. * LICENSE file in the root directory of this source tree. An additional grant
  17091. * of patent rights can be found in the PATENTS file in the same directory.
  17092. *
  17093. *
  17094. */
  17095. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  17096. // nor polyfill, then a plain number is used for performance.
  17097. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  17098. module.exports = REACT_ELEMENT_TYPE;
  17099. /***/ }),
  17100. /* 98 */
  17101. /***/ (function(module, exports, __webpack_require__) {
  17102. "use strict";
  17103. /**
  17104. * Copyright 2013-present, Facebook, Inc.
  17105. * All rights reserved.
  17106. *
  17107. * This source code is licensed under the BSD-style license found in the
  17108. * LICENSE file in the root directory of this source tree. An additional grant
  17109. * of patent rights can be found in the PATENTS file in the same directory.
  17110. *
  17111. *
  17112. */
  17113. var canDefineProperty = false;
  17114. if (false) {
  17115. try {
  17116. // $FlowFixMe https://github.com/facebook/flow/issues/285
  17117. Object.defineProperty({}, 'x', { get: function () {} });
  17118. canDefineProperty = true;
  17119. } catch (x) {
  17120. // IE will fail on defineProperty
  17121. }
  17122. }
  17123. module.exports = canDefineProperty;
  17124. /***/ }),
  17125. /* 99 */
  17126. /***/ (function(module, exports, __webpack_require__) {
  17127. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**!
  17128. * Sortable
  17129. * @author RubaXa <[email protected]>
  17130. * @license MIT
  17131. */
  17132. (function sortableModule(factory) {
  17133. "use strict";
  17134. if (true) {
  17135. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  17136. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  17137. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  17138. __WEBPACK_AMD_DEFINE_FACTORY__),
  17139. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17140. }
  17141. else if (typeof module != "undefined" && typeof module.exports != "undefined") {
  17142. module.exports = factory();
  17143. }
  17144. else {
  17145. /* jshint sub:true */
  17146. window["Sortable"] = factory();
  17147. }
  17148. })(function sortableFactory() {
  17149. "use strict";
  17150. if (typeof window == "undefined" || !window.document) {
  17151. return function sortableError() {
  17152. throw new Error("Sortable.js requires a window with a document");
  17153. };
  17154. }
  17155. var dragEl,
  17156. parentEl,
  17157. ghostEl,
  17158. cloneEl,
  17159. rootEl,
  17160. nextEl,
  17161. lastDownEl,
  17162. scrollEl,
  17163. scrollParentEl,
  17164. scrollCustomFn,
  17165. lastEl,
  17166. lastCSS,
  17167. lastParentCSS,
  17168. oldIndex,
  17169. newIndex,
  17170. activeGroup,
  17171. putSortable,
  17172. autoScroll = {},
  17173. tapEvt,
  17174. touchEvt,
  17175. moved,
  17176. /** @const */
  17177. R_SPACE = /\s+/g,
  17178. R_FLOAT = /left|right|inline/,
  17179. expando = 'Sortable' + (new Date).getTime(),
  17180. win = window,
  17181. document = win.document,
  17182. parseInt = win.parseInt,
  17183. $ = win.jQuery || win.Zepto,
  17184. Polymer = win.Polymer,
  17185. captureMode = false,
  17186. supportDraggable = !!('draggable' in document.createElement('div')),
  17187. supportCssPointerEvents = (function (el) {
  17188. // false when IE11
  17189. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  17190. return false;
  17191. }
  17192. el = document.createElement('x');
  17193. el.style.cssText = 'pointer-events:auto';
  17194. return el.style.pointerEvents === 'auto';
  17195. })(),
  17196. _silent = false,
  17197. abs = Math.abs,
  17198. min = Math.min,
  17199. savedInputChecked = [],
  17200. touchDragOverListeners = [],
  17201. _autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  17202. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  17203. if (rootEl && options.scroll) {
  17204. var _this = rootEl[expando],
  17205. el,
  17206. rect,
  17207. sens = options.scrollSensitivity,
  17208. speed = options.scrollSpeed,
  17209. x = evt.clientX,
  17210. y = evt.clientY,
  17211. winWidth = window.innerWidth,
  17212. winHeight = window.innerHeight,
  17213. vx,
  17214. vy,
  17215. scrollOffsetX,
  17216. scrollOffsetY
  17217. ;
  17218. // Delect scrollEl
  17219. if (scrollParentEl !== rootEl) {
  17220. scrollEl = options.scroll;
  17221. scrollParentEl = rootEl;
  17222. scrollCustomFn = options.scrollFn;
  17223. if (scrollEl === true) {
  17224. scrollEl = rootEl;
  17225. do {
  17226. if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
  17227. (scrollEl.offsetHeight < scrollEl.scrollHeight)
  17228. ) {
  17229. break;
  17230. }
  17231. /* jshint boss:true */
  17232. } while (scrollEl = scrollEl.parentNode);
  17233. }
  17234. }
  17235. if (scrollEl) {
  17236. el = scrollEl;
  17237. rect = scrollEl.getBoundingClientRect();
  17238. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  17239. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  17240. }
  17241. if (!(vx || vy)) {
  17242. vx = (winWidth - x <= sens) - (x <= sens);
  17243. vy = (winHeight - y <= sens) - (y <= sens);
  17244. /* jshint expr:true */
  17245. (vx || vy) && (el = win);
  17246. }
  17247. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  17248. autoScroll.el = el;
  17249. autoScroll.vx = vx;
  17250. autoScroll.vy = vy;
  17251. clearInterval(autoScroll.pid);
  17252. if (el) {
  17253. autoScroll.pid = setInterval(function () {
  17254. scrollOffsetY = vy ? vy * speed : 0;
  17255. scrollOffsetX = vx ? vx * speed : 0;
  17256. if ('function' === typeof(scrollCustomFn)) {
  17257. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  17258. }
  17259. if (el === win) {
  17260. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  17261. } else {
  17262. el.scrollTop += scrollOffsetY;
  17263. el.scrollLeft += scrollOffsetX;
  17264. }
  17265. }, 24);
  17266. }
  17267. }
  17268. }
  17269. }, 30),
  17270. _prepareGroup = function (options) {
  17271. function toFn(value, pull) {
  17272. if (value === void 0 || value === true) {
  17273. value = group.name;
  17274. }
  17275. if (typeof value === 'function') {
  17276. return value;
  17277. } else {
  17278. return function (to, from) {
  17279. var fromGroup = from.options.group.name;
  17280. return pull
  17281. ? value
  17282. : value && (value.join
  17283. ? value.indexOf(fromGroup) > -1
  17284. : (fromGroup == value)
  17285. );
  17286. };
  17287. }
  17288. }
  17289. var group = {};
  17290. var originalGroup = options.group;
  17291. if (!originalGroup || typeof originalGroup != 'object') {
  17292. originalGroup = {name: originalGroup};
  17293. }
  17294. group.name = originalGroup.name;
  17295. group.checkPull = toFn(originalGroup.pull, true);
  17296. group.checkPut = toFn(originalGroup.put);
  17297. group.revertClone = originalGroup.revertClone;
  17298. options.group = group;
  17299. }
  17300. ;
  17301. /**
  17302. * @class Sortable
  17303. * @param {HTMLElement} el
  17304. * @param {Object} [options]
  17305. */
  17306. function Sortable(el, options) {
  17307. if (!(el && el.nodeType && el.nodeType === 1)) {
  17308. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  17309. }
  17310. this.el = el; // root element
  17311. this.options = options = _extend({}, options);
  17312. // Export instance
  17313. el[expando] = this;
  17314. // Default options
  17315. var defaults = {
  17316. group: Math.random(),
  17317. sort: true,
  17318. disabled: false,
  17319. store: null,
  17320. handle: null,
  17321. scroll: true,
  17322. scrollSensitivity: 30,
  17323. scrollSpeed: 10,
  17324. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  17325. ghostClass: 'sortable-ghost',
  17326. chosenClass: 'sortable-chosen',
  17327. dragClass: 'sortable-drag',
  17328. ignore: 'a, img',
  17329. filter: null,
  17330. preventOnFilter: true,
  17331. animation: 0,
  17332. setData: function (dataTransfer, dragEl) {
  17333. dataTransfer.setData('Text', dragEl.textContent);
  17334. },
  17335. dropBubble: false,
  17336. dragoverBubble: false,
  17337. dataIdAttr: 'data-id',
  17338. delay: 0,
  17339. forceFallback: false,
  17340. fallbackClass: 'sortable-fallback',
  17341. fallbackOnBody: false,
  17342. fallbackTolerance: 0,
  17343. fallbackOffset: {x: 0, y: 0}
  17344. };
  17345. // Set default options
  17346. for (var name in defaults) {
  17347. !(name in options) && (options[name] = defaults[name]);
  17348. }
  17349. _prepareGroup(options);
  17350. // Bind all private methods
  17351. for (var fn in this) {
  17352. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  17353. this[fn] = this[fn].bind(this);
  17354. }
  17355. }
  17356. // Setup drag mode
  17357. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  17358. // Bind events
  17359. _on(el, 'mousedown', this._onTapStart);
  17360. _on(el, 'touchstart', this._onTapStart);
  17361. _on(el, 'pointerdown', this._onTapStart);
  17362. if (this.nativeDraggable) {
  17363. _on(el, 'dragover', this);
  17364. _on(el, 'dragenter', this);
  17365. }
  17366. touchDragOverListeners.push(this._onDragOver);
  17367. // Restore sorting
  17368. options.store && this.sort(options.store.get(this));
  17369. }
  17370. Sortable.prototype = /** @lends Sortable.prototype */ {
  17371. constructor: Sortable,
  17372. _onTapStart: function (/** Event|TouchEvent */evt) {
  17373. var _this = this,
  17374. el = this.el,
  17375. options = this.options,
  17376. preventOnFilter = options.preventOnFilter,
  17377. type = evt.type,
  17378. touch = evt.touches && evt.touches[0],
  17379. target = (touch || evt).target,
  17380. originalTarget = evt.target.shadowRoot && evt.path[0] || target,
  17381. filter = options.filter,
  17382. startIndex;
  17383. _saveInputCheckedState(el);
  17384. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  17385. if (dragEl) {
  17386. return;
  17387. }
  17388. if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
  17389. return; // only left button or enabled
  17390. }
  17391. target = _closest(target, options.draggable, el);
  17392. if (!target) {
  17393. return;
  17394. }
  17395. if (lastDownEl === target) {
  17396. // Ignoring duplicate `down`
  17397. return;
  17398. }
  17399. // Get the index of the dragged element within its parent
  17400. startIndex = _index(target, options.draggable);
  17401. // Check filter
  17402. if (typeof filter === 'function') {
  17403. if (filter.call(this, evt, target, this)) {
  17404. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  17405. preventOnFilter && evt.preventDefault();
  17406. return; // cancel dnd
  17407. }
  17408. }
  17409. else if (filter) {
  17410. filter = filter.split(',').some(function (criteria) {
  17411. criteria = _closest(originalTarget, criteria.trim(), el);
  17412. if (criteria) {
  17413. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  17414. return true;
  17415. }
  17416. });
  17417. if (filter) {
  17418. preventOnFilter && evt.preventDefault();
  17419. return; // cancel dnd
  17420. }
  17421. }
  17422. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  17423. return;
  17424. }
  17425. // Prepare `dragstart`
  17426. this._prepareDragStart(evt, touch, target, startIndex);
  17427. },
  17428. _prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  17429. var _this = this,
  17430. el = _this.el,
  17431. options = _this.options,
  17432. ownerDocument = el.ownerDocument,
  17433. dragStartFn;
  17434. if (target && !dragEl && (target.parentNode === el)) {
  17435. tapEvt = evt;
  17436. rootEl = el;
  17437. dragEl = target;
  17438. parentEl = dragEl.parentNode;
  17439. nextEl = dragEl.nextSibling;
  17440. lastDownEl = target;
  17441. activeGroup = options.group;
  17442. oldIndex = startIndex;
  17443. this._lastX = (touch || evt).clientX;
  17444. this._lastY = (touch || evt).clientY;
  17445. dragEl.style['will-change'] = 'transform';
  17446. dragStartFn = function () {
  17447. // Delayed drag has been triggered
  17448. // we can re-enable the events: touchmove/mousemove
  17449. _this._disableDelayedDrag();
  17450. // Make the element draggable
  17451. dragEl.draggable = _this.nativeDraggable;
  17452. // Chosen item
  17453. _toggleClass(dragEl, options.chosenClass, true);
  17454. // Bind the events: dragstart/dragend
  17455. _this._triggerDragStart(evt, touch);
  17456. // Drag start event
  17457. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  17458. };
  17459. // Disable "draggable"
  17460. options.ignore.split(',').forEach(function (criteria) {
  17461. _find(dragEl, criteria.trim(), _disableDraggable);
  17462. });
  17463. _on(ownerDocument, 'mouseup', _this._onDrop);
  17464. _on(ownerDocument, 'touchend', _this._onDrop);
  17465. _on(ownerDocument, 'touchcancel', _this._onDrop);
  17466. _on(ownerDocument, 'pointercancel', _this._onDrop);
  17467. _on(ownerDocument, 'selectstart', _this);
  17468. if (options.delay) {
  17469. // If the user moves the pointer or let go the click or touch
  17470. // before the delay has been reached:
  17471. // disable the delayed drag
  17472. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  17473. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  17474. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  17475. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  17476. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  17477. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  17478. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  17479. } else {
  17480. dragStartFn();
  17481. }
  17482. }
  17483. },
  17484. _disableDelayedDrag: function () {
  17485. var ownerDocument = this.el.ownerDocument;
  17486. clearTimeout(this._dragStartTimer);
  17487. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  17488. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  17489. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  17490. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  17491. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  17492. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  17493. },
  17494. _triggerDragStart: function (/** Event */evt, /** Touch */touch) {
  17495. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  17496. if (touch) {
  17497. // Touch device support
  17498. tapEvt = {
  17499. target: dragEl,
  17500. clientX: touch.clientX,
  17501. clientY: touch.clientY
  17502. };
  17503. this._onDragStart(tapEvt, 'touch');
  17504. }
  17505. else if (!this.nativeDraggable) {
  17506. this._onDragStart(tapEvt, true);
  17507. }
  17508. else {
  17509. _on(dragEl, 'dragend', this);
  17510. _on(rootEl, 'dragstart', this._onDragStart);
  17511. }
  17512. try {
  17513. if (document.selection) {
  17514. // Timeout neccessary for IE9
  17515. setTimeout(function () {
  17516. document.selection.empty();
  17517. });
  17518. } else {
  17519. window.getSelection().removeAllRanges();
  17520. }
  17521. } catch (err) {
  17522. }
  17523. },
  17524. _dragStarted: function () {
  17525. if (rootEl && dragEl) {
  17526. var options = this.options;
  17527. // Apply effect
  17528. _toggleClass(dragEl, options.ghostClass, true);
  17529. _toggleClass(dragEl, options.dragClass, false);
  17530. Sortable.active = this;
  17531. // Drag start event
  17532. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  17533. } else {
  17534. this._nulling();
  17535. }
  17536. },
  17537. _emulateDragOver: function () {
  17538. if (touchEvt) {
  17539. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  17540. return;
  17541. }
  17542. this._lastX = touchEvt.clientX;
  17543. this._lastY = touchEvt.clientY;
  17544. if (!supportCssPointerEvents) {
  17545. _css(ghostEl, 'display', 'none');
  17546. }
  17547. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  17548. parent = target,
  17549. i = touchDragOverListeners.length;
  17550. if (parent) {
  17551. do {
  17552. if (parent[expando]) {
  17553. while (i--) {
  17554. touchDragOverListeners[i]({
  17555. clientX: touchEvt.clientX,
  17556. clientY: touchEvt.clientY,
  17557. target: target,
  17558. rootEl: parent
  17559. });
  17560. }
  17561. break;
  17562. }
  17563. target = parent; // store last element
  17564. }
  17565. /* jshint boss:true */
  17566. while (parent = parent.parentNode);
  17567. }
  17568. if (!supportCssPointerEvents) {
  17569. _css(ghostEl, 'display', '');
  17570. }
  17571. }
  17572. },
  17573. _onTouchMove: function (/**TouchEvent*/evt) {
  17574. if (tapEvt) {
  17575. var options = this.options,
  17576. fallbackTolerance = options.fallbackTolerance,
  17577. fallbackOffset = options.fallbackOffset,
  17578. touch = evt.touches ? evt.touches[0] : evt,
  17579. dx = (touch.clientX - tapEvt.clientX) + fallbackOffset.x,
  17580. dy = (touch.clientY - tapEvt.clientY) + fallbackOffset.y,
  17581. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  17582. // only set the status to dragging, when we are actually dragging
  17583. if (!Sortable.active) {
  17584. if (fallbackTolerance &&
  17585. min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance
  17586. ) {
  17587. return;
  17588. }
  17589. this._dragStarted();
  17590. }
  17591. // as well as creating the ghost element on the document body
  17592. this._appendGhost();
  17593. moved = true;
  17594. touchEvt = touch;
  17595. _css(ghostEl, 'webkitTransform', translate3d);
  17596. _css(ghostEl, 'mozTransform', translate3d);
  17597. _css(ghostEl, 'msTransform', translate3d);
  17598. _css(ghostEl, 'transform', translate3d);
  17599. evt.preventDefault();
  17600. }
  17601. },
  17602. _appendGhost: function () {
  17603. if (!ghostEl) {
  17604. var rect = dragEl.getBoundingClientRect(),
  17605. css = _css(dragEl),
  17606. options = this.options,
  17607. ghostRect;
  17608. ghostEl = dragEl.cloneNode(true);
  17609. _toggleClass(ghostEl, options.ghostClass, false);
  17610. _toggleClass(ghostEl, options.fallbackClass, true);
  17611. _toggleClass(ghostEl, options.dragClass, true);
  17612. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  17613. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  17614. _css(ghostEl, 'width', rect.width);
  17615. _css(ghostEl, 'height', rect.height);
  17616. _css(ghostEl, 'opacity', '0.8');
  17617. _css(ghostEl, 'position', 'fixed');
  17618. _css(ghostEl, 'zIndex', '100000');
  17619. _css(ghostEl, 'pointerEvents', 'none');
  17620. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  17621. // Fixing dimensions.
  17622. ghostRect = ghostEl.getBoundingClientRect();
  17623. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  17624. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  17625. }
  17626. },
  17627. _onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
  17628. var dataTransfer = evt.dataTransfer,
  17629. options = this.options;
  17630. this._offUpEvents();
  17631. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  17632. cloneEl = _clone(dragEl);
  17633. cloneEl.draggable = false;
  17634. cloneEl.style['will-change'] = '';
  17635. _css(cloneEl, 'display', 'none');
  17636. _toggleClass(cloneEl, this.options.chosenClass, false);
  17637. rootEl.insertBefore(cloneEl, dragEl);
  17638. _dispatchEvent(this, rootEl, 'clone', dragEl);
  17639. }
  17640. _toggleClass(dragEl, options.dragClass, true);
  17641. if (useFallback) {
  17642. if (useFallback === 'touch') {
  17643. // Bind touch events
  17644. _on(document, 'touchmove', this._onTouchMove);
  17645. _on(document, 'touchend', this._onDrop);
  17646. _on(document, 'touchcancel', this._onDrop);
  17647. _on(document, 'pointermove', this._onTouchMove);
  17648. _on(document, 'pointerup', this._onDrop);
  17649. } else {
  17650. // Old brwoser
  17651. _on(document, 'mousemove', this._onTouchMove);
  17652. _on(document, 'mouseup', this._onDrop);
  17653. }
  17654. this._loopId = setInterval(this._emulateDragOver, 50);
  17655. }
  17656. else {
  17657. if (dataTransfer) {
  17658. dataTransfer.effectAllowed = 'move';
  17659. options.setData && options.setData.call(this, dataTransfer, dragEl);
  17660. }
  17661. _on(document, 'drop', this);
  17662. setTimeout(this._dragStarted, 0);
  17663. }
  17664. },
  17665. _onDragOver: function (/**Event*/evt) {
  17666. var el = this.el,
  17667. target,
  17668. dragRect,
  17669. targetRect,
  17670. revert,
  17671. options = this.options,
  17672. group = options.group,
  17673. activeSortable = Sortable.active,
  17674. isOwner = (activeGroup === group),
  17675. isMovingBetweenSortable = false,
  17676. canSort = options.sort;
  17677. if (evt.preventDefault !== void 0) {
  17678. evt.preventDefault();
  17679. !options.dragoverBubble && evt.stopPropagation();
  17680. }
  17681. if (dragEl.animated) {
  17682. return;
  17683. }
  17684. moved = true;
  17685. if (activeSortable && !options.disabled &&
  17686. (isOwner
  17687. ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  17688. : (
  17689. putSortable === this ||
  17690. (
  17691. (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
  17692. group.checkPut(this, activeSortable, dragEl, evt)
  17693. )
  17694. )
  17695. ) &&
  17696. (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  17697. ) {
  17698. // Smart auto-scrolling
  17699. _autoScroll(evt, options, this.el);
  17700. if (_silent) {
  17701. return;
  17702. }
  17703. target = _closest(evt.target, options.draggable, el);
  17704. dragRect = dragEl.getBoundingClientRect();
  17705. if (putSortable !== this) {
  17706. putSortable = this;
  17707. isMovingBetweenSortable = true;
  17708. }
  17709. if (revert) {
  17710. _cloneHide(activeSortable, true);
  17711. parentEl = rootEl; // actualization
  17712. if (cloneEl || nextEl) {
  17713. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  17714. }
  17715. else if (!canSort) {
  17716. rootEl.appendChild(dragEl);
  17717. }
  17718. return;
  17719. }
  17720. if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
  17721. (el === evt.target) && (target = _ghostIsLast(el, evt))
  17722. ) {
  17723. if (target) {
  17724. if (target.animated) {
  17725. return;
  17726. }
  17727. targetRect = target.getBoundingClientRect();
  17728. }
  17729. _cloneHide(activeSortable, isOwner);
  17730. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  17731. if (!dragEl.contains(el)) {
  17732. el.appendChild(dragEl);
  17733. parentEl = el; // actualization
  17734. }
  17735. this._animate(dragRect, dragEl);
  17736. target && this._animate(targetRect, target);
  17737. }
  17738. }
  17739. else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
  17740. if (lastEl !== target) {
  17741. lastEl = target;
  17742. lastCSS = _css(target);
  17743. lastParentCSS = _css(target.parentNode);
  17744. }
  17745. targetRect = target.getBoundingClientRect();
  17746. var width = targetRect.right - targetRect.left,
  17747. height = targetRect.bottom - targetRect.top,
  17748. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display)
  17749. || (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
  17750. isWide = (target.offsetWidth > dragEl.offsetWidth),
  17751. isLong = (target.offsetHeight > dragEl.offsetHeight),
  17752. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  17753. nextSibling = target.nextElementSibling,
  17754. moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt),
  17755. after = false
  17756. ;
  17757. if (moveVector !== false) {
  17758. _silent = true;
  17759. setTimeout(_unsilent, 30);
  17760. _cloneHide(activeSortable, isOwner);
  17761. if (moveVector === 1 || moveVector === -1) {
  17762. after = (moveVector === 1);
  17763. }
  17764. else if (floating) {
  17765. var elTop = dragEl.offsetTop,
  17766. tgTop = target.offsetTop;
  17767. if (elTop === tgTop) {
  17768. after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
  17769. }
  17770. else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  17771. after = (evt.clientY - targetRect.top) / height > 0.5;
  17772. } else {
  17773. after = tgTop > elTop;
  17774. }
  17775. } else if (!isMovingBetweenSortable) {
  17776. after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
  17777. }
  17778. if (!dragEl.contains(el)) {
  17779. if (after && !nextSibling) {
  17780. el.appendChild(dragEl);
  17781. } else {
  17782. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  17783. }
  17784. }
  17785. parentEl = dragEl.parentNode; // actualization
  17786. this._animate(dragRect, dragEl);
  17787. this._animate(targetRect, target);
  17788. }
  17789. }
  17790. }
  17791. },
  17792. _animate: function (prevRect, target) {
  17793. var ms = this.options.animation;
  17794. if (ms) {
  17795. var currentRect = target.getBoundingClientRect();
  17796. if (prevRect.nodeType === 1) {
  17797. prevRect = prevRect.getBoundingClientRect();
  17798. }
  17799. _css(target, 'transition', 'none');
  17800. _css(target, 'transform', 'translate3d('
  17801. + (prevRect.left - currentRect.left) + 'px,'
  17802. + (prevRect.top - currentRect.top) + 'px,0)'
  17803. );
  17804. target.offsetWidth; // repaint
  17805. _css(target, 'transition', 'all ' + ms + 'ms');
  17806. _css(target, 'transform', 'translate3d(0,0,0)');
  17807. clearTimeout(target.animated);
  17808. target.animated = setTimeout(function () {
  17809. _css(target, 'transition', '');
  17810. _css(target, 'transform', '');
  17811. target.animated = false;
  17812. }, ms);
  17813. }
  17814. },
  17815. _offUpEvents: function () {
  17816. var ownerDocument = this.el.ownerDocument;
  17817. _off(document, 'touchmove', this._onTouchMove);
  17818. _off(document, 'pointermove', this._onTouchMove);
  17819. _off(ownerDocument, 'mouseup', this._onDrop);
  17820. _off(ownerDocument, 'touchend', this._onDrop);
  17821. _off(ownerDocument, 'pointerup', this._onDrop);
  17822. _off(ownerDocument, 'touchcancel', this._onDrop);
  17823. _off(ownerDocument, 'selectstart', this);
  17824. },
  17825. _onDrop: function (/**Event*/evt) {
  17826. var el = this.el,
  17827. options = this.options;
  17828. clearInterval(this._loopId);
  17829. clearInterval(autoScroll.pid);
  17830. clearTimeout(this._dragStartTimer);
  17831. // Unbind events
  17832. _off(document, 'mousemove', this._onTouchMove);
  17833. if (this.nativeDraggable) {
  17834. _off(document, 'drop', this);
  17835. _off(el, 'dragstart', this._onDragStart);
  17836. }
  17837. this._offUpEvents();
  17838. if (evt) {
  17839. if (moved) {
  17840. evt.preventDefault();
  17841. !options.dropBubble && evt.stopPropagation();
  17842. }
  17843. ghostEl && ghostEl.parentNode.removeChild(ghostEl);
  17844. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  17845. // Remove clone
  17846. cloneEl && cloneEl.parentNode.removeChild(cloneEl);
  17847. }
  17848. if (dragEl) {
  17849. if (this.nativeDraggable) {
  17850. _off(dragEl, 'dragend', this);
  17851. }
  17852. _disableDraggable(dragEl);
  17853. dragEl.style['will-change'] = '';
  17854. // Remove class's
  17855. _toggleClass(dragEl, this.options.ghostClass, false);
  17856. _toggleClass(dragEl, this.options.chosenClass, false);
  17857. if (rootEl !== parentEl) {
  17858. newIndex = _index(dragEl, options.draggable);
  17859. if (newIndex >= 0) {
  17860. // Add event
  17861. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  17862. // Remove event
  17863. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  17864. // drag from one list and drop into another
  17865. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  17866. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  17867. }
  17868. }
  17869. else {
  17870. if (dragEl.nextSibling !== nextEl) {
  17871. // Get the index of the dragged element within its parent
  17872. newIndex = _index(dragEl, options.draggable);
  17873. if (newIndex >= 0) {
  17874. // drag & drop within the same list
  17875. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  17876. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  17877. }
  17878. }
  17879. }
  17880. if (Sortable.active) {
  17881. /* jshint eqnull:true */
  17882. if (newIndex == null || newIndex === -1) {
  17883. newIndex = oldIndex;
  17884. }
  17885. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  17886. // Save sorting
  17887. this.save();
  17888. }
  17889. }
  17890. }
  17891. this._nulling();
  17892. },
  17893. _nulling: function() {
  17894. rootEl =
  17895. dragEl =
  17896. parentEl =
  17897. ghostEl =
  17898. nextEl =
  17899. cloneEl =
  17900. lastDownEl =
  17901. scrollEl =
  17902. scrollParentEl =
  17903. tapEvt =
  17904. touchEvt =
  17905. moved =
  17906. newIndex =
  17907. lastEl =
  17908. lastCSS =
  17909. putSortable =
  17910. activeGroup =
  17911. Sortable.active = null;
  17912. savedInputChecked.forEach(function (el) {
  17913. el.checked = true;
  17914. });
  17915. savedInputChecked.length = 0;
  17916. },
  17917. handleEvent: function (/**Event*/evt) {
  17918. switch (evt.type) {
  17919. case 'drop':
  17920. case 'dragend':
  17921. this._onDrop(evt);
  17922. break;
  17923. case 'dragover':
  17924. case 'dragenter':
  17925. if (dragEl) {
  17926. this._onDragOver(evt);
  17927. _globalDragOver(evt);
  17928. }
  17929. break;
  17930. case 'selectstart':
  17931. evt.preventDefault();
  17932. break;
  17933. }
  17934. },
  17935. /**
  17936. * Serializes the item into an array of string.
  17937. * @returns {String[]}
  17938. */
  17939. toArray: function () {
  17940. var order = [],
  17941. el,
  17942. children = this.el.children,
  17943. i = 0,
  17944. n = children.length,
  17945. options = this.options;
  17946. for (; i < n; i++) {
  17947. el = children[i];
  17948. if (_closest(el, options.draggable, this.el)) {
  17949. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  17950. }
  17951. }
  17952. return order;
  17953. },
  17954. /**
  17955. * Sorts the elements according to the array.
  17956. * @param {String[]} order order of the items
  17957. */
  17958. sort: function (order) {
  17959. var items = {}, rootEl = this.el;
  17960. this.toArray().forEach(function (id, i) {
  17961. var el = rootEl.children[i];
  17962. if (_closest(el, this.options.draggable, rootEl)) {
  17963. items[id] = el;
  17964. }
  17965. }, this);
  17966. order.forEach(function (id) {
  17967. if (items[id]) {
  17968. rootEl.removeChild(items[id]);
  17969. rootEl.appendChild(items[id]);
  17970. }
  17971. });
  17972. },
  17973. /**
  17974. * Save the current sorting
  17975. */
  17976. save: function () {
  17977. var store = this.options.store;
  17978. store && store.set(this);
  17979. },
  17980. /**
  17981. * 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.
  17982. * @param {HTMLElement} el
  17983. * @param {String} [selector] default: `options.draggable`
  17984. * @returns {HTMLElement|null}
  17985. */
  17986. closest: function (el, selector) {
  17987. return _closest(el, selector || this.options.draggable, this.el);
  17988. },
  17989. /**
  17990. * Set/get option
  17991. * @param {string} name
  17992. * @param {*} [value]
  17993. * @returns {*}
  17994. */
  17995. option: function (name, value) {
  17996. var options = this.options;
  17997. if (value === void 0) {
  17998. return options[name];
  17999. } else {
  18000. options[name] = value;
  18001. if (name === 'group') {
  18002. _prepareGroup(options);
  18003. }
  18004. }
  18005. },
  18006. /**
  18007. * Destroy
  18008. */
  18009. destroy: function () {
  18010. var el = this.el;
  18011. el[expando] = null;
  18012. _off(el, 'mousedown', this._onTapStart);
  18013. _off(el, 'touchstart', this._onTapStart);
  18014. _off(el, 'pointerdown', this._onTapStart);
  18015. if (this.nativeDraggable) {
  18016. _off(el, 'dragover', this);
  18017. _off(el, 'dragenter', this);
  18018. }
  18019. // Remove draggable attributes
  18020. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  18021. el.removeAttribute('draggable');
  18022. });
  18023. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  18024. this._onDrop();
  18025. this.el = el = null;
  18026. }
  18027. };
  18028. function _cloneHide(sortable, state) {
  18029. if (sortable.lastPullMode !== 'clone') {
  18030. state = true;
  18031. }
  18032. if (cloneEl && (cloneEl.state !== state)) {
  18033. _css(cloneEl, 'display', state ? 'none' : '');
  18034. if (!state) {
  18035. if (cloneEl.state) {
  18036. if (sortable.options.group.revertClone) {
  18037. rootEl.insertBefore(cloneEl, nextEl);
  18038. sortable._animate(dragEl, cloneEl);
  18039. } else {
  18040. rootEl.insertBefore(cloneEl, dragEl);
  18041. }
  18042. }
  18043. }
  18044. cloneEl.state = state;
  18045. }
  18046. }
  18047. function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  18048. if (el) {
  18049. ctx = ctx || document;
  18050. do {
  18051. if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
  18052. return el;
  18053. }
  18054. /* jshint boss:true */
  18055. } while (el = _getParentOrHost(el));
  18056. }
  18057. return null;
  18058. }
  18059. function _getParentOrHost(el) {
  18060. var parent = el.host;
  18061. return (parent && parent.nodeType) ? parent : el.parentNode;
  18062. }
  18063. function _globalDragOver(/**Event*/evt) {
  18064. if (evt.dataTransfer) {
  18065. evt.dataTransfer.dropEffect = 'move';
  18066. }
  18067. evt.preventDefault();
  18068. }
  18069. function _on(el, event, fn) {
  18070. el.addEventListener(event, fn, captureMode);
  18071. }
  18072. function _off(el, event, fn) {
  18073. el.removeEventListener(event, fn, captureMode);
  18074. }
  18075. function _toggleClass(el, name, state) {
  18076. if (el) {
  18077. if (el.classList) {
  18078. el.classList[state ? 'add' : 'remove'](name);
  18079. }
  18080. else {
  18081. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  18082. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  18083. }
  18084. }
  18085. }
  18086. function _css(el, prop, val) {
  18087. var style = el && el.style;
  18088. if (style) {
  18089. if (val === void 0) {
  18090. if (document.defaultView && document.defaultView.getComputedStyle) {
  18091. val = document.defaultView.getComputedStyle(el, '');
  18092. }
  18093. else if (el.currentStyle) {
  18094. val = el.currentStyle;
  18095. }
  18096. return prop === void 0 ? val : val[prop];
  18097. }
  18098. else {
  18099. if (!(prop in style)) {
  18100. prop = '-webkit-' + prop;
  18101. }
  18102. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  18103. }
  18104. }
  18105. }
  18106. function _find(ctx, tagName, iterator) {
  18107. if (ctx) {
  18108. var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
  18109. if (iterator) {
  18110. for (; i < n; i++) {
  18111. iterator(list[i], i);
  18112. }
  18113. }
  18114. return list;
  18115. }
  18116. return [];
  18117. }
  18118. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  18119. sortable = (sortable || rootEl[expando]);
  18120. var evt = document.createEvent('Event'),
  18121. options = sortable.options,
  18122. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  18123. evt.initEvent(name, true, true);
  18124. evt.to = rootEl;
  18125. evt.from = fromEl || rootEl;
  18126. evt.item = targetEl || rootEl;
  18127. evt.clone = cloneEl;
  18128. evt.oldIndex = startIndex;
  18129. evt.newIndex = newIndex;
  18130. rootEl.dispatchEvent(evt);
  18131. if (options[onName]) {
  18132. options[onName].call(sortable, evt);
  18133. }
  18134. }
  18135. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt) {
  18136. var evt,
  18137. sortable = fromEl[expando],
  18138. onMoveFn = sortable.options.onMove,
  18139. retVal;
  18140. evt = document.createEvent('Event');
  18141. evt.initEvent('move', true, true);
  18142. evt.to = toEl;
  18143. evt.from = fromEl;
  18144. evt.dragged = dragEl;
  18145. evt.draggedRect = dragRect;
  18146. evt.related = targetEl || toEl;
  18147. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  18148. fromEl.dispatchEvent(evt);
  18149. if (onMoveFn) {
  18150. retVal = onMoveFn.call(sortable, evt, originalEvt);
  18151. }
  18152. return retVal;
  18153. }
  18154. function _disableDraggable(el) {
  18155. el.draggable = false;
  18156. }
  18157. function _unsilent() {
  18158. _silent = false;
  18159. }
  18160. /** @returns {HTMLElement|false} */
  18161. function _ghostIsLast(el, evt) {
  18162. var lastEl = el.lastElementChild,
  18163. rect = lastEl.getBoundingClientRect();
  18164. // 5 — min delta
  18165. // abs — нельзя добавлять, а то глюки при наведении сверху
  18166. return (
  18167. (evt.clientY - (rect.top + rect.height) > 5) ||
  18168. (evt.clientX - (rect.right + rect.width) > 5)
  18169. ) && lastEl;
  18170. }
  18171. /**
  18172. * Generate id
  18173. * @param {HTMLElement} el
  18174. * @returns {String}
  18175. * @private
  18176. */
  18177. function _generateId(el) {
  18178. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  18179. i = str.length,
  18180. sum = 0;
  18181. while (i--) {
  18182. sum += str.charCodeAt(i);
  18183. }
  18184. return sum.toString(36);
  18185. }
  18186. /**
  18187. * Returns the index of an element within its parent for a selected set of
  18188. * elements
  18189. * @param {HTMLElement} el
  18190. * @param {selector} selector
  18191. * @return {number}
  18192. */
  18193. function _index(el, selector) {
  18194. var index = 0;
  18195. if (!el || !el.parentNode) {
  18196. return -1;
  18197. }
  18198. while (el && (el = el.previousElementSibling)) {
  18199. if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && (selector === '>*' || _matches(el, selector))) {
  18200. index++;
  18201. }
  18202. }
  18203. return index;
  18204. }
  18205. function _matches(/**HTMLElement*/el, /**String*/selector) {
  18206. if (el) {
  18207. selector = selector.split('.');
  18208. var tag = selector.shift().toUpperCase(),
  18209. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  18210. return (
  18211. (tag === '' || el.nodeName.toUpperCase() == tag) &&
  18212. (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
  18213. );
  18214. }
  18215. return false;
  18216. }
  18217. function _throttle(callback, ms) {
  18218. var args, _this;
  18219. return function () {
  18220. if (args === void 0) {
  18221. args = arguments;
  18222. _this = this;
  18223. setTimeout(function () {
  18224. if (args.length === 1) {
  18225. callback.call(_this, args[0]);
  18226. } else {
  18227. callback.apply(_this, args);
  18228. }
  18229. args = void 0;
  18230. }, ms);
  18231. }
  18232. };
  18233. }
  18234. function _extend(dst, src) {
  18235. if (dst && src) {
  18236. for (var key in src) {
  18237. if (src.hasOwnProperty(key)) {
  18238. dst[key] = src[key];
  18239. }
  18240. }
  18241. }
  18242. return dst;
  18243. }
  18244. function _clone(el) {
  18245. return $
  18246. ? $(el).clone(true)[0]
  18247. : (Polymer && Polymer.dom
  18248. ? Polymer.dom(el).cloneNode(true)
  18249. : el.cloneNode(true)
  18250. );
  18251. }
  18252. function _saveInputCheckedState(root) {
  18253. var inputs = root.getElementsByTagName('input');
  18254. var idx = inputs.length;
  18255. while (idx--) {
  18256. var el = inputs[idx];
  18257. el.checked && savedInputChecked.push(el);
  18258. }
  18259. }
  18260. // Fixed #973:
  18261. _on(document, 'touchmove', function (evt) {
  18262. if (Sortable.active) {
  18263. evt.preventDefault();
  18264. }
  18265. });
  18266. try {
  18267. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  18268. get: function () {
  18269. captureMode = {
  18270. capture: false,
  18271. passive: false
  18272. };
  18273. }
  18274. }));
  18275. } catch (err) {}
  18276. // Export utils
  18277. Sortable.utils = {
  18278. on: _on,
  18279. off: _off,
  18280. css: _css,
  18281. find: _find,
  18282. is: function (el, selector) {
  18283. return !!_closest(el, selector, el);
  18284. },
  18285. extend: _extend,
  18286. throttle: _throttle,
  18287. closest: _closest,
  18288. toggleClass: _toggleClass,
  18289. clone: _clone,
  18290. index: _index
  18291. };
  18292. /**
  18293. * Create sortable instance
  18294. * @param {HTMLElement} el
  18295. * @param {Object} [options]
  18296. */
  18297. Sortable.create = function (el, options) {
  18298. return new Sortable(el, options);
  18299. };
  18300. // Export
  18301. Sortable.version = '1.5.1';
  18302. return Sortable;
  18303. });
  18304. /***/ }),
  18305. /* 100 */
  18306. /***/ (function(module, exports) {
  18307. 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=="
  18308. /***/ }),
  18309. /* 101 */
  18310. /***/ (function(module, exports, __webpack_require__) {
  18311. "use strict";
  18312. /**
  18313. * @author oldj
  18314. * @blog https://oldj.net
  18315. */
  18316. /**
  18317. * 将一个 node list 转为数组
  18318. * @param list {NodeList}
  18319. * 参见:http://www.planabc.net/2010/01/06/arguments_to_array/
  18320. */
  18321. module.exports = (list) => {
  18322. let arr
  18323. let length
  18324. try {
  18325. // works in every browser except IE
  18326. arr = [].slice.call(list);
  18327. return arr;
  18328. } catch(err) {
  18329. // slower, but works in IE
  18330. arr = [];
  18331. length = list.length;
  18332. for (let i = 0; i < length; i++) {
  18333. arr.push(list[i]);
  18334. }
  18335. return arr;
  18336. }
  18337. }
  18338. /***/ }),
  18339. /* 102 */
  18340. /***/ (function(module, exports, __webpack_require__) {
  18341. "use strict";
  18342. /**
  18343. * @author oldj
  18344. * @blog http://oldj.net
  18345. */
  18346. Object.defineProperty(exports, "__esModule", {
  18347. value: true
  18348. });
  18349. 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; }; }();
  18350. var _react = __webpack_require__(7);
  18351. var _react2 = _interopRequireDefault(_react);
  18352. var _panel = __webpack_require__(118);
  18353. var _panel2 = _interopRequireDefault(_panel);
  18354. var _content = __webpack_require__(108);
  18355. var _content2 = _interopRequireDefault(_content);
  18356. var _sudo = __webpack_require__(113);
  18357. var _sudo2 = _interopRequireDefault(_sudo);
  18358. var _edit = __webpack_require__(110);
  18359. var _edit2 = _interopRequireDefault(_edit);
  18360. var _preferences = __webpack_require__(112);
  18361. var _preferences2 = _interopRequireDefault(_preferences);
  18362. var _Agent = __webpack_require__(4);
  18363. var _Agent2 = _interopRequireDefault(_Agent);
  18364. var _index = __webpack_require__(30);
  18365. __webpack_require__(229);
  18366. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18367. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18368. 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; }
  18369. 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; }
  18370. var App = function (_React$Component) {
  18371. _inherits(App, _React$Component);
  18372. function App(props) {
  18373. _classCallCheck(this, App);
  18374. var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props));
  18375. _this.state = {
  18376. list: [], // 用户的 hosts 列表
  18377. sys_hosts: {}, // 系统 hosts
  18378. current: {}, // 当前 hosts
  18379. lang: {}, // 语言
  18380. just_added_id: null
  18381. };
  18382. _this.is_dragging = false;
  18383. _this.loadHosts();
  18384. _Agent2.default.pact('getPref').then(function (pref) {
  18385. return pref.user_language || 'en';
  18386. }).then(function (l) {
  18387. _Agent2.default.pact('getLang', l).then(function (lang) {
  18388. _this.setState({ lang: lang });
  18389. });
  18390. });
  18391. (0, _index.reg)(_this);
  18392. _Agent2.default.on('drag_start', function () {
  18393. _this.is_dragging = true;
  18394. console.log('drag_start');
  18395. });
  18396. _Agent2.default.on('drag_end', function () {
  18397. _this.is_dragging = false;
  18398. console.log('drag_end');
  18399. });
  18400. setInterval(function () {
  18401. var list = _this.state.list;
  18402. if (_this.is_dragging || !list || list.length === 0) return;
  18403. console.log('checkNeedRemoteRefresh');
  18404. _Agent2.default.pact('checkNeedRemoteRefresh', list).then(function (list) {
  18405. if (!list) return;
  18406. _Agent2.default.emit('list_updated', list);
  18407. }).catch(function (e) {
  18408. console.log(e);
  18409. });
  18410. }, 60 * 1000);
  18411. return _this;
  18412. }
  18413. _createClass(App, [{
  18414. key: 'loadHosts',
  18415. value: function loadHosts() {
  18416. var _this2 = this;
  18417. _Agent2.default.pact('getHosts').then(function (data) {
  18418. var state = {
  18419. list: data.list,
  18420. sys_hosts: data.sys_hosts
  18421. };
  18422. var current = _this2.state.current;
  18423. state.current = data.list.find(function (item) {
  18424. return item.id === current.id;
  18425. }) || data.sys_hosts;
  18426. _this2.setState(state);
  18427. });
  18428. }
  18429. }, {
  18430. key: 'setCurrent',
  18431. value: function setCurrent(hosts) {
  18432. var _this3 = this;
  18433. if (hosts.is_sys) {
  18434. _Agent2.default.pact('getSysHosts').then(function (_hosts) {
  18435. _this3.setState({
  18436. sys_hosts: _hosts,
  18437. current: _hosts
  18438. });
  18439. });
  18440. } else {
  18441. this.setState({
  18442. current: hosts
  18443. });
  18444. }
  18445. }
  18446. }, {
  18447. key: 'toSave',
  18448. value: function toSave() {
  18449. var _this4 = this;
  18450. clearTimeout(this._t);
  18451. this._t = setTimeout(function () {
  18452. _Agent2.default.emit('save', _this4.state.list);
  18453. }, 1000);
  18454. }
  18455. }, {
  18456. key: 'setHostsContent',
  18457. value: function setHostsContent(v) {
  18458. var _this5 = this;
  18459. if (this.state.current.content === v) return; // not changed
  18460. var current = Object.assign({}, this.state.current, {
  18461. content: v || ''
  18462. });
  18463. var list = this.state.list.slice(0);
  18464. var idx = list.findIndex(function (i) {
  18465. return i.id === current.id;
  18466. });
  18467. if (idx !== -1) {
  18468. list.splice(idx, 1, current);
  18469. }
  18470. this.setState({
  18471. current: current,
  18472. list: list
  18473. }, function () {
  18474. _this5.toSave();
  18475. });
  18476. }
  18477. }, {
  18478. key: 'justAdd',
  18479. value: function justAdd(id) {
  18480. this.setState({
  18481. just_added_id: id
  18482. });
  18483. }
  18484. }, {
  18485. key: 'componentDidMount',
  18486. value: function componentDidMount() {
  18487. window.addEventListener('keydown', function (e) {
  18488. if (e.keyCode === 27) {
  18489. _Agent2.default.emit('esc');
  18490. }
  18491. }, false);
  18492. window.addEventListener('mouseup', function () {
  18493. _Agent2.default.emit('drag_end');
  18494. });
  18495. }
  18496. }, {
  18497. key: 'render',
  18498. value: function render() {
  18499. var current = this.state.current;
  18500. return _react2.default.createElement(
  18501. 'div',
  18502. { id: 'app', className: 'platform-' + _Agent2.default.platform },
  18503. _react2.default.createElement(_panel2.default, {
  18504. list: this.state.list,
  18505. sys_hosts: this.state.sys_hosts,
  18506. current: current,
  18507. setCurrent: this.setCurrent.bind(this),
  18508. lang: this.state.lang,
  18509. just_added_id: this.state.just_added_id,
  18510. justAdd: this.justAdd.bind(this)
  18511. }),
  18512. _react2.default.createElement(_content2.default, {
  18513. current: current,
  18514. readonly: App.isReadOnly(current),
  18515. setHostsContent: this.setHostsContent.bind(this),
  18516. lang: this.state.lang
  18517. }),
  18518. _react2.default.createElement(
  18519. 'div',
  18520. { className: 'frames' },
  18521. _react2.default.createElement(_sudo2.default, { lang: this.state.lang }),
  18522. _react2.default.createElement(_edit2.default, {
  18523. lang: this.state.lang,
  18524. list: this.state.list,
  18525. justAdd: this.justAdd.bind(this)
  18526. }),
  18527. _react2.default.createElement(_preferences2.default, {
  18528. lang: this.state.lang
  18529. })
  18530. )
  18531. );
  18532. }
  18533. }], [{
  18534. key: 'isReadOnly',
  18535. value: function isReadOnly(hosts) {
  18536. return !hosts || hosts.is_sys || hosts.where === 'remote' || hosts.where === 'group';
  18537. }
  18538. }]);
  18539. return App;
  18540. }(_react2.default.Component);
  18541. exports.default = App;
  18542. /***/ }),
  18543. /* 103 */
  18544. /***/ (function(module, exports, __webpack_require__) {
  18545. "use strict";
  18546. module.exports = __webpack_require__(164);
  18547. /***/ }),
  18548. /* 104 */
  18549. /***/ (function(module, exports, __webpack_require__) {
  18550. "use strict";
  18551. /**
  18552. * @author oldj
  18553. * @blog https://oldj.net
  18554. */
  18555. var m_ver = __webpack_require__(69).version;
  18556. module.exports = {
  18557. PORT: 50761,
  18558. version: m_ver.slice(0, 3).join('.'),
  18559. version_full: m_ver.join('.'),
  18560. url_download: 'https://github.com/oldj/SwitchHosts/releases'
  18561. };
  18562. /***/ }),
  18563. /* 105 */
  18564. /***/ (function(module, exports, __webpack_require__) {
  18565. "use strict";
  18566. /**
  18567. * @author oldj
  18568. * @blog https://oldj.net
  18569. */
  18570. module.exports = function (v) {
  18571. return 'v' + v.slice(0, 3).join('.') + (' (' + v[3] + ')');
  18572. };
  18573. /***/ }),
  18574. /* 106 */
  18575. /***/ (function(module, exports, __webpack_require__) {
  18576. "use strict";
  18577. /**
  18578. * @author oldj
  18579. * @blog https://oldj.net
  18580. */
  18581. module.exports = function () {
  18582. return new Date().getTime() + '-' + Math.floor(Math.random() * 1e6);
  18583. };
  18584. /***/ }),
  18585. /* 107 */
  18586. /***/ (function(module, exports, __webpack_require__) {
  18587. "use strict";
  18588. // custom mode
  18589. Object.defineProperty(exports, "__esModule", {
  18590. value: true
  18591. });
  18592. exports.default = function () {
  18593. _codemirror2.default.defineMode('hosts', function () {
  18594. function tokenBase(stream) {
  18595. if (stream.eatSpace()) return null;
  18596. var sol = stream.sol();
  18597. var ch = stream.next();
  18598. var s = stream.string;
  18599. if (ch === '#') {
  18600. stream.skipToEnd();
  18601. return 'comment';
  18602. }
  18603. if (!s.match(/^\s*([\d\.]+|[\da-f:\.%lo]+)\s+\w/i)) {
  18604. return 'error';
  18605. }
  18606. if (sol && ch.match(/[\w\.:%]/)) {
  18607. stream.eatWhile(/[\w\.:%]/);
  18608. return 'ip';
  18609. }
  18610. return null;
  18611. }
  18612. function tokenize(stream, state) {
  18613. return (state.tokens[0] || tokenBase)(stream, state);
  18614. }
  18615. return {
  18616. startState: function startState() {
  18617. return { tokens: [] };
  18618. },
  18619. token: function token(stream, state) {
  18620. return tokenize(stream, state);
  18621. },
  18622. lineComment: '#'
  18623. };
  18624. });
  18625. //CodeMirror.defineMIME('text/x-hosts', 'hosts');
  18626. };
  18627. var _codemirror = __webpack_require__(49);
  18628. var _codemirror2 = _interopRequireDefault(_codemirror);
  18629. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18630. /***/ }),
  18631. /* 108 */
  18632. /***/ (function(module, exports, __webpack_require__) {
  18633. "use strict";
  18634. /**
  18635. * @author oldj
  18636. * @blog https://oldj.net
  18637. */
  18638. Object.defineProperty(exports, "__esModule", {
  18639. value: true
  18640. });
  18641. 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; }; }();
  18642. var _react = __webpack_require__(7);
  18643. var _react2 = _interopRequireDefault(_react);
  18644. var _classnames = __webpack_require__(15);
  18645. var _classnames2 = _interopRequireDefault(_classnames);
  18646. var _editor = __webpack_require__(109);
  18647. var _editor2 = _interopRequireDefault(_editor);
  18648. __webpack_require__(230);
  18649. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18650. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18651. 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; }
  18652. 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; }
  18653. var Content = function (_React$Component) {
  18654. _inherits(Content, _React$Component);
  18655. function Content(props) {
  18656. _classCallCheck(this, Content);
  18657. var _this = _possibleConstructorReturn(this, (Content.__proto__ || Object.getPrototypeOf(Content)).call(this, props));
  18658. _this.state = {
  18659. is_loading: _this.props.current.is_loading
  18660. };
  18661. return _this;
  18662. }
  18663. _createClass(Content, [{
  18664. key: 'setValue',
  18665. value: function setValue(v) {
  18666. this.props.setHostsContent(v);
  18667. }
  18668. }, {
  18669. key: 'render',
  18670. value: function render() {
  18671. var _props = this.props,
  18672. current = _props.current,
  18673. lang = _props.lang;
  18674. return _react2.default.createElement(
  18675. 'div',
  18676. { id: 'sh-content' },
  18677. _react2.default.createElement(
  18678. 'div',
  18679. { className: 'inform' },
  18680. _react2.default.createElement(
  18681. 'span',
  18682. {
  18683. className: (0, _classnames2.default)({
  18684. loading: 1,
  18685. show: this.state.is_loading
  18686. })
  18687. },
  18688. 'loading...'
  18689. ),
  18690. _react2.default.createElement('i', {
  18691. className: (0, _classnames2.default)({
  18692. show: current.where === 'remote',
  18693. iconfont: 1,
  18694. 'icon-earth': 1
  18695. }),
  18696. title: lang.remote_hosts
  18697. }),
  18698. _react2.default.createElement('i', {
  18699. className: (0, _classnames2.default)({
  18700. show: this.props.readonly,
  18701. iconfont: 1,
  18702. 'icon-lock2': 1
  18703. }),
  18704. title: lang.readonly
  18705. })
  18706. ),
  18707. _react2.default.createElement(
  18708. 'div',
  18709. { className: (0, _classnames2.default)({
  18710. errorMessage: 1,
  18711. show: !!this.props.current.error
  18712. }) },
  18713. this.props.current.error
  18714. ),
  18715. _react2.default.createElement(_editor2.default, {
  18716. readonly: this.props.readonly,
  18717. code: this.props.current.content || '',
  18718. setValue: this.setValue.bind(this)
  18719. })
  18720. );
  18721. }
  18722. }]);
  18723. return Content;
  18724. }(_react2.default.Component);
  18725. exports.default = Content;
  18726. /***/ }),
  18727. /* 109 */
  18728. /***/ (function(module, exports, __webpack_require__) {
  18729. "use strict";
  18730. /**
  18731. * @author oldj
  18732. * @blog http://oldj.net
  18733. */
  18734. Object.defineProperty(exports, "__esModule", {
  18735. value: true
  18736. });
  18737. 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; }; }();
  18738. var _react = __webpack_require__(7);
  18739. var _react2 = _interopRequireDefault(_react);
  18740. var _codemirror = __webpack_require__(49);
  18741. var _codemirror2 = _interopRequireDefault(_codemirror);
  18742. __webpack_require__(120);
  18743. var _classnames = __webpack_require__(15);
  18744. var _classnames2 = _interopRequireDefault(_classnames);
  18745. var _kw = __webpack_require__(70);
  18746. var _kw2 = _interopRequireDefault(_kw);
  18747. var _Agent = __webpack_require__(4);
  18748. var _Agent2 = _interopRequireDefault(_Agent);
  18749. __webpack_require__(228);
  18750. __webpack_require__(231);
  18751. var _cm_hl = __webpack_require__(107);
  18752. var _cm_hl2 = _interopRequireDefault(_cm_hl);
  18753. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18754. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18755. 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; }
  18756. 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; }
  18757. // import '../../../node_modules/codemirror/addon/comment/comment'
  18758. (0, _cm_hl2.default)();
  18759. var Editor = function (_React$Component) {
  18760. _inherits(Editor, _React$Component);
  18761. function Editor(props) {
  18762. _classCallCheck(this, Editor);
  18763. var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));
  18764. _this.codemirror = null;
  18765. _this.marks = [];
  18766. _this.kw = '';
  18767. _this.state = {};
  18768. _Agent2.default.on('search', function (kw) {
  18769. _this.kw = kw;
  18770. _this.highlightKeyword();
  18771. });
  18772. return _this;
  18773. }
  18774. _createClass(Editor, [{
  18775. key: 'highlightKeyword',
  18776. value: function highlightKeyword() {
  18777. var _this2 = this;
  18778. while (this.marks.length > 0) {
  18779. this.marks.shift().clear();
  18780. }
  18781. var code = this.props.code;
  18782. var pos = _kw2.default.findPositions(this.kw, code) || [];
  18783. // this.codemirror.markText({line: 6, ch: 16}, {line: 6, ch: 22}, {className: 'cm-hl'});
  18784. pos.map(function (p) {
  18785. _this2.marks.push(_this2.codemirror.markText(p[0], p[1], { className: 'cm-hl' }));
  18786. });
  18787. }
  18788. }, {
  18789. key: 'setValue',
  18790. value: function setValue(v) {
  18791. this.props.setValue(v);
  18792. }
  18793. }, {
  18794. key: 'toComment',
  18795. value: function toComment() {
  18796. var doc = this.codemirror.getDoc();
  18797. var cur = doc.getCursor();
  18798. var line = cur.line;
  18799. var info = doc.lineInfo(line);
  18800. this.codemirror.toggleComment({
  18801. line: line,
  18802. cur: 0
  18803. }, {
  18804. line: line,
  18805. cur: info.text.length
  18806. });
  18807. }
  18808. }, {
  18809. key: 'componentDidMount',
  18810. value: function componentDidMount() {
  18811. var _this3 = this;
  18812. // console.log(this.cnt_node, this.cnt_node.value);
  18813. this.codemirror = _codemirror2.default.fromTextArea(this.cnt_node, {
  18814. lineNumbers: true,
  18815. readOnly: true,
  18816. mode: 'hosts'
  18817. });
  18818. this.codemirror.setSize('100%', '100%');
  18819. this.codemirror.on('change', function (a) {
  18820. var v = a.getDoc().getValue();
  18821. _this3.setValue(v);
  18822. });
  18823. this.codemirror.on('gutterClick', function (cm, n) {
  18824. if (_this3.props.readonly === true) return;
  18825. var info = cm.lineInfo(n);
  18826. //cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker());
  18827. var ln = info.text;
  18828. if (/^\s*$/.test(ln)) return;
  18829. var new_ln = void 0;
  18830. if (/^#/.test(ln)) {
  18831. new_ln = ln.replace(/^#\s*/, '');
  18832. } else {
  18833. new_ln = '# ' + ln;
  18834. }
  18835. _this3.codemirror.getDoc().replaceRange(new_ln, { line: info.line, ch: 0 }, {
  18836. line: info.line,
  18837. ch: ln.length
  18838. });
  18839. //app.caculateHosts();
  18840. });
  18841. _Agent2.default.on('to_comment', function () {
  18842. _this3.toComment();
  18843. });
  18844. }
  18845. }, {
  18846. key: 'componentWillReceiveProps',
  18847. value: function componentWillReceiveProps(next_props) {
  18848. var _this4 = this;
  18849. // console.log(next_props);
  18850. var cm = this.codemirror;
  18851. var v = cm.getDoc().getValue();
  18852. if (v !== next_props.code) {
  18853. cm.getDoc().setValue(next_props.code);
  18854. }
  18855. cm.setOption('readOnly', next_props.readonly);
  18856. setTimeout(function () {
  18857. _this4.highlightKeyword();
  18858. }, 100);
  18859. }
  18860. }, {
  18861. key: 'render',
  18862. value: function render() {
  18863. var _this5 = this;
  18864. return _react2.default.createElement(
  18865. 'div',
  18866. {
  18867. id: 'sh-editor',
  18868. className: (0, _classnames2.default)({
  18869. readonly: this.props.readonly
  18870. }) },
  18871. _react2.default.createElement('textarea', {
  18872. ref: function ref(c) {
  18873. return _this5.cnt_node = c;
  18874. },
  18875. defaultValue: this.props.code || ''
  18876. })
  18877. );
  18878. }
  18879. }]);
  18880. return Editor;
  18881. }(_react2.default.Component);
  18882. exports.default = Editor;
  18883. /***/ }),
  18884. /* 110 */
  18885. /***/ (function(module, exports, __webpack_require__) {
  18886. "use strict";
  18887. /**
  18888. * @author oldj
  18889. * @blog https://oldj.net
  18890. */
  18891. Object.defineProperty(exports, "__esModule", {
  18892. value: true
  18893. });
  18894. 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"); } }; }();
  18895. 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; }; }();
  18896. var _react = __webpack_require__(7);
  18897. var _react2 = _interopRequireDefault(_react);
  18898. var _frame = __webpack_require__(48);
  18899. var _frame2 = _interopRequireDefault(_frame);
  18900. var _classnames = __webpack_require__(15);
  18901. var _classnames2 = _interopRequireDefault(_classnames);
  18902. var _group = __webpack_require__(111);
  18903. var _group2 = _interopRequireDefault(_group);
  18904. var _Agent = __webpack_require__(4);
  18905. var _Agent2 = _interopRequireDefault(_Agent);
  18906. var _makeId = __webpack_require__(106);
  18907. var _makeId2 = _interopRequireDefault(_makeId);
  18908. __webpack_require__(232);
  18909. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18910. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18911. 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; }
  18912. 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; }
  18913. var EditPrompt = function (_React$Component) {
  18914. _inherits(EditPrompt, _React$Component);
  18915. function EditPrompt(props) {
  18916. _classCallCheck(this, EditPrompt);
  18917. var _this = _possibleConstructorReturn(this, (EditPrompt.__proto__ || Object.getPrototypeOf(EditPrompt)).call(this, props));
  18918. _this.state = {
  18919. show: false,
  18920. is_add: true,
  18921. where: 'local',
  18922. title: '',
  18923. url: '',
  18924. last_refresh: null,
  18925. refresh_interval: 0,
  18926. is_loading: false,
  18927. include: []
  18928. };
  18929. _this.current_hosts = null;
  18930. return _this;
  18931. }
  18932. _createClass(EditPrompt, [{
  18933. key: 'tryToFocus',
  18934. value: function tryToFocus() {
  18935. var el = this.refs.body && this.refs.body.querySelector('input[type=text]');
  18936. el && el.focus();
  18937. }
  18938. }, {
  18939. key: 'clear',
  18940. value: function clear() {
  18941. this.setState({
  18942. where: 'local',
  18943. title: '',
  18944. url: '',
  18945. last_refresh: null,
  18946. refresh_interval: 0
  18947. });
  18948. }
  18949. }, {
  18950. key: 'componentDidMount',
  18951. value: function componentDidMount() {
  18952. var _this2 = this;
  18953. _Agent2.default.on('add_hosts', function () {
  18954. _this2.setState({
  18955. show: true,
  18956. is_add: true
  18957. });
  18958. setTimeout(function () {
  18959. _this2.tryToFocus();
  18960. }, 100);
  18961. });
  18962. _Agent2.default.on('edit_hosts', function (hosts) {
  18963. _this2.current_hosts = hosts;
  18964. var include = hosts.include || [];
  18965. include = Array.from(new Set(include));
  18966. _this2.setState({
  18967. id: hosts.id,
  18968. show: true,
  18969. is_add: false,
  18970. where: hosts.where || 'local',
  18971. title: hosts.title || '',
  18972. url: hosts.url || '',
  18973. last_refresh: hosts.last_refresh || null,
  18974. refresh_interval: hosts.refresh_interval || 0,
  18975. include: include
  18976. });
  18977. setTimeout(function () {
  18978. _this2.tryToFocus();
  18979. }, 100);
  18980. });
  18981. _Agent2.default.on('list_updated', function (list) {
  18982. var hosts = list.find(function (i) {
  18983. return i.id === _this2.state.id;
  18984. });
  18985. if (hosts) {
  18986. _this2.current_hosts = hosts;
  18987. _this2.setState({ last_refresh: hosts.last_refresh });
  18988. setTimeout(function () {
  18989. return _this2.setState({ is_loading: false });
  18990. }, 500);
  18991. }
  18992. });
  18993. }
  18994. }, {
  18995. key: 'onOK',
  18996. value: function onOK() {
  18997. this.setState({
  18998. title: (this.state.title || '').replace(/^\s+|\s+$/g, ''),
  18999. url: (this.state.url || '').replace(/^\s+|\s+$/g, '')
  19000. });
  19001. if (this.state.title === '') {
  19002. this.refs.title.focus();
  19003. return false;
  19004. }
  19005. if (this.state.where === 'remote' && this.state.url === '') {
  19006. this.refs.url.focus();
  19007. return false;
  19008. }
  19009. var new_id = (0, _makeId2.default)();
  19010. var data = Object.assign({}, this.current_hosts, this.state, this.state.is_add ? {
  19011. id: new_id,
  19012. content: '# ' + this.state.title,
  19013. on: false
  19014. } : {});
  19015. if (!data.id) data.id = new_id;
  19016. if (this.state.is_add) {
  19017. this.props.justAdd(new_id);
  19018. }
  19019. delete data['is_add'];
  19020. _Agent2.default.emit('update_hosts', data);
  19021. this.setState({
  19022. show: false
  19023. });
  19024. this.clear();
  19025. }
  19026. }, {
  19027. key: 'onCancel',
  19028. value: function onCancel() {
  19029. this.setState({
  19030. show: false
  19031. });
  19032. this.clear();
  19033. }
  19034. }, {
  19035. key: 'confirmDel',
  19036. value: function confirmDel() {
  19037. var lang = this.props.lang;
  19038. if (!confirm(lang.confirm_del)) return;
  19039. _Agent2.default.emit('del_hosts', this.current_hosts);
  19040. this.setState({
  19041. show: false
  19042. });
  19043. this.clear();
  19044. }
  19045. }, {
  19046. key: 'updateInclude',
  19047. value: function updateInclude(include) {
  19048. this.setState({ include: include });
  19049. }
  19050. }, {
  19051. key: 'getRefreshOptions',
  19052. value: function getRefreshOptions() {
  19053. var lang = this.props.lang;
  19054. var k = [[0, '' + lang.never], [1, '1 ' + lang.hour], [24, '24 ' + lang.hours], [168, '7 ' + lang.days]];
  19055. if (_Agent2.default.IS_DEV) {
  19056. k.splice(1, 0, [0.002778, '10s (for DEV)']); // dev test only
  19057. }
  19058. return k.map(function (_ref, idx) {
  19059. var _ref2 = _slicedToArray(_ref, 2),
  19060. v = _ref2[0],
  19061. n = _ref2[1];
  19062. return _react2.default.createElement(
  19063. 'option',
  19064. { value: v, key: idx },
  19065. n
  19066. );
  19067. });
  19068. }
  19069. }, {
  19070. key: 'getEditOperations',
  19071. value: function getEditOperations() {
  19072. if (this.state.is_add) return null;
  19073. var lang = this.props.lang;
  19074. return _react2.default.createElement(
  19075. 'div',
  19076. null,
  19077. _react2.default.createElement(
  19078. 'div',
  19079. { className: 'ln' },
  19080. _react2.default.createElement(
  19081. 'a',
  19082. { href: '#', className: 'del',
  19083. onClick: this.confirmDel.bind(this)
  19084. },
  19085. _react2.default.createElement('i', { className: 'iconfont icon-delete' }),
  19086. _react2.default.createElement(
  19087. 'span',
  19088. null,
  19089. lang.del_hosts
  19090. )
  19091. )
  19092. )
  19093. );
  19094. }
  19095. }, {
  19096. key: 'refresh',
  19097. value: function refresh() {
  19098. if (this.state.is_loading) return;
  19099. _Agent2.default.emit('check_hosts_refresh', this.current_hosts);
  19100. this.setState({
  19101. is_loading: true
  19102. });
  19103. }
  19104. }, {
  19105. key: 'renderGroup',
  19106. value: function renderGroup() {
  19107. if (this.state.where !== 'group') return null;
  19108. return _react2.default.createElement(_group2.default, {
  19109. list: this.props.list,
  19110. include: this.state.include,
  19111. updateInclude: this.updateInclude.bind(this)
  19112. });
  19113. }
  19114. }, {
  19115. key: 'renderRemoteInputs',
  19116. value: function renderRemoteInputs() {
  19117. var _this3 = this;
  19118. if (this.state.where !== 'remote') return null;
  19119. var lang = this.props.lang;
  19120. return _react2.default.createElement(
  19121. 'div',
  19122. { className: 'remote-ipts' },
  19123. _react2.default.createElement(
  19124. 'div',
  19125. { className: 'ln' },
  19126. _react2.default.createElement(
  19127. 'div',
  19128. { className: 'title' },
  19129. lang.url
  19130. ),
  19131. _react2.default.createElement(
  19132. 'div',
  19133. { className: 'cnt' },
  19134. _react2.default.createElement('input', {
  19135. type: 'text',
  19136. ref: 'url',
  19137. value: this.state.url,
  19138. placeholder: 'http://',
  19139. onChange: function onChange(e) {
  19140. return _this3.setState({ url: e.target.value });
  19141. },
  19142. onKeyDown: function onKeyDown(e) {
  19143. return e.keyCode === 13 && _this3.onOK() || e.keyCode === 27 && _this3.onCancel();
  19144. }
  19145. })
  19146. )
  19147. ),
  19148. _react2.default.createElement(
  19149. 'div',
  19150. { className: 'ln' },
  19151. _react2.default.createElement(
  19152. 'div',
  19153. { className: 'title' },
  19154. lang.auto_refresh
  19155. ),
  19156. _react2.default.createElement(
  19157. 'div',
  19158. { className: 'cnt' },
  19159. _react2.default.createElement(
  19160. 'select',
  19161. {
  19162. value: this.state.refresh_interval,
  19163. onChange: function onChange(e) {
  19164. return _this3.setState({ refresh_interval: parseFloat(e.target.value) || 0 });
  19165. }
  19166. },
  19167. this.getRefreshOptions()
  19168. ),
  19169. _react2.default.createElement('i', {
  19170. className: (0, _classnames2.default)({
  19171. iconfont: 1,
  19172. 'icon-refresh': 1,
  19173. 'invisible': !this.current_hosts || this.state.url !== this.current_hosts.url,
  19174. 'loading': this.state.is_loading
  19175. }),
  19176. title: lang.refresh,
  19177. onClick: function onClick() {
  19178. return _this3.refresh();
  19179. }
  19180. }),
  19181. _react2.default.createElement(
  19182. 'span',
  19183. { className: 'last-refresh' },
  19184. lang.last_refresh,
  19185. this.state.last_refresh || 'N/A'
  19186. )
  19187. )
  19188. )
  19189. );
  19190. }
  19191. }, {
  19192. key: 'body',
  19193. value: function body() {
  19194. var _this4 = this;
  19195. var lang = this.props.lang;
  19196. return _react2.default.createElement(
  19197. 'div',
  19198. { ref: 'body' },
  19199. _react2.default.createElement(
  19200. 'div',
  19201. { className: 'ln' },
  19202. _react2.default.createElement('input', { id: 'ipt-local', type: 'radio', name: 'where', value: 'local',
  19203. checked: this.state.where === 'local',
  19204. onChange: function onChange(e) {
  19205. return _this4.setState({ where: e.target.value });
  19206. }
  19207. }),
  19208. _react2.default.createElement(
  19209. 'label',
  19210. { htmlFor: 'ipt-local' },
  19211. lang.where_local
  19212. ),
  19213. _react2.default.createElement('input', { id: 'ipt-remote', type: 'radio', name: 'where', value: 'remote',
  19214. checked: this.state.where === 'remote',
  19215. onChange: function onChange(e) {
  19216. return _this4.setState({ where: e.target.value });
  19217. }
  19218. }),
  19219. _react2.default.createElement(
  19220. 'label',
  19221. { htmlFor: 'ipt-remote' },
  19222. lang.where_remote
  19223. ),
  19224. _react2.default.createElement('input', { id: 'ipt-group', type: 'radio', name: 'where', value: 'group',
  19225. checked: this.state.where === 'group',
  19226. onChange: function onChange(e) {
  19227. return _this4.setState({ where: e.target.value });
  19228. }
  19229. }),
  19230. _react2.default.createElement(
  19231. 'label',
  19232. { htmlFor: 'ipt-group' },
  19233. lang.where_group
  19234. )
  19235. ),
  19236. _react2.default.createElement(
  19237. 'div',
  19238. { className: 'ln' },
  19239. _react2.default.createElement(
  19240. 'div',
  19241. { className: 'title' },
  19242. lang.hosts_title
  19243. ),
  19244. _react2.default.createElement(
  19245. 'div',
  19246. { className: 'cnt' },
  19247. _react2.default.createElement('input', {
  19248. type: 'text',
  19249. ref: 'title',
  19250. name: 'text',
  19251. value: this.state.title,
  19252. onChange: function onChange(e) {
  19253. return _this4.setState({ title: e.target.value });
  19254. },
  19255. onKeyDown: function onKeyDown(e) {
  19256. return e.keyCode === 13 && _this4.onOK() || e.keyCode === 27 && _this4.onCancel();
  19257. }
  19258. })
  19259. )
  19260. ),
  19261. this.renderRemoteInputs(),
  19262. this.renderGroup(),
  19263. this.getEditOperations()
  19264. );
  19265. }
  19266. }, {
  19267. key: 'render',
  19268. value: function render() {
  19269. var _this5 = this;
  19270. var lang = this.props.lang;
  19271. return _react2.default.createElement(_frame2.default, {
  19272. show: this.state.show,
  19273. head: lang[this.state.is_add ? 'add_hosts' : 'edit_hosts'],
  19274. body: this.body(),
  19275. onOK: function onOK() {
  19276. return _this5.onOK();
  19277. },
  19278. onCancel: function onCancel() {
  19279. return _this5.onCancel();
  19280. },
  19281. lang: this.props.lang
  19282. });
  19283. }
  19284. }]);
  19285. return EditPrompt;
  19286. }(_react2.default.Component);
  19287. exports.default = EditPrompt;
  19288. /***/ }),
  19289. /* 111 */
  19290. /***/ (function(module, exports, __webpack_require__) {
  19291. "use strict";
  19292. /**
  19293. * @author oldj
  19294. * @blog https://oldj.net
  19295. */
  19296. Object.defineProperty(exports, "__esModule", {
  19297. value: true
  19298. });
  19299. 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; };
  19300. 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; }; }();
  19301. var _react = __webpack_require__(7);
  19302. var _react2 = _interopRequireDefault(_react);
  19303. var _classnames = __webpack_require__(15);
  19304. var _classnames2 = _interopRequireDefault(_classnames);
  19305. var _sortablejs = __webpack_require__(99);
  19306. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  19307. var _listToArray = __webpack_require__(101);
  19308. var _listToArray2 = _interopRequireDefault(_listToArray);
  19309. __webpack_require__(234);
  19310. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19311. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19312. 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; }
  19313. 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; }
  19314. var Group = function (_React$Component) {
  19315. _inherits(Group, _React$Component);
  19316. function Group(props) {
  19317. _classCallCheck(this, Group);
  19318. var _this = _possibleConstructorReturn(this, (Group.__proto__ || Object.getPrototypeOf(Group)).call(this, props));
  19319. _this.state = {
  19320. list: [],
  19321. include: []
  19322. };
  19323. _this.current_hosts = null;
  19324. _this.ids = [];
  19325. return _this;
  19326. }
  19327. _createClass(Group, [{
  19328. key: 'makeItem',
  19329. value: function makeItem(item) {
  19330. if (!item) {
  19331. return null;
  19332. }
  19333. var attrs = {
  19334. 'data-id': item.id || ''
  19335. };
  19336. return _react2.default.createElement(
  19337. 'div',
  19338. _extends({ className: 'hosts-item' }, attrs),
  19339. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  19340. 'iconfont': 1,
  19341. 'item-icon': 1,
  19342. 'icon-file': item.where !== 'group',
  19343. 'icon-files': item.where === 'group'
  19344. })
  19345. }),
  19346. _react2.default.createElement(
  19347. 'span',
  19348. null,
  19349. item.title || 'untitled'
  19350. )
  19351. );
  19352. }
  19353. }, {
  19354. key: 'makeList',
  19355. value: function makeList() {
  19356. var _this2 = this;
  19357. var include = this.state.include;
  19358. var items = this.state.list.filter(function (item) {
  19359. return item.where !== 'group' && !include.includes(item.id);
  19360. }).map(function (item) {
  19361. return _this2.makeItem(item);
  19362. });
  19363. return _react2.default.createElement(
  19364. 'div',
  19365. { id: 'hosts-group-valid' },
  19366. _react2.default.createElement(
  19367. 'div',
  19368. { ref: 'group_valid', className: 'hosts-group-list' },
  19369. items
  19370. )
  19371. );
  19372. }
  19373. }, {
  19374. key: 'currentList',
  19375. value: function currentList() {
  19376. var _this3 = this;
  19377. var list = this.state.list;
  19378. var items = this.state.include.map(function (id) {
  19379. return list.find(function (item) {
  19380. return item.id === id;
  19381. });
  19382. }).map(function (item) {
  19383. return _this3.makeItem(item);
  19384. });
  19385. return _react2.default.createElement(
  19386. 'div',
  19387. { id: 'hosts-group-current' },
  19388. _react2.default.createElement(
  19389. 'div',
  19390. { ref: 'group_current', className: 'hosts-group-list' },
  19391. items
  19392. )
  19393. );
  19394. }
  19395. }, {
  19396. key: 'getCurrentListFromDOM',
  19397. value: function getCurrentListFromDOM() {
  19398. var updateInclude = this.props.updateInclude;
  19399. var nodes = this.refs.group_current.getElementsByClassName('hosts-item');
  19400. nodes = (0, _listToArray2.default)(nodes);
  19401. var ids = nodes.map(function (item) {
  19402. return item.getAttribute('data-id');
  19403. });
  19404. this.ids = ids;
  19405. updateInclude(ids);
  19406. }
  19407. }, {
  19408. key: 'componentWillMount',
  19409. value: function componentWillMount() {
  19410. this.setState({
  19411. list: this.props.list,
  19412. include: this.props.include
  19413. });
  19414. }
  19415. }, {
  19416. key: 'componentDidMount',
  19417. value: function componentDidMount() {
  19418. var _this4 = this;
  19419. _sortablejs2.default.create(this.refs.group_valid, {
  19420. group: 'sorting',
  19421. animation: 150,
  19422. sort: false
  19423. });
  19424. _sortablejs2.default.create(this.refs.group_current, {
  19425. group: 'sorting',
  19426. animation: 150,
  19427. sort: true,
  19428. onSort: function onSort() {
  19429. _this4.getCurrentListFromDOM();
  19430. }
  19431. });
  19432. }
  19433. }, {
  19434. key: 'render',
  19435. value: function render() {
  19436. return _react2.default.createElement(
  19437. 'div',
  19438. { id: 'hosts-group' },
  19439. this.makeList(),
  19440. _react2.default.createElement('div', { className: 'arrow' }),
  19441. this.currentList()
  19442. );
  19443. }
  19444. }]);
  19445. return Group;
  19446. }(_react2.default.Component);
  19447. exports.default = Group;
  19448. /***/ }),
  19449. /* 112 */
  19450. /***/ (function(module, exports, __webpack_require__) {
  19451. "use strict";
  19452. /**
  19453. * @author oldj
  19454. * @blog http://oldj.net
  19455. */
  19456. Object.defineProperty(exports, "__esModule", {
  19457. value: true
  19458. });
  19459. 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; }; }();
  19460. var _react = __webpack_require__(7);
  19461. var _react2 = _interopRequireDefault(_react);
  19462. var _frame = __webpack_require__(48);
  19463. var _frame2 = _interopRequireDefault(_frame);
  19464. var _classnames = __webpack_require__(15);
  19465. var _classnames2 = _interopRequireDefault(_classnames);
  19466. var _Agent = __webpack_require__(4);
  19467. var _Agent2 = _interopRequireDefault(_Agent);
  19468. var _version = __webpack_require__(69);
  19469. var _formatVersion = __webpack_require__(105);
  19470. var _formatVersion2 = _interopRequireDefault(_formatVersion);
  19471. __webpack_require__(235);
  19472. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19473. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19474. 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; }
  19475. 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; }
  19476. var pref_keys = ['after_cmd', 'auto_launch', 'choice_mode', 'hide_at_launch', 'is_dock_icon_hidden', 'user_language'];
  19477. var PreferencesPrompt = function (_React$Component) {
  19478. _inherits(PreferencesPrompt, _React$Component);
  19479. function PreferencesPrompt(props) {
  19480. _classCallCheck(this, PreferencesPrompt);
  19481. var _this = _possibleConstructorReturn(this, (PreferencesPrompt.__proto__ || Object.getPrototypeOf(PreferencesPrompt)).call(this, props));
  19482. _this.state = {
  19483. show: false,
  19484. user_language: '',
  19485. after_cmd: '',
  19486. choice_mode: 'multiple',
  19487. auto_launch: false,
  19488. hide_at_launch: false,
  19489. lang_list: [],
  19490. update_found: false // 发现新版本
  19491. };
  19492. _Agent2.default.pact('getLangList').then(function (lang_list) {
  19493. return _this.setState({ lang_list: lang_list });
  19494. });
  19495. return _this;
  19496. }
  19497. _createClass(PreferencesPrompt, [{
  19498. key: 'componentDidMount',
  19499. value: function componentDidMount() {
  19500. var _this2 = this;
  19501. _Agent2.default.on('show_preferences', function () {
  19502. _Agent2.default.pact('getPref').then(function (pref) {
  19503. _this2.setState(Object.assign({}, pref, { show: true }));
  19504. });
  19505. });
  19506. _Agent2.default.on('update_found', function (v) {
  19507. console.log(v);
  19508. _this2.setState({
  19509. update_found: true
  19510. });
  19511. });
  19512. }
  19513. }, {
  19514. key: 'onOK',
  19515. value: function onOK() {
  19516. var _this3 = this;
  19517. this.setState({
  19518. show: false
  19519. }, function () {
  19520. var prefs = {};
  19521. var d = _this3.state;
  19522. pref_keys.map(function (k) {
  19523. if (d.hasOwnProperty(k)) {
  19524. prefs[k] = d[k];
  19525. }
  19526. });
  19527. _Agent2.default.pact('setPref', prefs).then(function () {
  19528. setTimeout(function () {
  19529. _Agent2.default.pact('relaunch');
  19530. }, 200);
  19531. });
  19532. });
  19533. }
  19534. }, {
  19535. key: 'onCancel',
  19536. value: function onCancel() {
  19537. this.setState({
  19538. show: false
  19539. });
  19540. }
  19541. }, {
  19542. key: 'getLanguageOptions',
  19543. value: function getLanguageOptions() {
  19544. return this.state.lang_list.map(function (_ref, idx) {
  19545. var key = _ref.key,
  19546. name = _ref.name;
  19547. return _react2.default.createElement(
  19548. 'option',
  19549. { value: key, key: idx },
  19550. name
  19551. );
  19552. });
  19553. }
  19554. }, {
  19555. key: 'updateLangKey',
  19556. value: function updateLangKey(v) {
  19557. this.setState({ user_language: v });
  19558. }
  19559. }, {
  19560. key: 'updateChoiceMode',
  19561. value: function updateChoiceMode(v) {
  19562. this.setState({
  19563. choice_mode: v
  19564. });
  19565. }
  19566. }, {
  19567. key: 'updateAfterCmd',
  19568. value: function updateAfterCmd(v) {
  19569. this.setState({
  19570. after_cmd: v
  19571. });
  19572. }
  19573. }, {
  19574. key: 'updateAutoLaunch',
  19575. value: function updateAutoLaunch(v) {
  19576. this.setState({
  19577. auto_launch: v
  19578. });
  19579. // todo set auto launch
  19580. }
  19581. }, {
  19582. key: 'updateMinimizeAtLaunch',
  19583. value: function updateMinimizeAtLaunch(v) {
  19584. this.setState({
  19585. hide_at_launch: v
  19586. });
  19587. }
  19588. }, {
  19589. key: 'prefLanguage',
  19590. value: function prefLanguage() {
  19591. var _this4 = this;
  19592. var lang = this.props.lang;
  19593. return _react2.default.createElement(
  19594. 'div',
  19595. { className: 'ln' },
  19596. _react2.default.createElement(
  19597. 'div',
  19598. { className: 'title' },
  19599. lang.language
  19600. ),
  19601. _react2.default.createElement(
  19602. 'div',
  19603. { className: 'cnt' },
  19604. _react2.default.createElement(
  19605. 'select',
  19606. {
  19607. value: this.state.user_language || '',
  19608. onChange: function onChange(e) {
  19609. return _this4.updateLangKey(e.target.value);
  19610. }
  19611. },
  19612. this.getLanguageOptions()
  19613. ),
  19614. _react2.default.createElement(
  19615. 'div',
  19616. {
  19617. className: 'inform' },
  19618. lang.should_restart_after_change_language
  19619. )
  19620. )
  19621. );
  19622. }
  19623. }, {
  19624. key: 'prefChoiceMode',
  19625. value: function prefChoiceMode() {
  19626. var _this5 = this;
  19627. var lang = this.props.lang;
  19628. return _react2.default.createElement(
  19629. 'div',
  19630. { className: 'ln' },
  19631. _react2.default.createElement(
  19632. 'div',
  19633. { className: 'title' },
  19634. lang.pref_choice_mode
  19635. ),
  19636. _react2.default.createElement(
  19637. 'div',
  19638. { className: 'cnt' },
  19639. _react2.default.createElement('input', { type: 'radio', id: 'pref-choice-mode-single', name: 'choice_mode',
  19640. value: 'single',
  19641. defaultChecked: this.state.choice_mode === 'single',
  19642. onChange: function onChange(e) {
  19643. return _this5.updateChoiceMode(e.target.value);
  19644. }
  19645. }),
  19646. _react2.default.createElement(
  19647. 'label',
  19648. {
  19649. htmlFor: 'pref-choice-mode-single' },
  19650. lang.pref_choice_mode_single
  19651. ),
  19652. _react2.default.createElement('input', { type: 'radio', id: 'pref-choice-mode-multiple', name: 'choice_mode',
  19653. value: 'multiple',
  19654. defaultChecked: this.state.choice_mode === 'multiple',
  19655. onChange: function onChange(e) {
  19656. return _this5.updateChoiceMode(e.target.value);
  19657. }
  19658. }),
  19659. _react2.default.createElement(
  19660. 'label',
  19661. {
  19662. htmlFor: 'pref-choice-mode-multiple' },
  19663. lang.pref_choice_mode_multiple
  19664. )
  19665. )
  19666. );
  19667. }
  19668. }, {
  19669. key: 'prefAfterCmd',
  19670. value: function prefAfterCmd() {
  19671. var _this6 = this;
  19672. var lang = this.props.lang;
  19673. return _react2.default.createElement(
  19674. 'div',
  19675. { className: 'ln' },
  19676. _react2.default.createElement(
  19677. 'div',
  19678. { className: 'title' },
  19679. lang.pref_after_cmd
  19680. ),
  19681. _react2.default.createElement(
  19682. 'div',
  19683. { className: 'cnt' },
  19684. _react2.default.createElement(
  19685. 'div',
  19686. { className: 'inform' },
  19687. lang.pref_after_cmd_info
  19688. ),
  19689. _react2.default.createElement('textarea', {
  19690. name: '',
  19691. defaultValue: this.state.after_cmd,
  19692. placeholder: lang.pref_after_cmd_placeholder,
  19693. onChange: function onChange(e) {
  19694. return _this6.updateAfterCmd(e.target.value);
  19695. }
  19696. })
  19697. )
  19698. );
  19699. }
  19700. }, {
  19701. key: 'prefAutoLaunch',
  19702. value: function prefAutoLaunch() {
  19703. var _this7 = this;
  19704. var lang = this.props.lang;
  19705. return _react2.default.createElement(
  19706. 'div',
  19707. { className: 'ln' },
  19708. _react2.default.createElement(
  19709. 'div',
  19710. { className: 'title' },
  19711. lang.auto_launch
  19712. ),
  19713. _react2.default.createElement(
  19714. 'div',
  19715. { className: 'cnt' },
  19716. _react2.default.createElement('input', { type: 'checkbox', name: '',
  19717. defaultChecked: this.state.auto_launch,
  19718. onChange: function onChange(e) {
  19719. return _this7.updateAutoLaunch(e.target.checked);
  19720. }
  19721. })
  19722. )
  19723. );
  19724. }
  19725. }, {
  19726. key: 'prefMinimizeAtLaunch',
  19727. value: function prefMinimizeAtLaunch() {
  19728. var _this8 = this;
  19729. var lang = this.props.lang;
  19730. return _react2.default.createElement(
  19731. 'div',
  19732. { className: 'ln' },
  19733. _react2.default.createElement(
  19734. 'div',
  19735. { className: 'title' },
  19736. lang.hide_at_launch
  19737. ),
  19738. _react2.default.createElement(
  19739. 'div',
  19740. { className: 'cnt' },
  19741. _react2.default.createElement('input', { type: 'checkbox', name: '',
  19742. defaultChecked: this.state.hide_at_launch,
  19743. onChange: function onChange(e) {
  19744. return _this8.updateMinimizeAtLaunch(e.target.checked);
  19745. }
  19746. })
  19747. )
  19748. );
  19749. }
  19750. }, {
  19751. key: 'body',
  19752. value: function body() {
  19753. return _react2.default.createElement(
  19754. 'div',
  19755. { ref: 'body' },
  19756. _react2.default.createElement(
  19757. 'div',
  19758. {
  19759. className: (0, _classnames2.default)('current-version', { 'update-found': this.state.update_found }) },
  19760. _react2.default.createElement(
  19761. 'a',
  19762. { href: '#',
  19763. onClick: PreferencesPrompt.openDownloadPage },
  19764. (0, _formatVersion2.default)(_version.version)
  19765. )
  19766. ),
  19767. this.prefLanguage(),
  19768. this.prefChoiceMode(),
  19769. this.prefAfterCmd(),
  19770. this.prefMinimizeAtLaunch()
  19771. );
  19772. }
  19773. }, {
  19774. key: 'render',
  19775. value: function render() {
  19776. var _this9 = this;
  19777. var lang = this.props.lang;
  19778. return _react2.default.createElement(_frame2.default, {
  19779. show: this.state.show,
  19780. head: lang.preferences,
  19781. body: this.body(),
  19782. onOK: function onOK() {
  19783. return _this9.onOK();
  19784. },
  19785. onCancel: function onCancel() {
  19786. return _this9.onCancel();
  19787. },
  19788. cancel_title: lang.cancel,
  19789. ok_title: lang.set_and_relaunch_app
  19790. });
  19791. }
  19792. }], [{
  19793. key: 'openDownloadPage',
  19794. value: function openDownloadPage() {
  19795. _Agent2.default.pact('openUrl', __webpack_require__(104).url_download);
  19796. }
  19797. }]);
  19798. return PreferencesPrompt;
  19799. }(_react2.default.Component);
  19800. exports.default = PreferencesPrompt;
  19801. /***/ }),
  19802. /* 113 */
  19803. /***/ (function(module, exports, __webpack_require__) {
  19804. "use strict";
  19805. /**
  19806. * @author oldj
  19807. * @blog http://oldj.net
  19808. */
  19809. Object.defineProperty(exports, "__esModule", {
  19810. value: true
  19811. });
  19812. 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; }; }();
  19813. var _react = __webpack_require__(7);
  19814. var _react2 = _interopRequireDefault(_react);
  19815. var _Agent = __webpack_require__(4);
  19816. var _Agent2 = _interopRequireDefault(_Agent);
  19817. var _frame = __webpack_require__(48);
  19818. var _frame2 = _interopRequireDefault(_frame);
  19819. __webpack_require__(236);
  19820. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19821. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19822. 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; }
  19823. 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; }
  19824. var SudoPrompt = function (_React$Component) {
  19825. _inherits(SudoPrompt, _React$Component);
  19826. function SudoPrompt(props) {
  19827. _classCallCheck(this, SudoPrompt);
  19828. var _this = _possibleConstructorReturn(this, (SudoPrompt.__proto__ || Object.getPrototypeOf(SudoPrompt)).call(this, props));
  19829. _this.onSuccess = null;
  19830. _this.state = {
  19831. show: false,
  19832. pswd: ''
  19833. };
  19834. return _this;
  19835. }
  19836. _createClass(SudoPrompt, [{
  19837. key: 'componentDidMount',
  19838. value: function componentDidMount() {
  19839. var _this2 = this;
  19840. _Agent2.default.on('sudo_prompt', function (success) {
  19841. _this2.setState({ show: true });
  19842. _this2.onSuccess = success;
  19843. setTimeout(function () {
  19844. var el = _this2.refs.body;
  19845. el && el.querySelector('input').focus();
  19846. }, 100);
  19847. });
  19848. }
  19849. }, {
  19850. key: 'onOK',
  19851. value: function onOK() {
  19852. var pswd = this.refs.pswd.value;
  19853. if (!pswd) {
  19854. var el = this.refs.body;
  19855. el && el.querySelector('input').focus();
  19856. return;
  19857. }
  19858. this.setState({
  19859. show: false,
  19860. pswd: pswd
  19861. });
  19862. _Agent2.default.emit('sudo_pswd', pswd);
  19863. if (typeof this.onSuccess === 'function') {
  19864. this.onSuccess(pswd);
  19865. }
  19866. this.onSuccess = null;
  19867. }
  19868. }, {
  19869. key: 'onCancel',
  19870. value: function onCancel() {
  19871. _Agent2.default.emit('sudo_cancel');
  19872. this.setState({
  19873. show: false
  19874. });
  19875. this.onSuccess = null;
  19876. }
  19877. }, {
  19878. key: 'body',
  19879. value: function body() {
  19880. var _this3 = this;
  19881. var lang = this.props.lang;
  19882. return _react2.default.createElement(
  19883. 'div',
  19884. { ref: 'body' },
  19885. _react2.default.createElement(
  19886. 'div',
  19887. { className: 'ln' },
  19888. _react2.default.createElement(
  19889. 'div',
  19890. { className: 'title' },
  19891. lang.sudo_pswd
  19892. ),
  19893. _react2.default.createElement(
  19894. 'div',
  19895. { className: 'cnt' },
  19896. _react2.default.createElement('input', {
  19897. type: 'password',
  19898. ref: 'pswd',
  19899. onKeyDown: function onKeyDown(e) {
  19900. return e.keyCode === 13 && _this3.onOK() || e.keyCode === 27 && _this3.onCancel();
  19901. }
  19902. })
  19903. )
  19904. )
  19905. );
  19906. }
  19907. }, {
  19908. key: 'render',
  19909. value: function render() {
  19910. var _this4 = this;
  19911. var lang = this.props.lang;
  19912. return _react2.default.createElement(_frame2.default, {
  19913. show: this.state.show,
  19914. head: lang.input_sudo_pswd,
  19915. body: this.body(),
  19916. onOK: function onOK() {
  19917. return _this4.onOK();
  19918. },
  19919. onCancel: function onCancel() {
  19920. return _this4.onCancel();
  19921. },
  19922. lang: lang
  19923. });
  19924. }
  19925. }]);
  19926. return SudoPrompt;
  19927. }(_react2.default.Component);
  19928. exports.default = SudoPrompt;
  19929. /***/ }),
  19930. /* 114 */
  19931. /***/ (function(module, exports, __webpack_require__) {
  19932. "use strict";
  19933. /**
  19934. * @author oldj
  19935. * @blog http://oldj.net
  19936. */
  19937. var _react = __webpack_require__(7);
  19938. var _react2 = _interopRequireDefault(_react);
  19939. var _reactDom = __webpack_require__(103);
  19940. var _reactDom2 = _interopRequireDefault(_reactDom);
  19941. var _app = __webpack_require__(102);
  19942. var _app2 = _interopRequireDefault(_app);
  19943. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19944. _reactDom2.default.render(_react2.default.createElement(_app2.default, null), document.getElementById('app'));
  19945. /***/ }),
  19946. /* 115 */
  19947. /***/ (function(module, exports, __webpack_require__) {
  19948. "use strict";
  19949. /**
  19950. * @author oldj
  19951. * @blog https://oldj.net
  19952. */
  19953. Object.defineProperty(exports, "__esModule", {
  19954. value: true
  19955. });
  19956. 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; }; }();
  19957. var _react = __webpack_require__(7);
  19958. var _react2 = _interopRequireDefault(_react);
  19959. var _classnames = __webpack_require__(15);
  19960. var _classnames2 = _interopRequireDefault(_classnames);
  19961. var _Agent = __webpack_require__(4);
  19962. var _Agent2 = _interopRequireDefault(_Agent);
  19963. __webpack_require__(237);
  19964. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19965. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19966. 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; }
  19967. 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; }
  19968. var Buttons = function (_React$Component) {
  19969. _inherits(Buttons, _React$Component);
  19970. function Buttons(props) {
  19971. _classCallCheck(this, Buttons);
  19972. var _this = _possibleConstructorReturn(this, (Buttons.__proto__ || Object.getPrototypeOf(Buttons)).call(this, props));
  19973. _this.state = {
  19974. top_toggle_on: true,
  19975. search_on: false
  19976. };
  19977. _this.on_ids = [];
  19978. return _this;
  19979. }
  19980. _createClass(Buttons, [{
  19981. key: 'btnToggle',
  19982. value: function btnToggle() {
  19983. var _this2 = this;
  19984. var doToggle = function doToggle() {
  19985. var on = !_this2.state.top_toggle_on;
  19986. _Agent2.default.emit('top_toggle', on, _this2.on_ids, function (e) {
  19987. if (e) {
  19988. console.log(e);
  19989. return;
  19990. }
  19991. _this2.setState({
  19992. top_toggle_on: on
  19993. }, function () {
  19994. if (_this2.state.top_toggle_on) {
  19995. _this2.on_ids = [];
  19996. }
  19997. });
  19998. });
  19999. };
  20000. if (this.state.top_toggle_on) {
  20001. _Agent2.default.emit('get_on_hosts', function (ids) {
  20002. _this2.on_ids = ids;
  20003. doToggle();
  20004. });
  20005. } else {
  20006. doToggle();
  20007. }
  20008. }
  20009. }, {
  20010. key: 'btnSearch',
  20011. value: function btnSearch() {
  20012. var _this3 = this;
  20013. this.setState({
  20014. search_on: !this.state.search_on
  20015. }, function () {
  20016. _Agent2.default.emit(_this3.state.search_on ? 'search_on' : 'search_off');
  20017. });
  20018. }
  20019. }, {
  20020. key: 'cancelSearch',
  20021. value: function cancelSearch() {
  20022. this.setState({
  20023. search_on: false
  20024. }, function () {
  20025. _Agent2.default.emit('search_off');
  20026. });
  20027. }
  20028. }, {
  20029. key: 'componentDidMount',
  20030. value: function componentDidMount() {
  20031. var _this4 = this;
  20032. _Agent2.default.on('to_search', function () {
  20033. _this4.btnSearch();
  20034. });
  20035. _Agent2.default.on('esc', function () {
  20036. if (_this4.state.search_on) {
  20037. _this4.btnSearch();
  20038. }
  20039. });
  20040. }
  20041. }, {
  20042. key: 'render',
  20043. value: function render() {
  20044. var _this5 = this;
  20045. return _react2.default.createElement(
  20046. 'div',
  20047. { id: 'sh-buttons' },
  20048. _react2.default.createElement(
  20049. 'div',
  20050. { className: 'left' },
  20051. _react2.default.createElement(
  20052. 'a',
  20053. {
  20054. className: 'btn-add',
  20055. href: '#',
  20056. onClick: function onClick() {
  20057. return Buttons.btnAdd();
  20058. }
  20059. },
  20060. '+'
  20061. )
  20062. ),
  20063. _react2.default.createElement(
  20064. 'div',
  20065. { className: 'right' },
  20066. _react2.default.createElement('i', {
  20067. className: (0, _classnames2.default)({
  20068. iconfont: 1,
  20069. 'icon-search': 1,
  20070. 'on': this.state.search_on
  20071. }),
  20072. onClick: function onClick() {
  20073. return _this5.btnSearch();
  20074. }
  20075. }),
  20076. _react2.default.createElement('i', {
  20077. className: (0, _classnames2.default)({
  20078. iconfont: 1,
  20079. 'icon-switchon': this.state.top_toggle_on,
  20080. 'icon-switchoff': !this.state.top_toggle_on
  20081. }),
  20082. onClick: function onClick() {
  20083. return _this5.btnToggle();
  20084. }
  20085. })
  20086. )
  20087. );
  20088. }
  20089. }], [{
  20090. key: 'btnAdd',
  20091. value: function btnAdd() {
  20092. _Agent2.default.emit('add_hosts');
  20093. }
  20094. }]);
  20095. return Buttons;
  20096. }(_react2.default.Component);
  20097. exports.default = Buttons;
  20098. /***/ }),
  20099. /* 116 */
  20100. /***/ (function(module, exports, __webpack_require__) {
  20101. "use strict";
  20102. /**
  20103. * @author oldj
  20104. * @blog https://oldj.net
  20105. */
  20106. Object.defineProperty(exports, "__esModule", {
  20107. value: true
  20108. });
  20109. 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; };
  20110. 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; }; }();
  20111. var _react = __webpack_require__(7);
  20112. var _react2 = _interopRequireDefault(_react);
  20113. var _classnames = __webpack_require__(15);
  20114. var _classnames2 = _interopRequireDefault(_classnames);
  20115. var _Agent = __webpack_require__(4);
  20116. var _Agent2 = _interopRequireDefault(_Agent);
  20117. var _isInViewport = __webpack_require__(245);
  20118. var _isInViewport2 = _interopRequireDefault(_isInViewport);
  20119. __webpack_require__(238);
  20120. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20121. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20122. 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; }
  20123. 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; }
  20124. var ListItem = function (_React$Component) {
  20125. _inherits(ListItem, _React$Component);
  20126. function ListItem(props) {
  20127. _classCallCheck(this, ListItem);
  20128. var _this = _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).call(this, props));
  20129. _this.is_sys = !!_this.props.sys;
  20130. _this.state = {};
  20131. return _this;
  20132. }
  20133. _createClass(ListItem, [{
  20134. key: 'getTitle',
  20135. value: function getTitle() {
  20136. var lang = this.props.lang;
  20137. return this.is_sys ? lang.sys_hosts_title : this.props.data.title || lang.untitled;
  20138. }
  20139. }, {
  20140. key: 'beSelected',
  20141. value: function beSelected() {
  20142. this.props.setCurrent(this.props.data);
  20143. }
  20144. }, {
  20145. key: 'toggle',
  20146. value: function toggle() {
  20147. _Agent2.default.emit('toggle_hosts', Object.assign({}, this.props.data));
  20148. }
  20149. }, {
  20150. key: 'toEdit',
  20151. value: function toEdit() {
  20152. _Agent2.default.emit('edit_hosts', Object.assign({}, this.props.data));
  20153. }
  20154. }, {
  20155. key: 'componentDidMount',
  20156. value: function componentDidMount() {
  20157. var _props = this.props,
  20158. just_added_id = _props.just_added_id,
  20159. data = _props.data;
  20160. //Agent.on('select_hosts', id => {
  20161. // if (id && id === this.props.data.id) {
  20162. // this.beSelected()
  20163. // this.el && this.el.scrollIntoView()
  20164. // }
  20165. //})
  20166. if (!this.el) {
  20167. return;
  20168. }
  20169. var el = this.el;
  20170. if (just_added_id === data.id && !(0, _isInViewport2.default)(el)) {
  20171. el.scrollIntoView();
  20172. this.props.justAdd(null);
  20173. }
  20174. }
  20175. }, {
  20176. key: 'render',
  20177. value: function render() {
  20178. var _this2 = this;
  20179. var _props2 = this.props,
  20180. data = _props2.data,
  20181. sys = _props2.sys,
  20182. current = _props2.current,
  20183. show = _props2.show;
  20184. if (!data) return null;
  20185. var is_selected = data.id === current.id || data.is_sys && current.is_sys;
  20186. var attrs = {
  20187. 'data-id': data.id || ''
  20188. };
  20189. return _react2.default.createElement(
  20190. 'div',
  20191. _extends({ className: (0, _classnames2.default)({
  20192. 'list-item': 1
  20193. //, 'hidden': !this.isMatched()
  20194. , 'sys-hosts': sys,
  20195. 'selected': is_selected,
  20196. 'hidden': show === false
  20197. }),
  20198. onClick: this.beSelected.bind(this),
  20199. ref: function ref(el) {
  20200. return _this2.el = el;
  20201. }
  20202. }, attrs),
  20203. sys ? null : _react2.default.createElement(
  20204. 'div',
  20205. { className: 'item-buttons' },
  20206. _react2.default.createElement('i', {
  20207. className: 'iconfont icon-edit',
  20208. onClick: this.toEdit.bind(this)
  20209. }),
  20210. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  20211. 'switch': 1,
  20212. 'iconfont': 1,
  20213. 'icon-on': data.on,
  20214. 'icon-off': !data.on
  20215. }),
  20216. onClick: this.toggle.bind(this)
  20217. })
  20218. ),
  20219. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  20220. 'iconfont': 1,
  20221. 'item-icon': 1,
  20222. 'icon-warn': !!data.error,
  20223. 'icon-file': !sys && !data.error && data.where !== 'group',
  20224. 'icon-files': data.where === 'group',
  20225. 'icon-sysserver': sys && !data.error
  20226. }),
  20227. title: data.error || ''
  20228. }),
  20229. _react2.default.createElement(
  20230. 'span',
  20231. null,
  20232. this.getTitle()
  20233. )
  20234. );
  20235. }
  20236. }]);
  20237. return ListItem;
  20238. }(_react2.default.Component);
  20239. exports.default = ListItem;
  20240. /***/ }),
  20241. /* 117 */
  20242. /***/ (function(module, exports, __webpack_require__) {
  20243. "use strict";
  20244. /**
  20245. * @author oldj
  20246. * @blog https://oldj.net
  20247. */
  20248. Object.defineProperty(exports, "__esModule", {
  20249. value: true
  20250. });
  20251. 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; };
  20252. 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; }; }();
  20253. var _react = __webpack_require__(7);
  20254. var _react2 = _interopRequireDefault(_react);
  20255. var _listItem = __webpack_require__(116);
  20256. var _listItem2 = _interopRequireDefault(_listItem);
  20257. var _sortablejs = __webpack_require__(99);
  20258. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  20259. var _listToArray = __webpack_require__(101);
  20260. var _listToArray2 = _interopRequireDefault(_listToArray);
  20261. var _Agent = __webpack_require__(4);
  20262. var _Agent2 = _interopRequireDefault(_Agent);
  20263. var _kw = __webpack_require__(70);
  20264. __webpack_require__(239);
  20265. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20266. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20267. 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; }
  20268. 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; }
  20269. var List = function (_React$Component) {
  20270. _inherits(List, _React$Component);
  20271. function List(props) {
  20272. _classCallCheck(this, List);
  20273. var _this = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, props));
  20274. _this.state = {
  20275. kw: ''
  20276. };
  20277. _Agent2.default.on('search', function (kw) {
  20278. _this.setState({ kw: kw });
  20279. });
  20280. return _this;
  20281. }
  20282. _createClass(List, [{
  20283. key: 'customItems',
  20284. value: function customItems() {
  20285. var _this2 = this;
  20286. var kw = this.state.kw;
  20287. function match(kw, item) {
  20288. return (0, _kw.findPositions)(kw, item.content).length > 0 || (0, _kw.findPositions)(kw, item.title).length > 0;
  20289. }
  20290. return this.props.list.map(function (item, idx) {
  20291. var show = true;
  20292. if (kw && !match(kw, item)) {
  20293. show = false;
  20294. }
  20295. return _react2.default.createElement(_listItem2.default, _extends({
  20296. data: item,
  20297. idx: idx,
  20298. key: 'hosts-' + idx + Math.random(),
  20299. show: show
  20300. }, _this2.props));
  20301. });
  20302. }
  20303. }, {
  20304. key: 'getCurrentListFromDOM',
  20305. value: function getCurrentListFromDOM() {
  20306. var nodes = this.refs.items.getElementsByClassName('list-item');
  20307. nodes = (0, _listToArray2.default)(nodes);
  20308. var ids = nodes.map(function (el) {
  20309. return el.getAttribute('data-id');
  20310. });
  20311. _Agent2.default.emit('sort', ids);
  20312. }
  20313. }, {
  20314. key: 'componentDidMount',
  20315. value: function componentDidMount() {
  20316. var _this3 = this;
  20317. _sortablejs2.default.create(this.refs.items, {
  20318. group: 'list-sorting',
  20319. sort: true,
  20320. animation: 150,
  20321. onStart: function onStart() {
  20322. _Agent2.default.emit('drag_start');
  20323. },
  20324. onSort: function onSort() {
  20325. _this3.getCurrentListFromDOM();
  20326. _Agent2.default.emit('drag_end');
  20327. //console.log(evt)
  20328. //console.log(evt.item)
  20329. //console.log(evt.oldIndex, evt.newIndex)
  20330. }
  20331. });
  20332. }
  20333. }, {
  20334. key: 'render',
  20335. value: function render() {
  20336. return _react2.default.createElement(
  20337. 'div',
  20338. { id: 'sh-list' },
  20339. _react2.default.createElement(_listItem2.default, _extends({
  20340. data: this.props.sys_hosts
  20341. }, this.props, {
  20342. sys: '1' })),
  20343. _react2.default.createElement(
  20344. 'div',
  20345. { ref: 'items', className: 'custom-items' },
  20346. this.customItems()
  20347. )
  20348. );
  20349. }
  20350. }]);
  20351. return List;
  20352. }(_react2.default.Component);
  20353. exports.default = List;
  20354. /***/ }),
  20355. /* 118 */
  20356. /***/ (function(module, exports, __webpack_require__) {
  20357. "use strict";
  20358. /**
  20359. * @author oldj
  20360. * @blog http://oldj.net
  20361. */
  20362. Object.defineProperty(exports, "__esModule", {
  20363. value: true
  20364. });
  20365. 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; }; }();
  20366. var _react = __webpack_require__(7);
  20367. var _react2 = _interopRequireDefault(_react);
  20368. var _buttons = __webpack_require__(115);
  20369. var _buttons2 = _interopRequireDefault(_buttons);
  20370. var _searchbar = __webpack_require__(119);
  20371. var _searchbar2 = _interopRequireDefault(_searchbar);
  20372. var _list = __webpack_require__(117);
  20373. var _list2 = _interopRequireDefault(_list);
  20374. __webpack_require__(240);
  20375. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20376. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20377. 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; }
  20378. 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; }
  20379. var Panel = function (_React$Component) {
  20380. _inherits(Panel, _React$Component);
  20381. function Panel() {
  20382. _classCallCheck(this, Panel);
  20383. return _possibleConstructorReturn(this, (Panel.__proto__ || Object.getPrototypeOf(Panel)).apply(this, arguments));
  20384. }
  20385. _createClass(Panel, [{
  20386. key: 'render',
  20387. value: function render() {
  20388. return _react2.default.createElement(
  20389. 'div',
  20390. { id: 'panel' },
  20391. _react2.default.createElement(_list2.default, this.props),
  20392. _react2.default.createElement(_searchbar2.default, null),
  20393. _react2.default.createElement(_buttons2.default, null)
  20394. );
  20395. }
  20396. }]);
  20397. return Panel;
  20398. }(_react2.default.Component);
  20399. exports.default = Panel;
  20400. /***/ }),
  20401. /* 119 */
  20402. /***/ (function(module, exports, __webpack_require__) {
  20403. "use strict";
  20404. /**
  20405. * @author oldj
  20406. * @blog http://oldj.net
  20407. */
  20408. Object.defineProperty(exports, "__esModule", {
  20409. value: true
  20410. });
  20411. 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; }; }();
  20412. var _react = __webpack_require__(7);
  20413. var _react2 = _interopRequireDefault(_react);
  20414. var _Agent = __webpack_require__(4);
  20415. var _Agent2 = _interopRequireDefault(_Agent);
  20416. __webpack_require__(241);
  20417. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20418. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20419. 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; }
  20420. 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; }
  20421. var SearchBar = function (_React$Component) {
  20422. _inherits(SearchBar, _React$Component);
  20423. function SearchBar(props) {
  20424. _classCallCheck(this, SearchBar);
  20425. var _this = _possibleConstructorReturn(this, (SearchBar.__proto__ || Object.getPrototypeOf(SearchBar)).call(this, props));
  20426. _this.state = {
  20427. show: false,
  20428. keyword: ''
  20429. };
  20430. _this._t = null;
  20431. _Agent2.default.on('search_on', function () {
  20432. _this.setState({
  20433. show: true
  20434. }, function () {
  20435. setTimeout(function () {
  20436. _this.refs.keyword.focus();
  20437. }, 100);
  20438. });
  20439. });
  20440. _Agent2.default.on('search_off', function () {
  20441. _this.clearSearch();
  20442. });
  20443. return _this;
  20444. }
  20445. _createClass(SearchBar, [{
  20446. key: 'clearSearch',
  20447. value: function clearSearch() {
  20448. this.setState({
  20449. show: false,
  20450. keyword: ''
  20451. });
  20452. _Agent2.default.emit('search', '');
  20453. }
  20454. }, {
  20455. key: 'doSearch',
  20456. value: function doSearch(kw) {
  20457. this.setState({
  20458. keyword: kw
  20459. });
  20460. clearTimeout(this._t);
  20461. this._t = setTimeout(function () {
  20462. _Agent2.default.emit('search', kw);
  20463. }, 300);
  20464. }
  20465. }, {
  20466. key: 'render',
  20467. value: function render() {
  20468. var _this2 = this;
  20469. if (!this.state.show) {
  20470. return null;
  20471. }
  20472. return _react2.default.createElement(
  20473. 'div',
  20474. { id: 'sh-searchbar' },
  20475. _react2.default.createElement('input', {
  20476. ref: 'keyword',
  20477. type: 'text',
  20478. placeholder: 'keyword',
  20479. value: this.state.keyword,
  20480. onChange: function onChange(e) {
  20481. return _this2.doSearch(e.target.value);
  20482. },
  20483. onKeyDown: function onKeyDown(e) {
  20484. return e.keyCode === 27 && SearchBar.onCancel();
  20485. }
  20486. })
  20487. );
  20488. }
  20489. }], [{
  20490. key: 'onCancel',
  20491. value: function onCancel() {
  20492. _Agent2.default.emit('cancel_search');
  20493. }
  20494. }]);
  20495. return SearchBar;
  20496. }(_react2.default.Component);
  20497. exports.default = SearchBar;
  20498. /***/ }),
  20499. /* 120 */
  20500. /***/ (function(module, exports, __webpack_require__) {
  20501. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  20502. // Distributed under an MIT license: http://codemirror.net/LICENSE
  20503. (function(mod) {
  20504. if (true) // CommonJS
  20505. mod(__webpack_require__(49));
  20506. else if (typeof define == "function" && define.amd) // AMD
  20507. define(["../../lib/codemirror"], mod);
  20508. else // Plain browser env
  20509. mod(CodeMirror);
  20510. })(function(CodeMirror) {
  20511. "use strict";
  20512. var noOptions = {};
  20513. var nonWS = /[^\s\u00a0]/;
  20514. var Pos = CodeMirror.Pos;
  20515. function firstNonWS(str) {
  20516. var found = str.search(nonWS);
  20517. return found == -1 ? 0 : found;
  20518. }
  20519. CodeMirror.commands.toggleComment = function(cm) {
  20520. cm.toggleComment();
  20521. };
  20522. CodeMirror.defineExtension("toggleComment", function(options) {
  20523. if (!options) options = noOptions;
  20524. var cm = this;
  20525. var minLine = Infinity, ranges = this.listSelections(), mode = null;
  20526. for (var i = ranges.length - 1; i >= 0; i--) {
  20527. var from = ranges[i].from(), to = ranges[i].to();
  20528. if (from.line >= minLine) continue;
  20529. if (to.line >= minLine) to = Pos(minLine, 0);
  20530. minLine = from.line;
  20531. if (mode == null) {
  20532. if (cm.uncomment(from, to, options)) mode = "un";
  20533. else { cm.lineComment(from, to, options); mode = "line"; }
  20534. } else if (mode == "un") {
  20535. cm.uncomment(from, to, options);
  20536. } else {
  20537. cm.lineComment(from, to, options);
  20538. }
  20539. }
  20540. });
  20541. // Rough heuristic to try and detect lines that are part of multi-line string
  20542. function probablyInsideString(cm, pos, line) {
  20543. return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
  20544. }
  20545. function getMode(cm, pos) {
  20546. var mode = cm.getMode()
  20547. return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
  20548. }
  20549. CodeMirror.defineExtension("lineComment", function(from, to, options) {
  20550. if (!options) options = noOptions;
  20551. var self = this, mode = getMode(self, from);
  20552. var firstLine = self.getLine(from.line);
  20553. if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
  20554. var commentString = options.lineComment || mode.lineComment;
  20555. if (!commentString) {
  20556. if (options.blockCommentStart || mode.blockCommentStart) {
  20557. options.fullLines = true;
  20558. self.blockComment(from, to, options);
  20559. }
  20560. return;
  20561. }
  20562. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
  20563. var pad = options.padding == null ? " " : options.padding;
  20564. var blankLines = options.commentBlankLines || from.line == to.line;
  20565. self.operation(function() {
  20566. if (options.indent) {
  20567. var baseString = null;
  20568. for (var i = from.line; i < end; ++i) {
  20569. var line = self.getLine(i);
  20570. var whitespace = line.slice(0, firstNonWS(line));
  20571. if (baseString == null || baseString.length > whitespace.length) {
  20572. baseString = whitespace;
  20573. }
  20574. }
  20575. for (var i = from.line; i < end; ++i) {
  20576. var line = self.getLine(i), cut = baseString.length;
  20577. if (!blankLines && !nonWS.test(line)) continue;
  20578. if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
  20579. self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
  20580. }
  20581. } else {
  20582. for (var i = from.line; i < end; ++i) {
  20583. if (blankLines || nonWS.test(self.getLine(i)))
  20584. self.replaceRange(commentString + pad, Pos(i, 0));
  20585. }
  20586. }
  20587. });
  20588. });
  20589. CodeMirror.defineExtension("blockComment", function(from, to, options) {
  20590. if (!options) options = noOptions;
  20591. var self = this, mode = getMode(self, from);
  20592. var startString = options.blockCommentStart || mode.blockCommentStart;
  20593. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  20594. if (!startString || !endString) {
  20595. if ((options.lineComment || mode.lineComment) && options.fullLines != false)
  20596. self.lineComment(from, to, options);
  20597. return;
  20598. }
  20599. if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
  20600. var end = Math.min(to.line, self.lastLine());
  20601. if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
  20602. var pad = options.padding == null ? " " : options.padding;
  20603. if (from.line > end) return;
  20604. self.operation(function() {
  20605. if (options.fullLines != false) {
  20606. var lastLineHasText = nonWS.test(self.getLine(end));
  20607. self.replaceRange(pad + endString, Pos(end));
  20608. self.replaceRange(startString + pad, Pos(from.line, 0));
  20609. var lead = options.blockCommentLead || mode.blockCommentLead;
  20610. if (lead != null) for (var i = from.line + 1; i <= end; ++i)
  20611. if (i != end || lastLineHasText)
  20612. self.replaceRange(lead + pad, Pos(i, 0));
  20613. } else {
  20614. self.replaceRange(endString, to);
  20615. self.replaceRange(startString, from);
  20616. }
  20617. });
  20618. });
  20619. CodeMirror.defineExtension("uncomment", function(from, to, options) {
  20620. if (!options) options = noOptions;
  20621. var self = this, mode = getMode(self, from);
  20622. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
  20623. // Try finding line comments
  20624. var lineString = options.lineComment || mode.lineComment, lines = [];
  20625. var pad = options.padding == null ? " " : options.padding, didSomething;
  20626. lineComment: {
  20627. if (!lineString) break lineComment;
  20628. for (var i = start; i <= end; ++i) {
  20629. var line = self.getLine(i);
  20630. var found = line.indexOf(lineString);
  20631. if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
  20632. if (found == -1 && nonWS.test(line)) break lineComment;
  20633. if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
  20634. lines.push(line);
  20635. }
  20636. self.operation(function() {
  20637. for (var i = start; i <= end; ++i) {
  20638. var line = lines[i - start];
  20639. var pos = line.indexOf(lineString), endPos = pos + lineString.length;
  20640. if (pos < 0) continue;
  20641. if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
  20642. didSomething = true;
  20643. self.replaceRange("", Pos(i, pos), Pos(i, endPos));
  20644. }
  20645. });
  20646. if (didSomething) return true;
  20647. }
  20648. // Try block comments
  20649. var startString = options.blockCommentStart || mode.blockCommentStart;
  20650. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  20651. if (!startString || !endString) return false;
  20652. var lead = options.blockCommentLead || mode.blockCommentLead;
  20653. var startLine = self.getLine(start), open = startLine.indexOf(startString)
  20654. if (open == -1) return false
  20655. var endLine = end == start ? startLine : self.getLine(end)
  20656. var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
  20657. if (close == -1 && start != end) {
  20658. endLine = self.getLine(--end);
  20659. close = endLine.indexOf(endString);
  20660. }
  20661. var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
  20662. if (close == -1 ||
  20663. !/comment/.test(self.getTokenTypeAt(insideStart)) ||
  20664. !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
  20665. self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
  20666. return false;
  20667. // Avoid killing block comments completely outside the selection.
  20668. // Positions of the last startString before the start of the selection, and the first endString after it.
  20669. var lastStart = startLine.lastIndexOf(startString, from.ch);
  20670. var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
  20671. if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
  20672. // Positions of the first endString after the end of the selection, and the last startString before it.
  20673. firstEnd = endLine.indexOf(endString, to.ch);
  20674. var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
  20675. lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
  20676. if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
  20677. self.operation(function() {
  20678. self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
  20679. Pos(end, close + endString.length));
  20680. var openEnd = open + startString.length;
  20681. if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
  20682. self.replaceRange("", Pos(start, open), Pos(start, openEnd));
  20683. if (lead) for (var i = start + 1; i <= end; ++i) {
  20684. var line = self.getLine(i), found = line.indexOf(lead);
  20685. if (found == -1 || nonWS.test(line.slice(0, found))) continue;
  20686. var foundEnd = found + lead.length;
  20687. if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
  20688. self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
  20689. }
  20690. });
  20691. return true;
  20692. });
  20693. });
  20694. /***/ }),
  20695. /* 121 */
  20696. /***/ (function(module, exports, __webpack_require__) {
  20697. exports = module.exports = __webpack_require__(6)();
  20698. // imports
  20699. // module
  20700. 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", ""]);
  20701. // exports
  20702. /***/ }),
  20703. /* 122 */
  20704. /***/ (function(module, exports, __webpack_require__) {
  20705. exports = module.exports = __webpack_require__(6)();
  20706. // imports
  20707. // module
  20708. 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", ""]);
  20709. // exports
  20710. /***/ }),
  20711. /* 123 */
  20712. /***/ (function(module, exports, __webpack_require__) {
  20713. exports = module.exports = __webpack_require__(6)();
  20714. // imports
  20715. // module
  20716. 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", ""]);
  20717. // exports
  20718. /***/ }),
  20719. /* 124 */
  20720. /***/ (function(module, exports, __webpack_require__) {
  20721. exports = module.exports = __webpack_require__(6)();
  20722. // imports
  20723. // module
  20724. 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", ""]);
  20725. // exports
  20726. /***/ }),
  20727. /* 125 */
  20728. /***/ (function(module, exports, __webpack_require__) {
  20729. exports = module.exports = __webpack_require__(6)();
  20730. // imports
  20731. // module
  20732. 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", ""]);
  20733. // exports
  20734. /***/ }),
  20735. /* 126 */
  20736. /***/ (function(module, exports, __webpack_require__) {
  20737. exports = module.exports = __webpack_require__(6)();
  20738. // imports
  20739. // module
  20740. 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", ""]);
  20741. // exports
  20742. /***/ }),
  20743. /* 127 */
  20744. /***/ (function(module, exports, __webpack_require__) {
  20745. exports = module.exports = __webpack_require__(6)();
  20746. // imports
  20747. // module
  20748. 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", ""]);
  20749. // exports
  20750. /***/ }),
  20751. /* 128 */
  20752. /***/ (function(module, exports, __webpack_require__) {
  20753. exports = module.exports = __webpack_require__(6)();
  20754. // imports
  20755. // module
  20756. 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", ""]);
  20757. // exports
  20758. /***/ }),
  20759. /* 129 */
  20760. /***/ (function(module, exports, __webpack_require__) {
  20761. exports = module.exports = __webpack_require__(6)();
  20762. // imports
  20763. // module
  20764. 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", ""]);
  20765. // exports
  20766. /***/ }),
  20767. /* 130 */
  20768. /***/ (function(module, exports, __webpack_require__) {
  20769. exports = module.exports = __webpack_require__(6)();
  20770. // imports
  20771. // module
  20772. 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", ""]);
  20773. // exports
  20774. /***/ }),
  20775. /* 131 */
  20776. /***/ (function(module, exports, __webpack_require__) {
  20777. exports = module.exports = __webpack_require__(6)();
  20778. // imports
  20779. // module
  20780. 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", ""]);
  20781. // exports
  20782. /***/ }),
  20783. /* 132 */
  20784. /***/ (function(module, exports, __webpack_require__) {
  20785. exports = module.exports = __webpack_require__(6)();
  20786. // imports
  20787. // module
  20788. 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", ""]);
  20789. // exports
  20790. /***/ }),
  20791. /* 133 */
  20792. /***/ (function(module, exports, __webpack_require__) {
  20793. exports = module.exports = __webpack_require__(6)();
  20794. // imports
  20795. exports.i(__webpack_require__(135), "");
  20796. // module
  20797. exports.push([module.i, "#panel {\n width: 240px;\n height: 100%;\n background: #373d47;\n color: #979da7;\n}\n", ""]);
  20798. // exports
  20799. /***/ }),
  20800. /* 134 */
  20801. /***/ (function(module, exports, __webpack_require__) {
  20802. exports = module.exports = __webpack_require__(6)();
  20803. // imports
  20804. // module
  20805. 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", ""]);
  20806. // exports
  20807. /***/ }),
  20808. /* 135 */
  20809. /***/ (function(module, exports, __webpack_require__) {
  20810. exports = module.exports = __webpack_require__(6)();
  20811. // imports
  20812. // module
  20813. exports.push([module.i, "\n@font-face {font-family: \"iconfont\";\n src: url(" + __webpack_require__(100) + "); /* IE9*/\n src: url(" + __webpack_require__(100) + "#iefix) format('embedded-opentype'), \n url(" + __webpack_require__(244) + ") format('woff'), \n url(" + __webpack_require__(243) + ") format('truetype'), \n url(" + __webpack_require__(242) + "#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", ""]);
  20814. // exports
  20815. /***/ }),
  20816. /* 136 */
  20817. /***/ (function(module, exports, __webpack_require__) {
  20818. "use strict";
  20819. /**
  20820. * Copyright (c) 2013-present, Facebook, Inc.
  20821. * All rights reserved.
  20822. *
  20823. * This source code is licensed under the BSD-style license found in the
  20824. * LICENSE file in the root directory of this source tree. An additional grant
  20825. * of patent rights can be found in the PATENTS file in the same directory.
  20826. *
  20827. * @typechecks
  20828. */
  20829. var _hyphenPattern = /-(.)/g;
  20830. /**
  20831. * Camelcases a hyphenated string, for example:
  20832. *
  20833. * > camelize('background-color')
  20834. * < "backgroundColor"
  20835. *
  20836. * @param {string} string
  20837. * @return {string}
  20838. */
  20839. function camelize(string) {
  20840. return string.replace(_hyphenPattern, function (_, character) {
  20841. return character.toUpperCase();
  20842. });
  20843. }
  20844. module.exports = camelize;
  20845. /***/ }),
  20846. /* 137 */
  20847. /***/ (function(module, exports, __webpack_require__) {
  20848. "use strict";
  20849. /**
  20850. * Copyright (c) 2013-present, Facebook, Inc.
  20851. * All rights reserved.
  20852. *
  20853. * This source code is licensed under the BSD-style license found in the
  20854. * LICENSE file in the root directory of this source tree. An additional grant
  20855. * of patent rights can be found in the PATENTS file in the same directory.
  20856. *
  20857. * @typechecks
  20858. */
  20859. var camelize = __webpack_require__(136);
  20860. var msPattern = /^-ms-/;
  20861. /**
  20862. * Camelcases a hyphenated CSS property name, for example:
  20863. *
  20864. * > camelizeStyleName('background-color')
  20865. * < "backgroundColor"
  20866. * > camelizeStyleName('-moz-transition')
  20867. * < "MozTransition"
  20868. * > camelizeStyleName('-ms-transition')
  20869. * < "msTransition"
  20870. *
  20871. * As Andi Smith suggests
  20872. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  20873. * is converted to lowercase `ms`.
  20874. *
  20875. * @param {string} string
  20876. * @return {string}
  20877. */
  20878. function camelizeStyleName(string) {
  20879. return camelize(string.replace(msPattern, 'ms-'));
  20880. }
  20881. module.exports = camelizeStyleName;
  20882. /***/ }),
  20883. /* 138 */
  20884. /***/ (function(module, exports, __webpack_require__) {
  20885. "use strict";
  20886. /**
  20887. * Copyright (c) 2013-present, Facebook, Inc.
  20888. * All rights reserved.
  20889. *
  20890. * This source code is licensed under the BSD-style license found in the
  20891. * LICENSE file in the root directory of this source tree. An additional grant
  20892. * of patent rights can be found in the PATENTS file in the same directory.
  20893. *
  20894. *
  20895. */
  20896. var isTextNode = __webpack_require__(146);
  20897. /*eslint-disable no-bitwise */
  20898. /**
  20899. * Checks if a given DOM node contains or is another DOM node.
  20900. */
  20901. function containsNode(outerNode, innerNode) {
  20902. if (!outerNode || !innerNode) {
  20903. return false;
  20904. } else if (outerNode === innerNode) {
  20905. return true;
  20906. } else if (isTextNode(outerNode)) {
  20907. return false;
  20908. } else if (isTextNode(innerNode)) {
  20909. return containsNode(outerNode, innerNode.parentNode);
  20910. } else if ('contains' in outerNode) {
  20911. return outerNode.contains(innerNode);
  20912. } else if (outerNode.compareDocumentPosition) {
  20913. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  20914. } else {
  20915. return false;
  20916. }
  20917. }
  20918. module.exports = containsNode;
  20919. /***/ }),
  20920. /* 139 */
  20921. /***/ (function(module, exports, __webpack_require__) {
  20922. "use strict";
  20923. /**
  20924. * Copyright (c) 2013-present, Facebook, Inc.
  20925. * All rights reserved.
  20926. *
  20927. * This source code is licensed under the BSD-style license found in the
  20928. * LICENSE file in the root directory of this source tree. An additional grant
  20929. * of patent rights can be found in the PATENTS file in the same directory.
  20930. *
  20931. * @typechecks
  20932. */
  20933. var invariant = __webpack_require__(0);
  20934. /**
  20935. * Convert array-like objects to arrays.
  20936. *
  20937. * This API assumes the caller knows the contents of the data type. For less
  20938. * well defined inputs use createArrayFromMixed.
  20939. *
  20940. * @param {object|function|filelist} obj
  20941. * @return {array}
  20942. */
  20943. function toArray(obj) {
  20944. var length = obj.length;
  20945. // Some browsers builtin objects can report typeof 'function' (e.g. NodeList
  20946. // in old versions of Safari).
  20947. !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? false ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
  20948. !(typeof length === 'number') ? false ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
  20949. !(length === 0 || length - 1 in obj) ? false ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
  20950. !(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;
  20951. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  20952. // without method will throw during the slice call and skip straight to the
  20953. // fallback.
  20954. if (obj.hasOwnProperty) {
  20955. try {
  20956. return Array.prototype.slice.call(obj);
  20957. } catch (e) {
  20958. // IE < 9 does not support Array#slice on collections objects
  20959. }
  20960. }
  20961. // Fall back to copying key by key. This assumes all keys have a value,
  20962. // so will not preserve sparsely populated inputs.
  20963. var ret = Array(length);
  20964. for (var ii = 0; ii < length; ii++) {
  20965. ret[ii] = obj[ii];
  20966. }
  20967. return ret;
  20968. }
  20969. /**
  20970. * Perform a heuristic test to determine if an object is "array-like".
  20971. *
  20972. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  20973. * Joshu replied: "Mu."
  20974. *
  20975. * This function determines if its argument has "array nature": it returns
  20976. * true if the argument is an actual array, an `arguments' object, or an
  20977. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  20978. *
  20979. * It will return false for other array-like objects like Filelist.
  20980. *
  20981. * @param {*} obj
  20982. * @return {boolean}
  20983. */
  20984. function hasArrayNature(obj) {
  20985. return (
  20986. // not null/false
  20987. !!obj && (
  20988. // arrays are objects, NodeLists are functions in Safari
  20989. typeof obj == 'object' || typeof obj == 'function') &&
  20990. // quacks like an array
  20991. 'length' in obj &&
  20992. // not window
  20993. !('setInterval' in obj) &&
  20994. // no DOM node should be considered an array-like
  20995. // a 'select' element has 'length' and 'item' properties on IE8
  20996. typeof obj.nodeType != 'number' && (
  20997. // a real array
  20998. Array.isArray(obj) ||
  20999. // arguments
  21000. 'callee' in obj ||
  21001. // HTMLCollection/NodeList
  21002. 'item' in obj)
  21003. );
  21004. }
  21005. /**
  21006. * Ensure that the argument is an array by wrapping it in an array if it is not.
  21007. * Creates a copy of the argument if it is already an array.
  21008. *
  21009. * This is mostly useful idiomatically:
  21010. *
  21011. * var createArrayFromMixed = require('createArrayFromMixed');
  21012. *
  21013. * function takesOneOrMoreThings(things) {
  21014. * things = createArrayFromMixed(things);
  21015. * ...
  21016. * }
  21017. *
  21018. * This allows you to treat `things' as an array, but accept scalars in the API.
  21019. *
  21020. * If you need to convert an array-like object, like `arguments`, into an array
  21021. * use toArray instead.
  21022. *
  21023. * @param {*} obj
  21024. * @return {array}
  21025. */
  21026. function createArrayFromMixed(obj) {
  21027. if (!hasArrayNature(obj)) {
  21028. return [obj];
  21029. } else if (Array.isArray(obj)) {
  21030. return obj.slice();
  21031. } else {
  21032. return toArray(obj);
  21033. }
  21034. }
  21035. module.exports = createArrayFromMixed;
  21036. /***/ }),
  21037. /* 140 */
  21038. /***/ (function(module, exports, __webpack_require__) {
  21039. "use strict";
  21040. /**
  21041. * Copyright (c) 2013-present, Facebook, Inc.
  21042. * All rights reserved.
  21043. *
  21044. * This source code is licensed under the BSD-style license found in the
  21045. * LICENSE file in the root directory of this source tree. An additional grant
  21046. * of patent rights can be found in the PATENTS file in the same directory.
  21047. *
  21048. * @typechecks
  21049. */
  21050. /*eslint-disable fb-www/unsafe-html*/
  21051. var ExecutionEnvironment = __webpack_require__(8);
  21052. var createArrayFromMixed = __webpack_require__(139);
  21053. var getMarkupWrap = __webpack_require__(141);
  21054. var invariant = __webpack_require__(0);
  21055. /**
  21056. * Dummy container used to render all markup.
  21057. */
  21058. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  21059. /**
  21060. * Pattern used by `getNodeName`.
  21061. */
  21062. var nodeNamePattern = /^\s*<(\w+)/;
  21063. /**
  21064. * Extracts the `nodeName` of the first element in a string of markup.
  21065. *
  21066. * @param {string} markup String of markup.
  21067. * @return {?string} Node name of the supplied markup.
  21068. */
  21069. function getNodeName(markup) {
  21070. var nodeNameMatch = markup.match(nodeNamePattern);
  21071. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  21072. }
  21073. /**
  21074. * Creates an array containing the nodes rendered from the supplied markup. The
  21075. * optionally supplied `handleScript` function will be invoked once for each
  21076. * <script> element that is rendered. If no `handleScript` function is supplied,
  21077. * an exception is thrown if any <script> elements are rendered.
  21078. *
  21079. * @param {string} markup A string of valid HTML markup.
  21080. * @param {?function} handleScript Invoked once for each rendered <script>.
  21081. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  21082. */
  21083. function createNodesFromMarkup(markup, handleScript) {
  21084. var node = dummyNode;
  21085. !!!dummyNode ? false ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
  21086. var nodeName = getNodeName(markup);
  21087. var wrap = nodeName && getMarkupWrap(nodeName);
  21088. if (wrap) {
  21089. node.innerHTML = wrap[1] + markup + wrap[2];
  21090. var wrapDepth = wrap[0];
  21091. while (wrapDepth--) {
  21092. node = node.lastChild;
  21093. }
  21094. } else {
  21095. node.innerHTML = markup;
  21096. }
  21097. var scripts = node.getElementsByTagName('script');
  21098. if (scripts.length) {
  21099. !handleScript ? false ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
  21100. createArrayFromMixed(scripts).forEach(handleScript);
  21101. }
  21102. var nodes = Array.from(node.childNodes);
  21103. while (node.lastChild) {
  21104. node.removeChild(node.lastChild);
  21105. }
  21106. return nodes;
  21107. }
  21108. module.exports = createNodesFromMarkup;
  21109. /***/ }),
  21110. /* 141 */
  21111. /***/ (function(module, exports, __webpack_require__) {
  21112. "use strict";
  21113. /**
  21114. * Copyright (c) 2013-present, Facebook, Inc.
  21115. * All rights reserved.
  21116. *
  21117. * This source code is licensed under the BSD-style license found in the
  21118. * LICENSE file in the root directory of this source tree. An additional grant
  21119. * of patent rights can be found in the PATENTS file in the same directory.
  21120. *
  21121. */
  21122. /*eslint-disable fb-www/unsafe-html */
  21123. var ExecutionEnvironment = __webpack_require__(8);
  21124. var invariant = __webpack_require__(0);
  21125. /**
  21126. * Dummy container used to detect which wraps are necessary.
  21127. */
  21128. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  21129. /**
  21130. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  21131. * so we wrap them, render the wrapped nodes, then extract the desired node.
  21132. *
  21133. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  21134. */
  21135. var shouldWrap = {};
  21136. var selectWrap = [1, '<select multiple="true">', '</select>'];
  21137. var tableWrap = [1, '<table>', '</table>'];
  21138. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  21139. var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
  21140. var markupWrap = {
  21141. '*': [1, '?<div>', '</div>'],
  21142. 'area': [1, '<map>', '</map>'],
  21143. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  21144. 'legend': [1, '<fieldset>', '</fieldset>'],
  21145. 'param': [1, '<object>', '</object>'],
  21146. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  21147. 'optgroup': selectWrap,
  21148. 'option': selectWrap,
  21149. 'caption': tableWrap,
  21150. 'colgroup': tableWrap,
  21151. 'tbody': tableWrap,
  21152. 'tfoot': tableWrap,
  21153. 'thead': tableWrap,
  21154. 'td': trWrap,
  21155. 'th': trWrap
  21156. };
  21157. // Initialize the SVG elements since we know they'll always need to be wrapped
  21158. // consistently. If they are created inside a <div> they will be initialized in
  21159. // the wrong namespace (and will not display).
  21160. var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
  21161. svgElements.forEach(function (nodeName) {
  21162. markupWrap[nodeName] = svgWrap;
  21163. shouldWrap[nodeName] = true;
  21164. });
  21165. /**
  21166. * Gets the markup wrap configuration for the supplied `nodeName`.
  21167. *
  21168. * NOTE: This lazily detects which wraps are necessary for the current browser.
  21169. *
  21170. * @param {string} nodeName Lowercase `nodeName`.
  21171. * @return {?array} Markup wrap configuration, if applicable.
  21172. */
  21173. function getMarkupWrap(nodeName) {
  21174. !!!dummyNode ? false ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
  21175. if (!markupWrap.hasOwnProperty(nodeName)) {
  21176. nodeName = '*';
  21177. }
  21178. if (!shouldWrap.hasOwnProperty(nodeName)) {
  21179. if (nodeName === '*') {
  21180. dummyNode.innerHTML = '<link />';
  21181. } else {
  21182. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  21183. }
  21184. shouldWrap[nodeName] = !dummyNode.firstChild;
  21185. }
  21186. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  21187. }
  21188. module.exports = getMarkupWrap;
  21189. /***/ }),
  21190. /* 142 */
  21191. /***/ (function(module, exports, __webpack_require__) {
  21192. "use strict";
  21193. /**
  21194. * Copyright (c) 2013-present, Facebook, Inc.
  21195. * All rights reserved.
  21196. *
  21197. * This source code is licensed under the BSD-style license found in the
  21198. * LICENSE file in the root directory of this source tree. An additional grant
  21199. * of patent rights can be found in the PATENTS file in the same directory.
  21200. *
  21201. * @typechecks
  21202. */
  21203. /**
  21204. * Gets the scroll position of the supplied element or window.
  21205. *
  21206. * The return values are unbounded, unlike `getScrollPosition`. This means they
  21207. * may be negative or exceed the element boundaries (which is possible using
  21208. * inertial scrolling).
  21209. *
  21210. * @param {DOMWindow|DOMElement} scrollable
  21211. * @return {object} Map with `x` and `y` keys.
  21212. */
  21213. function getUnboundedScrollPosition(scrollable) {
  21214. if (scrollable.Window && scrollable instanceof scrollable.Window) {
  21215. return {
  21216. x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
  21217. y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
  21218. };
  21219. }
  21220. return {
  21221. x: scrollable.scrollLeft,
  21222. y: scrollable.scrollTop
  21223. };
  21224. }
  21225. module.exports = getUnboundedScrollPosition;
  21226. /***/ }),
  21227. /* 143 */
  21228. /***/ (function(module, exports, __webpack_require__) {
  21229. "use strict";
  21230. /**
  21231. * Copyright (c) 2013-present, Facebook, Inc.
  21232. * All rights reserved.
  21233. *
  21234. * This source code is licensed under the BSD-style license found in the
  21235. * LICENSE file in the root directory of this source tree. An additional grant
  21236. * of patent rights can be found in the PATENTS file in the same directory.
  21237. *
  21238. * @typechecks
  21239. */
  21240. var _uppercasePattern = /([A-Z])/g;
  21241. /**
  21242. * Hyphenates a camelcased string, for example:
  21243. *
  21244. * > hyphenate('backgroundColor')
  21245. * < "background-color"
  21246. *
  21247. * For CSS style names, use `hyphenateStyleName` instead which works properly
  21248. * with all vendor prefixes, including `ms`.
  21249. *
  21250. * @param {string} string
  21251. * @return {string}
  21252. */
  21253. function hyphenate(string) {
  21254. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  21255. }
  21256. module.exports = hyphenate;
  21257. /***/ }),
  21258. /* 144 */
  21259. /***/ (function(module, exports, __webpack_require__) {
  21260. "use strict";
  21261. /**
  21262. * Copyright (c) 2013-present, Facebook, Inc.
  21263. * All rights reserved.
  21264. *
  21265. * This source code is licensed under the BSD-style license found in the
  21266. * LICENSE file in the root directory of this source tree. An additional grant
  21267. * of patent rights can be found in the PATENTS file in the same directory.
  21268. *
  21269. * @typechecks
  21270. */
  21271. var hyphenate = __webpack_require__(143);
  21272. var msPattern = /^ms-/;
  21273. /**
  21274. * Hyphenates a camelcased CSS property name, for example:
  21275. *
  21276. * > hyphenateStyleName('backgroundColor')
  21277. * < "background-color"
  21278. * > hyphenateStyleName('MozTransition')
  21279. * < "-moz-transition"
  21280. * > hyphenateStyleName('msTransition')
  21281. * < "-ms-transition"
  21282. *
  21283. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  21284. * is converted to `-ms-`.
  21285. *
  21286. * @param {string} string
  21287. * @return {string}
  21288. */
  21289. function hyphenateStyleName(string) {
  21290. return hyphenate(string).replace(msPattern, '-ms-');
  21291. }
  21292. module.exports = hyphenateStyleName;
  21293. /***/ }),
  21294. /* 145 */
  21295. /***/ (function(module, exports, __webpack_require__) {
  21296. "use strict";
  21297. /**
  21298. * Copyright (c) 2013-present, Facebook, Inc.
  21299. * All rights reserved.
  21300. *
  21301. * This source code is licensed under the BSD-style license found in the
  21302. * LICENSE file in the root directory of this source tree. An additional grant
  21303. * of patent rights can be found in the PATENTS file in the same directory.
  21304. *
  21305. * @typechecks
  21306. */
  21307. /**
  21308. * @param {*} object The object to check.
  21309. * @return {boolean} Whether or not the object is a DOM node.
  21310. */
  21311. function isNode(object) {
  21312. var doc = object ? object.ownerDocument || object : document;
  21313. var defaultView = doc.defaultView || window;
  21314. return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
  21315. }
  21316. module.exports = isNode;
  21317. /***/ }),
  21318. /* 146 */
  21319. /***/ (function(module, exports, __webpack_require__) {
  21320. "use strict";
  21321. /**
  21322. * Copyright (c) 2013-present, Facebook, Inc.
  21323. * All rights reserved.
  21324. *
  21325. * This source code is licensed under the BSD-style license found in the
  21326. * LICENSE file in the root directory of this source tree. An additional grant
  21327. * of patent rights can be found in the PATENTS file in the same directory.
  21328. *
  21329. * @typechecks
  21330. */
  21331. var isNode = __webpack_require__(145);
  21332. /**
  21333. * @param {*} object The object to check.
  21334. * @return {boolean} Whether or not the object is a DOM text node.
  21335. */
  21336. function isTextNode(object) {
  21337. return isNode(object) && object.nodeType == 3;
  21338. }
  21339. module.exports = isTextNode;
  21340. /***/ }),
  21341. /* 147 */
  21342. /***/ (function(module, exports, __webpack_require__) {
  21343. "use strict";
  21344. /**
  21345. * Copyright (c) 2013-present, Facebook, Inc.
  21346. * All rights reserved.
  21347. *
  21348. * This source code is licensed under the BSD-style license found in the
  21349. * LICENSE file in the root directory of this source tree. An additional grant
  21350. * of patent rights can be found in the PATENTS file in the same directory.
  21351. *
  21352. *
  21353. * @typechecks static-only
  21354. */
  21355. /**
  21356. * Memoizes the return value of a function that accepts one string argument.
  21357. */
  21358. function memoizeStringOnly(callback) {
  21359. var cache = {};
  21360. return function (string) {
  21361. if (!cache.hasOwnProperty(string)) {
  21362. cache[string] = callback.call(this, string);
  21363. }
  21364. return cache[string];
  21365. };
  21366. }
  21367. module.exports = memoizeStringOnly;
  21368. /***/ }),
  21369. /* 148 */
  21370. /***/ (function(module, exports, __webpack_require__) {
  21371. "use strict";
  21372. /**
  21373. * Copyright 2013-present, Facebook, Inc.
  21374. * All rights reserved.
  21375. *
  21376. * This source code is licensed under the BSD-style license found in the
  21377. * LICENSE file in the root directory of this source tree. An additional grant
  21378. * of patent rights can be found in the PATENTS file in the same directory.
  21379. */
  21380. if (false) {
  21381. var invariant = require('fbjs/lib/invariant');
  21382. var warning = require('fbjs/lib/warning');
  21383. var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
  21384. var loggedTypeFailures = {};
  21385. }
  21386. /**
  21387. * Assert that the values match with the type specs.
  21388. * Error messages are memorized and will only be shown once.
  21389. *
  21390. * @param {object} typeSpecs Map of name to a ReactPropType
  21391. * @param {object} values Runtime values that need to be type-checked
  21392. * @param {string} location e.g. "prop", "context", "child context"
  21393. * @param {string} componentName Name of the component for error messages.
  21394. * @param {?Function} getStack Returns the component stack.
  21395. * @private
  21396. */
  21397. function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
  21398. if (false) {
  21399. for (var typeSpecName in typeSpecs) {
  21400. if (typeSpecs.hasOwnProperty(typeSpecName)) {
  21401. var error;
  21402. // Prop type validation may throw. In case they do, we don't want to
  21403. // fail the render phase where it didn't fail before. So we log it.
  21404. // After these have been cleaned up, we'll let them throw.
  21405. try {
  21406. // This is intentionally an invariant that gets caught. It's the same
  21407. // behavior as without this statement except with a better message.
  21408. invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
  21409. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
  21410. } catch (ex) {
  21411. error = ex;
  21412. }
  21413. warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
  21414. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  21415. // Only monitor this failure once because there tends to be a lot of the
  21416. // same error.
  21417. loggedTypeFailures[error.message] = true;
  21418. var stack = getStack ? getStack() : '';
  21419. warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
  21420. }
  21421. }
  21422. }
  21423. }
  21424. }
  21425. module.exports = checkPropTypes;
  21426. /***/ }),
  21427. /* 149 */
  21428. /***/ (function(module, exports, __webpack_require__) {
  21429. "use strict";
  21430. /**
  21431. * Copyright 2013-present, Facebook, Inc.
  21432. * All rights reserved.
  21433. *
  21434. * This source code is licensed under the BSD-style license found in the
  21435. * LICENSE file in the root directory of this source tree. An additional grant
  21436. * of patent rights can be found in the PATENTS file in the same directory.
  21437. */
  21438. var emptyFunction = __webpack_require__(10);
  21439. var invariant = __webpack_require__(0);
  21440. var warning = __webpack_require__(1);
  21441. var ReactPropTypesSecret = __webpack_require__(150);
  21442. var checkPropTypes = __webpack_require__(148);
  21443. module.exports = function(isValidElement, throwOnDirectAccess) {
  21444. /* global Symbol */
  21445. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  21446. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  21447. /**
  21448. * Returns the iterator method function contained on the iterable object.
  21449. *
  21450. * Be sure to invoke the function with the iterable as context:
  21451. *
  21452. * var iteratorFn = getIteratorFn(myIterable);
  21453. * if (iteratorFn) {
  21454. * var iterator = iteratorFn.call(myIterable);
  21455. * ...
  21456. * }
  21457. *
  21458. * @param {?object} maybeIterable
  21459. * @return {?function}
  21460. */
  21461. function getIteratorFn(maybeIterable) {
  21462. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  21463. if (typeof iteratorFn === 'function') {
  21464. return iteratorFn;
  21465. }
  21466. }
  21467. /**
  21468. * Collection of methods that allow declaration and validation of props that are
  21469. * supplied to React components. Example usage:
  21470. *
  21471. * var Props = require('ReactPropTypes');
  21472. * var MyArticle = React.createClass({
  21473. * propTypes: {
  21474. * // An optional string prop named "description".
  21475. * description: Props.string,
  21476. *
  21477. * // A required enum prop named "category".
  21478. * category: Props.oneOf(['News','Photos']).isRequired,
  21479. *
  21480. * // A prop named "dialog" that requires an instance of Dialog.
  21481. * dialog: Props.instanceOf(Dialog).isRequired
  21482. * },
  21483. * render: function() { ... }
  21484. * });
  21485. *
  21486. * A more formal specification of how these methods are used:
  21487. *
  21488. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  21489. * decl := ReactPropTypes.{type}(.isRequired)?
  21490. *
  21491. * Each and every declaration produces a function with the same signature. This
  21492. * allows the creation of custom validation functions. For example:
  21493. *
  21494. * var MyLink = React.createClass({
  21495. * propTypes: {
  21496. * // An optional string or URI prop named "href".
  21497. * href: function(props, propName, componentName) {
  21498. * var propValue = props[propName];
  21499. * if (propValue != null && typeof propValue !== 'string' &&
  21500. * !(propValue instanceof URI)) {
  21501. * return new Error(
  21502. * 'Expected a string or an URI for ' + propName + ' in ' +
  21503. * componentName
  21504. * );
  21505. * }
  21506. * }
  21507. * },
  21508. * render: function() {...}
  21509. * });
  21510. *
  21511. * @internal
  21512. */
  21513. var ANONYMOUS = '<<anonymous>>';
  21514. // Important!
  21515. // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
  21516. var ReactPropTypes = {
  21517. array: createPrimitiveTypeChecker('array'),
  21518. bool: createPrimitiveTypeChecker('boolean'),
  21519. func: createPrimitiveTypeChecker('function'),
  21520. number: createPrimitiveTypeChecker('number'),
  21521. object: createPrimitiveTypeChecker('object'),
  21522. string: createPrimitiveTypeChecker('string'),
  21523. symbol: createPrimitiveTypeChecker('symbol'),
  21524. any: createAnyTypeChecker(),
  21525. arrayOf: createArrayOfTypeChecker,
  21526. element: createElementTypeChecker(),
  21527. instanceOf: createInstanceTypeChecker,
  21528. node: createNodeChecker(),
  21529. objectOf: createObjectOfTypeChecker,
  21530. oneOf: createEnumTypeChecker,
  21531. oneOfType: createUnionTypeChecker,
  21532. shape: createShapeTypeChecker
  21533. };
  21534. /**
  21535. * inlined Object.is polyfill to avoid requiring consumers ship their own
  21536. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  21537. */
  21538. /*eslint-disable no-self-compare*/
  21539. function is(x, y) {
  21540. // SameValue algorithm
  21541. if (x === y) {
  21542. // Steps 1-5, 7-10
  21543. // Steps 6.b-6.e: +0 != -0
  21544. return x !== 0 || 1 / x === 1 / y;
  21545. } else {
  21546. // Step 6.a: NaN == NaN
  21547. return x !== x && y !== y;
  21548. }
  21549. }
  21550. /*eslint-enable no-self-compare*/
  21551. /**
  21552. * We use an Error-like object for backward compatibility as people may call
  21553. * PropTypes directly and inspect their output. However, we don't use real
  21554. * Errors anymore. We don't inspect their stack anyway, and creating them
  21555. * is prohibitively expensive if they are created too often, such as what
  21556. * happens in oneOfType() for any type before the one that matched.
  21557. */
  21558. function PropTypeError(message) {
  21559. this.message = message;
  21560. this.stack = '';
  21561. }
  21562. // Make `instanceof Error` still work for returned errors.
  21563. PropTypeError.prototype = Error.prototype;
  21564. function createChainableTypeChecker(validate) {
  21565. if (false) {
  21566. var manualPropTypeCallCache = {};
  21567. var manualPropTypeWarningCount = 0;
  21568. }
  21569. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  21570. componentName = componentName || ANONYMOUS;
  21571. propFullName = propFullName || propName;
  21572. if (secret !== ReactPropTypesSecret) {
  21573. if (throwOnDirectAccess) {
  21574. // New behavior only for users of `prop-types` package
  21575. invariant(
  21576. false,
  21577. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  21578. 'Use `PropTypes.checkPropTypes()` to call them. ' +
  21579. 'Read more at http://fb.me/use-check-prop-types'
  21580. );
  21581. } else if (false) {
  21582. // Old behavior for people using React.PropTypes
  21583. var cacheKey = componentName + ':' + propName;
  21584. if (
  21585. !manualPropTypeCallCache[cacheKey] &&
  21586. // Avoid spamming the console because they are often not actionable except for lib authors
  21587. manualPropTypeWarningCount < 3
  21588. ) {
  21589. warning(
  21590. false,
  21591. 'You are manually calling a React.PropTypes validation ' +
  21592. 'function for the `%s` prop on `%s`. This is deprecated ' +
  21593. 'and will throw in the standalone `prop-types` package. ' +
  21594. 'You may be seeing this warning due to a third-party PropTypes ' +
  21595. 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
  21596. propFullName,
  21597. componentName
  21598. );
  21599. manualPropTypeCallCache[cacheKey] = true;
  21600. manualPropTypeWarningCount++;
  21601. }
  21602. }
  21603. }
  21604. if (props[propName] == null) {
  21605. if (isRequired) {
  21606. if (props[propName] === null) {
  21607. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  21608. }
  21609. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  21610. }
  21611. return null;
  21612. } else {
  21613. return validate(props, propName, componentName, location, propFullName);
  21614. }
  21615. }
  21616. var chainedCheckType = checkType.bind(null, false);
  21617. chainedCheckType.isRequired = checkType.bind(null, true);
  21618. return chainedCheckType;
  21619. }
  21620. function createPrimitiveTypeChecker(expectedType) {
  21621. function validate(props, propName, componentName, location, propFullName, secret) {
  21622. var propValue = props[propName];
  21623. var propType = getPropType(propValue);
  21624. if (propType !== expectedType) {
  21625. // `propValue` being instance of, say, date/regexp, pass the 'object'
  21626. // check, but we can offer a more precise error message here rather than
  21627. // 'of type `object`'.
  21628. var preciseType = getPreciseType(propValue);
  21629. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  21630. }
  21631. return null;
  21632. }
  21633. return createChainableTypeChecker(validate);
  21634. }
  21635. function createAnyTypeChecker() {
  21636. return createChainableTypeChecker(emptyFunction.thatReturnsNull);
  21637. }
  21638. function createArrayOfTypeChecker(typeChecker) {
  21639. function validate(props, propName, componentName, location, propFullName) {
  21640. if (typeof typeChecker !== 'function') {
  21641. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  21642. }
  21643. var propValue = props[propName];
  21644. if (!Array.isArray(propValue)) {
  21645. var propType = getPropType(propValue);
  21646. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  21647. }
  21648. for (var i = 0; i < propValue.length; i++) {
  21649. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  21650. if (error instanceof Error) {
  21651. return error;
  21652. }
  21653. }
  21654. return null;
  21655. }
  21656. return createChainableTypeChecker(validate);
  21657. }
  21658. function createElementTypeChecker() {
  21659. function validate(props, propName, componentName, location, propFullName) {
  21660. var propValue = props[propName];
  21661. if (!isValidElement(propValue)) {
  21662. var propType = getPropType(propValue);
  21663. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  21664. }
  21665. return null;
  21666. }
  21667. return createChainableTypeChecker(validate);
  21668. }
  21669. function createInstanceTypeChecker(expectedClass) {
  21670. function validate(props, propName, componentName, location, propFullName) {
  21671. if (!(props[propName] instanceof expectedClass)) {
  21672. var expectedClassName = expectedClass.name || ANONYMOUS;
  21673. var actualClassName = getClassName(props[propName]);
  21674. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  21675. }
  21676. return null;
  21677. }
  21678. return createChainableTypeChecker(validate);
  21679. }
  21680. function createEnumTypeChecker(expectedValues) {
  21681. if (!Array.isArray(expectedValues)) {
  21682. false ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
  21683. return emptyFunction.thatReturnsNull;
  21684. }
  21685. function validate(props, propName, componentName, location, propFullName) {
  21686. var propValue = props[propName];
  21687. for (var i = 0; i < expectedValues.length; i++) {
  21688. if (is(propValue, expectedValues[i])) {
  21689. return null;
  21690. }
  21691. }
  21692. var valuesString = JSON.stringify(expectedValues);
  21693. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  21694. }
  21695. return createChainableTypeChecker(validate);
  21696. }
  21697. function createObjectOfTypeChecker(typeChecker) {
  21698. function validate(props, propName, componentName, location, propFullName) {
  21699. if (typeof typeChecker !== 'function') {
  21700. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  21701. }
  21702. var propValue = props[propName];
  21703. var propType = getPropType(propValue);
  21704. if (propType !== 'object') {
  21705. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  21706. }
  21707. for (var key in propValue) {
  21708. if (propValue.hasOwnProperty(key)) {
  21709. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  21710. if (error instanceof Error) {
  21711. return error;
  21712. }
  21713. }
  21714. }
  21715. return null;
  21716. }
  21717. return createChainableTypeChecker(validate);
  21718. }
  21719. function createUnionTypeChecker(arrayOfTypeCheckers) {
  21720. if (!Array.isArray(arrayOfTypeCheckers)) {
  21721. false ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  21722. return emptyFunction.thatReturnsNull;
  21723. }
  21724. function validate(props, propName, componentName, location, propFullName) {
  21725. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  21726. var checker = arrayOfTypeCheckers[i];
  21727. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
  21728. return null;
  21729. }
  21730. }
  21731. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  21732. }
  21733. return createChainableTypeChecker(validate);
  21734. }
  21735. function createNodeChecker() {
  21736. function validate(props, propName, componentName, location, propFullName) {
  21737. if (!isNode(props[propName])) {
  21738. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  21739. }
  21740. return null;
  21741. }
  21742. return createChainableTypeChecker(validate);
  21743. }
  21744. function createShapeTypeChecker(shapeTypes) {
  21745. function validate(props, propName, componentName, location, propFullName) {
  21746. var propValue = props[propName];
  21747. var propType = getPropType(propValue);
  21748. if (propType !== 'object') {
  21749. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  21750. }
  21751. for (var key in shapeTypes) {
  21752. var checker = shapeTypes[key];
  21753. if (!checker) {
  21754. continue;
  21755. }
  21756. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  21757. if (error) {
  21758. return error;
  21759. }
  21760. }
  21761. return null;
  21762. }
  21763. return createChainableTypeChecker(validate);
  21764. }
  21765. function isNode(propValue) {
  21766. switch (typeof propValue) {
  21767. case 'number':
  21768. case 'string':
  21769. case 'undefined':
  21770. return true;
  21771. case 'boolean':
  21772. return !propValue;
  21773. case 'object':
  21774. if (Array.isArray(propValue)) {
  21775. return propValue.every(isNode);
  21776. }
  21777. if (propValue === null || isValidElement(propValue)) {
  21778. return true;
  21779. }
  21780. var iteratorFn = getIteratorFn(propValue);
  21781. if (iteratorFn) {
  21782. var iterator = iteratorFn.call(propValue);
  21783. var step;
  21784. if (iteratorFn !== propValue.entries) {
  21785. while (!(step = iterator.next()).done) {
  21786. if (!isNode(step.value)) {
  21787. return false;
  21788. }
  21789. }
  21790. } else {
  21791. // Iterator will provide entry [k,v] tuples rather than values.
  21792. while (!(step = iterator.next()).done) {
  21793. var entry = step.value;
  21794. if (entry) {
  21795. if (!isNode(entry[1])) {
  21796. return false;
  21797. }
  21798. }
  21799. }
  21800. }
  21801. } else {
  21802. return false;
  21803. }
  21804. return true;
  21805. default:
  21806. return false;
  21807. }
  21808. }
  21809. function isSymbol(propType, propValue) {
  21810. // Native Symbol.
  21811. if (propType === 'symbol') {
  21812. return true;
  21813. }
  21814. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  21815. if (propValue['@@toStringTag'] === 'Symbol') {
  21816. return true;
  21817. }
  21818. // Fallback for non-spec compliant Symbols which are polyfilled.
  21819. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  21820. return true;
  21821. }
  21822. return false;
  21823. }
  21824. // Equivalent of `typeof` but with special handling for array and regexp.
  21825. function getPropType(propValue) {
  21826. var propType = typeof propValue;
  21827. if (Array.isArray(propValue)) {
  21828. return 'array';
  21829. }
  21830. if (propValue instanceof RegExp) {
  21831. // Old webkits (at least until Android 4.0) return 'function' rather than
  21832. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  21833. // passes PropTypes.object.
  21834. return 'object';
  21835. }
  21836. if (isSymbol(propType, propValue)) {
  21837. return 'symbol';
  21838. }
  21839. return propType;
  21840. }
  21841. // This handles more types than `getPropType`. Only used for error messages.
  21842. // See `createPrimitiveTypeChecker`.
  21843. function getPreciseType(propValue) {
  21844. var propType = getPropType(propValue);
  21845. if (propType === 'object') {
  21846. if (propValue instanceof Date) {
  21847. return 'date';
  21848. } else if (propValue instanceof RegExp) {
  21849. return 'regexp';
  21850. }
  21851. }
  21852. return propType;
  21853. }
  21854. // Returns class name of the object, if any.
  21855. function getClassName(propValue) {
  21856. if (!propValue.constructor || !propValue.constructor.name) {
  21857. return ANONYMOUS;
  21858. }
  21859. return propValue.constructor.name;
  21860. }
  21861. ReactPropTypes.checkPropTypes = checkPropTypes;
  21862. ReactPropTypes.PropTypes = ReactPropTypes;
  21863. return ReactPropTypes;
  21864. };
  21865. /***/ }),
  21866. /* 150 */
  21867. /***/ (function(module, exports, __webpack_require__) {
  21868. "use strict";
  21869. /**
  21870. * Copyright 2013-present, Facebook, Inc.
  21871. * All rights reserved.
  21872. *
  21873. * This source code is licensed under the BSD-style license found in the
  21874. * LICENSE file in the root directory of this source tree. An additional grant
  21875. * of patent rights can be found in the PATENTS file in the same directory.
  21876. */
  21877. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  21878. module.exports = ReactPropTypesSecret;
  21879. /***/ }),
  21880. /* 151 */
  21881. /***/ (function(module, exports, __webpack_require__) {
  21882. "use strict";
  21883. /**
  21884. * Copyright 2013-present, Facebook, Inc.
  21885. * All rights reserved.
  21886. *
  21887. * This source code is licensed under the BSD-style license found in the
  21888. * LICENSE file in the root directory of this source tree. An additional grant
  21889. * of patent rights can be found in the PATENTS file in the same directory.
  21890. *
  21891. */
  21892. var ARIADOMPropertyConfig = {
  21893. Properties: {
  21894. // Global States and Properties
  21895. 'aria-current': 0, // state
  21896. 'aria-details': 0,
  21897. 'aria-disabled': 0, // state
  21898. 'aria-hidden': 0, // state
  21899. 'aria-invalid': 0, // state
  21900. 'aria-keyshortcuts': 0,
  21901. 'aria-label': 0,
  21902. 'aria-roledescription': 0,
  21903. // Widget Attributes
  21904. 'aria-autocomplete': 0,
  21905. 'aria-checked': 0,
  21906. 'aria-expanded': 0,
  21907. 'aria-haspopup': 0,
  21908. 'aria-level': 0,
  21909. 'aria-modal': 0,
  21910. 'aria-multiline': 0,
  21911. 'aria-multiselectable': 0,
  21912. 'aria-orientation': 0,
  21913. 'aria-placeholder': 0,
  21914. 'aria-pressed': 0,
  21915. 'aria-readonly': 0,
  21916. 'aria-required': 0,
  21917. 'aria-selected': 0,
  21918. 'aria-sort': 0,
  21919. 'aria-valuemax': 0,
  21920. 'aria-valuemin': 0,
  21921. 'aria-valuenow': 0,
  21922. 'aria-valuetext': 0,
  21923. // Live Region Attributes
  21924. 'aria-atomic': 0,
  21925. 'aria-busy': 0,
  21926. 'aria-live': 0,
  21927. 'aria-relevant': 0,
  21928. // Drag-and-Drop Attributes
  21929. 'aria-dropeffect': 0,
  21930. 'aria-grabbed': 0,
  21931. // Relationship Attributes
  21932. 'aria-activedescendant': 0,
  21933. 'aria-colcount': 0,
  21934. 'aria-colindex': 0,
  21935. 'aria-colspan': 0,
  21936. 'aria-controls': 0,
  21937. 'aria-describedby': 0,
  21938. 'aria-errormessage': 0,
  21939. 'aria-flowto': 0,
  21940. 'aria-labelledby': 0,
  21941. 'aria-owns': 0,
  21942. 'aria-posinset': 0,
  21943. 'aria-rowcount': 0,
  21944. 'aria-rowindex': 0,
  21945. 'aria-rowspan': 0,
  21946. 'aria-setsize': 0
  21947. },
  21948. DOMAttributeNames: {},
  21949. DOMPropertyNames: {}
  21950. };
  21951. module.exports = ARIADOMPropertyConfig;
  21952. /***/ }),
  21953. /* 152 */
  21954. /***/ (function(module, exports, __webpack_require__) {
  21955. "use strict";
  21956. /**
  21957. * Copyright 2013-present, Facebook, Inc.
  21958. * All rights reserved.
  21959. *
  21960. * This source code is licensed under the BSD-style license found in the
  21961. * LICENSE file in the root directory of this source tree. An additional grant
  21962. * of patent rights can be found in the PATENTS file in the same directory.
  21963. *
  21964. */
  21965. var ReactDOMComponentTree = __webpack_require__(5);
  21966. var focusNode = __webpack_require__(72);
  21967. var AutoFocusUtils = {
  21968. focusDOMComponent: function () {
  21969. focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
  21970. }
  21971. };
  21972. module.exports = AutoFocusUtils;
  21973. /***/ }),
  21974. /* 153 */
  21975. /***/ (function(module, exports, __webpack_require__) {
  21976. "use strict";
  21977. /**
  21978. * Copyright 2013-present Facebook, Inc.
  21979. * All rights reserved.
  21980. *
  21981. * This source code is licensed under the BSD-style license found in the
  21982. * LICENSE file in the root directory of this source tree. An additional grant
  21983. * of patent rights can be found in the PATENTS file in the same directory.
  21984. *
  21985. */
  21986. var EventPropagators = __webpack_require__(27);
  21987. var ExecutionEnvironment = __webpack_require__(8);
  21988. var FallbackCompositionState = __webpack_require__(159);
  21989. var SyntheticCompositionEvent = __webpack_require__(196);
  21990. var SyntheticInputEvent = __webpack_require__(199);
  21991. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  21992. var START_KEYCODE = 229;
  21993. var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
  21994. var documentMode = null;
  21995. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  21996. documentMode = document.documentMode;
  21997. }
  21998. // Webkit offers a very useful `textInput` event that can be used to
  21999. // directly represent `beforeInput`. The IE `textinput` event is not as
  22000. // useful, so we don't use it.
  22001. var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
  22002. // In IE9+, we have access to composition events, but the data supplied
  22003. // by the native compositionend event may be incorrect. Japanese ideographic
  22004. // spaces, for instance (\u3000) are not recorded correctly.
  22005. var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
  22006. /**
  22007. * Opera <= 12 includes TextEvent in window, but does not fire
  22008. * text input events. Rely on keypress instead.
  22009. */
  22010. function isPresto() {
  22011. var opera = window.opera;
  22012. return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
  22013. }
  22014. var SPACEBAR_CODE = 32;
  22015. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  22016. // Events and their corresponding property names.
  22017. var eventTypes = {
  22018. beforeInput: {
  22019. phasedRegistrationNames: {
  22020. bubbled: 'onBeforeInput',
  22021. captured: 'onBeforeInputCapture'
  22022. },
  22023. dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
  22024. },
  22025. compositionEnd: {
  22026. phasedRegistrationNames: {
  22027. bubbled: 'onCompositionEnd',
  22028. captured: 'onCompositionEndCapture'
  22029. },
  22030. dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  22031. },
  22032. compositionStart: {
  22033. phasedRegistrationNames: {
  22034. bubbled: 'onCompositionStart',
  22035. captured: 'onCompositionStartCapture'
  22036. },
  22037. dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  22038. },
  22039. compositionUpdate: {
  22040. phasedRegistrationNames: {
  22041. bubbled: 'onCompositionUpdate',
  22042. captured: 'onCompositionUpdateCapture'
  22043. },
  22044. dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  22045. }
  22046. };
  22047. // Track whether we've ever handled a keypress on the space key.
  22048. var hasSpaceKeypress = false;
  22049. /**
  22050. * Return whether a native keypress event is assumed to be a command.
  22051. * This is required because Firefox fires `keypress` events for key commands
  22052. * (cut, copy, select-all, etc.) even though no character is inserted.
  22053. */
  22054. function isKeypressCommand(nativeEvent) {
  22055. return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  22056. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  22057. !(nativeEvent.ctrlKey && nativeEvent.altKey);
  22058. }
  22059. /**
  22060. * Translate native top level events into event types.
  22061. *
  22062. * @param {string} topLevelType
  22063. * @return {object}
  22064. */
  22065. function getCompositionEventType(topLevelType) {
  22066. switch (topLevelType) {
  22067. case 'topCompositionStart':
  22068. return eventTypes.compositionStart;
  22069. case 'topCompositionEnd':
  22070. return eventTypes.compositionEnd;
  22071. case 'topCompositionUpdate':
  22072. return eventTypes.compositionUpdate;
  22073. }
  22074. }
  22075. /**
  22076. * Does our fallback best-guess model think this event signifies that
  22077. * composition has begun?
  22078. *
  22079. * @param {string} topLevelType
  22080. * @param {object} nativeEvent
  22081. * @return {boolean}
  22082. */
  22083. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  22084. return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
  22085. }
  22086. /**
  22087. * Does our fallback mode think that this event is the end of composition?
  22088. *
  22089. * @param {string} topLevelType
  22090. * @param {object} nativeEvent
  22091. * @return {boolean}
  22092. */
  22093. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  22094. switch (topLevelType) {
  22095. case 'topKeyUp':
  22096. // Command keys insert or clear IME input.
  22097. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
  22098. case 'topKeyDown':
  22099. // Expect IME keyCode on each keydown. If we get any other
  22100. // code we must have exited earlier.
  22101. return nativeEvent.keyCode !== START_KEYCODE;
  22102. case 'topKeyPress':
  22103. case 'topMouseDown':
  22104. case 'topBlur':
  22105. // Events are not possible without cancelling IME.
  22106. return true;
  22107. default:
  22108. return false;
  22109. }
  22110. }
  22111. /**
  22112. * Google Input Tools provides composition data via a CustomEvent,
  22113. * with the `data` property populated in the `detail` object. If this
  22114. * is available on the event object, use it. If not, this is a plain
  22115. * composition event and we have nothing special to extract.
  22116. *
  22117. * @param {object} nativeEvent
  22118. * @return {?string}
  22119. */
  22120. function getDataFromCustomEvent(nativeEvent) {
  22121. var detail = nativeEvent.detail;
  22122. if (typeof detail === 'object' && 'data' in detail) {
  22123. return detail.data;
  22124. }
  22125. return null;
  22126. }
  22127. // Track the current IME composition fallback object, if any.
  22128. var currentComposition = null;
  22129. /**
  22130. * @return {?object} A SyntheticCompositionEvent.
  22131. */
  22132. function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22133. var eventType;
  22134. var fallbackData;
  22135. if (canUseCompositionEvent) {
  22136. eventType = getCompositionEventType(topLevelType);
  22137. } else if (!currentComposition) {
  22138. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  22139. eventType = eventTypes.compositionStart;
  22140. }
  22141. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  22142. eventType = eventTypes.compositionEnd;
  22143. }
  22144. if (!eventType) {
  22145. return null;
  22146. }
  22147. if (useFallbackCompositionData) {
  22148. // The current composition is stored statically and must not be
  22149. // overwritten while composition continues.
  22150. if (!currentComposition && eventType === eventTypes.compositionStart) {
  22151. currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
  22152. } else if (eventType === eventTypes.compositionEnd) {
  22153. if (currentComposition) {
  22154. fallbackData = currentComposition.getData();
  22155. }
  22156. }
  22157. }
  22158. var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
  22159. if (fallbackData) {
  22160. // Inject data generated from fallback path into the synthetic event.
  22161. // This matches the property of native CompositionEventInterface.
  22162. event.data = fallbackData;
  22163. } else {
  22164. var customData = getDataFromCustomEvent(nativeEvent);
  22165. if (customData !== null) {
  22166. event.data = customData;
  22167. }
  22168. }
  22169. EventPropagators.accumulateTwoPhaseDispatches(event);
  22170. return event;
  22171. }
  22172. /**
  22173. * @param {string} topLevelType Record from `EventConstants`.
  22174. * @param {object} nativeEvent Native browser event.
  22175. * @return {?string} The string corresponding to this `beforeInput` event.
  22176. */
  22177. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  22178. switch (topLevelType) {
  22179. case 'topCompositionEnd':
  22180. return getDataFromCustomEvent(nativeEvent);
  22181. case 'topKeyPress':
  22182. /**
  22183. * If native `textInput` events are available, our goal is to make
  22184. * use of them. However, there is a special case: the spacebar key.
  22185. * In Webkit, preventing default on a spacebar `textInput` event
  22186. * cancels character insertion, but it *also* causes the browser
  22187. * to fall back to its default spacebar behavior of scrolling the
  22188. * page.
  22189. *
  22190. * Tracking at:
  22191. * https://code.google.com/p/chromium/issues/detail?id=355103
  22192. *
  22193. * To avoid this issue, use the keypress event as if no `textInput`
  22194. * event is available.
  22195. */
  22196. var which = nativeEvent.which;
  22197. if (which !== SPACEBAR_CODE) {
  22198. return null;
  22199. }
  22200. hasSpaceKeypress = true;
  22201. return SPACEBAR_CHAR;
  22202. case 'topTextInput':
  22203. // Record the characters to be added to the DOM.
  22204. var chars = nativeEvent.data;
  22205. // If it's a spacebar character, assume that we have already handled
  22206. // it at the keypress level and bail immediately. Android Chrome
  22207. // doesn't give us keycodes, so we need to blacklist it.
  22208. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  22209. return null;
  22210. }
  22211. return chars;
  22212. default:
  22213. // For other native event types, do nothing.
  22214. return null;
  22215. }
  22216. }
  22217. /**
  22218. * For browsers that do not provide the `textInput` event, extract the
  22219. * appropriate string to use for SyntheticInputEvent.
  22220. *
  22221. * @param {string} topLevelType Record from `EventConstants`.
  22222. * @param {object} nativeEvent Native browser event.
  22223. * @return {?string} The fallback string for this `beforeInput` event.
  22224. */
  22225. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  22226. // If we are currently composing (IME) and using a fallback to do so,
  22227. // try to extract the composed characters from the fallback object.
  22228. // If composition event is available, we extract a string only at
  22229. // compositionevent, otherwise extract it at fallback events.
  22230. if (currentComposition) {
  22231. if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  22232. var chars = currentComposition.getData();
  22233. FallbackCompositionState.release(currentComposition);
  22234. currentComposition = null;
  22235. return chars;
  22236. }
  22237. return null;
  22238. }
  22239. switch (topLevelType) {
  22240. case 'topPaste':
  22241. // If a paste event occurs after a keypress, throw out the input
  22242. // chars. Paste events should not lead to BeforeInput events.
  22243. return null;
  22244. case 'topKeyPress':
  22245. /**
  22246. * As of v27, Firefox may fire keypress events even when no character
  22247. * will be inserted. A few possibilities:
  22248. *
  22249. * - `which` is `0`. Arrow keys, Esc key, etc.
  22250. *
  22251. * - `which` is the pressed key code, but no char is available.
  22252. * Ex: 'AltGr + d` in Polish. There is no modified character for
  22253. * this key combination and no character is inserted into the
  22254. * document, but FF fires the keypress for char code `100` anyway.
  22255. * No `input` event will occur.
  22256. *
  22257. * - `which` is the pressed key code, but a command combination is
  22258. * being used. Ex: `Cmd+C`. No character is inserted, and no
  22259. * `input` event will occur.
  22260. */
  22261. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  22262. return String.fromCharCode(nativeEvent.which);
  22263. }
  22264. return null;
  22265. case 'topCompositionEnd':
  22266. return useFallbackCompositionData ? null : nativeEvent.data;
  22267. default:
  22268. return null;
  22269. }
  22270. }
  22271. /**
  22272. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  22273. * `textInput` or fallback behavior.
  22274. *
  22275. * @return {?object} A SyntheticInputEvent.
  22276. */
  22277. function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22278. var chars;
  22279. if (canUseTextInputEvent) {
  22280. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  22281. } else {
  22282. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  22283. }
  22284. // If no characters are being inserted, no BeforeInput event should
  22285. // be fired.
  22286. if (!chars) {
  22287. return null;
  22288. }
  22289. var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
  22290. event.data = chars;
  22291. EventPropagators.accumulateTwoPhaseDispatches(event);
  22292. return event;
  22293. }
  22294. /**
  22295. * Create an `onBeforeInput` event to match
  22296. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  22297. *
  22298. * This event plugin is based on the native `textInput` event
  22299. * available in Chrome, Safari, Opera, and IE. This event fires after
  22300. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  22301. *
  22302. * `beforeInput` is spec'd but not implemented in any browsers, and
  22303. * the `input` event does not provide any useful information about what has
  22304. * actually been added, contrary to the spec. Thus, `textInput` is the best
  22305. * available event to identify the characters that have actually been inserted
  22306. * into the target node.
  22307. *
  22308. * This plugin is also responsible for emitting `composition` events, thus
  22309. * allowing us to share composition fallback code for both `beforeInput` and
  22310. * `composition` event types.
  22311. */
  22312. var BeforeInputEventPlugin = {
  22313. eventTypes: eventTypes,
  22314. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22315. return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
  22316. }
  22317. };
  22318. module.exports = BeforeInputEventPlugin;
  22319. /***/ }),
  22320. /* 154 */
  22321. /***/ (function(module, exports, __webpack_require__) {
  22322. "use strict";
  22323. /**
  22324. * Copyright 2013-present, Facebook, Inc.
  22325. * All rights reserved.
  22326. *
  22327. * This source code is licensed under the BSD-style license found in the
  22328. * LICENSE file in the root directory of this source tree. An additional grant
  22329. * of patent rights can be found in the PATENTS file in the same directory.
  22330. *
  22331. */
  22332. var CSSProperty = __webpack_require__(76);
  22333. var ExecutionEnvironment = __webpack_require__(8);
  22334. var ReactInstrumentation = __webpack_require__(11);
  22335. var camelizeStyleName = __webpack_require__(137);
  22336. var dangerousStyleValue = __webpack_require__(205);
  22337. var hyphenateStyleName = __webpack_require__(144);
  22338. var memoizeStringOnly = __webpack_require__(147);
  22339. var warning = __webpack_require__(1);
  22340. var processStyleName = memoizeStringOnly(function (styleName) {
  22341. return hyphenateStyleName(styleName);
  22342. });
  22343. var hasShorthandPropertyBug = false;
  22344. var styleFloatAccessor = 'cssFloat';
  22345. if (ExecutionEnvironment.canUseDOM) {
  22346. var tempStyle = document.createElement('div').style;
  22347. try {
  22348. // IE8 throws "Invalid argument." if resetting shorthand style properties.
  22349. tempStyle.font = '';
  22350. } catch (e) {
  22351. hasShorthandPropertyBug = true;
  22352. }
  22353. // IE8 only supports accessing cssFloat (standard) as styleFloat
  22354. if (document.documentElement.style.cssFloat === undefined) {
  22355. styleFloatAccessor = 'styleFloat';
  22356. }
  22357. }
  22358. if (false) {
  22359. // 'msTransform' is correct, but the other prefixes should be capitalized
  22360. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  22361. // style values shouldn't contain a semicolon
  22362. var badStyleValueWithSemicolonPattern = /;\s*$/;
  22363. var warnedStyleNames = {};
  22364. var warnedStyleValues = {};
  22365. var warnedForNaNValue = false;
  22366. var warnHyphenatedStyleName = function (name, owner) {
  22367. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  22368. return;
  22369. }
  22370. warnedStyleNames[name] = true;
  22371. process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
  22372. };
  22373. var warnBadVendoredStyleName = function (name, owner) {
  22374. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  22375. return;
  22376. }
  22377. warnedStyleNames[name] = true;
  22378. 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;
  22379. };
  22380. var warnStyleValueWithSemicolon = function (name, value, owner) {
  22381. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  22382. return;
  22383. }
  22384. warnedStyleValues[value] = true;
  22385. 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;
  22386. };
  22387. var warnStyleValueIsNaN = function (name, value, owner) {
  22388. if (warnedForNaNValue) {
  22389. return;
  22390. }
  22391. warnedForNaNValue = true;
  22392. process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
  22393. };
  22394. var checkRenderMessage = function (owner) {
  22395. if (owner) {
  22396. var name = owner.getName();
  22397. if (name) {
  22398. return ' Check the render method of `' + name + '`.';
  22399. }
  22400. }
  22401. return '';
  22402. };
  22403. /**
  22404. * @param {string} name
  22405. * @param {*} value
  22406. * @param {ReactDOMComponent} component
  22407. */
  22408. var warnValidStyle = function (name, value, component) {
  22409. var owner;
  22410. if (component) {
  22411. owner = component._currentElement._owner;
  22412. }
  22413. if (name.indexOf('-') > -1) {
  22414. warnHyphenatedStyleName(name, owner);
  22415. } else if (badVendoredStyleNamePattern.test(name)) {
  22416. warnBadVendoredStyleName(name, owner);
  22417. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  22418. warnStyleValueWithSemicolon(name, value, owner);
  22419. }
  22420. if (typeof value === 'number' && isNaN(value)) {
  22421. warnStyleValueIsNaN(name, value, owner);
  22422. }
  22423. };
  22424. }
  22425. /**
  22426. * Operations for dealing with CSS properties.
  22427. */
  22428. var CSSPropertyOperations = {
  22429. /**
  22430. * Serializes a mapping of style properties for use as inline styles:
  22431. *
  22432. * > createMarkupForStyles({width: '200px', height: 0})
  22433. * "width:200px;height:0;"
  22434. *
  22435. * Undefined values are ignored so that declarative programming is easier.
  22436. * The result should be HTML-escaped before insertion into the DOM.
  22437. *
  22438. * @param {object} styles
  22439. * @param {ReactDOMComponent} component
  22440. * @return {?string}
  22441. */
  22442. createMarkupForStyles: function (styles, component) {
  22443. var serialized = '';
  22444. for (var styleName in styles) {
  22445. if (!styles.hasOwnProperty(styleName)) {
  22446. continue;
  22447. }
  22448. var styleValue = styles[styleName];
  22449. if (false) {
  22450. warnValidStyle(styleName, styleValue, component);
  22451. }
  22452. if (styleValue != null) {
  22453. serialized += processStyleName(styleName) + ':';
  22454. serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
  22455. }
  22456. }
  22457. return serialized || null;
  22458. },
  22459. /**
  22460. * Sets the value for multiple styles on a node. If a value is specified as
  22461. * '' (empty string), the corresponding style property will be unset.
  22462. *
  22463. * @param {DOMElement} node
  22464. * @param {object} styles
  22465. * @param {ReactDOMComponent} component
  22466. */
  22467. setValueForStyles: function (node, styles, component) {
  22468. if (false) {
  22469. ReactInstrumentation.debugTool.onHostOperation({
  22470. instanceID: component._debugID,
  22471. type: 'update styles',
  22472. payload: styles
  22473. });
  22474. }
  22475. var style = node.style;
  22476. for (var styleName in styles) {
  22477. if (!styles.hasOwnProperty(styleName)) {
  22478. continue;
  22479. }
  22480. if (false) {
  22481. warnValidStyle(styleName, styles[styleName], component);
  22482. }
  22483. var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
  22484. if (styleName === 'float' || styleName === 'cssFloat') {
  22485. styleName = styleFloatAccessor;
  22486. }
  22487. if (styleValue) {
  22488. style[styleName] = styleValue;
  22489. } else {
  22490. var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
  22491. if (expansion) {
  22492. // Shorthand property that IE8 won't like unsetting, so unset each
  22493. // component to placate it
  22494. for (var individualStyleName in expansion) {
  22495. style[individualStyleName] = '';
  22496. }
  22497. } else {
  22498. style[styleName] = '';
  22499. }
  22500. }
  22501. }
  22502. }
  22503. };
  22504. module.exports = CSSPropertyOperations;
  22505. /***/ }),
  22506. /* 155 */
  22507. /***/ (function(module, exports, __webpack_require__) {
  22508. "use strict";
  22509. /**
  22510. * Copyright 2013-present, Facebook, Inc.
  22511. * All rights reserved.
  22512. *
  22513. * This source code is licensed under the BSD-style license found in the
  22514. * LICENSE file in the root directory of this source tree. An additional grant
  22515. * of patent rights can be found in the PATENTS file in the same directory.
  22516. *
  22517. */
  22518. var EventPluginHub = __webpack_require__(26);
  22519. var EventPropagators = __webpack_require__(27);
  22520. var ExecutionEnvironment = __webpack_require__(8);
  22521. var ReactDOMComponentTree = __webpack_require__(5);
  22522. var ReactUpdates = __webpack_require__(12);
  22523. var SyntheticEvent = __webpack_require__(13);
  22524. var getEventTarget = __webpack_require__(63);
  22525. var isEventSupported = __webpack_require__(64);
  22526. var isTextInputElement = __webpack_require__(93);
  22527. var eventTypes = {
  22528. change: {
  22529. phasedRegistrationNames: {
  22530. bubbled: 'onChange',
  22531. captured: 'onChangeCapture'
  22532. },
  22533. dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
  22534. }
  22535. };
  22536. /**
  22537. * For IE shims
  22538. */
  22539. var activeElement = null;
  22540. var activeElementInst = null;
  22541. var activeElementValue = null;
  22542. var activeElementValueProp = null;
  22543. /**
  22544. * SECTION: handle `change` event
  22545. */
  22546. function shouldUseChangeEvent(elem) {
  22547. var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  22548. return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
  22549. }
  22550. var doesChangeEventBubble = false;
  22551. if (ExecutionEnvironment.canUseDOM) {
  22552. // See `handleChange` comment below
  22553. doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8);
  22554. }
  22555. function manualDispatchChangeEvent(nativeEvent) {
  22556. var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
  22557. EventPropagators.accumulateTwoPhaseDispatches(event);
  22558. // If change and propertychange bubbled, we'd just bind to it like all the
  22559. // other events and have it go through ReactBrowserEventEmitter. Since it
  22560. // doesn't, we manually listen for the events and so we have to enqueue and
  22561. // process the abstract event manually.
  22562. //
  22563. // Batching is necessary here in order to ensure that all event handlers run
  22564. // before the next rerender (including event handlers attached to ancestor
  22565. // elements instead of directly on the input). Without this, controlled
  22566. // components don't work properly in conjunction with event bubbling because
  22567. // the component is rerendered and the value reverted before all the event
  22568. // handlers can run. See https://github.com/facebook/react/issues/708.
  22569. ReactUpdates.batchedUpdates(runEventInBatch, event);
  22570. }
  22571. function runEventInBatch(event) {
  22572. EventPluginHub.enqueueEvents(event);
  22573. EventPluginHub.processEventQueue(false);
  22574. }
  22575. function startWatchingForChangeEventIE8(target, targetInst) {
  22576. activeElement = target;
  22577. activeElementInst = targetInst;
  22578. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  22579. }
  22580. function stopWatchingForChangeEventIE8() {
  22581. if (!activeElement) {
  22582. return;
  22583. }
  22584. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  22585. activeElement = null;
  22586. activeElementInst = null;
  22587. }
  22588. function getTargetInstForChangeEvent(topLevelType, targetInst) {
  22589. if (topLevelType === 'topChange') {
  22590. return targetInst;
  22591. }
  22592. }
  22593. function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
  22594. if (topLevelType === 'topFocus') {
  22595. // stopWatching() should be a noop here but we call it just in case we
  22596. // missed a blur event somehow.
  22597. stopWatchingForChangeEventIE8();
  22598. startWatchingForChangeEventIE8(target, targetInst);
  22599. } else if (topLevelType === 'topBlur') {
  22600. stopWatchingForChangeEventIE8();
  22601. }
  22602. }
  22603. /**
  22604. * SECTION: handle `input` event
  22605. */
  22606. var isInputEventSupported = false;
  22607. if (ExecutionEnvironment.canUseDOM) {
  22608. // IE9 claims to support the input event but fails to trigger it when
  22609. // deleting text, so we ignore its input events.
  22610. // IE10+ fire input events to often, such when a placeholder
  22611. // changes or when an input with a placeholder is focused.
  22612. isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11);
  22613. }
  22614. /**
  22615. * (For IE <=11) Replacement getter/setter for the `value` property that gets
  22616. * set on the active element.
  22617. */
  22618. var newValueProp = {
  22619. get: function () {
  22620. return activeElementValueProp.get.call(this);
  22621. },
  22622. set: function (val) {
  22623. // Cast to a string so we can do equality checks.
  22624. activeElementValue = '' + val;
  22625. activeElementValueProp.set.call(this, val);
  22626. }
  22627. };
  22628. /**
  22629. * (For IE <=11) Starts tracking propertychange events on the passed-in element
  22630. * and override the value property so that we can distinguish user events from
  22631. * value changes in JS.
  22632. */
  22633. function startWatchingForValueChange(target, targetInst) {
  22634. activeElement = target;
  22635. activeElementInst = targetInst;
  22636. activeElementValue = target.value;
  22637. activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
  22638. // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
  22639. // on DOM elements
  22640. Object.defineProperty(activeElement, 'value', newValueProp);
  22641. if (activeElement.attachEvent) {
  22642. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  22643. } else {
  22644. activeElement.addEventListener('propertychange', handlePropertyChange, false);
  22645. }
  22646. }
  22647. /**
  22648. * (For IE <=11) Removes the event listeners from the currently-tracked element,
  22649. * if any exists.
  22650. */
  22651. function stopWatchingForValueChange() {
  22652. if (!activeElement) {
  22653. return;
  22654. }
  22655. // delete restores the original property definition
  22656. delete activeElement.value;
  22657. if (activeElement.detachEvent) {
  22658. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  22659. } else {
  22660. activeElement.removeEventListener('propertychange', handlePropertyChange, false);
  22661. }
  22662. activeElement = null;
  22663. activeElementInst = null;
  22664. activeElementValue = null;
  22665. activeElementValueProp = null;
  22666. }
  22667. /**
  22668. * (For IE <=11) Handles a propertychange event, sending a `change` event if
  22669. * the value of the active element has changed.
  22670. */
  22671. function handlePropertyChange(nativeEvent) {
  22672. if (nativeEvent.propertyName !== 'value') {
  22673. return;
  22674. }
  22675. var value = nativeEvent.srcElement.value;
  22676. if (value === activeElementValue) {
  22677. return;
  22678. }
  22679. activeElementValue = value;
  22680. manualDispatchChangeEvent(nativeEvent);
  22681. }
  22682. /**
  22683. * If a `change` event should be fired, returns the target's ID.
  22684. */
  22685. function getTargetInstForInputEvent(topLevelType, targetInst) {
  22686. if (topLevelType === 'topInput') {
  22687. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  22688. // what we want so fall through here and trigger an abstract event
  22689. return targetInst;
  22690. }
  22691. }
  22692. function handleEventsForInputEventIE(topLevelType, target, targetInst) {
  22693. if (topLevelType === 'topFocus') {
  22694. // In IE8, we can capture almost all .value changes by adding a
  22695. // propertychange handler and looking for events with propertyName
  22696. // equal to 'value'
  22697. // In IE9-11, propertychange fires for most input events but is buggy and
  22698. // doesn't fire when text is deleted, but conveniently, selectionchange
  22699. // appears to fire in all of the remaining cases so we catch those and
  22700. // forward the event if the value has changed
  22701. // In either case, we don't want to call the event handler if the value
  22702. // is changed from JS so we redefine a setter for `.value` that updates
  22703. // our activeElementValue variable, allowing us to ignore those changes
  22704. //
  22705. // stopWatching() should be a noop here but we call it just in case we
  22706. // missed a blur event somehow.
  22707. stopWatchingForValueChange();
  22708. startWatchingForValueChange(target, targetInst);
  22709. } else if (topLevelType === 'topBlur') {
  22710. stopWatchingForValueChange();
  22711. }
  22712. }
  22713. // For IE8 and IE9.
  22714. function getTargetInstForInputEventIE(topLevelType, targetInst) {
  22715. if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
  22716. // On the selectionchange event, the target is just document which isn't
  22717. // helpful for us so just check activeElement instead.
  22718. //
  22719. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  22720. // propertychange on the first input event after setting `value` from a
  22721. // script and fires only keydown, keypress, keyup. Catching keyup usually
  22722. // gets it and catching keydown lets us fire an event for the first
  22723. // keystroke if user does a key repeat (it'll be a little delayed: right
  22724. // before the second keystroke). Other input methods (e.g., paste) seem to
  22725. // fire selectionchange normally.
  22726. if (activeElement && activeElement.value !== activeElementValue) {
  22727. activeElementValue = activeElement.value;
  22728. return activeElementInst;
  22729. }
  22730. }
  22731. }
  22732. /**
  22733. * SECTION: handle `click` event
  22734. */
  22735. function shouldUseClickEvent(elem) {
  22736. // Use the `click` event to detect changes to checkbox and radio inputs.
  22737. // This approach works across all browsers, whereas `change` does not fire
  22738. // until `blur` in IE8.
  22739. return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
  22740. }
  22741. function getTargetInstForClickEvent(topLevelType, targetInst) {
  22742. if (topLevelType === 'topClick') {
  22743. return targetInst;
  22744. }
  22745. }
  22746. function handleControlledInputBlur(inst, node) {
  22747. // TODO: In IE, inst is occasionally null. Why?
  22748. if (inst == null) {
  22749. return;
  22750. }
  22751. // Fiber and ReactDOM keep wrapper state in separate places
  22752. var state = inst._wrapperState || node._wrapperState;
  22753. if (!state || !state.controlled || node.type !== 'number') {
  22754. return;
  22755. }
  22756. // If controlled, assign the value attribute to the current value on blur
  22757. var value = '' + node.value;
  22758. if (node.getAttribute('value') !== value) {
  22759. node.setAttribute('value', value);
  22760. }
  22761. }
  22762. /**
  22763. * This plugin creates an `onChange` event that normalizes change events
  22764. * across form elements. This event fires at a time when it's possible to
  22765. * change the element's value without seeing a flicker.
  22766. *
  22767. * Supported elements are:
  22768. * - input (see `isTextInputElement`)
  22769. * - textarea
  22770. * - select
  22771. */
  22772. var ChangeEventPlugin = {
  22773. eventTypes: eventTypes,
  22774. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22775. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  22776. var getTargetInstFunc, handleEventFunc;
  22777. if (shouldUseChangeEvent(targetNode)) {
  22778. if (doesChangeEventBubble) {
  22779. getTargetInstFunc = getTargetInstForChangeEvent;
  22780. } else {
  22781. handleEventFunc = handleEventsForChangeEventIE8;
  22782. }
  22783. } else if (isTextInputElement(targetNode)) {
  22784. if (isInputEventSupported) {
  22785. getTargetInstFunc = getTargetInstForInputEvent;
  22786. } else {
  22787. getTargetInstFunc = getTargetInstForInputEventIE;
  22788. handleEventFunc = handleEventsForInputEventIE;
  22789. }
  22790. } else if (shouldUseClickEvent(targetNode)) {
  22791. getTargetInstFunc = getTargetInstForClickEvent;
  22792. }
  22793. if (getTargetInstFunc) {
  22794. var inst = getTargetInstFunc(topLevelType, targetInst);
  22795. if (inst) {
  22796. var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
  22797. event.type = 'change';
  22798. EventPropagators.accumulateTwoPhaseDispatches(event);
  22799. return event;
  22800. }
  22801. }
  22802. if (handleEventFunc) {
  22803. handleEventFunc(topLevelType, targetNode, targetInst);
  22804. }
  22805. // When blurring, set the value attribute for number inputs
  22806. if (topLevelType === 'topBlur') {
  22807. handleControlledInputBlur(targetInst, targetNode);
  22808. }
  22809. }
  22810. };
  22811. module.exports = ChangeEventPlugin;
  22812. /***/ }),
  22813. /* 156 */
  22814. /***/ (function(module, exports, __webpack_require__) {
  22815. "use strict";
  22816. /**
  22817. * Copyright 2013-present, Facebook, Inc.
  22818. * All rights reserved.
  22819. *
  22820. * This source code is licensed under the BSD-style license found in the
  22821. * LICENSE file in the root directory of this source tree. An additional grant
  22822. * of patent rights can be found in the PATENTS file in the same directory.
  22823. *
  22824. */
  22825. var _prodInvariant = __webpack_require__(2);
  22826. var DOMLazyTree = __webpack_require__(18);
  22827. var ExecutionEnvironment = __webpack_require__(8);
  22828. var createNodesFromMarkup = __webpack_require__(140);
  22829. var emptyFunction = __webpack_require__(10);
  22830. var invariant = __webpack_require__(0);
  22831. var Danger = {
  22832. /**
  22833. * Replaces a node with a string of markup at its current position within its
  22834. * parent. The markup must render into a single root node.
  22835. *
  22836. * @param {DOMElement} oldChild Child node to replace.
  22837. * @param {string} markup Markup to render in place of the child node.
  22838. * @internal
  22839. */
  22840. dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
  22841. !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;
  22842. !markup ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
  22843. !(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;
  22844. if (typeof markup === 'string') {
  22845. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  22846. oldChild.parentNode.replaceChild(newChild, oldChild);
  22847. } else {
  22848. DOMLazyTree.replaceChildWithTree(oldChild, markup);
  22849. }
  22850. }
  22851. };
  22852. module.exports = Danger;
  22853. /***/ }),
  22854. /* 157 */
  22855. /***/ (function(module, exports, __webpack_require__) {
  22856. "use strict";
  22857. /**
  22858. * Copyright 2013-present, Facebook, Inc.
  22859. * All rights reserved.
  22860. *
  22861. * This source code is licensed under the BSD-style license found in the
  22862. * LICENSE file in the root directory of this source tree. An additional grant
  22863. * of patent rights can be found in the PATENTS file in the same directory.
  22864. *
  22865. */
  22866. /**
  22867. * Module that is injectable into `EventPluginHub`, that specifies a
  22868. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  22869. * plugins, without having to package every one of them. This is better than
  22870. * having plugins be ordered in the same order that they are injected because
  22871. * that ordering would be influenced by the packaging order.
  22872. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  22873. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  22874. */
  22875. var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
  22876. module.exports = DefaultEventPluginOrder;
  22877. /***/ }),
  22878. /* 158 */
  22879. /***/ (function(module, exports, __webpack_require__) {
  22880. "use strict";
  22881. /**
  22882. * Copyright 2013-present, Facebook, Inc.
  22883. * All rights reserved.
  22884. *
  22885. * This source code is licensed under the BSD-style license found in the
  22886. * LICENSE file in the root directory of this source tree. An additional grant
  22887. * of patent rights can be found in the PATENTS file in the same directory.
  22888. *
  22889. */
  22890. var EventPropagators = __webpack_require__(27);
  22891. var ReactDOMComponentTree = __webpack_require__(5);
  22892. var SyntheticMouseEvent = __webpack_require__(32);
  22893. var eventTypes = {
  22894. mouseEnter: {
  22895. registrationName: 'onMouseEnter',
  22896. dependencies: ['topMouseOut', 'topMouseOver']
  22897. },
  22898. mouseLeave: {
  22899. registrationName: 'onMouseLeave',
  22900. dependencies: ['topMouseOut', 'topMouseOver']
  22901. }
  22902. };
  22903. var EnterLeaveEventPlugin = {
  22904. eventTypes: eventTypes,
  22905. /**
  22906. * For almost every interaction we care about, there will be both a top-level
  22907. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  22908. * we do not extract duplicate events. However, moving the mouse into the
  22909. * browser from outside will not fire a `mouseout` event. In this case, we use
  22910. * the `mouseover` top-level event.
  22911. */
  22912. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22913. if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  22914. return null;
  22915. }
  22916. if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
  22917. // Must not be a mouse in or mouse out - ignoring.
  22918. return null;
  22919. }
  22920. var win;
  22921. if (nativeEventTarget.window === nativeEventTarget) {
  22922. // `nativeEventTarget` is probably a window object.
  22923. win = nativeEventTarget;
  22924. } else {
  22925. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  22926. var doc = nativeEventTarget.ownerDocument;
  22927. if (doc) {
  22928. win = doc.defaultView || doc.parentWindow;
  22929. } else {
  22930. win = window;
  22931. }
  22932. }
  22933. var from;
  22934. var to;
  22935. if (topLevelType === 'topMouseOut') {
  22936. from = targetInst;
  22937. var related = nativeEvent.relatedTarget || nativeEvent.toElement;
  22938. to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
  22939. } else {
  22940. // Moving to a node from outside the window.
  22941. from = null;
  22942. to = targetInst;
  22943. }
  22944. if (from === to) {
  22945. // Nothing pertains to our managed components.
  22946. return null;
  22947. }
  22948. var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
  22949. var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
  22950. var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
  22951. leave.type = 'mouseleave';
  22952. leave.target = fromNode;
  22953. leave.relatedTarget = toNode;
  22954. var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
  22955. enter.type = 'mouseenter';
  22956. enter.target = toNode;
  22957. enter.relatedTarget = fromNode;
  22958. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
  22959. return [leave, enter];
  22960. }
  22961. };
  22962. module.exports = EnterLeaveEventPlugin;
  22963. /***/ }),
  22964. /* 159 */
  22965. /***/ (function(module, exports, __webpack_require__) {
  22966. "use strict";
  22967. /**
  22968. * Copyright 2013-present, Facebook, Inc.
  22969. * All rights reserved.
  22970. *
  22971. * This source code is licensed under the BSD-style license found in the
  22972. * LICENSE file in the root directory of this source tree. An additional grant
  22973. * of patent rights can be found in the PATENTS file in the same directory.
  22974. *
  22975. */
  22976. var _assign = __webpack_require__(3);
  22977. var PooledClass = __webpack_require__(16);
  22978. var getTextContentAccessor = __webpack_require__(91);
  22979. /**
  22980. * This helper class stores information about text content of a target node,
  22981. * allowing comparison of content before and after a given event.
  22982. *
  22983. * Identify the node where selection currently begins, then observe
  22984. * both its text content and its current position in the DOM. Since the
  22985. * browser may natively replace the target node during composition, we can
  22986. * use its position to find its replacement.
  22987. *
  22988. * @param {DOMEventTarget} root
  22989. */
  22990. function FallbackCompositionState(root) {
  22991. this._root = root;
  22992. this._startText = this.getText();
  22993. this._fallbackText = null;
  22994. }
  22995. _assign(FallbackCompositionState.prototype, {
  22996. destructor: function () {
  22997. this._root = null;
  22998. this._startText = null;
  22999. this._fallbackText = null;
  23000. },
  23001. /**
  23002. * Get current text of input.
  23003. *
  23004. * @return {string}
  23005. */
  23006. getText: function () {
  23007. if ('value' in this._root) {
  23008. return this._root.value;
  23009. }
  23010. return this._root[getTextContentAccessor()];
  23011. },
  23012. /**
  23013. * Determine the differing substring between the initially stored
  23014. * text content and the current content.
  23015. *
  23016. * @return {string}
  23017. */
  23018. getData: function () {
  23019. if (this._fallbackText) {
  23020. return this._fallbackText;
  23021. }
  23022. var start;
  23023. var startValue = this._startText;
  23024. var startLength = startValue.length;
  23025. var end;
  23026. var endValue = this.getText();
  23027. var endLength = endValue.length;
  23028. for (start = 0; start < startLength; start++) {
  23029. if (startValue[start] !== endValue[start]) {
  23030. break;
  23031. }
  23032. }
  23033. var minEnd = startLength - start;
  23034. for (end = 1; end <= minEnd; end++) {
  23035. if (startValue[startLength - end] !== endValue[endLength - end]) {
  23036. break;
  23037. }
  23038. }
  23039. var sliceTail = end > 1 ? 1 - end : undefined;
  23040. this._fallbackText = endValue.slice(start, sliceTail);
  23041. return this._fallbackText;
  23042. }
  23043. });
  23044. PooledClass.addPoolingTo(FallbackCompositionState);
  23045. module.exports = FallbackCompositionState;
  23046. /***/ }),
  23047. /* 160 */
  23048. /***/ (function(module, exports, __webpack_require__) {
  23049. "use strict";
  23050. /**
  23051. * Copyright 2013-present, Facebook, Inc.
  23052. * All rights reserved.
  23053. *
  23054. * This source code is licensed under the BSD-style license found in the
  23055. * LICENSE file in the root directory of this source tree. An additional grant
  23056. * of patent rights can be found in the PATENTS file in the same directory.
  23057. *
  23058. */
  23059. var DOMProperty = __webpack_require__(19);
  23060. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  23061. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  23062. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  23063. var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  23064. var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  23065. var HTMLDOMPropertyConfig = {
  23066. isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
  23067. Properties: {
  23068. /**
  23069. * Standard Properties
  23070. */
  23071. accept: 0,
  23072. acceptCharset: 0,
  23073. accessKey: 0,
  23074. action: 0,
  23075. allowFullScreen: HAS_BOOLEAN_VALUE,
  23076. allowTransparency: 0,
  23077. alt: 0,
  23078. // specifies target context for links with `preload` type
  23079. as: 0,
  23080. async: HAS_BOOLEAN_VALUE,
  23081. autoComplete: 0,
  23082. // autoFocus is polyfilled/normalized by AutoFocusUtils
  23083. // autoFocus: HAS_BOOLEAN_VALUE,
  23084. autoPlay: HAS_BOOLEAN_VALUE,
  23085. capture: HAS_BOOLEAN_VALUE,
  23086. cellPadding: 0,
  23087. cellSpacing: 0,
  23088. charSet: 0,
  23089. challenge: 0,
  23090. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  23091. cite: 0,
  23092. classID: 0,
  23093. className: 0,
  23094. cols: HAS_POSITIVE_NUMERIC_VALUE,
  23095. colSpan: 0,
  23096. content: 0,
  23097. contentEditable: 0,
  23098. contextMenu: 0,
  23099. controls: HAS_BOOLEAN_VALUE,
  23100. coords: 0,
  23101. crossOrigin: 0,
  23102. data: 0, // For `<object />` acts as `src`.
  23103. dateTime: 0,
  23104. 'default': HAS_BOOLEAN_VALUE,
  23105. defer: HAS_BOOLEAN_VALUE,
  23106. dir: 0,
  23107. disabled: HAS_BOOLEAN_VALUE,
  23108. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  23109. draggable: 0,
  23110. encType: 0,
  23111. form: 0,
  23112. formAction: 0,
  23113. formEncType: 0,
  23114. formMethod: 0,
  23115. formNoValidate: HAS_BOOLEAN_VALUE,
  23116. formTarget: 0,
  23117. frameBorder: 0,
  23118. headers: 0,
  23119. height: 0,
  23120. hidden: HAS_BOOLEAN_VALUE,
  23121. high: 0,
  23122. href: 0,
  23123. hrefLang: 0,
  23124. htmlFor: 0,
  23125. httpEquiv: 0,
  23126. icon: 0,
  23127. id: 0,
  23128. inputMode: 0,
  23129. integrity: 0,
  23130. is: 0,
  23131. keyParams: 0,
  23132. keyType: 0,
  23133. kind: 0,
  23134. label: 0,
  23135. lang: 0,
  23136. list: 0,
  23137. loop: HAS_BOOLEAN_VALUE,
  23138. low: 0,
  23139. manifest: 0,
  23140. marginHeight: 0,
  23141. marginWidth: 0,
  23142. max: 0,
  23143. maxLength: 0,
  23144. media: 0,
  23145. mediaGroup: 0,
  23146. method: 0,
  23147. min: 0,
  23148. minLength: 0,
  23149. // Caution; `option.selected` is not updated if `select.multiple` is
  23150. // disabled with `removeAttribute`.
  23151. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  23152. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  23153. name: 0,
  23154. nonce: 0,
  23155. noValidate: HAS_BOOLEAN_VALUE,
  23156. open: HAS_BOOLEAN_VALUE,
  23157. optimum: 0,
  23158. pattern: 0,
  23159. placeholder: 0,
  23160. playsInline: HAS_BOOLEAN_VALUE,
  23161. poster: 0,
  23162. preload: 0,
  23163. profile: 0,
  23164. radioGroup: 0,
  23165. readOnly: HAS_BOOLEAN_VALUE,
  23166. referrerPolicy: 0,
  23167. rel: 0,
  23168. required: HAS_BOOLEAN_VALUE,
  23169. reversed: HAS_BOOLEAN_VALUE,
  23170. role: 0,
  23171. rows: HAS_POSITIVE_NUMERIC_VALUE,
  23172. rowSpan: HAS_NUMERIC_VALUE,
  23173. sandbox: 0,
  23174. scope: 0,
  23175. scoped: HAS_BOOLEAN_VALUE,
  23176. scrolling: 0,
  23177. seamless: HAS_BOOLEAN_VALUE,
  23178. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  23179. shape: 0,
  23180. size: HAS_POSITIVE_NUMERIC_VALUE,
  23181. sizes: 0,
  23182. span: HAS_POSITIVE_NUMERIC_VALUE,
  23183. spellCheck: 0,
  23184. src: 0,
  23185. srcDoc: 0,
  23186. srcLang: 0,
  23187. srcSet: 0,
  23188. start: HAS_NUMERIC_VALUE,
  23189. step: 0,
  23190. style: 0,
  23191. summary: 0,
  23192. tabIndex: 0,
  23193. target: 0,
  23194. title: 0,
  23195. // Setting .type throws on non-<input> tags
  23196. type: 0,
  23197. useMap: 0,
  23198. value: 0,
  23199. width: 0,
  23200. wmode: 0,
  23201. wrap: 0,
  23202. /**
  23203. * RDFa Properties
  23204. */
  23205. about: 0,
  23206. datatype: 0,
  23207. inlist: 0,
  23208. prefix: 0,
  23209. // property is also supported for OpenGraph in meta tags.
  23210. property: 0,
  23211. resource: 0,
  23212. 'typeof': 0,
  23213. vocab: 0,
  23214. /**
  23215. * Non-standard Properties
  23216. */
  23217. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  23218. // keyboard hints.
  23219. autoCapitalize: 0,
  23220. autoCorrect: 0,
  23221. // autoSave allows WebKit/Blink to persist values of input fields on page reloads
  23222. autoSave: 0,
  23223. // color is for Safari mask-icon link
  23224. color: 0,
  23225. // itemProp, itemScope, itemType are for
  23226. // Microdata support. See http://schema.org/docs/gs.html
  23227. itemProp: 0,
  23228. itemScope: HAS_BOOLEAN_VALUE,
  23229. itemType: 0,
  23230. // itemID and itemRef are for Microdata support as well but
  23231. // only specified in the WHATWG spec document. See
  23232. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  23233. itemID: 0,
  23234. itemRef: 0,
  23235. // results show looking glass icon and recent searches on input
  23236. // search fields in WebKit/Blink
  23237. results: 0,
  23238. // IE-only attribute that specifies security restrictions on an iframe
  23239. // as an alternative to the sandbox attribute on IE<10
  23240. security: 0,
  23241. // IE-only attribute that controls focus behavior
  23242. unselectable: 0
  23243. },
  23244. DOMAttributeNames: {
  23245. acceptCharset: 'accept-charset',
  23246. className: 'class',
  23247. htmlFor: 'for',
  23248. httpEquiv: 'http-equiv'
  23249. },
  23250. DOMPropertyNames: {},
  23251. DOMMutationMethods: {
  23252. value: function (node, value) {
  23253. if (value == null) {
  23254. return node.removeAttribute('value');
  23255. }
  23256. // Number inputs get special treatment due to some edge cases in
  23257. // Chrome. Let everything else assign the value attribute as normal.
  23258. // https://github.com/facebook/react/issues/7253#issuecomment-236074326
  23259. if (node.type !== 'number' || node.hasAttribute('value') === false) {
  23260. node.setAttribute('value', '' + value);
  23261. } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) {
  23262. // Don't assign an attribute if validation reports bad
  23263. // input. Chrome will clear the value. Additionally, don't
  23264. // operate on inputs that have focus, otherwise Chrome might
  23265. // strip off trailing decimal places and cause the user's
  23266. // cursor position to jump to the beginning of the input.
  23267. //
  23268. // In ReactDOMInput, we have an onBlur event that will trigger
  23269. // this function again when focus is lost.
  23270. node.setAttribute('value', '' + value);
  23271. }
  23272. }
  23273. }
  23274. };
  23275. module.exports = HTMLDOMPropertyConfig;
  23276. /***/ }),
  23277. /* 161 */
  23278. /***/ (function(module, exports, __webpack_require__) {
  23279. "use strict";
  23280. /* WEBPACK VAR INJECTION */(function(process) {/**
  23281. * Copyright 2014-present, Facebook, Inc.
  23282. * All rights reserved.
  23283. *
  23284. * This source code is licensed under the BSD-style license found in the
  23285. * LICENSE file in the root directory of this source tree. An additional grant
  23286. * of patent rights can be found in the PATENTS file in the same directory.
  23287. *
  23288. */
  23289. var ReactReconciler = __webpack_require__(20);
  23290. var instantiateReactComponent = __webpack_require__(92);
  23291. var KeyEscapeUtils = __webpack_require__(55);
  23292. var shouldUpdateReactComponent = __webpack_require__(65);
  23293. var traverseAllChildren = __webpack_require__(95);
  23294. var warning = __webpack_require__(1);
  23295. var ReactComponentTreeHook;
  23296. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  23297. // Temporary hack.
  23298. // Inline requires don't work well with Jest:
  23299. // https://github.com/facebook/react/issues/7240
  23300. // Remove the inline requires when we don't need them anymore:
  23301. // https://github.com/facebook/react/pull/7178
  23302. ReactComponentTreeHook = __webpack_require__(96);
  23303. }
  23304. function instantiateChild(childInstances, child, name, selfDebugID) {
  23305. // We found a component instance.
  23306. var keyUnique = childInstances[name] === undefined;
  23307. if (false) {
  23308. if (!ReactComponentTreeHook) {
  23309. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  23310. }
  23311. if (!keyUnique) {
  23312. 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;
  23313. }
  23314. }
  23315. if (child != null && keyUnique) {
  23316. childInstances[name] = instantiateReactComponent(child, true);
  23317. }
  23318. }
  23319. /**
  23320. * ReactChildReconciler provides helpers for initializing or updating a set of
  23321. * children. Its output is suitable for passing it onto ReactMultiChild which
  23322. * does diffed reordering and insertion.
  23323. */
  23324. var ReactChildReconciler = {
  23325. /**
  23326. * Generates a "mount image" for each of the supplied children. In the case
  23327. * of `ReactDOMComponent`, a mount image is a string of markup.
  23328. *
  23329. * @param {?object} nestedChildNodes Nested child maps.
  23330. * @return {?object} A set of child instances.
  23331. * @internal
  23332. */
  23333. instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots
  23334. ) {
  23335. if (nestedChildNodes == null) {
  23336. return null;
  23337. }
  23338. var childInstances = {};
  23339. if (false) {
  23340. traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
  23341. return instantiateChild(childInsts, child, name, selfDebugID);
  23342. }, childInstances);
  23343. } else {
  23344. traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
  23345. }
  23346. return childInstances;
  23347. },
  23348. /**
  23349. * Updates the rendered children and returns a new set of children.
  23350. *
  23351. * @param {?object} prevChildren Previously initialized set of children.
  23352. * @param {?object} nextChildren Flat child element maps.
  23353. * @param {ReactReconcileTransaction} transaction
  23354. * @param {object} context
  23355. * @return {?object} A new set of child instances.
  23356. * @internal
  23357. */
  23358. updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots
  23359. ) {
  23360. // We currently don't have a way to track moves here but if we use iterators
  23361. // instead of for..in we can zip the iterators and check if an item has
  23362. // moved.
  23363. // TODO: If nothing has changed, return the prevChildren object so that we
  23364. // can quickly bailout if nothing has changed.
  23365. if (!nextChildren && !prevChildren) {
  23366. return;
  23367. }
  23368. var name;
  23369. var prevChild;
  23370. for (name in nextChildren) {
  23371. if (!nextChildren.hasOwnProperty(name)) {
  23372. continue;
  23373. }
  23374. prevChild = prevChildren && prevChildren[name];
  23375. var prevElement = prevChild && prevChild._currentElement;
  23376. var nextElement = nextChildren[name];
  23377. if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
  23378. ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
  23379. nextChildren[name] = prevChild;
  23380. } else {
  23381. if (prevChild) {
  23382. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  23383. ReactReconciler.unmountComponent(prevChild, false);
  23384. }
  23385. // The child must be instantiated before it's mounted.
  23386. var nextChildInstance = instantiateReactComponent(nextElement, true);
  23387. nextChildren[name] = nextChildInstance;
  23388. // Creating mount image now ensures refs are resolved in right order
  23389. // (see https://github.com/facebook/react/pull/7101 for explanation).
  23390. var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID);
  23391. mountImages.push(nextChildMountImage);
  23392. }
  23393. }
  23394. // Unmount children that are no longer present.
  23395. for (name in prevChildren) {
  23396. if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
  23397. prevChild = prevChildren[name];
  23398. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  23399. ReactReconciler.unmountComponent(prevChild, false);
  23400. }
  23401. }
  23402. },
  23403. /**
  23404. * Unmounts all rendered children. This should be used to clean up children
  23405. * when this component is unmounted.
  23406. *
  23407. * @param {?object} renderedChildren Previously initialized set of children.
  23408. * @internal
  23409. */
  23410. unmountChildren: function (renderedChildren, safely) {
  23411. for (var name in renderedChildren) {
  23412. if (renderedChildren.hasOwnProperty(name)) {
  23413. var renderedChild = renderedChildren[name];
  23414. ReactReconciler.unmountComponent(renderedChild, safely);
  23415. }
  23416. }
  23417. }
  23418. };
  23419. module.exports = ReactChildReconciler;
  23420. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
  23421. /***/ }),
  23422. /* 162 */
  23423. /***/ (function(module, exports, __webpack_require__) {
  23424. "use strict";
  23425. /**
  23426. * Copyright 2013-present, Facebook, Inc.
  23427. * All rights reserved.
  23428. *
  23429. * This source code is licensed under the BSD-style license found in the
  23430. * LICENSE file in the root directory of this source tree. An additional grant
  23431. * of patent rights can be found in the PATENTS file in the same directory.
  23432. *
  23433. */
  23434. var DOMChildrenOperations = __webpack_require__(51);
  23435. var ReactDOMIDOperations = __webpack_require__(169);
  23436. /**
  23437. * Abstracts away all functionality of the reconciler that requires knowledge of
  23438. * the browser context. TODO: These callers should be refactored to avoid the
  23439. * need for this injection.
  23440. */
  23441. var ReactComponentBrowserEnvironment = {
  23442. processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  23443. replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup
  23444. };
  23445. module.exports = ReactComponentBrowserEnvironment;
  23446. /***/ }),
  23447. /* 163 */
  23448. /***/ (function(module, exports, __webpack_require__) {
  23449. "use strict";
  23450. /**
  23451. * Copyright 2013-present, Facebook, Inc.
  23452. * All rights reserved.
  23453. *
  23454. * This source code is licensed under the BSD-style license found in the
  23455. * LICENSE file in the root directory of this source tree. An additional grant
  23456. * of patent rights can be found in the PATENTS file in the same directory.
  23457. *
  23458. */
  23459. var _prodInvariant = __webpack_require__(2),
  23460. _assign = __webpack_require__(3);
  23461. var React = __webpack_require__(21);
  23462. var ReactComponentEnvironment = __webpack_require__(57);
  23463. var ReactCurrentOwner = __webpack_require__(14);
  23464. var ReactErrorUtils = __webpack_require__(58);
  23465. var ReactInstanceMap = __webpack_require__(28);
  23466. var ReactInstrumentation = __webpack_require__(11);
  23467. var ReactNodeTypes = __webpack_require__(86);
  23468. var ReactReconciler = __webpack_require__(20);
  23469. if (false) {
  23470. var checkReactTypeSpec = require('./checkReactTypeSpec');
  23471. }
  23472. var emptyObject = __webpack_require__(25);
  23473. var invariant = __webpack_require__(0);
  23474. var shallowEqual = __webpack_require__(50);
  23475. var shouldUpdateReactComponent = __webpack_require__(65);
  23476. var warning = __webpack_require__(1);
  23477. var CompositeTypes = {
  23478. ImpureClass: 0,
  23479. PureClass: 1,
  23480. StatelessFunctional: 2
  23481. };
  23482. function StatelessComponent(Component) {}
  23483. StatelessComponent.prototype.render = function () {
  23484. var Component = ReactInstanceMap.get(this)._currentElement.type;
  23485. var element = Component(this.props, this.context, this.updater);
  23486. warnIfInvalidElement(Component, element);
  23487. return element;
  23488. };
  23489. function warnIfInvalidElement(Component, element) {
  23490. if (false) {
  23491. 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;
  23492. process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
  23493. }
  23494. }
  23495. function shouldConstruct(Component) {
  23496. return !!(Component.prototype && Component.prototype.isReactComponent);
  23497. }
  23498. function isPureComponent(Component) {
  23499. return !!(Component.prototype && Component.prototype.isPureReactComponent);
  23500. }
  23501. // Separated into a function to contain deoptimizations caused by try/finally.
  23502. function measureLifeCyclePerf(fn, debugID, timerType) {
  23503. if (debugID === 0) {
  23504. // Top-level wrappers (see ReactMount) and empty components (see
  23505. // ReactDOMEmptyComponent) are invisible to hooks and devtools.
  23506. // Both are implementation details that should go away in the future.
  23507. return fn();
  23508. }
  23509. ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
  23510. try {
  23511. return fn();
  23512. } finally {
  23513. ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
  23514. }
  23515. }
  23516. /**
  23517. * ------------------ The Life-Cycle of a Composite Component ------------------
  23518. *
  23519. * - constructor: Initialization of state. The instance is now retained.
  23520. * - componentWillMount
  23521. * - render
  23522. * - [children's constructors]
  23523. * - [children's componentWillMount and render]
  23524. * - [children's componentDidMount]
  23525. * - componentDidMount
  23526. *
  23527. * Update Phases:
  23528. * - componentWillReceiveProps (only called if parent updated)
  23529. * - shouldComponentUpdate
  23530. * - componentWillUpdate
  23531. * - render
  23532. * - [children's constructors or receive props phases]
  23533. * - componentDidUpdate
  23534. *
  23535. * - componentWillUnmount
  23536. * - [children's componentWillUnmount]
  23537. * - [children destroyed]
  23538. * - (destroyed): The instance is now blank, released by React and ready for GC.
  23539. *
  23540. * -----------------------------------------------------------------------------
  23541. */
  23542. /**
  23543. * An incrementing ID assigned to each component when it is mounted. This is
  23544. * used to enforce the order in which `ReactUpdates` updates dirty components.
  23545. *
  23546. * @private
  23547. */
  23548. var nextMountID = 1;
  23549. /**
  23550. * @lends {ReactCompositeComponent.prototype}
  23551. */
  23552. var ReactCompositeComponent = {
  23553. /**
  23554. * Base constructor for all composite component.
  23555. *
  23556. * @param {ReactElement} element
  23557. * @final
  23558. * @internal
  23559. */
  23560. construct: function (element) {
  23561. this._currentElement = element;
  23562. this._rootNodeID = 0;
  23563. this._compositeType = null;
  23564. this._instance = null;
  23565. this._hostParent = null;
  23566. this._hostContainerInfo = null;
  23567. // See ReactUpdateQueue
  23568. this._updateBatchNumber = null;
  23569. this._pendingElement = null;
  23570. this._pendingStateQueue = null;
  23571. this._pendingReplaceState = false;
  23572. this._pendingForceUpdate = false;
  23573. this._renderedNodeType = null;
  23574. this._renderedComponent = null;
  23575. this._context = null;
  23576. this._mountOrder = 0;
  23577. this._topLevelWrapper = null;
  23578. // See ReactUpdates and ReactUpdateQueue.
  23579. this._pendingCallbacks = null;
  23580. // ComponentWillUnmount shall only be called once
  23581. this._calledComponentWillUnmount = false;
  23582. if (false) {
  23583. this._warnedAboutRefsInRender = false;
  23584. }
  23585. },
  23586. /**
  23587. * Initializes the component, renders markup, and registers event listeners.
  23588. *
  23589. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  23590. * @param {?object} hostParent
  23591. * @param {?object} hostContainerInfo
  23592. * @param {?object} context
  23593. * @return {?string} Rendered markup to be inserted into the DOM.
  23594. * @final
  23595. * @internal
  23596. */
  23597. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  23598. var _this = this;
  23599. this._context = context;
  23600. this._mountOrder = nextMountID++;
  23601. this._hostParent = hostParent;
  23602. this._hostContainerInfo = hostContainerInfo;
  23603. var publicProps = this._currentElement.props;
  23604. var publicContext = this._processContext(context);
  23605. var Component = this._currentElement.type;
  23606. var updateQueue = transaction.getUpdateQueue();
  23607. // Initialize the public class
  23608. var doConstruct = shouldConstruct(Component);
  23609. var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
  23610. var renderedElement;
  23611. // Support functional components
  23612. if (!doConstruct && (inst == null || inst.render == null)) {
  23613. renderedElement = inst;
  23614. warnIfInvalidElement(Component, renderedElement);
  23615. !(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;
  23616. inst = new StatelessComponent(Component);
  23617. this._compositeType = CompositeTypes.StatelessFunctional;
  23618. } else {
  23619. if (isPureComponent(Component)) {
  23620. this._compositeType = CompositeTypes.PureClass;
  23621. } else {
  23622. this._compositeType = CompositeTypes.ImpureClass;
  23623. }
  23624. }
  23625. if (false) {
  23626. // This will throw later in _renderValidatedComponent, but add an early
  23627. // warning now to help debugging
  23628. if (inst.render == null) {
  23629. 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;
  23630. }
  23631. var propsMutated = inst.props !== publicProps;
  23632. var componentName = Component.displayName || Component.name || 'Component';
  23633. 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;
  23634. }
  23635. // These should be set up in the constructor, but as a convenience for
  23636. // simpler class abstractions, we set them up after the fact.
  23637. inst.props = publicProps;
  23638. inst.context = publicContext;
  23639. inst.refs = emptyObject;
  23640. inst.updater = updateQueue;
  23641. this._instance = inst;
  23642. // Store a reference from the instance back to the internal representation
  23643. ReactInstanceMap.set(inst, this);
  23644. if (false) {
  23645. // Since plain JS classes are defined without any special initialization
  23646. // logic, we can not catch common errors early. Therefore, we have to
  23647. // catch them here, at initialization time, instead.
  23648. 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;
  23649. 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;
  23650. 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;
  23651. 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;
  23652. 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;
  23653. 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;
  23654. 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;
  23655. }
  23656. var initialState = inst.state;
  23657. if (initialState === undefined) {
  23658. inst.state = initialState = null;
  23659. }
  23660. !(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;
  23661. this._pendingStateQueue = null;
  23662. this._pendingReplaceState = false;
  23663. this._pendingForceUpdate = false;
  23664. var markup;
  23665. if (inst.unstable_handleError) {
  23666. markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23667. } else {
  23668. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23669. }
  23670. if (inst.componentDidMount) {
  23671. if (false) {
  23672. transaction.getReactMountReady().enqueue(function () {
  23673. measureLifeCyclePerf(function () {
  23674. return inst.componentDidMount();
  23675. }, _this._debugID, 'componentDidMount');
  23676. });
  23677. } else {
  23678. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  23679. }
  23680. }
  23681. return markup;
  23682. },
  23683. _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
  23684. if (false) {
  23685. ReactCurrentOwner.current = this;
  23686. try {
  23687. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  23688. } finally {
  23689. ReactCurrentOwner.current = null;
  23690. }
  23691. } else {
  23692. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  23693. }
  23694. },
  23695. _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
  23696. var Component = this._currentElement.type;
  23697. if (doConstruct) {
  23698. if (false) {
  23699. return measureLifeCyclePerf(function () {
  23700. return new Component(publicProps, publicContext, updateQueue);
  23701. }, this._debugID, 'ctor');
  23702. } else {
  23703. return new Component(publicProps, publicContext, updateQueue);
  23704. }
  23705. }
  23706. // This can still be an instance in case of factory components
  23707. // but we'll count this as time spent rendering as the more common case.
  23708. if (false) {
  23709. return measureLifeCyclePerf(function () {
  23710. return Component(publicProps, publicContext, updateQueue);
  23711. }, this._debugID, 'render');
  23712. } else {
  23713. return Component(publicProps, publicContext, updateQueue);
  23714. }
  23715. },
  23716. performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  23717. var markup;
  23718. var checkpoint = transaction.checkpoint();
  23719. try {
  23720. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23721. } catch (e) {
  23722. // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
  23723. transaction.rollback(checkpoint);
  23724. this._instance.unstable_handleError(e);
  23725. if (this._pendingStateQueue) {
  23726. this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
  23727. }
  23728. checkpoint = transaction.checkpoint();
  23729. this._renderedComponent.unmountComponent(true);
  23730. transaction.rollback(checkpoint);
  23731. // Try again - we've informed the component about the error, so they can render an error message this time.
  23732. // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
  23733. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23734. }
  23735. return markup;
  23736. },
  23737. performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  23738. var inst = this._instance;
  23739. var debugID = 0;
  23740. if (false) {
  23741. debugID = this._debugID;
  23742. }
  23743. if (inst.componentWillMount) {
  23744. if (false) {
  23745. measureLifeCyclePerf(function () {
  23746. return inst.componentWillMount();
  23747. }, debugID, 'componentWillMount');
  23748. } else {
  23749. inst.componentWillMount();
  23750. }
  23751. // When mounting, calls to `setState` by `componentWillMount` will set
  23752. // `this._pendingStateQueue` without triggering a re-render.
  23753. if (this._pendingStateQueue) {
  23754. inst.state = this._processPendingState(inst.props, inst.context);
  23755. }
  23756. }
  23757. // If not a stateless component, we now render
  23758. if (renderedElement === undefined) {
  23759. renderedElement = this._renderValidatedComponent();
  23760. }
  23761. var nodeType = ReactNodeTypes.getType(renderedElement);
  23762. this._renderedNodeType = nodeType;
  23763. var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  23764. );
  23765. this._renderedComponent = child;
  23766. var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
  23767. if (false) {
  23768. if (debugID !== 0) {
  23769. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  23770. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  23771. }
  23772. }
  23773. return markup;
  23774. },
  23775. getHostNode: function () {
  23776. return ReactReconciler.getHostNode(this._renderedComponent);
  23777. },
  23778. /**
  23779. * Releases any resources allocated by `mountComponent`.
  23780. *
  23781. * @final
  23782. * @internal
  23783. */
  23784. unmountComponent: function (safely) {
  23785. if (!this._renderedComponent) {
  23786. return;
  23787. }
  23788. var inst = this._instance;
  23789. if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
  23790. inst._calledComponentWillUnmount = true;
  23791. if (safely) {
  23792. var name = this.getName() + '.componentWillUnmount()';
  23793. ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
  23794. } else {
  23795. if (false) {
  23796. measureLifeCyclePerf(function () {
  23797. return inst.componentWillUnmount();
  23798. }, this._debugID, 'componentWillUnmount');
  23799. } else {
  23800. inst.componentWillUnmount();
  23801. }
  23802. }
  23803. }
  23804. if (this._renderedComponent) {
  23805. ReactReconciler.unmountComponent(this._renderedComponent, safely);
  23806. this._renderedNodeType = null;
  23807. this._renderedComponent = null;
  23808. this._instance = null;
  23809. }
  23810. // Reset pending fields
  23811. // Even if this component is scheduled for another update in ReactUpdates,
  23812. // it would still be ignored because these fields are reset.
  23813. this._pendingStateQueue = null;
  23814. this._pendingReplaceState = false;
  23815. this._pendingForceUpdate = false;
  23816. this._pendingCallbacks = null;
  23817. this._pendingElement = null;
  23818. // These fields do not really need to be reset since this object is no
  23819. // longer accessible.
  23820. this._context = null;
  23821. this._rootNodeID = 0;
  23822. this._topLevelWrapper = null;
  23823. // Delete the reference from the instance to this internal representation
  23824. // which allow the internals to be properly cleaned up even if the user
  23825. // leaks a reference to the public instance.
  23826. ReactInstanceMap.remove(inst);
  23827. // Some existing components rely on inst.props even after they've been
  23828. // destroyed (in event handlers).
  23829. // TODO: inst.props = null;
  23830. // TODO: inst.state = null;
  23831. // TODO: inst.context = null;
  23832. },
  23833. /**
  23834. * Filters the context object to only contain keys specified in
  23835. * `contextTypes`
  23836. *
  23837. * @param {object} context
  23838. * @return {?object}
  23839. * @private
  23840. */
  23841. _maskContext: function (context) {
  23842. var Component = this._currentElement.type;
  23843. var contextTypes = Component.contextTypes;
  23844. if (!contextTypes) {
  23845. return emptyObject;
  23846. }
  23847. var maskedContext = {};
  23848. for (var contextName in contextTypes) {
  23849. maskedContext[contextName] = context[contextName];
  23850. }
  23851. return maskedContext;
  23852. },
  23853. /**
  23854. * Filters the context object to only contain keys specified in
  23855. * `contextTypes`, and asserts that they are valid.
  23856. *
  23857. * @param {object} context
  23858. * @return {?object}
  23859. * @private
  23860. */
  23861. _processContext: function (context) {
  23862. var maskedContext = this._maskContext(context);
  23863. if (false) {
  23864. var Component = this._currentElement.type;
  23865. if (Component.contextTypes) {
  23866. this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
  23867. }
  23868. }
  23869. return maskedContext;
  23870. },
  23871. /**
  23872. * @param {object} currentContext
  23873. * @return {object}
  23874. * @private
  23875. */
  23876. _processChildContext: function (currentContext) {
  23877. var Component = this._currentElement.type;
  23878. var inst = this._instance;
  23879. var childContext;
  23880. if (inst.getChildContext) {
  23881. if (false) {
  23882. ReactInstrumentation.debugTool.onBeginProcessingChildContext();
  23883. try {
  23884. childContext = inst.getChildContext();
  23885. } finally {
  23886. ReactInstrumentation.debugTool.onEndProcessingChildContext();
  23887. }
  23888. } else {
  23889. childContext = inst.getChildContext();
  23890. }
  23891. }
  23892. if (childContext) {
  23893. !(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;
  23894. if (false) {
  23895. this._checkContextTypes(Component.childContextTypes, childContext, 'child context');
  23896. }
  23897. for (var name in childContext) {
  23898. !(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;
  23899. }
  23900. return _assign({}, currentContext, childContext);
  23901. }
  23902. return currentContext;
  23903. },
  23904. /**
  23905. * Assert that the context types are valid
  23906. *
  23907. * @param {object} typeSpecs Map of context field to a ReactPropType
  23908. * @param {object} values Runtime values that need to be type-checked
  23909. * @param {string} location e.g. "prop", "context", "child context"
  23910. * @private
  23911. */
  23912. _checkContextTypes: function (typeSpecs, values, location) {
  23913. if (false) {
  23914. checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
  23915. }
  23916. },
  23917. receiveComponent: function (nextElement, transaction, nextContext) {
  23918. var prevElement = this._currentElement;
  23919. var prevContext = this._context;
  23920. this._pendingElement = null;
  23921. this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
  23922. },
  23923. /**
  23924. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  23925. * is set, update the component.
  23926. *
  23927. * @param {ReactReconcileTransaction} transaction
  23928. * @internal
  23929. */
  23930. performUpdateIfNecessary: function (transaction) {
  23931. if (this._pendingElement != null) {
  23932. ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
  23933. } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  23934. this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
  23935. } else {
  23936. this._updateBatchNumber = null;
  23937. }
  23938. },
  23939. /**
  23940. * Perform an update to a mounted component. The componentWillReceiveProps and
  23941. * shouldComponentUpdate methods are called, then (assuming the update isn't
  23942. * skipped) the remaining update lifecycle methods are called and the DOM
  23943. * representation is updated.
  23944. *
  23945. * By default, this implements React's rendering and reconciliation algorithm.
  23946. * Sophisticated clients may wish to override this.
  23947. *
  23948. * @param {ReactReconcileTransaction} transaction
  23949. * @param {ReactElement} prevParentElement
  23950. * @param {ReactElement} nextParentElement
  23951. * @internal
  23952. * @overridable
  23953. */
  23954. updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
  23955. var inst = this._instance;
  23956. !(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;
  23957. var willReceive = false;
  23958. var nextContext;
  23959. // Determine if the context has changed or not
  23960. if (this._context === nextUnmaskedContext) {
  23961. nextContext = inst.context;
  23962. } else {
  23963. nextContext = this._processContext(nextUnmaskedContext);
  23964. willReceive = true;
  23965. }
  23966. var prevProps = prevParentElement.props;
  23967. var nextProps = nextParentElement.props;
  23968. // Not a simple state update but a props update
  23969. if (prevParentElement !== nextParentElement) {
  23970. willReceive = true;
  23971. }
  23972. // An update here will schedule an update but immediately set
  23973. // _pendingStateQueue which will ensure that any state updates gets
  23974. // immediately reconciled instead of waiting for the next batch.
  23975. if (willReceive && inst.componentWillReceiveProps) {
  23976. if (false) {
  23977. measureLifeCyclePerf(function () {
  23978. return inst.componentWillReceiveProps(nextProps, nextContext);
  23979. }, this._debugID, 'componentWillReceiveProps');
  23980. } else {
  23981. inst.componentWillReceiveProps(nextProps, nextContext);
  23982. }
  23983. }
  23984. var nextState = this._processPendingState(nextProps, nextContext);
  23985. var shouldUpdate = true;
  23986. if (!this._pendingForceUpdate) {
  23987. if (inst.shouldComponentUpdate) {
  23988. if (false) {
  23989. shouldUpdate = measureLifeCyclePerf(function () {
  23990. return inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  23991. }, this._debugID, 'shouldComponentUpdate');
  23992. } else {
  23993. shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  23994. }
  23995. } else {
  23996. if (this._compositeType === CompositeTypes.PureClass) {
  23997. shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState);
  23998. }
  23999. }
  24000. }
  24001. if (false) {
  24002. 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;
  24003. }
  24004. this._updateBatchNumber = null;
  24005. if (shouldUpdate) {
  24006. this._pendingForceUpdate = false;
  24007. // Will set `this.props`, `this.state` and `this.context`.
  24008. this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
  24009. } else {
  24010. // If it's determined that a component should not update, we still want
  24011. // to set props and state but we shortcut the rest of the update.
  24012. this._currentElement = nextParentElement;
  24013. this._context = nextUnmaskedContext;
  24014. inst.props = nextProps;
  24015. inst.state = nextState;
  24016. inst.context = nextContext;
  24017. }
  24018. },
  24019. _processPendingState: function (props, context) {
  24020. var inst = this._instance;
  24021. var queue = this._pendingStateQueue;
  24022. var replace = this._pendingReplaceState;
  24023. this._pendingReplaceState = false;
  24024. this._pendingStateQueue = null;
  24025. if (!queue) {
  24026. return inst.state;
  24027. }
  24028. if (replace && queue.length === 1) {
  24029. return queue[0];
  24030. }
  24031. var nextState = _assign({}, replace ? queue[0] : inst.state);
  24032. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  24033. var partial = queue[i];
  24034. _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
  24035. }
  24036. return nextState;
  24037. },
  24038. /**
  24039. * Merges new props and state, notifies delegate methods of update and
  24040. * performs update.
  24041. *
  24042. * @param {ReactElement} nextElement Next element
  24043. * @param {object} nextProps Next public object to set as properties.
  24044. * @param {?object} nextState Next object to set as state.
  24045. * @param {?object} nextContext Next public object to set as context.
  24046. * @param {ReactReconcileTransaction} transaction
  24047. * @param {?object} unmaskedContext
  24048. * @private
  24049. */
  24050. _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
  24051. var _this2 = this;
  24052. var inst = this._instance;
  24053. var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
  24054. var prevProps;
  24055. var prevState;
  24056. var prevContext;
  24057. if (hasComponentDidUpdate) {
  24058. prevProps = inst.props;
  24059. prevState = inst.state;
  24060. prevContext = inst.context;
  24061. }
  24062. if (inst.componentWillUpdate) {
  24063. if (false) {
  24064. measureLifeCyclePerf(function () {
  24065. return inst.componentWillUpdate(nextProps, nextState, nextContext);
  24066. }, this._debugID, 'componentWillUpdate');
  24067. } else {
  24068. inst.componentWillUpdate(nextProps, nextState, nextContext);
  24069. }
  24070. }
  24071. this._currentElement = nextElement;
  24072. this._context = unmaskedContext;
  24073. inst.props = nextProps;
  24074. inst.state = nextState;
  24075. inst.context = nextContext;
  24076. this._updateRenderedComponent(transaction, unmaskedContext);
  24077. if (hasComponentDidUpdate) {
  24078. if (false) {
  24079. transaction.getReactMountReady().enqueue(function () {
  24080. measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate');
  24081. });
  24082. } else {
  24083. transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
  24084. }
  24085. }
  24086. },
  24087. /**
  24088. * Call the component's `render` method and update the DOM accordingly.
  24089. *
  24090. * @param {ReactReconcileTransaction} transaction
  24091. * @internal
  24092. */
  24093. _updateRenderedComponent: function (transaction, context) {
  24094. var prevComponentInstance = this._renderedComponent;
  24095. var prevRenderedElement = prevComponentInstance._currentElement;
  24096. var nextRenderedElement = this._renderValidatedComponent();
  24097. var debugID = 0;
  24098. if (false) {
  24099. debugID = this._debugID;
  24100. }
  24101. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  24102. ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
  24103. } else {
  24104. var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance);
  24105. ReactReconciler.unmountComponent(prevComponentInstance, false);
  24106. var nodeType = ReactNodeTypes.getType(nextRenderedElement);
  24107. this._renderedNodeType = nodeType;
  24108. var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  24109. );
  24110. this._renderedComponent = child;
  24111. var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID);
  24112. if (false) {
  24113. if (debugID !== 0) {
  24114. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  24115. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  24116. }
  24117. }
  24118. this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance);
  24119. }
  24120. },
  24121. /**
  24122. * Overridden in shallow rendering.
  24123. *
  24124. * @protected
  24125. */
  24126. _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) {
  24127. ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance);
  24128. },
  24129. /**
  24130. * @protected
  24131. */
  24132. _renderValidatedComponentWithoutOwnerOrContext: function () {
  24133. var inst = this._instance;
  24134. var renderedElement;
  24135. if (false) {
  24136. renderedElement = measureLifeCyclePerf(function () {
  24137. return inst.render();
  24138. }, this._debugID, 'render');
  24139. } else {
  24140. renderedElement = inst.render();
  24141. }
  24142. if (false) {
  24143. // We allow auto-mocks to proceed as if they're returning null.
  24144. if (renderedElement === undefined && inst.render._isMockFunction) {
  24145. // This is probably bad practice. Consider warning here and
  24146. // deprecating this convenience.
  24147. renderedElement = null;
  24148. }
  24149. }
  24150. return renderedElement;
  24151. },
  24152. /**
  24153. * @private
  24154. */
  24155. _renderValidatedComponent: function () {
  24156. var renderedElement;
  24157. if ("production" !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) {
  24158. ReactCurrentOwner.current = this;
  24159. try {
  24160. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  24161. } finally {
  24162. ReactCurrentOwner.current = null;
  24163. }
  24164. } else {
  24165. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  24166. }
  24167. !(
  24168. // TODO: An `isValidNode` function would probably be more appropriate
  24169. 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;
  24170. return renderedElement;
  24171. },
  24172. /**
  24173. * Lazily allocates the refs object and stores `component` as `ref`.
  24174. *
  24175. * @param {string} ref Reference name.
  24176. * @param {component} component Component to store as `ref`.
  24177. * @final
  24178. * @private
  24179. */
  24180. attachRef: function (ref, component) {
  24181. var inst = this.getPublicInstance();
  24182. !(inst != null) ? false ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
  24183. var publicComponentInstance = component.getPublicInstance();
  24184. if (false) {
  24185. var componentName = component && component.getName ? component.getName() : 'a component';
  24186. 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;
  24187. }
  24188. var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
  24189. refs[ref] = publicComponentInstance;
  24190. },
  24191. /**
  24192. * Detaches a reference name.
  24193. *
  24194. * @param {string} ref Name to dereference.
  24195. * @final
  24196. * @private
  24197. */
  24198. detachRef: function (ref) {
  24199. var refs = this.getPublicInstance().refs;
  24200. delete refs[ref];
  24201. },
  24202. /**
  24203. * Get a text description of the component that can be used to identify it
  24204. * in error messages.
  24205. * @return {string} The name or null.
  24206. * @internal
  24207. */
  24208. getName: function () {
  24209. var type = this._currentElement.type;
  24210. var constructor = this._instance && this._instance.constructor;
  24211. return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
  24212. },
  24213. /**
  24214. * Get the publicly accessible representation of this component - i.e. what
  24215. * is exposed by refs and returned by render. Can be null for stateless
  24216. * components.
  24217. *
  24218. * @return {ReactComponent} the public component instance.
  24219. * @internal
  24220. */
  24221. getPublicInstance: function () {
  24222. var inst = this._instance;
  24223. if (this._compositeType === CompositeTypes.StatelessFunctional) {
  24224. return null;
  24225. }
  24226. return inst;
  24227. },
  24228. // Stub
  24229. _instantiateReactComponent: null
  24230. };
  24231. module.exports = ReactCompositeComponent;
  24232. /***/ }),
  24233. /* 164 */
  24234. /***/ (function(module, exports, __webpack_require__) {
  24235. "use strict";
  24236. /**
  24237. * Copyright 2013-present, Facebook, Inc.
  24238. * All rights reserved.
  24239. *
  24240. * This source code is licensed under the BSD-style license found in the
  24241. * LICENSE file in the root directory of this source tree. An additional grant
  24242. * of patent rights can be found in the PATENTS file in the same directory.
  24243. *
  24244. */
  24245. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  24246. var ReactDOMComponentTree = __webpack_require__(5);
  24247. var ReactDefaultInjection = __webpack_require__(177);
  24248. var ReactMount = __webpack_require__(85);
  24249. var ReactReconciler = __webpack_require__(20);
  24250. var ReactUpdates = __webpack_require__(12);
  24251. var ReactVersion = __webpack_require__(190);
  24252. var findDOMNode = __webpack_require__(206);
  24253. var getHostComponentFromComposite = __webpack_require__(90);
  24254. var renderSubtreeIntoContainer = __webpack_require__(213);
  24255. var warning = __webpack_require__(1);
  24256. ReactDefaultInjection.inject();
  24257. var ReactDOM = {
  24258. findDOMNode: findDOMNode,
  24259. render: ReactMount.render,
  24260. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  24261. version: ReactVersion,
  24262. /* eslint-disable camelcase */
  24263. unstable_batchedUpdates: ReactUpdates.batchedUpdates,
  24264. unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
  24265. };
  24266. // Inject the runtime into a devtools global hook regardless of browser.
  24267. // Allows for debugging when the hook is injected on the page.
  24268. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  24269. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  24270. ComponentTree: {
  24271. getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
  24272. getNodeFromInstance: function (inst) {
  24273. // inst is an internal instance (but could be a composite)
  24274. if (inst._renderedComponent) {
  24275. inst = getHostComponentFromComposite(inst);
  24276. }
  24277. if (inst) {
  24278. return ReactDOMComponentTree.getNodeFromInstance(inst);
  24279. } else {
  24280. return null;
  24281. }
  24282. }
  24283. },
  24284. Mount: ReactMount,
  24285. Reconciler: ReactReconciler
  24286. });
  24287. }
  24288. if (false) {
  24289. var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
  24290. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  24291. // First check if devtools is not installed
  24292. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  24293. // If we're in Chrome or Firefox, provide a download link if not installed.
  24294. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
  24295. // Firefox does not have the issue with devtools loaded over file://
  24296. var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
  24297. 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');
  24298. }
  24299. }
  24300. var testFunc = function testFn() {};
  24301. 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;
  24302. // If we're in IE8, check to see if we are in compatibility mode and provide
  24303. // information on preventing compatibility mode
  24304. var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
  24305. 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;
  24306. var expectedFeatures = [
  24307. // shims
  24308. Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim];
  24309. for (var i = 0; i < expectedFeatures.length; i++) {
  24310. if (!expectedFeatures[i]) {
  24311. 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;
  24312. break;
  24313. }
  24314. }
  24315. }
  24316. }
  24317. if (false) {
  24318. var ReactInstrumentation = require('./ReactInstrumentation');
  24319. var ReactDOMUnknownPropertyHook = require('./ReactDOMUnknownPropertyHook');
  24320. var ReactDOMNullInputValuePropHook = require('./ReactDOMNullInputValuePropHook');
  24321. var ReactDOMInvalidARIAHook = require('./ReactDOMInvalidARIAHook');
  24322. ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook);
  24323. ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook);
  24324. ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook);
  24325. }
  24326. module.exports = ReactDOM;
  24327. /***/ }),
  24328. /* 165 */
  24329. /***/ (function(module, exports, __webpack_require__) {
  24330. "use strict";
  24331. /**
  24332. * Copyright 2013-present, Facebook, Inc.
  24333. * All rights reserved.
  24334. *
  24335. * This source code is licensed under the BSD-style license found in the
  24336. * LICENSE file in the root directory of this source tree. An additional grant
  24337. * of patent rights can be found in the PATENTS file in the same directory.
  24338. *
  24339. */
  24340. /* global hasOwnProperty:true */
  24341. var _prodInvariant = __webpack_require__(2),
  24342. _assign = __webpack_require__(3);
  24343. var AutoFocusUtils = __webpack_require__(152);
  24344. var CSSPropertyOperations = __webpack_require__(154);
  24345. var DOMLazyTree = __webpack_require__(18);
  24346. var DOMNamespaces = __webpack_require__(52);
  24347. var DOMProperty = __webpack_require__(19);
  24348. var DOMPropertyOperations = __webpack_require__(78);
  24349. var EventPluginHub = __webpack_require__(26);
  24350. var EventPluginRegistry = __webpack_require__(53);
  24351. var ReactBrowserEventEmitter = __webpack_require__(31);
  24352. var ReactDOMComponentFlags = __webpack_require__(79);
  24353. var ReactDOMComponentTree = __webpack_require__(5);
  24354. var ReactDOMInput = __webpack_require__(170);
  24355. var ReactDOMOption = __webpack_require__(171);
  24356. var ReactDOMSelect = __webpack_require__(80);
  24357. var ReactDOMTextarea = __webpack_require__(174);
  24358. var ReactInstrumentation = __webpack_require__(11);
  24359. var ReactMultiChild = __webpack_require__(183);
  24360. var ReactServerRenderingTransaction = __webpack_require__(188);
  24361. var emptyFunction = __webpack_require__(10);
  24362. var escapeTextContentForBrowser = __webpack_require__(34);
  24363. var invariant = __webpack_require__(0);
  24364. var isEventSupported = __webpack_require__(64);
  24365. var shallowEqual = __webpack_require__(50);
  24366. var validateDOMNesting = __webpack_require__(66);
  24367. var warning = __webpack_require__(1);
  24368. var Flags = ReactDOMComponentFlags;
  24369. var deleteListener = EventPluginHub.deleteListener;
  24370. var getNode = ReactDOMComponentTree.getNodeFromInstance;
  24371. var listenTo = ReactBrowserEventEmitter.listenTo;
  24372. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  24373. // For quickly matching children type, to test if can be treated as content.
  24374. var CONTENT_TYPES = { 'string': true, 'number': true };
  24375. var STYLE = 'style';
  24376. var HTML = '__html';
  24377. var RESERVED_PROPS = {
  24378. children: null,
  24379. dangerouslySetInnerHTML: null,
  24380. suppressContentEditableWarning: null
  24381. };
  24382. // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
  24383. var DOC_FRAGMENT_TYPE = 11;
  24384. function getDeclarationErrorAddendum(internalInstance) {
  24385. if (internalInstance) {
  24386. var owner = internalInstance._currentElement._owner || null;
  24387. if (owner) {
  24388. var name = owner.getName();
  24389. if (name) {
  24390. return ' This DOM node was rendered by `' + name + '`.';
  24391. }
  24392. }
  24393. }
  24394. return '';
  24395. }
  24396. function friendlyStringify(obj) {
  24397. if (typeof obj === 'object') {
  24398. if (Array.isArray(obj)) {
  24399. return '[' + obj.map(friendlyStringify).join(', ') + ']';
  24400. } else {
  24401. var pairs = [];
  24402. for (var key in obj) {
  24403. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  24404. var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
  24405. pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
  24406. }
  24407. }
  24408. return '{' + pairs.join(', ') + '}';
  24409. }
  24410. } else if (typeof obj === 'string') {
  24411. return JSON.stringify(obj);
  24412. } else if (typeof obj === 'function') {
  24413. return '[function object]';
  24414. }
  24415. // Differs from JSON.stringify in that undefined because undefined and that
  24416. // inf and nan don't become null
  24417. return String(obj);
  24418. }
  24419. var styleMutationWarning = {};
  24420. function checkAndWarnForMutatedStyle(style1, style2, component) {
  24421. if (style1 == null || style2 == null) {
  24422. return;
  24423. }
  24424. if (shallowEqual(style1, style2)) {
  24425. return;
  24426. }
  24427. var componentName = component._tag;
  24428. var owner = component._currentElement._owner;
  24429. var ownerName;
  24430. if (owner) {
  24431. ownerName = owner.getName();
  24432. }
  24433. var hash = ownerName + '|' + componentName;
  24434. if (styleMutationWarning.hasOwnProperty(hash)) {
  24435. return;
  24436. }
  24437. styleMutationWarning[hash] = true;
  24438. 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;
  24439. }
  24440. /**
  24441. * @param {object} component
  24442. * @param {?object} props
  24443. */
  24444. function assertValidProps(component, props) {
  24445. if (!props) {
  24446. return;
  24447. }
  24448. // Note the use of `==` which checks for null or undefined.
  24449. if (voidElementTags[component._tag]) {
  24450. !(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;
  24451. }
  24452. if (props.dangerouslySetInnerHTML != null) {
  24453. !(props.children == null) ? false ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0;
  24454. !(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;
  24455. }
  24456. if (false) {
  24457. 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;
  24458. 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;
  24459. 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;
  24460. }
  24461. !(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;
  24462. }
  24463. function enqueuePutListener(inst, registrationName, listener, transaction) {
  24464. if (transaction instanceof ReactServerRenderingTransaction) {
  24465. return;
  24466. }
  24467. if (false) {
  24468. // IE8 has no API for event capturing and the `onScroll` event doesn't
  24469. // bubble.
  24470. process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
  24471. }
  24472. var containerInfo = inst._hostContainerInfo;
  24473. var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
  24474. var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
  24475. listenTo(registrationName, doc);
  24476. transaction.getReactMountReady().enqueue(putListener, {
  24477. inst: inst,
  24478. registrationName: registrationName,
  24479. listener: listener
  24480. });
  24481. }
  24482. function putListener() {
  24483. var listenerToPut = this;
  24484. EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
  24485. }
  24486. function inputPostMount() {
  24487. var inst = this;
  24488. ReactDOMInput.postMountWrapper(inst);
  24489. }
  24490. function textareaPostMount() {
  24491. var inst = this;
  24492. ReactDOMTextarea.postMountWrapper(inst);
  24493. }
  24494. function optionPostMount() {
  24495. var inst = this;
  24496. ReactDOMOption.postMountWrapper(inst);
  24497. }
  24498. var setAndValidateContentChildDev = emptyFunction;
  24499. if (false) {
  24500. setAndValidateContentChildDev = function (content) {
  24501. var hasExistingContent = this._contentDebugID != null;
  24502. var debugID = this._debugID;
  24503. // This ID represents the inlined child that has no backing instance:
  24504. var contentDebugID = -debugID;
  24505. if (content == null) {
  24506. if (hasExistingContent) {
  24507. ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
  24508. }
  24509. this._contentDebugID = null;
  24510. return;
  24511. }
  24512. validateDOMNesting(null, String(content), this, this._ancestorInfo);
  24513. this._contentDebugID = contentDebugID;
  24514. if (hasExistingContent) {
  24515. ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
  24516. ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID);
  24517. } else {
  24518. ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID);
  24519. ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
  24520. ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
  24521. }
  24522. };
  24523. }
  24524. // There are so many media events, it makes sense to just
  24525. // maintain a list rather than create a `trapBubbledEvent` for each
  24526. var mediaEvents = {
  24527. topAbort: 'abort',
  24528. topCanPlay: 'canplay',
  24529. topCanPlayThrough: 'canplaythrough',
  24530. topDurationChange: 'durationchange',
  24531. topEmptied: 'emptied',
  24532. topEncrypted: 'encrypted',
  24533. topEnded: 'ended',
  24534. topError: 'error',
  24535. topLoadedData: 'loadeddata',
  24536. topLoadedMetadata: 'loadedmetadata',
  24537. topLoadStart: 'loadstart',
  24538. topPause: 'pause',
  24539. topPlay: 'play',
  24540. topPlaying: 'playing',
  24541. topProgress: 'progress',
  24542. topRateChange: 'ratechange',
  24543. topSeeked: 'seeked',
  24544. topSeeking: 'seeking',
  24545. topStalled: 'stalled',
  24546. topSuspend: 'suspend',
  24547. topTimeUpdate: 'timeupdate',
  24548. topVolumeChange: 'volumechange',
  24549. topWaiting: 'waiting'
  24550. };
  24551. function trapBubbledEventsLocal() {
  24552. var inst = this;
  24553. // If a component renders to null or if another component fatals and causes
  24554. // the state of the tree to be corrupted, `node` here can be null.
  24555. !inst._rootNodeID ? false ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0;
  24556. var node = getNode(inst);
  24557. !node ? false ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0;
  24558. switch (inst._tag) {
  24559. case 'iframe':
  24560. case 'object':
  24561. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  24562. break;
  24563. case 'video':
  24564. case 'audio':
  24565. inst._wrapperState.listeners = [];
  24566. // Create listener for each media event
  24567. for (var event in mediaEvents) {
  24568. if (mediaEvents.hasOwnProperty(event)) {
  24569. inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node));
  24570. }
  24571. }
  24572. break;
  24573. case 'source':
  24574. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)];
  24575. break;
  24576. case 'img':
  24577. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  24578. break;
  24579. case 'form':
  24580. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)];
  24581. break;
  24582. case 'input':
  24583. case 'select':
  24584. case 'textarea':
  24585. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)];
  24586. break;
  24587. }
  24588. }
  24589. function postUpdateSelectWrapper() {
  24590. ReactDOMSelect.postUpdateWrapper(this);
  24591. }
  24592. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  24593. // those special-case tags.
  24594. var omittedCloseTags = {
  24595. 'area': true,
  24596. 'base': true,
  24597. 'br': true,
  24598. 'col': true,
  24599. 'embed': true,
  24600. 'hr': true,
  24601. 'img': true,
  24602. 'input': true,
  24603. 'keygen': true,
  24604. 'link': true,
  24605. 'meta': true,
  24606. 'param': true,
  24607. 'source': true,
  24608. 'track': true,
  24609. 'wbr': true
  24610. };
  24611. var newlineEatingTags = {
  24612. 'listing': true,
  24613. 'pre': true,
  24614. 'textarea': true
  24615. };
  24616. // For HTML, certain tags cannot have children. This has the same purpose as
  24617. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  24618. var voidElementTags = _assign({
  24619. 'menuitem': true
  24620. }, omittedCloseTags);
  24621. // We accept any tag to be rendered but since this gets injected into arbitrary
  24622. // HTML, we want to make sure that it's a safe tag.
  24623. // http://www.w3.org/TR/REC-xml/#NT-Name
  24624. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  24625. var validatedTagCache = {};
  24626. var hasOwnProperty = {}.hasOwnProperty;
  24627. function validateDangerousTag(tag) {
  24628. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  24629. !VALID_TAG_REGEX.test(tag) ? false ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0;
  24630. validatedTagCache[tag] = true;
  24631. }
  24632. }
  24633. function isCustomComponent(tagName, props) {
  24634. return tagName.indexOf('-') >= 0 || props.is != null;
  24635. }
  24636. var globalIdCounter = 1;
  24637. /**
  24638. * Creates a new React class that is idempotent and capable of containing other
  24639. * React components. It accepts event listeners and DOM properties that are
  24640. * valid according to `DOMProperty`.
  24641. *
  24642. * - Event listeners: `onClick`, `onMouseDown`, etc.
  24643. * - DOM properties: `className`, `name`, `title`, etc.
  24644. *
  24645. * The `style` property functions differently from the DOM API. It accepts an
  24646. * object mapping of style properties to values.
  24647. *
  24648. * @constructor ReactDOMComponent
  24649. * @extends ReactMultiChild
  24650. */
  24651. function ReactDOMComponent(element) {
  24652. var tag = element.type;
  24653. validateDangerousTag(tag);
  24654. this._currentElement = element;
  24655. this._tag = tag.toLowerCase();
  24656. this._namespaceURI = null;
  24657. this._renderedChildren = null;
  24658. this._previousStyle = null;
  24659. this._previousStyleCopy = null;
  24660. this._hostNode = null;
  24661. this._hostParent = null;
  24662. this._rootNodeID = 0;
  24663. this._domID = 0;
  24664. this._hostContainerInfo = null;
  24665. this._wrapperState = null;
  24666. this._topLevelWrapper = null;
  24667. this._flags = 0;
  24668. if (false) {
  24669. this._ancestorInfo = null;
  24670. setAndValidateContentChildDev.call(this, null);
  24671. }
  24672. }
  24673. ReactDOMComponent.displayName = 'ReactDOMComponent';
  24674. ReactDOMComponent.Mixin = {
  24675. /**
  24676. * Generates root tag markup then recurses. This method has side effects and
  24677. * is not idempotent.
  24678. *
  24679. * @internal
  24680. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24681. * @param {?ReactDOMComponent} the parent component instance
  24682. * @param {?object} info about the host container
  24683. * @param {object} context
  24684. * @return {string} The computed markup.
  24685. */
  24686. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  24687. this._rootNodeID = globalIdCounter++;
  24688. this._domID = hostContainerInfo._idCounter++;
  24689. this._hostParent = hostParent;
  24690. this._hostContainerInfo = hostContainerInfo;
  24691. var props = this._currentElement.props;
  24692. switch (this._tag) {
  24693. case 'audio':
  24694. case 'form':
  24695. case 'iframe':
  24696. case 'img':
  24697. case 'link':
  24698. case 'object':
  24699. case 'source':
  24700. case 'video':
  24701. this._wrapperState = {
  24702. listeners: null
  24703. };
  24704. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24705. break;
  24706. case 'input':
  24707. ReactDOMInput.mountWrapper(this, props, hostParent);
  24708. props = ReactDOMInput.getHostProps(this, props);
  24709. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24710. break;
  24711. case 'option':
  24712. ReactDOMOption.mountWrapper(this, props, hostParent);
  24713. props = ReactDOMOption.getHostProps(this, props);
  24714. break;
  24715. case 'select':
  24716. ReactDOMSelect.mountWrapper(this, props, hostParent);
  24717. props = ReactDOMSelect.getHostProps(this, props);
  24718. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24719. break;
  24720. case 'textarea':
  24721. ReactDOMTextarea.mountWrapper(this, props, hostParent);
  24722. props = ReactDOMTextarea.getHostProps(this, props);
  24723. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24724. break;
  24725. }
  24726. assertValidProps(this, props);
  24727. // We create tags in the namespace of their parent container, except HTML
  24728. // tags get no namespace.
  24729. var namespaceURI;
  24730. var parentTag;
  24731. if (hostParent != null) {
  24732. namespaceURI = hostParent._namespaceURI;
  24733. parentTag = hostParent._tag;
  24734. } else if (hostContainerInfo._tag) {
  24735. namespaceURI = hostContainerInfo._namespaceURI;
  24736. parentTag = hostContainerInfo._tag;
  24737. }
  24738. if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
  24739. namespaceURI = DOMNamespaces.html;
  24740. }
  24741. if (namespaceURI === DOMNamespaces.html) {
  24742. if (this._tag === 'svg') {
  24743. namespaceURI = DOMNamespaces.svg;
  24744. } else if (this._tag === 'math') {
  24745. namespaceURI = DOMNamespaces.mathml;
  24746. }
  24747. }
  24748. this._namespaceURI = namespaceURI;
  24749. if (false) {
  24750. var parentInfo;
  24751. if (hostParent != null) {
  24752. parentInfo = hostParent._ancestorInfo;
  24753. } else if (hostContainerInfo._tag) {
  24754. parentInfo = hostContainerInfo._ancestorInfo;
  24755. }
  24756. if (parentInfo) {
  24757. // parentInfo should always be present except for the top-level
  24758. // component when server rendering
  24759. validateDOMNesting(this._tag, null, this, parentInfo);
  24760. }
  24761. this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
  24762. }
  24763. var mountImage;
  24764. if (transaction.useCreateElement) {
  24765. var ownerDocument = hostContainerInfo._ownerDocument;
  24766. var el;
  24767. if (namespaceURI === DOMNamespaces.html) {
  24768. if (this._tag === 'script') {
  24769. // Create the script via .innerHTML so its "parser-inserted" flag is
  24770. // set to true and it does not execute
  24771. var div = ownerDocument.createElement('div');
  24772. var type = this._currentElement.type;
  24773. div.innerHTML = '<' + type + '></' + type + '>';
  24774. el = div.removeChild(div.firstChild);
  24775. } else if (props.is) {
  24776. el = ownerDocument.createElement(this._currentElement.type, props.is);
  24777. } else {
  24778. // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
  24779. // See discussion in https://github.com/facebook/react/pull/6896
  24780. // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  24781. el = ownerDocument.createElement(this._currentElement.type);
  24782. }
  24783. } else {
  24784. el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
  24785. }
  24786. ReactDOMComponentTree.precacheNode(this, el);
  24787. this._flags |= Flags.hasCachedChildNodes;
  24788. if (!this._hostParent) {
  24789. DOMPropertyOperations.setAttributeForRoot(el);
  24790. }
  24791. this._updateDOMProperties(null, props, transaction);
  24792. var lazyTree = DOMLazyTree(el);
  24793. this._createInitialChildren(transaction, props, context, lazyTree);
  24794. mountImage = lazyTree;
  24795. } else {
  24796. var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
  24797. var tagContent = this._createContentMarkup(transaction, props, context);
  24798. if (!tagContent && omittedCloseTags[this._tag]) {
  24799. mountImage = tagOpen + '/>';
  24800. } else {
  24801. mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
  24802. }
  24803. }
  24804. switch (this._tag) {
  24805. case 'input':
  24806. transaction.getReactMountReady().enqueue(inputPostMount, this);
  24807. if (props.autoFocus) {
  24808. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24809. }
  24810. break;
  24811. case 'textarea':
  24812. transaction.getReactMountReady().enqueue(textareaPostMount, this);
  24813. if (props.autoFocus) {
  24814. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24815. }
  24816. break;
  24817. case 'select':
  24818. if (props.autoFocus) {
  24819. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24820. }
  24821. break;
  24822. case 'button':
  24823. if (props.autoFocus) {
  24824. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24825. }
  24826. break;
  24827. case 'option':
  24828. transaction.getReactMountReady().enqueue(optionPostMount, this);
  24829. break;
  24830. }
  24831. return mountImage;
  24832. },
  24833. /**
  24834. * Creates markup for the open tag and all attributes.
  24835. *
  24836. * This method has side effects because events get registered.
  24837. *
  24838. * Iterating over object properties is faster than iterating over arrays.
  24839. * @see http://jsperf.com/obj-vs-arr-iteration
  24840. *
  24841. * @private
  24842. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24843. * @param {object} props
  24844. * @return {string} Markup of opening tag.
  24845. */
  24846. _createOpenTagMarkupAndPutListeners: function (transaction, props) {
  24847. var ret = '<' + this._currentElement.type;
  24848. for (var propKey in props) {
  24849. if (!props.hasOwnProperty(propKey)) {
  24850. continue;
  24851. }
  24852. var propValue = props[propKey];
  24853. if (propValue == null) {
  24854. continue;
  24855. }
  24856. if (registrationNameModules.hasOwnProperty(propKey)) {
  24857. if (propValue) {
  24858. enqueuePutListener(this, propKey, propValue, transaction);
  24859. }
  24860. } else {
  24861. if (propKey === STYLE) {
  24862. if (propValue) {
  24863. if (false) {
  24864. // See `_updateDOMProperties`. style block
  24865. this._previousStyle = propValue;
  24866. }
  24867. propValue = this._previousStyleCopy = _assign({}, props.style);
  24868. }
  24869. propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
  24870. }
  24871. var markup = null;
  24872. if (this._tag != null && isCustomComponent(this._tag, props)) {
  24873. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24874. markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
  24875. }
  24876. } else {
  24877. markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  24878. }
  24879. if (markup) {
  24880. ret += ' ' + markup;
  24881. }
  24882. }
  24883. }
  24884. // For static pages, no need to put React ID and checksum. Saves lots of
  24885. // bytes.
  24886. if (transaction.renderToStaticMarkup) {
  24887. return ret;
  24888. }
  24889. if (!this._hostParent) {
  24890. ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
  24891. }
  24892. ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
  24893. return ret;
  24894. },
  24895. /**
  24896. * Creates markup for the content between the tags.
  24897. *
  24898. * @private
  24899. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24900. * @param {object} props
  24901. * @param {object} context
  24902. * @return {string} Content markup.
  24903. */
  24904. _createContentMarkup: function (transaction, props, context) {
  24905. var ret = '';
  24906. // Intentional use of != to avoid catching zero/false.
  24907. var innerHTML = props.dangerouslySetInnerHTML;
  24908. if (innerHTML != null) {
  24909. if (innerHTML.__html != null) {
  24910. ret = innerHTML.__html;
  24911. }
  24912. } else {
  24913. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  24914. var childrenToUse = contentToUse != null ? null : props.children;
  24915. if (contentToUse != null) {
  24916. // TODO: Validate that text is allowed as a child of this node
  24917. ret = escapeTextContentForBrowser(contentToUse);
  24918. if (false) {
  24919. setAndValidateContentChildDev.call(this, contentToUse);
  24920. }
  24921. } else if (childrenToUse != null) {
  24922. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  24923. ret = mountImages.join('');
  24924. }
  24925. }
  24926. if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
  24927. // text/html ignores the first character in these tags if it's a newline
  24928. // Prefer to break application/xml over text/html (for now) by adding
  24929. // a newline specifically to get eaten by the parser. (Alternately for
  24930. // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
  24931. // \r is normalized out by HTMLTextAreaElement#value.)
  24932. // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
  24933. // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
  24934. // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
  24935. // See: Parsing of "textarea" "listing" and "pre" elements
  24936. // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
  24937. return '\n' + ret;
  24938. } else {
  24939. return ret;
  24940. }
  24941. },
  24942. _createInitialChildren: function (transaction, props, context, lazyTree) {
  24943. // Intentional use of != to avoid catching zero/false.
  24944. var innerHTML = props.dangerouslySetInnerHTML;
  24945. if (innerHTML != null) {
  24946. if (innerHTML.__html != null) {
  24947. DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
  24948. }
  24949. } else {
  24950. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  24951. var childrenToUse = contentToUse != null ? null : props.children;
  24952. // TODO: Validate that text is allowed as a child of this node
  24953. if (contentToUse != null) {
  24954. // Avoid setting textContent when the text is empty. In IE11 setting
  24955. // textContent on a text area will cause the placeholder to not
  24956. // show within the textarea until it has been focused and blurred again.
  24957. // https://github.com/facebook/react/issues/6731#issuecomment-254874553
  24958. if (contentToUse !== '') {
  24959. if (false) {
  24960. setAndValidateContentChildDev.call(this, contentToUse);
  24961. }
  24962. DOMLazyTree.queueText(lazyTree, contentToUse);
  24963. }
  24964. } else if (childrenToUse != null) {
  24965. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  24966. for (var i = 0; i < mountImages.length; i++) {
  24967. DOMLazyTree.queueChild(lazyTree, mountImages[i]);
  24968. }
  24969. }
  24970. }
  24971. },
  24972. /**
  24973. * Receives a next element and updates the component.
  24974. *
  24975. * @internal
  24976. * @param {ReactElement} nextElement
  24977. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24978. * @param {object} context
  24979. */
  24980. receiveComponent: function (nextElement, transaction, context) {
  24981. var prevElement = this._currentElement;
  24982. this._currentElement = nextElement;
  24983. this.updateComponent(transaction, prevElement, nextElement, context);
  24984. },
  24985. /**
  24986. * Updates a DOM component after it has already been allocated and
  24987. * attached to the DOM. Reconciles the root DOM node, then recurses.
  24988. *
  24989. * @param {ReactReconcileTransaction} transaction
  24990. * @param {ReactElement} prevElement
  24991. * @param {ReactElement} nextElement
  24992. * @internal
  24993. * @overridable
  24994. */
  24995. updateComponent: function (transaction, prevElement, nextElement, context) {
  24996. var lastProps = prevElement.props;
  24997. var nextProps = this._currentElement.props;
  24998. switch (this._tag) {
  24999. case 'input':
  25000. lastProps = ReactDOMInput.getHostProps(this, lastProps);
  25001. nextProps = ReactDOMInput.getHostProps(this, nextProps);
  25002. break;
  25003. case 'option':
  25004. lastProps = ReactDOMOption.getHostProps(this, lastProps);
  25005. nextProps = ReactDOMOption.getHostProps(this, nextProps);
  25006. break;
  25007. case 'select':
  25008. lastProps = ReactDOMSelect.getHostProps(this, lastProps);
  25009. nextProps = ReactDOMSelect.getHostProps(this, nextProps);
  25010. break;
  25011. case 'textarea':
  25012. lastProps = ReactDOMTextarea.getHostProps(this, lastProps);
  25013. nextProps = ReactDOMTextarea.getHostProps(this, nextProps);
  25014. break;
  25015. }
  25016. assertValidProps(this, nextProps);
  25017. this._updateDOMProperties(lastProps, nextProps, transaction);
  25018. this._updateDOMChildren(lastProps, nextProps, transaction, context);
  25019. switch (this._tag) {
  25020. case 'input':
  25021. // Update the wrapper around inputs *after* updating props. This has to
  25022. // happen after `_updateDOMProperties`. Otherwise HTML5 input validations
  25023. // raise warnings and prevent the new value from being assigned.
  25024. ReactDOMInput.updateWrapper(this);
  25025. break;
  25026. case 'textarea':
  25027. ReactDOMTextarea.updateWrapper(this);
  25028. break;
  25029. case 'select':
  25030. // <select> value update needs to occur after <option> children
  25031. // reconciliation
  25032. transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
  25033. break;
  25034. }
  25035. },
  25036. /**
  25037. * Reconciles the properties by detecting differences in property values and
  25038. * updating the DOM as necessary. This function is probably the single most
  25039. * critical path for performance optimization.
  25040. *
  25041. * TODO: Benchmark whether checking for changed values in memory actually
  25042. * improves performance (especially statically positioned elements).
  25043. * TODO: Benchmark the effects of putting this at the top since 99% of props
  25044. * do not change for a given reconciliation.
  25045. * TODO: Benchmark areas that can be improved with caching.
  25046. *
  25047. * @private
  25048. * @param {object} lastProps
  25049. * @param {object} nextProps
  25050. * @param {?DOMElement} node
  25051. */
  25052. _updateDOMProperties: function (lastProps, nextProps, transaction) {
  25053. var propKey;
  25054. var styleName;
  25055. var styleUpdates;
  25056. for (propKey in lastProps) {
  25057. if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
  25058. continue;
  25059. }
  25060. if (propKey === STYLE) {
  25061. var lastStyle = this._previousStyleCopy;
  25062. for (styleName in lastStyle) {
  25063. if (lastStyle.hasOwnProperty(styleName)) {
  25064. styleUpdates = styleUpdates || {};
  25065. styleUpdates[styleName] = '';
  25066. }
  25067. }
  25068. this._previousStyleCopy = null;
  25069. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  25070. if (lastProps[propKey]) {
  25071. // Only call deleteListener if there was a listener previously or
  25072. // else willDeleteListener gets called when there wasn't actually a
  25073. // listener (e.g., onClick={null})
  25074. deleteListener(this, propKey);
  25075. }
  25076. } else if (isCustomComponent(this._tag, lastProps)) {
  25077. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  25078. DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey);
  25079. }
  25080. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  25081. DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
  25082. }
  25083. }
  25084. for (propKey in nextProps) {
  25085. var nextProp = nextProps[propKey];
  25086. var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
  25087. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
  25088. continue;
  25089. }
  25090. if (propKey === STYLE) {
  25091. if (nextProp) {
  25092. if (false) {
  25093. checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
  25094. this._previousStyle = nextProp;
  25095. }
  25096. nextProp = this._previousStyleCopy = _assign({}, nextProp);
  25097. } else {
  25098. this._previousStyleCopy = null;
  25099. }
  25100. if (lastProp) {
  25101. // Unset styles on `lastProp` but not on `nextProp`.
  25102. for (styleName in lastProp) {
  25103. if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  25104. styleUpdates = styleUpdates || {};
  25105. styleUpdates[styleName] = '';
  25106. }
  25107. }
  25108. // Update styles that changed since `lastProp`.
  25109. for (styleName in nextProp) {
  25110. if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  25111. styleUpdates = styleUpdates || {};
  25112. styleUpdates[styleName] = nextProp[styleName];
  25113. }
  25114. }
  25115. } else {
  25116. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  25117. styleUpdates = nextProp;
  25118. }
  25119. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  25120. if (nextProp) {
  25121. enqueuePutListener(this, propKey, nextProp, transaction);
  25122. } else if (lastProp) {
  25123. deleteListener(this, propKey);
  25124. }
  25125. } else if (isCustomComponent(this._tag, nextProps)) {
  25126. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  25127. DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
  25128. }
  25129. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  25130. var node = getNode(this);
  25131. // If we're updating to null or undefined, we should remove the property
  25132. // from the DOM node instead of inadvertently setting to a string. This
  25133. // brings us in line with the same behavior we have on initial render.
  25134. if (nextProp != null) {
  25135. DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
  25136. } else {
  25137. DOMPropertyOperations.deleteValueForProperty(node, propKey);
  25138. }
  25139. }
  25140. }
  25141. if (styleUpdates) {
  25142. CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
  25143. }
  25144. },
  25145. /**
  25146. * Reconciles the children with the various properties that affect the
  25147. * children content.
  25148. *
  25149. * @param {object} lastProps
  25150. * @param {object} nextProps
  25151. * @param {ReactReconcileTransaction} transaction
  25152. * @param {object} context
  25153. */
  25154. _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
  25155. var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  25156. var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  25157. var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
  25158. var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
  25159. // Note the use of `!=` which checks for null or undefined.
  25160. var lastChildren = lastContent != null ? null : lastProps.children;
  25161. var nextChildren = nextContent != null ? null : nextProps.children;
  25162. // If we're switching from children to content/html or vice versa, remove
  25163. // the old content
  25164. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  25165. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  25166. if (lastChildren != null && nextChildren == null) {
  25167. this.updateChildren(null, transaction, context);
  25168. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  25169. this.updateTextContent('');
  25170. if (false) {
  25171. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  25172. }
  25173. }
  25174. if (nextContent != null) {
  25175. if (lastContent !== nextContent) {
  25176. this.updateTextContent('' + nextContent);
  25177. if (false) {
  25178. setAndValidateContentChildDev.call(this, nextContent);
  25179. }
  25180. }
  25181. } else if (nextHtml != null) {
  25182. if (lastHtml !== nextHtml) {
  25183. this.updateMarkup('' + nextHtml);
  25184. }
  25185. if (false) {
  25186. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  25187. }
  25188. } else if (nextChildren != null) {
  25189. if (false) {
  25190. setAndValidateContentChildDev.call(this, null);
  25191. }
  25192. this.updateChildren(nextChildren, transaction, context);
  25193. }
  25194. },
  25195. getHostNode: function () {
  25196. return getNode(this);
  25197. },
  25198. /**
  25199. * Destroys all event registrations for this instance. Does not remove from
  25200. * the DOM. That must be done by the parent.
  25201. *
  25202. * @internal
  25203. */
  25204. unmountComponent: function (safely) {
  25205. switch (this._tag) {
  25206. case 'audio':
  25207. case 'form':
  25208. case 'iframe':
  25209. case 'img':
  25210. case 'link':
  25211. case 'object':
  25212. case 'source':
  25213. case 'video':
  25214. var listeners = this._wrapperState.listeners;
  25215. if (listeners) {
  25216. for (var i = 0; i < listeners.length; i++) {
  25217. listeners[i].remove();
  25218. }
  25219. }
  25220. break;
  25221. case 'html':
  25222. case 'head':
  25223. case 'body':
  25224. /**
  25225. * Components like <html> <head> and <body> can't be removed or added
  25226. * easily in a cross-browser way, however it's valuable to be able to
  25227. * take advantage of React's reconciliation for styling and <title>
  25228. * management. So we just document it and throw in dangerous cases.
  25229. */
  25230. 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;
  25231. break;
  25232. }
  25233. this.unmountChildren(safely);
  25234. ReactDOMComponentTree.uncacheNode(this);
  25235. EventPluginHub.deleteAllListeners(this);
  25236. this._rootNodeID = 0;
  25237. this._domID = 0;
  25238. this._wrapperState = null;
  25239. if (false) {
  25240. setAndValidateContentChildDev.call(this, null);
  25241. }
  25242. },
  25243. getPublicInstance: function () {
  25244. return getNode(this);
  25245. }
  25246. };
  25247. _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
  25248. module.exports = ReactDOMComponent;
  25249. /***/ }),
  25250. /* 166 */
  25251. /***/ (function(module, exports, __webpack_require__) {
  25252. "use strict";
  25253. /**
  25254. * Copyright 2013-present, Facebook, Inc.
  25255. * All rights reserved.
  25256. *
  25257. * This source code is licensed under the BSD-style license found in the
  25258. * LICENSE file in the root directory of this source tree. An additional grant
  25259. * of patent rights can be found in the PATENTS file in the same directory.
  25260. *
  25261. */
  25262. var validateDOMNesting = __webpack_require__(66);
  25263. var DOC_NODE_TYPE = 9;
  25264. function ReactDOMContainerInfo(topLevelWrapper, node) {
  25265. var info = {
  25266. _topLevelWrapper: topLevelWrapper,
  25267. _idCounter: 1,
  25268. _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
  25269. _node: node,
  25270. _tag: node ? node.nodeName.toLowerCase() : null,
  25271. _namespaceURI: node ? node.namespaceURI : null
  25272. };
  25273. if (false) {
  25274. info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
  25275. }
  25276. return info;
  25277. }
  25278. module.exports = ReactDOMContainerInfo;
  25279. /***/ }),
  25280. /* 167 */
  25281. /***/ (function(module, exports, __webpack_require__) {
  25282. "use strict";
  25283. /**
  25284. * Copyright 2014-present, Facebook, Inc.
  25285. * All rights reserved.
  25286. *
  25287. * This source code is licensed under the BSD-style license found in the
  25288. * LICENSE file in the root directory of this source tree. An additional grant
  25289. * of patent rights can be found in the PATENTS file in the same directory.
  25290. *
  25291. */
  25292. var _assign = __webpack_require__(3);
  25293. var DOMLazyTree = __webpack_require__(18);
  25294. var ReactDOMComponentTree = __webpack_require__(5);
  25295. var ReactDOMEmptyComponent = function (instantiate) {
  25296. // ReactCompositeComponent uses this:
  25297. this._currentElement = null;
  25298. // ReactDOMComponentTree uses these:
  25299. this._hostNode = null;
  25300. this._hostParent = null;
  25301. this._hostContainerInfo = null;
  25302. this._domID = 0;
  25303. };
  25304. _assign(ReactDOMEmptyComponent.prototype, {
  25305. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  25306. var domID = hostContainerInfo._idCounter++;
  25307. this._domID = domID;
  25308. this._hostParent = hostParent;
  25309. this._hostContainerInfo = hostContainerInfo;
  25310. var nodeValue = ' react-empty: ' + this._domID + ' ';
  25311. if (transaction.useCreateElement) {
  25312. var ownerDocument = hostContainerInfo._ownerDocument;
  25313. var node = ownerDocument.createComment(nodeValue);
  25314. ReactDOMComponentTree.precacheNode(this, node);
  25315. return DOMLazyTree(node);
  25316. } else {
  25317. if (transaction.renderToStaticMarkup) {
  25318. // Normally we'd insert a comment node, but since this is a situation
  25319. // where React won't take over (static pages), we can simply return
  25320. // nothing.
  25321. return '';
  25322. }
  25323. return '<!--' + nodeValue + '-->';
  25324. }
  25325. },
  25326. receiveComponent: function () {},
  25327. getHostNode: function () {
  25328. return ReactDOMComponentTree.getNodeFromInstance(this);
  25329. },
  25330. unmountComponent: function () {
  25331. ReactDOMComponentTree.uncacheNode(this);
  25332. }
  25333. });
  25334. module.exports = ReactDOMEmptyComponent;
  25335. /***/ }),
  25336. /* 168 */
  25337. /***/ (function(module, exports, __webpack_require__) {
  25338. "use strict";
  25339. /**
  25340. * Copyright 2013-present, Facebook, Inc.
  25341. * All rights reserved.
  25342. *
  25343. * This source code is licensed under the BSD-style license found in the
  25344. * LICENSE file in the root directory of this source tree. An additional grant
  25345. * of patent rights can be found in the PATENTS file in the same directory.
  25346. *
  25347. */
  25348. var ReactDOMFeatureFlags = {
  25349. useCreateElement: true,
  25350. useFiber: false
  25351. };
  25352. module.exports = ReactDOMFeatureFlags;
  25353. /***/ }),
  25354. /* 169 */
  25355. /***/ (function(module, exports, __webpack_require__) {
  25356. "use strict";
  25357. /**
  25358. * Copyright 2013-present, Facebook, Inc.
  25359. * All rights reserved.
  25360. *
  25361. * This source code is licensed under the BSD-style license found in the
  25362. * LICENSE file in the root directory of this source tree. An additional grant
  25363. * of patent rights can be found in the PATENTS file in the same directory.
  25364. *
  25365. */
  25366. var DOMChildrenOperations = __webpack_require__(51);
  25367. var ReactDOMComponentTree = __webpack_require__(5);
  25368. /**
  25369. * Operations used to process updates to DOM nodes.
  25370. */
  25371. var ReactDOMIDOperations = {
  25372. /**
  25373. * Updates a component's children by processing a series of updates.
  25374. *
  25375. * @param {array<object>} updates List of update configurations.
  25376. * @internal
  25377. */
  25378. dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
  25379. var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
  25380. DOMChildrenOperations.processUpdates(node, updates);
  25381. }
  25382. };
  25383. module.exports = ReactDOMIDOperations;
  25384. /***/ }),
  25385. /* 170 */
  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 _prodInvariant = __webpack_require__(2),
  25398. _assign = __webpack_require__(3);
  25399. var DOMPropertyOperations = __webpack_require__(78);
  25400. var LinkedValueUtils = __webpack_require__(56);
  25401. var ReactDOMComponentTree = __webpack_require__(5);
  25402. var ReactUpdates = __webpack_require__(12);
  25403. var invariant = __webpack_require__(0);
  25404. var warning = __webpack_require__(1);
  25405. var didWarnValueLink = false;
  25406. var didWarnCheckedLink = false;
  25407. var didWarnValueDefaultValue = false;
  25408. var didWarnCheckedDefaultChecked = false;
  25409. var didWarnControlledToUncontrolled = false;
  25410. var didWarnUncontrolledToControlled = false;
  25411. function forceUpdateIfMounted() {
  25412. if (this._rootNodeID) {
  25413. // DOM component is still mounted; update
  25414. ReactDOMInput.updateWrapper(this);
  25415. }
  25416. }
  25417. function isControlled(props) {
  25418. var usesChecked = props.type === 'checkbox' || props.type === 'radio';
  25419. return usesChecked ? props.checked != null : props.value != null;
  25420. }
  25421. /**
  25422. * Implements an <input> host component that allows setting these optional
  25423. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  25424. *
  25425. * If `checked` or `value` are not supplied (or null/undefined), user actions
  25426. * that affect the checked state or value will trigger updates to the element.
  25427. *
  25428. * If they are supplied (and not null/undefined), the rendered element will not
  25429. * trigger updates to the element. Instead, the props must change in order for
  25430. * the rendered element to be updated.
  25431. *
  25432. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  25433. * with an empty value (or `defaultValue`).
  25434. *
  25435. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  25436. */
  25437. var ReactDOMInput = {
  25438. getHostProps: function (inst, props) {
  25439. var value = LinkedValueUtils.getValue(props);
  25440. var checked = LinkedValueUtils.getChecked(props);
  25441. var hostProps = _assign({
  25442. // Make sure we set .type before any other properties (setting .value
  25443. // before .type means .value is lost in IE11 and below)
  25444. type: undefined,
  25445. // Make sure we set .step before .value (setting .value before .step
  25446. // means .value is rounded on mount, based upon step precision)
  25447. step: undefined,
  25448. // Make sure we set .min & .max before .value (to ensure proper order
  25449. // in corner cases such as min or max deriving from value, e.g. Issue #7170)
  25450. min: undefined,
  25451. max: undefined
  25452. }, props, {
  25453. defaultChecked: undefined,
  25454. defaultValue: undefined,
  25455. value: value != null ? value : inst._wrapperState.initialValue,
  25456. checked: checked != null ? checked : inst._wrapperState.initialChecked,
  25457. onChange: inst._wrapperState.onChange
  25458. });
  25459. return hostProps;
  25460. },
  25461. mountWrapper: function (inst, props) {
  25462. if (false) {
  25463. LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
  25464. var owner = inst._currentElement._owner;
  25465. if (props.valueLink !== undefined && !didWarnValueLink) {
  25466. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  25467. didWarnValueLink = true;
  25468. }
  25469. if (props.checkedLink !== undefined && !didWarnCheckedLink) {
  25470. process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  25471. didWarnCheckedLink = true;
  25472. }
  25473. if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
  25474. 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;
  25475. didWarnCheckedDefaultChecked = true;
  25476. }
  25477. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  25478. 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;
  25479. didWarnValueDefaultValue = true;
  25480. }
  25481. }
  25482. var defaultValue = props.defaultValue;
  25483. inst._wrapperState = {
  25484. initialChecked: props.checked != null ? props.checked : props.defaultChecked,
  25485. initialValue: props.value != null ? props.value : defaultValue,
  25486. listeners: null,
  25487. onChange: _handleChange.bind(inst),
  25488. controlled: isControlled(props)
  25489. };
  25490. },
  25491. updateWrapper: function (inst) {
  25492. var props = inst._currentElement.props;
  25493. if (false) {
  25494. var controlled = isControlled(props);
  25495. var owner = inst._currentElement._owner;
  25496. if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
  25497. 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;
  25498. didWarnUncontrolledToControlled = true;
  25499. }
  25500. if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
  25501. 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;
  25502. didWarnControlledToUncontrolled = true;
  25503. }
  25504. }
  25505. // TODO: Shouldn't this be getChecked(props)?
  25506. var checked = props.checked;
  25507. if (checked != null) {
  25508. DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
  25509. }
  25510. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25511. var value = LinkedValueUtils.getValue(props);
  25512. if (value != null) {
  25513. if (value === 0 && node.value === '') {
  25514. node.value = '0';
  25515. // Note: IE9 reports a number inputs as 'text', so check props instead.
  25516. } else if (props.type === 'number') {
  25517. // Simulate `input.valueAsNumber`. IE9 does not support it
  25518. var valueAsNumber = parseFloat(node.value, 10) || 0;
  25519. // eslint-disable-next-line
  25520. if (value != valueAsNumber) {
  25521. // Cast `value` to a string to ensure the value is set correctly. While
  25522. // browsers typically do this as necessary, jsdom doesn't.
  25523. node.value = '' + value;
  25524. }
  25525. // eslint-disable-next-line
  25526. } else if (value != node.value) {
  25527. // Cast `value` to a string to ensure the value is set correctly. While
  25528. // browsers typically do this as necessary, jsdom doesn't.
  25529. node.value = '' + value;
  25530. }
  25531. } else {
  25532. if (props.value == null && props.defaultValue != null) {
  25533. // In Chrome, assigning defaultValue to certain input types triggers input validation.
  25534. // For number inputs, the display value loses trailing decimal points. For email inputs,
  25535. // Chrome raises "The specified value <x> is not a valid email address".
  25536. //
  25537. // Here we check to see if the defaultValue has actually changed, avoiding these problems
  25538. // when the user is inputting text
  25539. //
  25540. // https://github.com/facebook/react/issues/7253
  25541. if (node.defaultValue !== '' + props.defaultValue) {
  25542. node.defaultValue = '' + props.defaultValue;
  25543. }
  25544. }
  25545. if (props.checked == null && props.defaultChecked != null) {
  25546. node.defaultChecked = !!props.defaultChecked;
  25547. }
  25548. }
  25549. },
  25550. postMountWrapper: function (inst) {
  25551. var props = inst._currentElement.props;
  25552. // This is in postMount because we need access to the DOM node, which is not
  25553. // available until after the component has mounted.
  25554. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25555. // Detach value from defaultValue. We won't do anything if we're working on
  25556. // submit or reset inputs as those values & defaultValues are linked. They
  25557. // are not resetable nodes so this operation doesn't matter and actually
  25558. // removes browser-default values (eg "Submit Query") when no value is
  25559. // provided.
  25560. switch (props.type) {
  25561. case 'submit':
  25562. case 'reset':
  25563. break;
  25564. case 'color':
  25565. case 'date':
  25566. case 'datetime':
  25567. case 'datetime-local':
  25568. case 'month':
  25569. case 'time':
  25570. case 'week':
  25571. // This fixes the no-show issue on iOS Safari and Android Chrome:
  25572. // https://github.com/facebook/react/issues/7233
  25573. node.value = '';
  25574. node.value = node.defaultValue;
  25575. break;
  25576. default:
  25577. node.value = node.value;
  25578. break;
  25579. }
  25580. // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
  25581. // this is needed to work around a chrome bug where setting defaultChecked
  25582. // will sometimes influence the value of checked (even after detachment).
  25583. // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
  25584. // We need to temporarily unset name to avoid disrupting radio button groups.
  25585. var name = node.name;
  25586. if (name !== '') {
  25587. node.name = '';
  25588. }
  25589. node.defaultChecked = !node.defaultChecked;
  25590. node.defaultChecked = !node.defaultChecked;
  25591. if (name !== '') {
  25592. node.name = name;
  25593. }
  25594. }
  25595. };
  25596. function _handleChange(event) {
  25597. var props = this._currentElement.props;
  25598. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  25599. // Here we use asap to wait until all updates have propagated, which
  25600. // is important when using controlled components within layers:
  25601. // https://github.com/facebook/react/issues/1698
  25602. ReactUpdates.asap(forceUpdateIfMounted, this);
  25603. var name = props.name;
  25604. if (props.type === 'radio' && name != null) {
  25605. var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
  25606. var queryRoot = rootNode;
  25607. while (queryRoot.parentNode) {
  25608. queryRoot = queryRoot.parentNode;
  25609. }
  25610. // If `rootNode.form` was non-null, then we could try `form.elements`,
  25611. // but that sometimes behaves strangely in IE8. We could also try using
  25612. // `form.getElementsByName`, but that will only return direct children
  25613. // and won't include inputs that use the HTML5 `form=` attribute. Since
  25614. // the input might not even be in a form, let's just use the global
  25615. // `querySelectorAll` to ensure we don't miss anything.
  25616. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  25617. for (var i = 0; i < group.length; i++) {
  25618. var otherNode = group[i];
  25619. if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  25620. continue;
  25621. }
  25622. // This will throw if radio buttons rendered by different copies of React
  25623. // and the same name are rendered into the same form (same as #1939).
  25624. // That's probably okay; we don't support it just as we don't support
  25625. // mixing React radio buttons with non-React ones.
  25626. var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
  25627. !otherInstance ? false ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0;
  25628. // If this is a controlled radio button group, forcing the input that
  25629. // was previously checked to update will cause it to be come re-checked
  25630. // as appropriate.
  25631. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  25632. }
  25633. }
  25634. return returnValue;
  25635. }
  25636. module.exports = ReactDOMInput;
  25637. /***/ }),
  25638. /* 171 */
  25639. /***/ (function(module, exports, __webpack_require__) {
  25640. "use strict";
  25641. /**
  25642. * Copyright 2013-present, Facebook, Inc.
  25643. * All rights reserved.
  25644. *
  25645. * This source code is licensed under the BSD-style license found in the
  25646. * LICENSE file in the root directory of this source tree. An additional grant
  25647. * of patent rights can be found in the PATENTS file in the same directory.
  25648. *
  25649. */
  25650. var _assign = __webpack_require__(3);
  25651. var React = __webpack_require__(21);
  25652. var ReactDOMComponentTree = __webpack_require__(5);
  25653. var ReactDOMSelect = __webpack_require__(80);
  25654. var warning = __webpack_require__(1);
  25655. var didWarnInvalidOptionChildren = false;
  25656. function flattenChildren(children) {
  25657. var content = '';
  25658. // Flatten children and warn if they aren't strings or numbers;
  25659. // invalid types are ignored.
  25660. React.Children.forEach(children, function (child) {
  25661. if (child == null) {
  25662. return;
  25663. }
  25664. if (typeof child === 'string' || typeof child === 'number') {
  25665. content += child;
  25666. } else if (!didWarnInvalidOptionChildren) {
  25667. didWarnInvalidOptionChildren = true;
  25668. false ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
  25669. }
  25670. });
  25671. return content;
  25672. }
  25673. /**
  25674. * Implements an <option> host component that warns when `selected` is set.
  25675. */
  25676. var ReactDOMOption = {
  25677. mountWrapper: function (inst, props, hostParent) {
  25678. // TODO (yungsters): Remove support for `selected` in <option>.
  25679. if (false) {
  25680. 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;
  25681. }
  25682. // Look up whether this option is 'selected'
  25683. var selectValue = null;
  25684. if (hostParent != null) {
  25685. var selectParent = hostParent;
  25686. if (selectParent._tag === 'optgroup') {
  25687. selectParent = selectParent._hostParent;
  25688. }
  25689. if (selectParent != null && selectParent._tag === 'select') {
  25690. selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
  25691. }
  25692. }
  25693. // If the value is null (e.g., no specified value or after initial mount)
  25694. // or missing (e.g., for <datalist>), we don't change props.selected
  25695. var selected = null;
  25696. if (selectValue != null) {
  25697. var value;
  25698. if (props.value != null) {
  25699. value = props.value + '';
  25700. } else {
  25701. value = flattenChildren(props.children);
  25702. }
  25703. selected = false;
  25704. if (Array.isArray(selectValue)) {
  25705. // multiple
  25706. for (var i = 0; i < selectValue.length; i++) {
  25707. if ('' + selectValue[i] === value) {
  25708. selected = true;
  25709. break;
  25710. }
  25711. }
  25712. } else {
  25713. selected = '' + selectValue === value;
  25714. }
  25715. }
  25716. inst._wrapperState = { selected: selected };
  25717. },
  25718. postMountWrapper: function (inst) {
  25719. // value="" should make a value attribute (#6219)
  25720. var props = inst._currentElement.props;
  25721. if (props.value != null) {
  25722. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25723. node.setAttribute('value', props.value);
  25724. }
  25725. },
  25726. getHostProps: function (inst, props) {
  25727. var hostProps = _assign({ selected: undefined, children: undefined }, props);
  25728. // Read state only from initial mount because <select> updates value
  25729. // manually; we need the initial state only for server rendering
  25730. if (inst._wrapperState.selected != null) {
  25731. hostProps.selected = inst._wrapperState.selected;
  25732. }
  25733. var content = flattenChildren(props.children);
  25734. if (content) {
  25735. hostProps.children = content;
  25736. }
  25737. return hostProps;
  25738. }
  25739. };
  25740. module.exports = ReactDOMOption;
  25741. /***/ }),
  25742. /* 172 */
  25743. /***/ (function(module, exports, __webpack_require__) {
  25744. "use strict";
  25745. /**
  25746. * Copyright 2013-present, Facebook, Inc.
  25747. * All rights reserved.
  25748. *
  25749. * This source code is licensed under the BSD-style license found in the
  25750. * LICENSE file in the root directory of this source tree. An additional grant
  25751. * of patent rights can be found in the PATENTS file in the same directory.
  25752. *
  25753. */
  25754. var ExecutionEnvironment = __webpack_require__(8);
  25755. var getNodeForCharacterOffset = __webpack_require__(210);
  25756. var getTextContentAccessor = __webpack_require__(91);
  25757. /**
  25758. * While `isCollapsed` is available on the Selection object and `collapsed`
  25759. * is available on the Range object, IE11 sometimes gets them wrong.
  25760. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  25761. */
  25762. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  25763. return anchorNode === focusNode && anchorOffset === focusOffset;
  25764. }
  25765. /**
  25766. * Get the appropriate anchor and focus node/offset pairs for IE.
  25767. *
  25768. * The catch here is that IE's selection API doesn't provide information
  25769. * about whether the selection is forward or backward, so we have to
  25770. * behave as though it's always forward.
  25771. *
  25772. * IE text differs from modern selection in that it behaves as though
  25773. * block elements end with a new line. This means character offsets will
  25774. * differ between the two APIs.
  25775. *
  25776. * @param {DOMElement} node
  25777. * @return {object}
  25778. */
  25779. function getIEOffsets(node) {
  25780. var selection = document.selection;
  25781. var selectedRange = selection.createRange();
  25782. var selectedLength = selectedRange.text.length;
  25783. // Duplicate selection so we can move range without breaking user selection.
  25784. var fromStart = selectedRange.duplicate();
  25785. fromStart.moveToElementText(node);
  25786. fromStart.setEndPoint('EndToStart', selectedRange);
  25787. var startOffset = fromStart.text.length;
  25788. var endOffset = startOffset + selectedLength;
  25789. return {
  25790. start: startOffset,
  25791. end: endOffset
  25792. };
  25793. }
  25794. /**
  25795. * @param {DOMElement} node
  25796. * @return {?object}
  25797. */
  25798. function getModernOffsets(node) {
  25799. var selection = window.getSelection && window.getSelection();
  25800. if (!selection || selection.rangeCount === 0) {
  25801. return null;
  25802. }
  25803. var anchorNode = selection.anchorNode;
  25804. var anchorOffset = selection.anchorOffset;
  25805. var focusNode = selection.focusNode;
  25806. var focusOffset = selection.focusOffset;
  25807. var currentRange = selection.getRangeAt(0);
  25808. // In Firefox, range.startContainer and range.endContainer can be "anonymous
  25809. // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
  25810. // divs do not seem to expose properties, triggering a "Permission denied
  25811. // error" if any of its properties are accessed. The only seemingly possible
  25812. // way to avoid erroring is to access a property that typically works for
  25813. // non-anonymous divs and catch any error that may otherwise arise. See
  25814. // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  25815. try {
  25816. /* eslint-disable no-unused-expressions */
  25817. currentRange.startContainer.nodeType;
  25818. currentRange.endContainer.nodeType;
  25819. /* eslint-enable no-unused-expressions */
  25820. } catch (e) {
  25821. return null;
  25822. }
  25823. // If the node and offset values are the same, the selection is collapsed.
  25824. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  25825. // this value wrong.
  25826. var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
  25827. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  25828. var tempRange = currentRange.cloneRange();
  25829. tempRange.selectNodeContents(node);
  25830. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  25831. var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
  25832. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  25833. var end = start + rangeLength;
  25834. // Detect whether the selection is backward.
  25835. var detectionRange = document.createRange();
  25836. detectionRange.setStart(anchorNode, anchorOffset);
  25837. detectionRange.setEnd(focusNode, focusOffset);
  25838. var isBackward = detectionRange.collapsed;
  25839. return {
  25840. start: isBackward ? end : start,
  25841. end: isBackward ? start : end
  25842. };
  25843. }
  25844. /**
  25845. * @param {DOMElement|DOMTextNode} node
  25846. * @param {object} offsets
  25847. */
  25848. function setIEOffsets(node, offsets) {
  25849. var range = document.selection.createRange().duplicate();
  25850. var start, end;
  25851. if (offsets.end === undefined) {
  25852. start = offsets.start;
  25853. end = start;
  25854. } else if (offsets.start > offsets.end) {
  25855. start = offsets.end;
  25856. end = offsets.start;
  25857. } else {
  25858. start = offsets.start;
  25859. end = offsets.end;
  25860. }
  25861. range.moveToElementText(node);
  25862. range.moveStart('character', start);
  25863. range.setEndPoint('EndToStart', range);
  25864. range.moveEnd('character', end - start);
  25865. range.select();
  25866. }
  25867. /**
  25868. * In modern non-IE browsers, we can support both forward and backward
  25869. * selections.
  25870. *
  25871. * Note: IE10+ supports the Selection object, but it does not support
  25872. * the `extend` method, which means that even in modern IE, it's not possible
  25873. * to programmatically create a backward selection. Thus, for all IE
  25874. * versions, we use the old IE API to create our selections.
  25875. *
  25876. * @param {DOMElement|DOMTextNode} node
  25877. * @param {object} offsets
  25878. */
  25879. function setModernOffsets(node, offsets) {
  25880. if (!window.getSelection) {
  25881. return;
  25882. }
  25883. var selection = window.getSelection();
  25884. var length = node[getTextContentAccessor()].length;
  25885. var start = Math.min(offsets.start, length);
  25886. var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
  25887. // IE 11 uses modern selection, but doesn't support the extend method.
  25888. // Flip backward selections, so we can set with a single range.
  25889. if (!selection.extend && start > end) {
  25890. var temp = end;
  25891. end = start;
  25892. start = temp;
  25893. }
  25894. var startMarker = getNodeForCharacterOffset(node, start);
  25895. var endMarker = getNodeForCharacterOffset(node, end);
  25896. if (startMarker && endMarker) {
  25897. var range = document.createRange();
  25898. range.setStart(startMarker.node, startMarker.offset);
  25899. selection.removeAllRanges();
  25900. if (start > end) {
  25901. selection.addRange(range);
  25902. selection.extend(endMarker.node, endMarker.offset);
  25903. } else {
  25904. range.setEnd(endMarker.node, endMarker.offset);
  25905. selection.addRange(range);
  25906. }
  25907. }
  25908. }
  25909. var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
  25910. var ReactDOMSelection = {
  25911. /**
  25912. * @param {DOMElement} node
  25913. */
  25914. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  25915. /**
  25916. * @param {DOMElement|DOMTextNode} node
  25917. * @param {object} offsets
  25918. */
  25919. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  25920. };
  25921. module.exports = ReactDOMSelection;
  25922. /***/ }),
  25923. /* 173 */
  25924. /***/ (function(module, exports, __webpack_require__) {
  25925. "use strict";
  25926. /**
  25927. * Copyright 2013-present, Facebook, Inc.
  25928. * All rights reserved.
  25929. *
  25930. * This source code is licensed under the BSD-style license found in the
  25931. * LICENSE file in the root directory of this source tree. An additional grant
  25932. * of patent rights can be found in the PATENTS file in the same directory.
  25933. *
  25934. */
  25935. var _prodInvariant = __webpack_require__(2),
  25936. _assign = __webpack_require__(3);
  25937. var DOMChildrenOperations = __webpack_require__(51);
  25938. var DOMLazyTree = __webpack_require__(18);
  25939. var ReactDOMComponentTree = __webpack_require__(5);
  25940. var escapeTextContentForBrowser = __webpack_require__(34);
  25941. var invariant = __webpack_require__(0);
  25942. var validateDOMNesting = __webpack_require__(66);
  25943. /**
  25944. * Text nodes violate a couple assumptions that React makes about components:
  25945. *
  25946. * - When mounting text into the DOM, adjacent text nodes are merged.
  25947. * - Text nodes cannot be assigned a React root ID.
  25948. *
  25949. * This component is used to wrap strings between comment nodes so that they
  25950. * can undergo the same reconciliation that is applied to elements.
  25951. *
  25952. * TODO: Investigate representing React components in the DOM with text nodes.
  25953. *
  25954. * @class ReactDOMTextComponent
  25955. * @extends ReactComponent
  25956. * @internal
  25957. */
  25958. var ReactDOMTextComponent = function (text) {
  25959. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  25960. this._currentElement = text;
  25961. this._stringText = '' + text;
  25962. // ReactDOMComponentTree uses these:
  25963. this._hostNode = null;
  25964. this._hostParent = null;
  25965. // Properties
  25966. this._domID = 0;
  25967. this._mountIndex = 0;
  25968. this._closingComment = null;
  25969. this._commentNodes = null;
  25970. };
  25971. _assign(ReactDOMTextComponent.prototype, {
  25972. /**
  25973. * Creates the markup for this text node. This node is not intended to have
  25974. * any features besides containing text content.
  25975. *
  25976. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  25977. * @return {string} Markup for this text node.
  25978. * @internal
  25979. */
  25980. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  25981. if (false) {
  25982. var parentInfo;
  25983. if (hostParent != null) {
  25984. parentInfo = hostParent._ancestorInfo;
  25985. } else if (hostContainerInfo != null) {
  25986. parentInfo = hostContainerInfo._ancestorInfo;
  25987. }
  25988. if (parentInfo) {
  25989. // parentInfo should always be present except for the top-level
  25990. // component when server rendering
  25991. validateDOMNesting(null, this._stringText, this, parentInfo);
  25992. }
  25993. }
  25994. var domID = hostContainerInfo._idCounter++;
  25995. var openingValue = ' react-text: ' + domID + ' ';
  25996. var closingValue = ' /react-text ';
  25997. this._domID = domID;
  25998. this._hostParent = hostParent;
  25999. if (transaction.useCreateElement) {
  26000. var ownerDocument = hostContainerInfo._ownerDocument;
  26001. var openingComment = ownerDocument.createComment(openingValue);
  26002. var closingComment = ownerDocument.createComment(closingValue);
  26003. var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
  26004. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
  26005. if (this._stringText) {
  26006. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
  26007. }
  26008. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
  26009. ReactDOMComponentTree.precacheNode(this, openingComment);
  26010. this._closingComment = closingComment;
  26011. return lazyTree;
  26012. } else {
  26013. var escapedText = escapeTextContentForBrowser(this._stringText);
  26014. if (transaction.renderToStaticMarkup) {
  26015. // Normally we'd wrap this between comment nodes for the reasons stated
  26016. // above, but since this is a situation where React won't take over
  26017. // (static pages), we can simply return the text as it is.
  26018. return escapedText;
  26019. }
  26020. return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
  26021. }
  26022. },
  26023. /**
  26024. * Updates this component by updating the text content.
  26025. *
  26026. * @param {ReactText} nextText The next text content
  26027. * @param {ReactReconcileTransaction} transaction
  26028. * @internal
  26029. */
  26030. receiveComponent: function (nextText, transaction) {
  26031. if (nextText !== this._currentElement) {
  26032. this._currentElement = nextText;
  26033. var nextStringText = '' + nextText;
  26034. if (nextStringText !== this._stringText) {
  26035. // TODO: Save this as pending props and use performUpdateIfNecessary
  26036. // and/or updateComponent to do the actual update for consistency with
  26037. // other component types?
  26038. this._stringText = nextStringText;
  26039. var commentNodes = this.getHostNode();
  26040. DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
  26041. }
  26042. }
  26043. },
  26044. getHostNode: function () {
  26045. var hostNode = this._commentNodes;
  26046. if (hostNode) {
  26047. return hostNode;
  26048. }
  26049. if (!this._closingComment) {
  26050. var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
  26051. var node = openingComment.nextSibling;
  26052. while (true) {
  26053. !(node != null) ? false ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0;
  26054. if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
  26055. this._closingComment = node;
  26056. break;
  26057. }
  26058. node = node.nextSibling;
  26059. }
  26060. }
  26061. hostNode = [this._hostNode, this._closingComment];
  26062. this._commentNodes = hostNode;
  26063. return hostNode;
  26064. },
  26065. unmountComponent: function () {
  26066. this._closingComment = null;
  26067. this._commentNodes = null;
  26068. ReactDOMComponentTree.uncacheNode(this);
  26069. }
  26070. });
  26071. module.exports = ReactDOMTextComponent;
  26072. /***/ }),
  26073. /* 174 */
  26074. /***/ (function(module, exports, __webpack_require__) {
  26075. "use strict";
  26076. /**
  26077. * Copyright 2013-present, Facebook, Inc.
  26078. * All rights reserved.
  26079. *
  26080. * This source code is licensed under the BSD-style license found in the
  26081. * LICENSE file in the root directory of this source tree. An additional grant
  26082. * of patent rights can be found in the PATENTS file in the same directory.
  26083. *
  26084. */
  26085. var _prodInvariant = __webpack_require__(2),
  26086. _assign = __webpack_require__(3);
  26087. var LinkedValueUtils = __webpack_require__(56);
  26088. var ReactDOMComponentTree = __webpack_require__(5);
  26089. var ReactUpdates = __webpack_require__(12);
  26090. var invariant = __webpack_require__(0);
  26091. var warning = __webpack_require__(1);
  26092. var didWarnValueLink = false;
  26093. var didWarnValDefaultVal = false;
  26094. function forceUpdateIfMounted() {
  26095. if (this._rootNodeID) {
  26096. // DOM component is still mounted; update
  26097. ReactDOMTextarea.updateWrapper(this);
  26098. }
  26099. }
  26100. /**
  26101. * Implements a <textarea> host component that allows setting `value`, and
  26102. * `defaultValue`. This differs from the traditional DOM API because value is
  26103. * usually set as PCDATA children.
  26104. *
  26105. * If `value` is not supplied (or null/undefined), user actions that affect the
  26106. * value will trigger updates to the element.
  26107. *
  26108. * If `value` is supplied (and not null/undefined), the rendered element will
  26109. * not trigger updates to the element. Instead, the `value` prop must change in
  26110. * order for the rendered element to be updated.
  26111. *
  26112. * The rendered element will be initialized with an empty value, the prop
  26113. * `defaultValue` if specified, or the children content (deprecated).
  26114. */
  26115. var ReactDOMTextarea = {
  26116. getHostProps: function (inst, props) {
  26117. !(props.dangerouslySetInnerHTML == null) ? false ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0;
  26118. // Always set children to the same thing. In IE9, the selection range will
  26119. // get reset if `textContent` is mutated. We could add a check in setTextContent
  26120. // to only set the value if/when the value differs from the node value (which would
  26121. // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution.
  26122. // The value can be a boolean or object so that's why it's forced to be a string.
  26123. var hostProps = _assign({}, props, {
  26124. value: undefined,
  26125. defaultValue: undefined,
  26126. children: '' + inst._wrapperState.initialValue,
  26127. onChange: inst._wrapperState.onChange
  26128. });
  26129. return hostProps;
  26130. },
  26131. mountWrapper: function (inst, props) {
  26132. if (false) {
  26133. LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
  26134. if (props.valueLink !== undefined && !didWarnValueLink) {
  26135. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
  26136. didWarnValueLink = true;
  26137. }
  26138. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
  26139. 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;
  26140. didWarnValDefaultVal = true;
  26141. }
  26142. }
  26143. var value = LinkedValueUtils.getValue(props);
  26144. var initialValue = value;
  26145. // Only bother fetching default value if we're going to use it
  26146. if (value == null) {
  26147. var defaultValue = props.defaultValue;
  26148. // TODO (yungsters): Remove support for children content in <textarea>.
  26149. var children = props.children;
  26150. if (children != null) {
  26151. if (false) {
  26152. process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
  26153. }
  26154. !(defaultValue == null) ? false ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0;
  26155. if (Array.isArray(children)) {
  26156. !(children.length <= 1) ? false ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0;
  26157. children = children[0];
  26158. }
  26159. defaultValue = '' + children;
  26160. }
  26161. if (defaultValue == null) {
  26162. defaultValue = '';
  26163. }
  26164. initialValue = defaultValue;
  26165. }
  26166. inst._wrapperState = {
  26167. initialValue: '' + initialValue,
  26168. listeners: null,
  26169. onChange: _handleChange.bind(inst)
  26170. };
  26171. },
  26172. updateWrapper: function (inst) {
  26173. var props = inst._currentElement.props;
  26174. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  26175. var value = LinkedValueUtils.getValue(props);
  26176. if (value != null) {
  26177. // Cast `value` to a string to ensure the value is set correctly. While
  26178. // browsers typically do this as necessary, jsdom doesn't.
  26179. var newValue = '' + value;
  26180. // To avoid side effects (such as losing text selection), only set value if changed
  26181. if (newValue !== node.value) {
  26182. node.value = newValue;
  26183. }
  26184. if (props.defaultValue == null) {
  26185. node.defaultValue = newValue;
  26186. }
  26187. }
  26188. if (props.defaultValue != null) {
  26189. node.defaultValue = props.defaultValue;
  26190. }
  26191. },
  26192. postMountWrapper: function (inst) {
  26193. // This is in postMount because we need access to the DOM node, which is not
  26194. // available until after the component has mounted.
  26195. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  26196. var textContent = node.textContent;
  26197. // Only set node.value if textContent is equal to the expected
  26198. // initial value. In IE10/IE11 there is a bug where the placeholder attribute
  26199. // will populate textContent as well.
  26200. // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
  26201. if (textContent === inst._wrapperState.initialValue) {
  26202. node.value = textContent;
  26203. }
  26204. }
  26205. };
  26206. function _handleChange(event) {
  26207. var props = this._currentElement.props;
  26208. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  26209. ReactUpdates.asap(forceUpdateIfMounted, this);
  26210. return returnValue;
  26211. }
  26212. module.exports = ReactDOMTextarea;
  26213. /***/ }),
  26214. /* 175 */
  26215. /***/ (function(module, exports, __webpack_require__) {
  26216. "use strict";
  26217. /**
  26218. * Copyright 2015-present, Facebook, Inc.
  26219. * All rights reserved.
  26220. *
  26221. * This source code is licensed under the BSD-style license found in the
  26222. * LICENSE file in the root directory of this source tree. An additional grant
  26223. * of patent rights can be found in the PATENTS file in the same directory.
  26224. *
  26225. */
  26226. var _prodInvariant = __webpack_require__(2);
  26227. var invariant = __webpack_require__(0);
  26228. /**
  26229. * Return the lowest common ancestor of A and B, or null if they are in
  26230. * different trees.
  26231. */
  26232. function getLowestCommonAncestor(instA, instB) {
  26233. !('_hostNode' in instA) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  26234. !('_hostNode' in instB) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  26235. var depthA = 0;
  26236. for (var tempA = instA; tempA; tempA = tempA._hostParent) {
  26237. depthA++;
  26238. }
  26239. var depthB = 0;
  26240. for (var tempB = instB; tempB; tempB = tempB._hostParent) {
  26241. depthB++;
  26242. }
  26243. // If A is deeper, crawl up.
  26244. while (depthA - depthB > 0) {
  26245. instA = instA._hostParent;
  26246. depthA--;
  26247. }
  26248. // If B is deeper, crawl up.
  26249. while (depthB - depthA > 0) {
  26250. instB = instB._hostParent;
  26251. depthB--;
  26252. }
  26253. // Walk in lockstep until we find a match.
  26254. var depth = depthA;
  26255. while (depth--) {
  26256. if (instA === instB) {
  26257. return instA;
  26258. }
  26259. instA = instA._hostParent;
  26260. instB = instB._hostParent;
  26261. }
  26262. return null;
  26263. }
  26264. /**
  26265. * Return if A is an ancestor of B.
  26266. */
  26267. function isAncestor(instA, instB) {
  26268. !('_hostNode' in instA) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  26269. !('_hostNode' in instB) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  26270. while (instB) {
  26271. if (instB === instA) {
  26272. return true;
  26273. }
  26274. instB = instB._hostParent;
  26275. }
  26276. return false;
  26277. }
  26278. /**
  26279. * Return the parent instance of the passed-in instance.
  26280. */
  26281. function getParentInstance(inst) {
  26282. !('_hostNode' in inst) ? false ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
  26283. return inst._hostParent;
  26284. }
  26285. /**
  26286. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  26287. */
  26288. function traverseTwoPhase(inst, fn, arg) {
  26289. var path = [];
  26290. while (inst) {
  26291. path.push(inst);
  26292. inst = inst._hostParent;
  26293. }
  26294. var i;
  26295. for (i = path.length; i-- > 0;) {
  26296. fn(path[i], 'captured', arg);
  26297. }
  26298. for (i = 0; i < path.length; i++) {
  26299. fn(path[i], 'bubbled', arg);
  26300. }
  26301. }
  26302. /**
  26303. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  26304. * should would receive a `mouseEnter` or `mouseLeave` event.
  26305. *
  26306. * Does not invoke the callback on the nearest common ancestor because nothing
  26307. * "entered" or "left" that element.
  26308. */
  26309. function traverseEnterLeave(from, to, fn, argFrom, argTo) {
  26310. var common = from && to ? getLowestCommonAncestor(from, to) : null;
  26311. var pathFrom = [];
  26312. while (from && from !== common) {
  26313. pathFrom.push(from);
  26314. from = from._hostParent;
  26315. }
  26316. var pathTo = [];
  26317. while (to && to !== common) {
  26318. pathTo.push(to);
  26319. to = to._hostParent;
  26320. }
  26321. var i;
  26322. for (i = 0; i < pathFrom.length; i++) {
  26323. fn(pathFrom[i], 'bubbled', argFrom);
  26324. }
  26325. for (i = pathTo.length; i-- > 0;) {
  26326. fn(pathTo[i], 'captured', argTo);
  26327. }
  26328. }
  26329. module.exports = {
  26330. isAncestor: isAncestor,
  26331. getLowestCommonAncestor: getLowestCommonAncestor,
  26332. getParentInstance: getParentInstance,
  26333. traverseTwoPhase: traverseTwoPhase,
  26334. traverseEnterLeave: traverseEnterLeave
  26335. };
  26336. /***/ }),
  26337. /* 176 */
  26338. /***/ (function(module, exports, __webpack_require__) {
  26339. "use strict";
  26340. /**
  26341. * Copyright 2013-present, Facebook, Inc.
  26342. * All rights reserved.
  26343. *
  26344. * This source code is licensed under the BSD-style license found in the
  26345. * LICENSE file in the root directory of this source tree. An additional grant
  26346. * of patent rights can be found in the PATENTS file in the same directory.
  26347. *
  26348. */
  26349. var _assign = __webpack_require__(3);
  26350. var ReactUpdates = __webpack_require__(12);
  26351. var Transaction = __webpack_require__(33);
  26352. var emptyFunction = __webpack_require__(10);
  26353. var RESET_BATCHED_UPDATES = {
  26354. initialize: emptyFunction,
  26355. close: function () {
  26356. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  26357. }
  26358. };
  26359. var FLUSH_BATCHED_UPDATES = {
  26360. initialize: emptyFunction,
  26361. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  26362. };
  26363. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  26364. function ReactDefaultBatchingStrategyTransaction() {
  26365. this.reinitializeTransaction();
  26366. }
  26367. _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, {
  26368. getTransactionWrappers: function () {
  26369. return TRANSACTION_WRAPPERS;
  26370. }
  26371. });
  26372. var transaction = new ReactDefaultBatchingStrategyTransaction();
  26373. var ReactDefaultBatchingStrategy = {
  26374. isBatchingUpdates: false,
  26375. /**
  26376. * Call the provided function in a context within which calls to `setState`
  26377. * and friends are batched such that components aren't updated unnecessarily.
  26378. */
  26379. batchedUpdates: function (callback, a, b, c, d, e) {
  26380. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  26381. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  26382. // The code is written this way to avoid extra allocations
  26383. if (alreadyBatchingUpdates) {
  26384. return callback(a, b, c, d, e);
  26385. } else {
  26386. return transaction.perform(callback, null, a, b, c, d, e);
  26387. }
  26388. }
  26389. };
  26390. module.exports = ReactDefaultBatchingStrategy;
  26391. /***/ }),
  26392. /* 177 */
  26393. /***/ (function(module, exports, __webpack_require__) {
  26394. "use strict";
  26395. /**
  26396. * Copyright 2013-present, Facebook, Inc.
  26397. * All rights reserved.
  26398. *
  26399. * This source code is licensed under the BSD-style license found in the
  26400. * LICENSE file in the root directory of this source tree. An additional grant
  26401. * of patent rights can be found in the PATENTS file in the same directory.
  26402. *
  26403. */
  26404. var ARIADOMPropertyConfig = __webpack_require__(151);
  26405. var BeforeInputEventPlugin = __webpack_require__(153);
  26406. var ChangeEventPlugin = __webpack_require__(155);
  26407. var DefaultEventPluginOrder = __webpack_require__(157);
  26408. var EnterLeaveEventPlugin = __webpack_require__(158);
  26409. var HTMLDOMPropertyConfig = __webpack_require__(160);
  26410. var ReactComponentBrowserEnvironment = __webpack_require__(162);
  26411. var ReactDOMComponent = __webpack_require__(165);
  26412. var ReactDOMComponentTree = __webpack_require__(5);
  26413. var ReactDOMEmptyComponent = __webpack_require__(167);
  26414. var ReactDOMTreeTraversal = __webpack_require__(175);
  26415. var ReactDOMTextComponent = __webpack_require__(173);
  26416. var ReactDefaultBatchingStrategy = __webpack_require__(176);
  26417. var ReactEventListener = __webpack_require__(180);
  26418. var ReactInjection = __webpack_require__(181);
  26419. var ReactReconcileTransaction = __webpack_require__(186);
  26420. var SVGDOMPropertyConfig = __webpack_require__(191);
  26421. var SelectEventPlugin = __webpack_require__(192);
  26422. var SimpleEventPlugin = __webpack_require__(193);
  26423. var alreadyInjected = false;
  26424. function inject() {
  26425. if (alreadyInjected) {
  26426. // TODO: This is currently true because these injections are shared between
  26427. // the client and the server package. They should be built independently
  26428. // and not share any injection state. Then this problem will be solved.
  26429. return;
  26430. }
  26431. alreadyInjected = true;
  26432. ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
  26433. /**
  26434. * Inject modules for resolving DOM hierarchy and plugin ordering.
  26435. */
  26436. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  26437. ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
  26438. ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
  26439. /**
  26440. * Some important event plugins included by default (without having to require
  26441. * them).
  26442. */
  26443. ReactInjection.EventPluginHub.injectEventPluginsByName({
  26444. SimpleEventPlugin: SimpleEventPlugin,
  26445. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  26446. ChangeEventPlugin: ChangeEventPlugin,
  26447. SelectEventPlugin: SelectEventPlugin,
  26448. BeforeInputEventPlugin: BeforeInputEventPlugin
  26449. });
  26450. ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
  26451. ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
  26452. ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig);
  26453. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  26454. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  26455. ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
  26456. return new ReactDOMEmptyComponent(instantiate);
  26457. });
  26458. ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
  26459. ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  26460. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  26461. }
  26462. module.exports = {
  26463. inject: inject
  26464. };
  26465. /***/ }),
  26466. /* 178 */
  26467. /***/ (function(module, exports, __webpack_require__) {
  26468. "use strict";
  26469. /**
  26470. * Copyright 2014-present, Facebook, Inc.
  26471. * All rights reserved.
  26472. *
  26473. * This source code is licensed under the BSD-style license found in the
  26474. * LICENSE file in the root directory of this source tree. An additional grant
  26475. * of patent rights can be found in the PATENTS file in the same directory.
  26476. *
  26477. *
  26478. */
  26479. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  26480. // nor polyfill, then a plain number is used for performance.
  26481. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  26482. module.exports = REACT_ELEMENT_TYPE;
  26483. /***/ }),
  26484. /* 179 */
  26485. /***/ (function(module, exports, __webpack_require__) {
  26486. "use strict";
  26487. /**
  26488. * Copyright 2013-present, Facebook, Inc.
  26489. * All rights reserved.
  26490. *
  26491. * This source code is licensed under the BSD-style license found in the
  26492. * LICENSE file in the root directory of this source tree. An additional grant
  26493. * of patent rights can be found in the PATENTS file in the same directory.
  26494. *
  26495. */
  26496. var EventPluginHub = __webpack_require__(26);
  26497. function runEventQueueInBatch(events) {
  26498. EventPluginHub.enqueueEvents(events);
  26499. EventPluginHub.processEventQueue(false);
  26500. }
  26501. var ReactEventEmitterMixin = {
  26502. /**
  26503. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  26504. * opportunity to create `ReactEvent`s to be dispatched.
  26505. */
  26506. handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  26507. var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  26508. runEventQueueInBatch(events);
  26509. }
  26510. };
  26511. module.exports = ReactEventEmitterMixin;
  26512. /***/ }),
  26513. /* 180 */
  26514. /***/ (function(module, exports, __webpack_require__) {
  26515. "use strict";
  26516. /**
  26517. * Copyright 2013-present, Facebook, Inc.
  26518. * All rights reserved.
  26519. *
  26520. * This source code is licensed under the BSD-style license found in the
  26521. * LICENSE file in the root directory of this source tree. An additional grant
  26522. * of patent rights can be found in the PATENTS file in the same directory.
  26523. *
  26524. */
  26525. var _assign = __webpack_require__(3);
  26526. var EventListener = __webpack_require__(71);
  26527. var ExecutionEnvironment = __webpack_require__(8);
  26528. var PooledClass = __webpack_require__(16);
  26529. var ReactDOMComponentTree = __webpack_require__(5);
  26530. var ReactUpdates = __webpack_require__(12);
  26531. var getEventTarget = __webpack_require__(63);
  26532. var getUnboundedScrollPosition = __webpack_require__(142);
  26533. /**
  26534. * Find the deepest React component completely containing the root of the
  26535. * passed-in instance (for use when entire React trees are nested within each
  26536. * other). If React trees are not nested, returns null.
  26537. */
  26538. function findParent(inst) {
  26539. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  26540. // traversal, but caching is difficult to do correctly without using a
  26541. // mutation observer to listen for all DOM changes.
  26542. while (inst._hostParent) {
  26543. inst = inst._hostParent;
  26544. }
  26545. var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
  26546. var container = rootNode.parentNode;
  26547. return ReactDOMComponentTree.getClosestInstanceFromNode(container);
  26548. }
  26549. // Used to store ancestor hierarchy in top level callback
  26550. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  26551. this.topLevelType = topLevelType;
  26552. this.nativeEvent = nativeEvent;
  26553. this.ancestors = [];
  26554. }
  26555. _assign(TopLevelCallbackBookKeeping.prototype, {
  26556. destructor: function () {
  26557. this.topLevelType = null;
  26558. this.nativeEvent = null;
  26559. this.ancestors.length = 0;
  26560. }
  26561. });
  26562. PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
  26563. function handleTopLevelImpl(bookKeeping) {
  26564. var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
  26565. var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
  26566. // Loop through the hierarchy, in case there's any nested components.
  26567. // It's important that we build the array of ancestors before calling any
  26568. // event handlers, because event handlers can modify the DOM, leading to
  26569. // inconsistencies with ReactMount's node cache. See #1105.
  26570. var ancestor = targetInst;
  26571. do {
  26572. bookKeeping.ancestors.push(ancestor);
  26573. ancestor = ancestor && findParent(ancestor);
  26574. } while (ancestor);
  26575. for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  26576. targetInst = bookKeeping.ancestors[i];
  26577. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  26578. }
  26579. }
  26580. function scrollValueMonitor(cb) {
  26581. var scrollPosition = getUnboundedScrollPosition(window);
  26582. cb(scrollPosition);
  26583. }
  26584. var ReactEventListener = {
  26585. _enabled: true,
  26586. _handleTopLevel: null,
  26587. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  26588. setHandleTopLevel: function (handleTopLevel) {
  26589. ReactEventListener._handleTopLevel = handleTopLevel;
  26590. },
  26591. setEnabled: function (enabled) {
  26592. ReactEventListener._enabled = !!enabled;
  26593. },
  26594. isEnabled: function () {
  26595. return ReactEventListener._enabled;
  26596. },
  26597. /**
  26598. * Traps top-level events by using event bubbling.
  26599. *
  26600. * @param {string} topLevelType Record from `EventConstants`.
  26601. * @param {string} handlerBaseName Event name (e.g. "click").
  26602. * @param {object} element Element on which to attach listener.
  26603. * @return {?object} An object with a remove function which will forcefully
  26604. * remove the listener.
  26605. * @internal
  26606. */
  26607. trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
  26608. if (!element) {
  26609. return null;
  26610. }
  26611. return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  26612. },
  26613. /**
  26614. * Traps a top-level event by using event capturing.
  26615. *
  26616. * @param {string} topLevelType Record from `EventConstants`.
  26617. * @param {string} handlerBaseName Event name (e.g. "click").
  26618. * @param {object} element Element on which to attach listener.
  26619. * @return {?object} An object with a remove function which will forcefully
  26620. * remove the listener.
  26621. * @internal
  26622. */
  26623. trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
  26624. if (!element) {
  26625. return null;
  26626. }
  26627. return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  26628. },
  26629. monitorScrollValue: function (refresh) {
  26630. var callback = scrollValueMonitor.bind(null, refresh);
  26631. EventListener.listen(window, 'scroll', callback);
  26632. },
  26633. dispatchEvent: function (topLevelType, nativeEvent) {
  26634. if (!ReactEventListener._enabled) {
  26635. return;
  26636. }
  26637. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
  26638. try {
  26639. // Event queue being processed in the same cycle allows
  26640. // `preventDefault`.
  26641. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  26642. } finally {
  26643. TopLevelCallbackBookKeeping.release(bookKeeping);
  26644. }
  26645. }
  26646. };
  26647. module.exports = ReactEventListener;
  26648. /***/ }),
  26649. /* 181 */
  26650. /***/ (function(module, exports, __webpack_require__) {
  26651. "use strict";
  26652. /**
  26653. * Copyright 2013-present, Facebook, Inc.
  26654. * All rights reserved.
  26655. *
  26656. * This source code is licensed under the BSD-style license found in the
  26657. * LICENSE file in the root directory of this source tree. An additional grant
  26658. * of patent rights can be found in the PATENTS file in the same directory.
  26659. *
  26660. */
  26661. var DOMProperty = __webpack_require__(19);
  26662. var EventPluginHub = __webpack_require__(26);
  26663. var EventPluginUtils = __webpack_require__(54);
  26664. var ReactComponentEnvironment = __webpack_require__(57);
  26665. var ReactEmptyComponent = __webpack_require__(81);
  26666. var ReactBrowserEventEmitter = __webpack_require__(31);
  26667. var ReactHostComponent = __webpack_require__(83);
  26668. var ReactUpdates = __webpack_require__(12);
  26669. var ReactInjection = {
  26670. Component: ReactComponentEnvironment.injection,
  26671. DOMProperty: DOMProperty.injection,
  26672. EmptyComponent: ReactEmptyComponent.injection,
  26673. EventPluginHub: EventPluginHub.injection,
  26674. EventPluginUtils: EventPluginUtils.injection,
  26675. EventEmitter: ReactBrowserEventEmitter.injection,
  26676. HostComponent: ReactHostComponent.injection,
  26677. Updates: ReactUpdates.injection
  26678. };
  26679. module.exports = ReactInjection;
  26680. /***/ }),
  26681. /* 182 */
  26682. /***/ (function(module, exports, __webpack_require__) {
  26683. "use strict";
  26684. /**
  26685. * Copyright 2013-present, Facebook, Inc.
  26686. * All rights reserved.
  26687. *
  26688. * This source code is licensed under the BSD-style license found in the
  26689. * LICENSE file in the root directory of this source tree. An additional grant
  26690. * of patent rights can be found in the PATENTS file in the same directory.
  26691. *
  26692. */
  26693. var adler32 = __webpack_require__(204);
  26694. var TAG_END = /\/?>/;
  26695. var COMMENT_START = /^<\!\-\-/;
  26696. var ReactMarkupChecksum = {
  26697. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  26698. /**
  26699. * @param {string} markup Markup string
  26700. * @return {string} Markup string with checksum attribute attached
  26701. */
  26702. addChecksumToMarkup: function (markup) {
  26703. var checksum = adler32(markup);
  26704. // Add checksum (handle both parent tags, comments and self-closing tags)
  26705. if (COMMENT_START.test(markup)) {
  26706. return markup;
  26707. } else {
  26708. return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
  26709. }
  26710. },
  26711. /**
  26712. * @param {string} markup to use
  26713. * @param {DOMElement} element root React element
  26714. * @returns {boolean} whether or not the markup is the same
  26715. */
  26716. canReuseMarkup: function (markup, element) {
  26717. var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  26718. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  26719. var markupChecksum = adler32(markup);
  26720. return markupChecksum === existingChecksum;
  26721. }
  26722. };
  26723. module.exports = ReactMarkupChecksum;
  26724. /***/ }),
  26725. /* 183 */
  26726. /***/ (function(module, exports, __webpack_require__) {
  26727. "use strict";
  26728. /**
  26729. * Copyright 2013-present, Facebook, Inc.
  26730. * All rights reserved.
  26731. *
  26732. * This source code is licensed under the BSD-style license found in the
  26733. * LICENSE file in the root directory of this source tree. An additional grant
  26734. * of patent rights can be found in the PATENTS file in the same directory.
  26735. *
  26736. */
  26737. var _prodInvariant = __webpack_require__(2);
  26738. var ReactComponentEnvironment = __webpack_require__(57);
  26739. var ReactInstanceMap = __webpack_require__(28);
  26740. var ReactInstrumentation = __webpack_require__(11);
  26741. var ReactCurrentOwner = __webpack_require__(14);
  26742. var ReactReconciler = __webpack_require__(20);
  26743. var ReactChildReconciler = __webpack_require__(161);
  26744. var emptyFunction = __webpack_require__(10);
  26745. var flattenChildren = __webpack_require__(207);
  26746. var invariant = __webpack_require__(0);
  26747. /**
  26748. * Make an update for markup to be rendered and inserted at a supplied index.
  26749. *
  26750. * @param {string} markup Markup that renders into an element.
  26751. * @param {number} toIndex Destination index.
  26752. * @private
  26753. */
  26754. function makeInsertMarkup(markup, afterNode, toIndex) {
  26755. // NOTE: Null values reduce hidden classes.
  26756. return {
  26757. type: 'INSERT_MARKUP',
  26758. content: markup,
  26759. fromIndex: null,
  26760. fromNode: null,
  26761. toIndex: toIndex,
  26762. afterNode: afterNode
  26763. };
  26764. }
  26765. /**
  26766. * Make an update for moving an existing element to another index.
  26767. *
  26768. * @param {number} fromIndex Source index of the existing element.
  26769. * @param {number} toIndex Destination index of the element.
  26770. * @private
  26771. */
  26772. function makeMove(child, afterNode, toIndex) {
  26773. // NOTE: Null values reduce hidden classes.
  26774. return {
  26775. type: 'MOVE_EXISTING',
  26776. content: null,
  26777. fromIndex: child._mountIndex,
  26778. fromNode: ReactReconciler.getHostNode(child),
  26779. toIndex: toIndex,
  26780. afterNode: afterNode
  26781. };
  26782. }
  26783. /**
  26784. * Make an update for removing an element at an index.
  26785. *
  26786. * @param {number} fromIndex Index of the element to remove.
  26787. * @private
  26788. */
  26789. function makeRemove(child, node) {
  26790. // NOTE: Null values reduce hidden classes.
  26791. return {
  26792. type: 'REMOVE_NODE',
  26793. content: null,
  26794. fromIndex: child._mountIndex,
  26795. fromNode: node,
  26796. toIndex: null,
  26797. afterNode: null
  26798. };
  26799. }
  26800. /**
  26801. * Make an update for setting the markup of a node.
  26802. *
  26803. * @param {string} markup Markup that renders into an element.
  26804. * @private
  26805. */
  26806. function makeSetMarkup(markup) {
  26807. // NOTE: Null values reduce hidden classes.
  26808. return {
  26809. type: 'SET_MARKUP',
  26810. content: markup,
  26811. fromIndex: null,
  26812. fromNode: null,
  26813. toIndex: null,
  26814. afterNode: null
  26815. };
  26816. }
  26817. /**
  26818. * Make an update for setting the text content.
  26819. *
  26820. * @param {string} textContent Text content to set.
  26821. * @private
  26822. */
  26823. function makeTextContent(textContent) {
  26824. // NOTE: Null values reduce hidden classes.
  26825. return {
  26826. type: 'TEXT_CONTENT',
  26827. content: textContent,
  26828. fromIndex: null,
  26829. fromNode: null,
  26830. toIndex: null,
  26831. afterNode: null
  26832. };
  26833. }
  26834. /**
  26835. * Push an update, if any, onto the queue. Creates a new queue if none is
  26836. * passed and always returns the queue. Mutative.
  26837. */
  26838. function enqueue(queue, update) {
  26839. if (update) {
  26840. queue = queue || [];
  26841. queue.push(update);
  26842. }
  26843. return queue;
  26844. }
  26845. /**
  26846. * Processes any enqueued updates.
  26847. *
  26848. * @private
  26849. */
  26850. function processQueue(inst, updateQueue) {
  26851. ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
  26852. }
  26853. var setChildrenForInstrumentation = emptyFunction;
  26854. if (false) {
  26855. var getDebugID = function (inst) {
  26856. if (!inst._debugID) {
  26857. // Check for ART-like instances. TODO: This is silly/gross.
  26858. var internal;
  26859. if (internal = ReactInstanceMap.get(inst)) {
  26860. inst = internal;
  26861. }
  26862. }
  26863. return inst._debugID;
  26864. };
  26865. setChildrenForInstrumentation = function (children) {
  26866. var debugID = getDebugID(this);
  26867. // TODO: React Native empty components are also multichild.
  26868. // This means they still get into this method but don't have _debugID.
  26869. if (debugID !== 0) {
  26870. ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
  26871. return children[key]._debugID;
  26872. }) : []);
  26873. }
  26874. };
  26875. }
  26876. /**
  26877. * ReactMultiChild are capable of reconciling multiple children.
  26878. *
  26879. * @class ReactMultiChild
  26880. * @internal
  26881. */
  26882. var ReactMultiChild = {
  26883. /**
  26884. * Provides common functionality for components that must reconcile multiple
  26885. * children. This is used by `ReactDOMComponent` to mount, update, and
  26886. * unmount child components.
  26887. *
  26888. * @lends {ReactMultiChild.prototype}
  26889. */
  26890. Mixin: {
  26891. _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
  26892. if (false) {
  26893. var selfDebugID = getDebugID(this);
  26894. if (this._currentElement) {
  26895. try {
  26896. ReactCurrentOwner.current = this._currentElement._owner;
  26897. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
  26898. } finally {
  26899. ReactCurrentOwner.current = null;
  26900. }
  26901. }
  26902. }
  26903. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
  26904. },
  26905. _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
  26906. var nextChildren;
  26907. var selfDebugID = 0;
  26908. if (false) {
  26909. selfDebugID = getDebugID(this);
  26910. if (this._currentElement) {
  26911. try {
  26912. ReactCurrentOwner.current = this._currentElement._owner;
  26913. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  26914. } finally {
  26915. ReactCurrentOwner.current = null;
  26916. }
  26917. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26918. return nextChildren;
  26919. }
  26920. }
  26921. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  26922. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26923. return nextChildren;
  26924. },
  26925. /**
  26926. * Generates a "mount image" for each of the supplied children. In the case
  26927. * of `ReactDOMComponent`, a mount image is a string of markup.
  26928. *
  26929. * @param {?object} nestedChildren Nested child maps.
  26930. * @return {array} An array of mounted representations.
  26931. * @internal
  26932. */
  26933. mountChildren: function (nestedChildren, transaction, context) {
  26934. var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
  26935. this._renderedChildren = children;
  26936. var mountImages = [];
  26937. var index = 0;
  26938. for (var name in children) {
  26939. if (children.hasOwnProperty(name)) {
  26940. var child = children[name];
  26941. var selfDebugID = 0;
  26942. if (false) {
  26943. selfDebugID = getDebugID(this);
  26944. }
  26945. var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26946. child._mountIndex = index++;
  26947. mountImages.push(mountImage);
  26948. }
  26949. }
  26950. if (false) {
  26951. setChildrenForInstrumentation.call(this, children);
  26952. }
  26953. return mountImages;
  26954. },
  26955. /**
  26956. * Replaces any rendered children with a text content string.
  26957. *
  26958. * @param {string} nextContent String of content.
  26959. * @internal
  26960. */
  26961. updateTextContent: function (nextContent) {
  26962. var prevChildren = this._renderedChildren;
  26963. // Remove any rendered children.
  26964. ReactChildReconciler.unmountChildren(prevChildren, false);
  26965. for (var name in prevChildren) {
  26966. if (prevChildren.hasOwnProperty(name)) {
  26967. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  26968. }
  26969. }
  26970. // Set new text content.
  26971. var updates = [makeTextContent(nextContent)];
  26972. processQueue(this, updates);
  26973. },
  26974. /**
  26975. * Replaces any rendered children with a markup string.
  26976. *
  26977. * @param {string} nextMarkup String of markup.
  26978. * @internal
  26979. */
  26980. updateMarkup: function (nextMarkup) {
  26981. var prevChildren = this._renderedChildren;
  26982. // Remove any rendered children.
  26983. ReactChildReconciler.unmountChildren(prevChildren, false);
  26984. for (var name in prevChildren) {
  26985. if (prevChildren.hasOwnProperty(name)) {
  26986. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  26987. }
  26988. }
  26989. var updates = [makeSetMarkup(nextMarkup)];
  26990. processQueue(this, updates);
  26991. },
  26992. /**
  26993. * Updates the rendered children with new children.
  26994. *
  26995. * @param {?object} nextNestedChildrenElements Nested child element maps.
  26996. * @param {ReactReconcileTransaction} transaction
  26997. * @internal
  26998. */
  26999. updateChildren: function (nextNestedChildrenElements, transaction, context) {
  27000. // Hook used by React ART
  27001. this._updateChildren(nextNestedChildrenElements, transaction, context);
  27002. },
  27003. /**
  27004. * @param {?object} nextNestedChildrenElements Nested child element maps.
  27005. * @param {ReactReconcileTransaction} transaction
  27006. * @final
  27007. * @protected
  27008. */
  27009. _updateChildren: function (nextNestedChildrenElements, transaction, context) {
  27010. var prevChildren = this._renderedChildren;
  27011. var removedNodes = {};
  27012. var mountImages = [];
  27013. var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context);
  27014. if (!nextChildren && !prevChildren) {
  27015. return;
  27016. }
  27017. var updates = null;
  27018. var name;
  27019. // `nextIndex` will increment for each child in `nextChildren`, but
  27020. // `lastIndex` will be the last index visited in `prevChildren`.
  27021. var nextIndex = 0;
  27022. var lastIndex = 0;
  27023. // `nextMountIndex` will increment for each newly mounted child.
  27024. var nextMountIndex = 0;
  27025. var lastPlacedNode = null;
  27026. for (name in nextChildren) {
  27027. if (!nextChildren.hasOwnProperty(name)) {
  27028. continue;
  27029. }
  27030. var prevChild = prevChildren && prevChildren[name];
  27031. var nextChild = nextChildren[name];
  27032. if (prevChild === nextChild) {
  27033. updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
  27034. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  27035. prevChild._mountIndex = nextIndex;
  27036. } else {
  27037. if (prevChild) {
  27038. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  27039. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  27040. // The `removedNodes` loop below will actually remove the child.
  27041. }
  27042. // The child must be instantiated before it's mounted.
  27043. updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context));
  27044. nextMountIndex++;
  27045. }
  27046. nextIndex++;
  27047. lastPlacedNode = ReactReconciler.getHostNode(nextChild);
  27048. }
  27049. // Remove children that are no longer present.
  27050. for (name in removedNodes) {
  27051. if (removedNodes.hasOwnProperty(name)) {
  27052. updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
  27053. }
  27054. }
  27055. if (updates) {
  27056. processQueue(this, updates);
  27057. }
  27058. this._renderedChildren = nextChildren;
  27059. if (false) {
  27060. setChildrenForInstrumentation.call(this, nextChildren);
  27061. }
  27062. },
  27063. /**
  27064. * Unmounts all rendered children. This should be used to clean up children
  27065. * when this component is unmounted. It does not actually perform any
  27066. * backend operations.
  27067. *
  27068. * @internal
  27069. */
  27070. unmountChildren: function (safely) {
  27071. var renderedChildren = this._renderedChildren;
  27072. ReactChildReconciler.unmountChildren(renderedChildren, safely);
  27073. this._renderedChildren = null;
  27074. },
  27075. /**
  27076. * Moves a child component to the supplied index.
  27077. *
  27078. * @param {ReactComponent} child Component to move.
  27079. * @param {number} toIndex Destination index of the element.
  27080. * @param {number} lastIndex Last index visited of the siblings of `child`.
  27081. * @protected
  27082. */
  27083. moveChild: function (child, afterNode, toIndex, lastIndex) {
  27084. // If the index of `child` is less than `lastIndex`, then it needs to
  27085. // be moved. Otherwise, we do not need to move it because a child will be
  27086. // inserted or moved before `child`.
  27087. if (child._mountIndex < lastIndex) {
  27088. return makeMove(child, afterNode, toIndex);
  27089. }
  27090. },
  27091. /**
  27092. * Creates a child component.
  27093. *
  27094. * @param {ReactComponent} child Component to create.
  27095. * @param {string} mountImage Markup to insert.
  27096. * @protected
  27097. */
  27098. createChild: function (child, afterNode, mountImage) {
  27099. return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
  27100. },
  27101. /**
  27102. * Removes a child component.
  27103. *
  27104. * @param {ReactComponent} child Child to remove.
  27105. * @protected
  27106. */
  27107. removeChild: function (child, node) {
  27108. return makeRemove(child, node);
  27109. },
  27110. /**
  27111. * Mounts a child with the supplied name.
  27112. *
  27113. * NOTE: This is part of `updateChildren` and is here for readability.
  27114. *
  27115. * @param {ReactComponent} child Component to mount.
  27116. * @param {string} name Name of the child.
  27117. * @param {number} index Index at which to insert the child.
  27118. * @param {ReactReconcileTransaction} transaction
  27119. * @private
  27120. */
  27121. _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) {
  27122. child._mountIndex = index;
  27123. return this.createChild(child, afterNode, mountImage);
  27124. },
  27125. /**
  27126. * Unmounts a rendered child.
  27127. *
  27128. * NOTE: This is part of `updateChildren` and is here for readability.
  27129. *
  27130. * @param {ReactComponent} child Component to unmount.
  27131. * @private
  27132. */
  27133. _unmountChild: function (child, node) {
  27134. var update = this.removeChild(child, node);
  27135. child._mountIndex = null;
  27136. return update;
  27137. }
  27138. }
  27139. };
  27140. module.exports = ReactMultiChild;
  27141. /***/ }),
  27142. /* 184 */
  27143. /***/ (function(module, exports, __webpack_require__) {
  27144. "use strict";
  27145. /**
  27146. * Copyright 2013-present, Facebook, Inc.
  27147. * All rights reserved.
  27148. *
  27149. * This source code is licensed under the BSD-style license found in the
  27150. * LICENSE file in the root directory of this source tree. An additional grant
  27151. * of patent rights can be found in the PATENTS file in the same directory.
  27152. *
  27153. *
  27154. */
  27155. var _prodInvariant = __webpack_require__(2);
  27156. var invariant = __webpack_require__(0);
  27157. /**
  27158. * @param {?object} object
  27159. * @return {boolean} True if `object` is a valid owner.
  27160. * @final
  27161. */
  27162. function isValidOwner(object) {
  27163. return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
  27164. }
  27165. /**
  27166. * ReactOwners are capable of storing references to owned components.
  27167. *
  27168. * All components are capable of //being// referenced by owner components, but
  27169. * only ReactOwner components are capable of //referencing// owned components.
  27170. * The named reference is known as a "ref".
  27171. *
  27172. * Refs are available when mounted and updated during reconciliation.
  27173. *
  27174. * var MyComponent = React.createClass({
  27175. * render: function() {
  27176. * return (
  27177. * <div onClick={this.handleClick}>
  27178. * <CustomComponent ref="custom" />
  27179. * </div>
  27180. * );
  27181. * },
  27182. * handleClick: function() {
  27183. * this.refs.custom.handleClick();
  27184. * },
  27185. * componentDidMount: function() {
  27186. * this.refs.custom.initialize();
  27187. * }
  27188. * });
  27189. *
  27190. * Refs should rarely be used. When refs are used, they should only be done to
  27191. * control data that is not handled by React's data flow.
  27192. *
  27193. * @class ReactOwner
  27194. */
  27195. var ReactOwner = {
  27196. /**
  27197. * Adds a component by ref to an owner component.
  27198. *
  27199. * @param {ReactComponent} component Component to reference.
  27200. * @param {string} ref Name by which to refer to the component.
  27201. * @param {ReactOwner} owner Component on which to record the ref.
  27202. * @final
  27203. * @internal
  27204. */
  27205. addComponentAsRefTo: function (component, ref, owner) {
  27206. !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;
  27207. owner.attachRef(ref, component);
  27208. },
  27209. /**
  27210. * Removes a component by ref from an owner component.
  27211. *
  27212. * @param {ReactComponent} component Component to dereference.
  27213. * @param {string} ref Name of the ref to remove.
  27214. * @param {ReactOwner} owner Component on which the ref is recorded.
  27215. * @final
  27216. * @internal
  27217. */
  27218. removeComponentAsRefFrom: function (component, ref, owner) {
  27219. !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;
  27220. var ownerPublicInstance = owner.getPublicInstance();
  27221. // Check that `component`'s owner is still alive and that `component` is still the current ref
  27222. // because we do not want to detach the ref if another component stole it.
  27223. if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
  27224. owner.detachRef(ref);
  27225. }
  27226. }
  27227. };
  27228. module.exports = ReactOwner;
  27229. /***/ }),
  27230. /* 185 */
  27231. /***/ (function(module, exports, __webpack_require__) {
  27232. "use strict";
  27233. /**
  27234. * Copyright 2013-present, Facebook, Inc.
  27235. * All rights reserved.
  27236. *
  27237. * This source code is licensed under the BSD-style license found in the
  27238. * LICENSE file in the root directory of this source tree. An additional grant
  27239. * of patent rights can be found in the PATENTS file in the same directory.
  27240. *
  27241. *
  27242. */
  27243. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  27244. module.exports = ReactPropTypesSecret;
  27245. /***/ }),
  27246. /* 186 */
  27247. /***/ (function(module, exports, __webpack_require__) {
  27248. "use strict";
  27249. /**
  27250. * Copyright 2013-present, Facebook, Inc.
  27251. * All rights reserved.
  27252. *
  27253. * This source code is licensed under the BSD-style license found in the
  27254. * LICENSE file in the root directory of this source tree. An additional grant
  27255. * of patent rights can be found in the PATENTS file in the same directory.
  27256. *
  27257. */
  27258. var _assign = __webpack_require__(3);
  27259. var CallbackQueue = __webpack_require__(77);
  27260. var PooledClass = __webpack_require__(16);
  27261. var ReactBrowserEventEmitter = __webpack_require__(31);
  27262. var ReactInputSelection = __webpack_require__(84);
  27263. var ReactInstrumentation = __webpack_require__(11);
  27264. var Transaction = __webpack_require__(33);
  27265. var ReactUpdateQueue = __webpack_require__(59);
  27266. /**
  27267. * Ensures that, when possible, the selection range (currently selected text
  27268. * input) is not disturbed by performing the transaction.
  27269. */
  27270. var SELECTION_RESTORATION = {
  27271. /**
  27272. * @return {Selection} Selection information.
  27273. */
  27274. initialize: ReactInputSelection.getSelectionInformation,
  27275. /**
  27276. * @param {Selection} sel Selection information returned from `initialize`.
  27277. */
  27278. close: ReactInputSelection.restoreSelection
  27279. };
  27280. /**
  27281. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  27282. * high level DOM manipulations (like temporarily removing a text input from the
  27283. * DOM).
  27284. */
  27285. var EVENT_SUPPRESSION = {
  27286. /**
  27287. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  27288. * the reconciliation.
  27289. */
  27290. initialize: function () {
  27291. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  27292. ReactBrowserEventEmitter.setEnabled(false);
  27293. return currentlyEnabled;
  27294. },
  27295. /**
  27296. * @param {boolean} previouslyEnabled Enabled status of
  27297. * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
  27298. * restores the previous value.
  27299. */
  27300. close: function (previouslyEnabled) {
  27301. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  27302. }
  27303. };
  27304. /**
  27305. * Provides a queue for collecting `componentDidMount` and
  27306. * `componentDidUpdate` callbacks during the transaction.
  27307. */
  27308. var ON_DOM_READY_QUEUEING = {
  27309. /**
  27310. * Initializes the internal `onDOMReady` queue.
  27311. */
  27312. initialize: function () {
  27313. this.reactMountReady.reset();
  27314. },
  27315. /**
  27316. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  27317. */
  27318. close: function () {
  27319. this.reactMountReady.notifyAll();
  27320. }
  27321. };
  27322. /**
  27323. * Executed within the scope of the `Transaction` instance. Consider these as
  27324. * being member methods, but with an implied ordering while being isolated from
  27325. * each other.
  27326. */
  27327. var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
  27328. if (false) {
  27329. TRANSACTION_WRAPPERS.push({
  27330. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  27331. close: ReactInstrumentation.debugTool.onEndFlush
  27332. });
  27333. }
  27334. /**
  27335. * Currently:
  27336. * - The order that these are listed in the transaction is critical:
  27337. * - Suppresses events.
  27338. * - Restores selection range.
  27339. *
  27340. * Future:
  27341. * - Restore document/overflow scroll positions that were unintentionally
  27342. * modified via DOM insertions above the top viewport boundary.
  27343. * - Implement/integrate with customized constraint based layout system and keep
  27344. * track of which dimensions must be remeasured.
  27345. *
  27346. * @class ReactReconcileTransaction
  27347. */
  27348. function ReactReconcileTransaction(useCreateElement) {
  27349. this.reinitializeTransaction();
  27350. // Only server-side rendering really needs this option (see
  27351. // `ReactServerRendering`), but server-side uses
  27352. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  27353. // accessible and defaults to false when `ReactDOMComponent` and
  27354. // `ReactDOMTextComponent` checks it in `mountComponent`.`
  27355. this.renderToStaticMarkup = false;
  27356. this.reactMountReady = CallbackQueue.getPooled(null);
  27357. this.useCreateElement = useCreateElement;
  27358. }
  27359. var Mixin = {
  27360. /**
  27361. * @see Transaction
  27362. * @abstract
  27363. * @final
  27364. * @return {array<object>} List of operation wrap procedures.
  27365. * TODO: convert to array<TransactionWrapper>
  27366. */
  27367. getTransactionWrappers: function () {
  27368. return TRANSACTION_WRAPPERS;
  27369. },
  27370. /**
  27371. * @return {object} The queue to collect `onDOMReady` callbacks with.
  27372. */
  27373. getReactMountReady: function () {
  27374. return this.reactMountReady;
  27375. },
  27376. /**
  27377. * @return {object} The queue to collect React async events.
  27378. */
  27379. getUpdateQueue: function () {
  27380. return ReactUpdateQueue;
  27381. },
  27382. /**
  27383. * Save current transaction state -- if the return value from this method is
  27384. * passed to `rollback`, the transaction will be reset to that state.
  27385. */
  27386. checkpoint: function () {
  27387. // reactMountReady is the our only stateful wrapper
  27388. return this.reactMountReady.checkpoint();
  27389. },
  27390. rollback: function (checkpoint) {
  27391. this.reactMountReady.rollback(checkpoint);
  27392. },
  27393. /**
  27394. * `PooledClass` looks for this, and will invoke this before allowing this
  27395. * instance to be reused.
  27396. */
  27397. destructor: function () {
  27398. CallbackQueue.release(this.reactMountReady);
  27399. this.reactMountReady = null;
  27400. }
  27401. };
  27402. _assign(ReactReconcileTransaction.prototype, Transaction, Mixin);
  27403. PooledClass.addPoolingTo(ReactReconcileTransaction);
  27404. module.exports = ReactReconcileTransaction;
  27405. /***/ }),
  27406. /* 187 */
  27407. /***/ (function(module, exports, __webpack_require__) {
  27408. "use strict";
  27409. /**
  27410. * Copyright 2013-present, Facebook, Inc.
  27411. * All rights reserved.
  27412. *
  27413. * This source code is licensed under the BSD-style license found in the
  27414. * LICENSE file in the root directory of this source tree. An additional grant
  27415. * of patent rights can be found in the PATENTS file in the same directory.
  27416. *
  27417. *
  27418. */
  27419. var ReactOwner = __webpack_require__(184);
  27420. var ReactRef = {};
  27421. function attachRef(ref, component, owner) {
  27422. if (typeof ref === 'function') {
  27423. ref(component.getPublicInstance());
  27424. } else {
  27425. // Legacy ref
  27426. ReactOwner.addComponentAsRefTo(component, ref, owner);
  27427. }
  27428. }
  27429. function detachRef(ref, component, owner) {
  27430. if (typeof ref === 'function') {
  27431. ref(null);
  27432. } else {
  27433. // Legacy ref
  27434. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  27435. }
  27436. }
  27437. ReactRef.attachRefs = function (instance, element) {
  27438. if (element === null || typeof element !== 'object') {
  27439. return;
  27440. }
  27441. var ref = element.ref;
  27442. if (ref != null) {
  27443. attachRef(ref, instance, element._owner);
  27444. }
  27445. };
  27446. ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
  27447. // If either the owner or a `ref` has changed, make sure the newest owner
  27448. // has stored a reference to `this`, and the previous owner (if different)
  27449. // has forgotten the reference to `this`. We use the element instead
  27450. // of the public this.props because the post processing cannot determine
  27451. // a ref. The ref conceptually lives on the element.
  27452. // TODO: Should this even be possible? The owner cannot change because
  27453. // it's forbidden by shouldUpdateReactComponent. The ref can change
  27454. // if you swap the keys of but not the refs. Reconsider where this check
  27455. // is made. It probably belongs where the key checking and
  27456. // instantiateReactComponent is done.
  27457. var prevRef = null;
  27458. var prevOwner = null;
  27459. if (prevElement !== null && typeof prevElement === 'object') {
  27460. prevRef = prevElement.ref;
  27461. prevOwner = prevElement._owner;
  27462. }
  27463. var nextRef = null;
  27464. var nextOwner = null;
  27465. if (nextElement !== null && typeof nextElement === 'object') {
  27466. nextRef = nextElement.ref;
  27467. nextOwner = nextElement._owner;
  27468. }
  27469. return prevRef !== nextRef ||
  27470. // If owner changes but we have an unchanged function ref, don't update refs
  27471. typeof nextRef === 'string' && nextOwner !== prevOwner;
  27472. };
  27473. ReactRef.detachRefs = function (instance, element) {
  27474. if (element === null || typeof element !== 'object') {
  27475. return;
  27476. }
  27477. var ref = element.ref;
  27478. if (ref != null) {
  27479. detachRef(ref, instance, element._owner);
  27480. }
  27481. };
  27482. module.exports = ReactRef;
  27483. /***/ }),
  27484. /* 188 */
  27485. /***/ (function(module, exports, __webpack_require__) {
  27486. "use strict";
  27487. /**
  27488. * Copyright 2014-present, Facebook, Inc.
  27489. * All rights reserved.
  27490. *
  27491. * This source code is licensed under the BSD-style license found in the
  27492. * LICENSE file in the root directory of this source tree. An additional grant
  27493. * of patent rights can be found in the PATENTS file in the same directory.
  27494. *
  27495. */
  27496. var _assign = __webpack_require__(3);
  27497. var PooledClass = __webpack_require__(16);
  27498. var Transaction = __webpack_require__(33);
  27499. var ReactInstrumentation = __webpack_require__(11);
  27500. var ReactServerUpdateQueue = __webpack_require__(189);
  27501. /**
  27502. * Executed within the scope of the `Transaction` instance. Consider these as
  27503. * being member methods, but with an implied ordering while being isolated from
  27504. * each other.
  27505. */
  27506. var TRANSACTION_WRAPPERS = [];
  27507. if (false) {
  27508. TRANSACTION_WRAPPERS.push({
  27509. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  27510. close: ReactInstrumentation.debugTool.onEndFlush
  27511. });
  27512. }
  27513. var noopCallbackQueue = {
  27514. enqueue: function () {}
  27515. };
  27516. /**
  27517. * @class ReactServerRenderingTransaction
  27518. * @param {boolean} renderToStaticMarkup
  27519. */
  27520. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  27521. this.reinitializeTransaction();
  27522. this.renderToStaticMarkup = renderToStaticMarkup;
  27523. this.useCreateElement = false;
  27524. this.updateQueue = new ReactServerUpdateQueue(this);
  27525. }
  27526. var Mixin = {
  27527. /**
  27528. * @see Transaction
  27529. * @abstract
  27530. * @final
  27531. * @return {array} Empty list of operation wrap procedures.
  27532. */
  27533. getTransactionWrappers: function () {
  27534. return TRANSACTION_WRAPPERS;
  27535. },
  27536. /**
  27537. * @return {object} The queue to collect `onDOMReady` callbacks with.
  27538. */
  27539. getReactMountReady: function () {
  27540. return noopCallbackQueue;
  27541. },
  27542. /**
  27543. * @return {object} The queue to collect React async events.
  27544. */
  27545. getUpdateQueue: function () {
  27546. return this.updateQueue;
  27547. },
  27548. /**
  27549. * `PooledClass` looks for this, and will invoke this before allowing this
  27550. * instance to be reused.
  27551. */
  27552. destructor: function () {},
  27553. checkpoint: function () {},
  27554. rollback: function () {}
  27555. };
  27556. _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin);
  27557. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  27558. module.exports = ReactServerRenderingTransaction;
  27559. /***/ }),
  27560. /* 189 */
  27561. /***/ (function(module, exports, __webpack_require__) {
  27562. "use strict";
  27563. /**
  27564. * Copyright 2015-present, Facebook, Inc.
  27565. * All rights reserved.
  27566. *
  27567. * This source code is licensed under the BSD-style license found in the
  27568. * LICENSE file in the root directory of this source tree. An additional grant
  27569. * of patent rights can be found in the PATENTS file in the same directory.
  27570. *
  27571. *
  27572. */
  27573. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  27574. var ReactUpdateQueue = __webpack_require__(59);
  27575. var warning = __webpack_require__(1);
  27576. function warnNoop(publicInstance, callerName) {
  27577. if (false) {
  27578. var constructor = publicInstance.constructor;
  27579. 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;
  27580. }
  27581. }
  27582. /**
  27583. * This is the update queue used for server rendering.
  27584. * It delegates to ReactUpdateQueue while server rendering is in progress and
  27585. * switches to ReactNoopUpdateQueue after the transaction has completed.
  27586. * @class ReactServerUpdateQueue
  27587. * @param {Transaction} transaction
  27588. */
  27589. var ReactServerUpdateQueue = function () {
  27590. function ReactServerUpdateQueue(transaction) {
  27591. _classCallCheck(this, ReactServerUpdateQueue);
  27592. this.transaction = transaction;
  27593. }
  27594. /**
  27595. * Checks whether or not this composite component is mounted.
  27596. * @param {ReactClass} publicInstance The instance we want to test.
  27597. * @return {boolean} True if mounted, false otherwise.
  27598. * @protected
  27599. * @final
  27600. */
  27601. ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
  27602. return false;
  27603. };
  27604. /**
  27605. * Enqueue a callback that will be executed after all the pending updates
  27606. * have processed.
  27607. *
  27608. * @param {ReactClass} publicInstance The instance to use as `this` context.
  27609. * @param {?function} callback Called after state is updated.
  27610. * @internal
  27611. */
  27612. ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
  27613. if (this.transaction.isInTransaction()) {
  27614. ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
  27615. }
  27616. };
  27617. /**
  27618. * Forces an update. This should only be invoked when it is known with
  27619. * certainty that we are **not** in a DOM transaction.
  27620. *
  27621. * You may want to call this when you know that some deeper aspect of the
  27622. * component's state has changed but `setState` was not called.
  27623. *
  27624. * This will not invoke `shouldComponentUpdate`, but it will invoke
  27625. * `componentWillUpdate` and `componentDidUpdate`.
  27626. *
  27627. * @param {ReactClass} publicInstance The instance that should rerender.
  27628. * @internal
  27629. */
  27630. ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
  27631. if (this.transaction.isInTransaction()) {
  27632. ReactUpdateQueue.enqueueForceUpdate(publicInstance);
  27633. } else {
  27634. warnNoop(publicInstance, 'forceUpdate');
  27635. }
  27636. };
  27637. /**
  27638. * Replaces all of the state. Always use this or `setState` to mutate state.
  27639. * You should treat `this.state` as immutable.
  27640. *
  27641. * There is no guarantee that `this.state` will be immediately updated, so
  27642. * accessing `this.state` after calling this method may return the old value.
  27643. *
  27644. * @param {ReactClass} publicInstance The instance that should rerender.
  27645. * @param {object|function} completeState Next state.
  27646. * @internal
  27647. */
  27648. ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
  27649. if (this.transaction.isInTransaction()) {
  27650. ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
  27651. } else {
  27652. warnNoop(publicInstance, 'replaceState');
  27653. }
  27654. };
  27655. /**
  27656. * Sets a subset of the state. This only exists because _pendingState is
  27657. * internal. This provides a merging strategy that is not available to deep
  27658. * properties which is confusing. TODO: Expose pendingState or don't use it
  27659. * during the merge.
  27660. *
  27661. * @param {ReactClass} publicInstance The instance that should rerender.
  27662. * @param {object|function} partialState Next partial state to be merged with state.
  27663. * @internal
  27664. */
  27665. ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
  27666. if (this.transaction.isInTransaction()) {
  27667. ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
  27668. } else {
  27669. warnNoop(publicInstance, 'setState');
  27670. }
  27671. };
  27672. return ReactServerUpdateQueue;
  27673. }();
  27674. module.exports = ReactServerUpdateQueue;
  27675. /***/ }),
  27676. /* 190 */
  27677. /***/ (function(module, exports, __webpack_require__) {
  27678. "use strict";
  27679. /**
  27680. * Copyright 2013-present, Facebook, Inc.
  27681. * All rights reserved.
  27682. *
  27683. * This source code is licensed under the BSD-style license found in the
  27684. * LICENSE file in the root directory of this source tree. An additional grant
  27685. * of patent rights can be found in the PATENTS file in the same directory.
  27686. *
  27687. */
  27688. module.exports = '15.5.4';
  27689. /***/ }),
  27690. /* 191 */
  27691. /***/ (function(module, exports, __webpack_require__) {
  27692. "use strict";
  27693. /**
  27694. * Copyright 2013-present, Facebook, Inc.
  27695. * All rights reserved.
  27696. *
  27697. * This source code is licensed under the BSD-style license found in the
  27698. * LICENSE file in the root directory of this source tree. An additional grant
  27699. * of patent rights can be found in the PATENTS file in the same directory.
  27700. *
  27701. */
  27702. var NS = {
  27703. xlink: 'http://www.w3.org/1999/xlink',
  27704. xml: 'http://www.w3.org/XML/1998/namespace'
  27705. };
  27706. // We use attributes for everything SVG so let's avoid some duplication and run
  27707. // code instead.
  27708. // The following are all specified in the HTML config already so we exclude here.
  27709. // - class (as className)
  27710. // - color
  27711. // - height
  27712. // - id
  27713. // - lang
  27714. // - max
  27715. // - media
  27716. // - method
  27717. // - min
  27718. // - name
  27719. // - style
  27720. // - target
  27721. // - type
  27722. // - width
  27723. var ATTRS = {
  27724. accentHeight: 'accent-height',
  27725. accumulate: 0,
  27726. additive: 0,
  27727. alignmentBaseline: 'alignment-baseline',
  27728. allowReorder: 'allowReorder',
  27729. alphabetic: 0,
  27730. amplitude: 0,
  27731. arabicForm: 'arabic-form',
  27732. ascent: 0,
  27733. attributeName: 'attributeName',
  27734. attributeType: 'attributeType',
  27735. autoReverse: 'autoReverse',
  27736. azimuth: 0,
  27737. baseFrequency: 'baseFrequency',
  27738. baseProfile: 'baseProfile',
  27739. baselineShift: 'baseline-shift',
  27740. bbox: 0,
  27741. begin: 0,
  27742. bias: 0,
  27743. by: 0,
  27744. calcMode: 'calcMode',
  27745. capHeight: 'cap-height',
  27746. clip: 0,
  27747. clipPath: 'clip-path',
  27748. clipRule: 'clip-rule',
  27749. clipPathUnits: 'clipPathUnits',
  27750. colorInterpolation: 'color-interpolation',
  27751. colorInterpolationFilters: 'color-interpolation-filters',
  27752. colorProfile: 'color-profile',
  27753. colorRendering: 'color-rendering',
  27754. contentScriptType: 'contentScriptType',
  27755. contentStyleType: 'contentStyleType',
  27756. cursor: 0,
  27757. cx: 0,
  27758. cy: 0,
  27759. d: 0,
  27760. decelerate: 0,
  27761. descent: 0,
  27762. diffuseConstant: 'diffuseConstant',
  27763. direction: 0,
  27764. display: 0,
  27765. divisor: 0,
  27766. dominantBaseline: 'dominant-baseline',
  27767. dur: 0,
  27768. dx: 0,
  27769. dy: 0,
  27770. edgeMode: 'edgeMode',
  27771. elevation: 0,
  27772. enableBackground: 'enable-background',
  27773. end: 0,
  27774. exponent: 0,
  27775. externalResourcesRequired: 'externalResourcesRequired',
  27776. fill: 0,
  27777. fillOpacity: 'fill-opacity',
  27778. fillRule: 'fill-rule',
  27779. filter: 0,
  27780. filterRes: 'filterRes',
  27781. filterUnits: 'filterUnits',
  27782. floodColor: 'flood-color',
  27783. floodOpacity: 'flood-opacity',
  27784. focusable: 0,
  27785. fontFamily: 'font-family',
  27786. fontSize: 'font-size',
  27787. fontSizeAdjust: 'font-size-adjust',
  27788. fontStretch: 'font-stretch',
  27789. fontStyle: 'font-style',
  27790. fontVariant: 'font-variant',
  27791. fontWeight: 'font-weight',
  27792. format: 0,
  27793. from: 0,
  27794. fx: 0,
  27795. fy: 0,
  27796. g1: 0,
  27797. g2: 0,
  27798. glyphName: 'glyph-name',
  27799. glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  27800. glyphOrientationVertical: 'glyph-orientation-vertical',
  27801. glyphRef: 'glyphRef',
  27802. gradientTransform: 'gradientTransform',
  27803. gradientUnits: 'gradientUnits',
  27804. hanging: 0,
  27805. horizAdvX: 'horiz-adv-x',
  27806. horizOriginX: 'horiz-origin-x',
  27807. ideographic: 0,
  27808. imageRendering: 'image-rendering',
  27809. 'in': 0,
  27810. in2: 0,
  27811. intercept: 0,
  27812. k: 0,
  27813. k1: 0,
  27814. k2: 0,
  27815. k3: 0,
  27816. k4: 0,
  27817. kernelMatrix: 'kernelMatrix',
  27818. kernelUnitLength: 'kernelUnitLength',
  27819. kerning: 0,
  27820. keyPoints: 'keyPoints',
  27821. keySplines: 'keySplines',
  27822. keyTimes: 'keyTimes',
  27823. lengthAdjust: 'lengthAdjust',
  27824. letterSpacing: 'letter-spacing',
  27825. lightingColor: 'lighting-color',
  27826. limitingConeAngle: 'limitingConeAngle',
  27827. local: 0,
  27828. markerEnd: 'marker-end',
  27829. markerMid: 'marker-mid',
  27830. markerStart: 'marker-start',
  27831. markerHeight: 'markerHeight',
  27832. markerUnits: 'markerUnits',
  27833. markerWidth: 'markerWidth',
  27834. mask: 0,
  27835. maskContentUnits: 'maskContentUnits',
  27836. maskUnits: 'maskUnits',
  27837. mathematical: 0,
  27838. mode: 0,
  27839. numOctaves: 'numOctaves',
  27840. offset: 0,
  27841. opacity: 0,
  27842. operator: 0,
  27843. order: 0,
  27844. orient: 0,
  27845. orientation: 0,
  27846. origin: 0,
  27847. overflow: 0,
  27848. overlinePosition: 'overline-position',
  27849. overlineThickness: 'overline-thickness',
  27850. paintOrder: 'paint-order',
  27851. panose1: 'panose-1',
  27852. pathLength: 'pathLength',
  27853. patternContentUnits: 'patternContentUnits',
  27854. patternTransform: 'patternTransform',
  27855. patternUnits: 'patternUnits',
  27856. pointerEvents: 'pointer-events',
  27857. points: 0,
  27858. pointsAtX: 'pointsAtX',
  27859. pointsAtY: 'pointsAtY',
  27860. pointsAtZ: 'pointsAtZ',
  27861. preserveAlpha: 'preserveAlpha',
  27862. preserveAspectRatio: 'preserveAspectRatio',
  27863. primitiveUnits: 'primitiveUnits',
  27864. r: 0,
  27865. radius: 0,
  27866. refX: 'refX',
  27867. refY: 'refY',
  27868. renderingIntent: 'rendering-intent',
  27869. repeatCount: 'repeatCount',
  27870. repeatDur: 'repeatDur',
  27871. requiredExtensions: 'requiredExtensions',
  27872. requiredFeatures: 'requiredFeatures',
  27873. restart: 0,
  27874. result: 0,
  27875. rotate: 0,
  27876. rx: 0,
  27877. ry: 0,
  27878. scale: 0,
  27879. seed: 0,
  27880. shapeRendering: 'shape-rendering',
  27881. slope: 0,
  27882. spacing: 0,
  27883. specularConstant: 'specularConstant',
  27884. specularExponent: 'specularExponent',
  27885. speed: 0,
  27886. spreadMethod: 'spreadMethod',
  27887. startOffset: 'startOffset',
  27888. stdDeviation: 'stdDeviation',
  27889. stemh: 0,
  27890. stemv: 0,
  27891. stitchTiles: 'stitchTiles',
  27892. stopColor: 'stop-color',
  27893. stopOpacity: 'stop-opacity',
  27894. strikethroughPosition: 'strikethrough-position',
  27895. strikethroughThickness: 'strikethrough-thickness',
  27896. string: 0,
  27897. stroke: 0,
  27898. strokeDasharray: 'stroke-dasharray',
  27899. strokeDashoffset: 'stroke-dashoffset',
  27900. strokeLinecap: 'stroke-linecap',
  27901. strokeLinejoin: 'stroke-linejoin',
  27902. strokeMiterlimit: 'stroke-miterlimit',
  27903. strokeOpacity: 'stroke-opacity',
  27904. strokeWidth: 'stroke-width',
  27905. surfaceScale: 'surfaceScale',
  27906. systemLanguage: 'systemLanguage',
  27907. tableValues: 'tableValues',
  27908. targetX: 'targetX',
  27909. targetY: 'targetY',
  27910. textAnchor: 'text-anchor',
  27911. textDecoration: 'text-decoration',
  27912. textRendering: 'text-rendering',
  27913. textLength: 'textLength',
  27914. to: 0,
  27915. transform: 0,
  27916. u1: 0,
  27917. u2: 0,
  27918. underlinePosition: 'underline-position',
  27919. underlineThickness: 'underline-thickness',
  27920. unicode: 0,
  27921. unicodeBidi: 'unicode-bidi',
  27922. unicodeRange: 'unicode-range',
  27923. unitsPerEm: 'units-per-em',
  27924. vAlphabetic: 'v-alphabetic',
  27925. vHanging: 'v-hanging',
  27926. vIdeographic: 'v-ideographic',
  27927. vMathematical: 'v-mathematical',
  27928. values: 0,
  27929. vectorEffect: 'vector-effect',
  27930. version: 0,
  27931. vertAdvY: 'vert-adv-y',
  27932. vertOriginX: 'vert-origin-x',
  27933. vertOriginY: 'vert-origin-y',
  27934. viewBox: 'viewBox',
  27935. viewTarget: 'viewTarget',
  27936. visibility: 0,
  27937. widths: 0,
  27938. wordSpacing: 'word-spacing',
  27939. writingMode: 'writing-mode',
  27940. x: 0,
  27941. xHeight: 'x-height',
  27942. x1: 0,
  27943. x2: 0,
  27944. xChannelSelector: 'xChannelSelector',
  27945. xlinkActuate: 'xlink:actuate',
  27946. xlinkArcrole: 'xlink:arcrole',
  27947. xlinkHref: 'xlink:href',
  27948. xlinkRole: 'xlink:role',
  27949. xlinkShow: 'xlink:show',
  27950. xlinkTitle: 'xlink:title',
  27951. xlinkType: 'xlink:type',
  27952. xmlBase: 'xml:base',
  27953. xmlns: 0,
  27954. xmlnsXlink: 'xmlns:xlink',
  27955. xmlLang: 'xml:lang',
  27956. xmlSpace: 'xml:space',
  27957. y: 0,
  27958. y1: 0,
  27959. y2: 0,
  27960. yChannelSelector: 'yChannelSelector',
  27961. z: 0,
  27962. zoomAndPan: 'zoomAndPan'
  27963. };
  27964. var SVGDOMPropertyConfig = {
  27965. Properties: {},
  27966. DOMAttributeNamespaces: {
  27967. xlinkActuate: NS.xlink,
  27968. xlinkArcrole: NS.xlink,
  27969. xlinkHref: NS.xlink,
  27970. xlinkRole: NS.xlink,
  27971. xlinkShow: NS.xlink,
  27972. xlinkTitle: NS.xlink,
  27973. xlinkType: NS.xlink,
  27974. xmlBase: NS.xml,
  27975. xmlLang: NS.xml,
  27976. xmlSpace: NS.xml
  27977. },
  27978. DOMAttributeNames: {}
  27979. };
  27980. Object.keys(ATTRS).forEach(function (key) {
  27981. SVGDOMPropertyConfig.Properties[key] = 0;
  27982. if (ATTRS[key]) {
  27983. SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  27984. }
  27985. });
  27986. module.exports = SVGDOMPropertyConfig;
  27987. /***/ }),
  27988. /* 192 */
  27989. /***/ (function(module, exports, __webpack_require__) {
  27990. "use strict";
  27991. /**
  27992. * Copyright 2013-present, Facebook, Inc.
  27993. * All rights reserved.
  27994. *
  27995. * This source code is licensed under the BSD-style license found in the
  27996. * LICENSE file in the root directory of this source tree. An additional grant
  27997. * of patent rights can be found in the PATENTS file in the same directory.
  27998. *
  27999. */
  28000. var EventPropagators = __webpack_require__(27);
  28001. var ExecutionEnvironment = __webpack_require__(8);
  28002. var ReactDOMComponentTree = __webpack_require__(5);
  28003. var ReactInputSelection = __webpack_require__(84);
  28004. var SyntheticEvent = __webpack_require__(13);
  28005. var getActiveElement = __webpack_require__(73);
  28006. var isTextInputElement = __webpack_require__(93);
  28007. var shallowEqual = __webpack_require__(50);
  28008. var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
  28009. var eventTypes = {
  28010. select: {
  28011. phasedRegistrationNames: {
  28012. bubbled: 'onSelect',
  28013. captured: 'onSelectCapture'
  28014. },
  28015. dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
  28016. }
  28017. };
  28018. var activeElement = null;
  28019. var activeElementInst = null;
  28020. var lastSelection = null;
  28021. var mouseDown = false;
  28022. // Track whether a listener exists for this plugin. If none exist, we do
  28023. // not extract events. See #3639.
  28024. var hasListener = false;
  28025. /**
  28026. * Get an object which is a unique representation of the current selection.
  28027. *
  28028. * The return value will not be consistent across nodes or browsers, but
  28029. * two identical selections on the same node will return identical objects.
  28030. *
  28031. * @param {DOMElement} node
  28032. * @return {object}
  28033. */
  28034. function getSelection(node) {
  28035. if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
  28036. return {
  28037. start: node.selectionStart,
  28038. end: node.selectionEnd
  28039. };
  28040. } else if (window.getSelection) {
  28041. var selection = window.getSelection();
  28042. return {
  28043. anchorNode: selection.anchorNode,
  28044. anchorOffset: selection.anchorOffset,
  28045. focusNode: selection.focusNode,
  28046. focusOffset: selection.focusOffset
  28047. };
  28048. } else if (document.selection) {
  28049. var range = document.selection.createRange();
  28050. return {
  28051. parentElement: range.parentElement(),
  28052. text: range.text,
  28053. top: range.boundingTop,
  28054. left: range.boundingLeft
  28055. };
  28056. }
  28057. }
  28058. /**
  28059. * Poll selection to see whether it's changed.
  28060. *
  28061. * @param {object} nativeEvent
  28062. * @return {?SyntheticEvent}
  28063. */
  28064. function constructSelectEvent(nativeEvent, nativeEventTarget) {
  28065. // Ensure we have the right element, and that the user is not dragging a
  28066. // selection (this matches native `select` event behavior). In HTML5, select
  28067. // fires only on input and textarea thus if there's no focused element we
  28068. // won't dispatch.
  28069. if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
  28070. return null;
  28071. }
  28072. // Only fire when selection has actually changed.
  28073. var currentSelection = getSelection(activeElement);
  28074. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  28075. lastSelection = currentSelection;
  28076. var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
  28077. syntheticEvent.type = 'select';
  28078. syntheticEvent.target = activeElement;
  28079. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  28080. return syntheticEvent;
  28081. }
  28082. return null;
  28083. }
  28084. /**
  28085. * This plugin creates an `onSelect` event that normalizes select events
  28086. * across form elements.
  28087. *
  28088. * Supported elements are:
  28089. * - input (see `isTextInputElement`)
  28090. * - textarea
  28091. * - contentEditable
  28092. *
  28093. * This differs from native browser implementations in the following ways:
  28094. * - Fires on contentEditable fields as well as inputs.
  28095. * - Fires for collapsed selection.
  28096. * - Fires after user input.
  28097. */
  28098. var SelectEventPlugin = {
  28099. eventTypes: eventTypes,
  28100. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  28101. if (!hasListener) {
  28102. return null;
  28103. }
  28104. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  28105. switch (topLevelType) {
  28106. // Track the input node that has focus.
  28107. case 'topFocus':
  28108. if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
  28109. activeElement = targetNode;
  28110. activeElementInst = targetInst;
  28111. lastSelection = null;
  28112. }
  28113. break;
  28114. case 'topBlur':
  28115. activeElement = null;
  28116. activeElementInst = null;
  28117. lastSelection = null;
  28118. break;
  28119. // Don't fire the event while the user is dragging. This matches the
  28120. // semantics of the native select event.
  28121. case 'topMouseDown':
  28122. mouseDown = true;
  28123. break;
  28124. case 'topContextMenu':
  28125. case 'topMouseUp':
  28126. mouseDown = false;
  28127. return constructSelectEvent(nativeEvent, nativeEventTarget);
  28128. // Chrome and IE fire non-standard event when selection is changed (and
  28129. // sometimes when it hasn't). IE's event fires out of order with respect
  28130. // to key and input events on deletion, so we discard it.
  28131. //
  28132. // Firefox doesn't support selectionchange, so check selection status
  28133. // after each key entry. The selection changes after keydown and before
  28134. // keyup, but we check on keydown as well in the case of holding down a
  28135. // key, when multiple keydown events are fired but only one keyup is.
  28136. // This is also our approach for IE handling, for the reason above.
  28137. case 'topSelectionChange':
  28138. if (skipSelectionChangeEvent) {
  28139. break;
  28140. }
  28141. // falls through
  28142. case 'topKeyDown':
  28143. case 'topKeyUp':
  28144. return constructSelectEvent(nativeEvent, nativeEventTarget);
  28145. }
  28146. return null;
  28147. },
  28148. didPutListener: function (inst, registrationName, listener) {
  28149. if (registrationName === 'onSelect') {
  28150. hasListener = true;
  28151. }
  28152. }
  28153. };
  28154. module.exports = SelectEventPlugin;
  28155. /***/ }),
  28156. /* 193 */
  28157. /***/ (function(module, exports, __webpack_require__) {
  28158. "use strict";
  28159. /**
  28160. * Copyright 2013-present, Facebook, Inc.
  28161. * All rights reserved.
  28162. *
  28163. * This source code is licensed under the BSD-style license found in the
  28164. * LICENSE file in the root directory of this source tree. An additional grant
  28165. * of patent rights can be found in the PATENTS file in the same directory.
  28166. *
  28167. *
  28168. */
  28169. var _prodInvariant = __webpack_require__(2);
  28170. var EventListener = __webpack_require__(71);
  28171. var EventPropagators = __webpack_require__(27);
  28172. var ReactDOMComponentTree = __webpack_require__(5);
  28173. var SyntheticAnimationEvent = __webpack_require__(194);
  28174. var SyntheticClipboardEvent = __webpack_require__(195);
  28175. var SyntheticEvent = __webpack_require__(13);
  28176. var SyntheticFocusEvent = __webpack_require__(198);
  28177. var SyntheticKeyboardEvent = __webpack_require__(200);
  28178. var SyntheticMouseEvent = __webpack_require__(32);
  28179. var SyntheticDragEvent = __webpack_require__(197);
  28180. var SyntheticTouchEvent = __webpack_require__(201);
  28181. var SyntheticTransitionEvent = __webpack_require__(202);
  28182. var SyntheticUIEvent = __webpack_require__(29);
  28183. var SyntheticWheelEvent = __webpack_require__(203);
  28184. var emptyFunction = __webpack_require__(10);
  28185. var getEventCharCode = __webpack_require__(61);
  28186. var invariant = __webpack_require__(0);
  28187. /**
  28188. * Turns
  28189. * ['abort', ...]
  28190. * into
  28191. * eventTypes = {
  28192. * 'abort': {
  28193. * phasedRegistrationNames: {
  28194. * bubbled: 'onAbort',
  28195. * captured: 'onAbortCapture',
  28196. * },
  28197. * dependencies: ['topAbort'],
  28198. * },
  28199. * ...
  28200. * };
  28201. * topLevelEventsToDispatchConfig = {
  28202. * 'topAbort': { sameConfig }
  28203. * };
  28204. */
  28205. var eventTypes = {};
  28206. var topLevelEventsToDispatchConfig = {};
  28207. ['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) {
  28208. var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  28209. var onEvent = 'on' + capitalizedEvent;
  28210. var topEvent = 'top' + capitalizedEvent;
  28211. var type = {
  28212. phasedRegistrationNames: {
  28213. bubbled: onEvent,
  28214. captured: onEvent + 'Capture'
  28215. },
  28216. dependencies: [topEvent]
  28217. };
  28218. eventTypes[event] = type;
  28219. topLevelEventsToDispatchConfig[topEvent] = type;
  28220. });
  28221. var onClickListeners = {};
  28222. function getDictionaryKey(inst) {
  28223. // Prevents V8 performance issue:
  28224. // https://github.com/facebook/react/pull/7232
  28225. return '.' + inst._rootNodeID;
  28226. }
  28227. function isInteractive(tag) {
  28228. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  28229. }
  28230. var SimpleEventPlugin = {
  28231. eventTypes: eventTypes,
  28232. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  28233. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  28234. if (!dispatchConfig) {
  28235. return null;
  28236. }
  28237. var EventConstructor;
  28238. switch (topLevelType) {
  28239. case 'topAbort':
  28240. case 'topCanPlay':
  28241. case 'topCanPlayThrough':
  28242. case 'topDurationChange':
  28243. case 'topEmptied':
  28244. case 'topEncrypted':
  28245. case 'topEnded':
  28246. case 'topError':
  28247. case 'topInput':
  28248. case 'topInvalid':
  28249. case 'topLoad':
  28250. case 'topLoadedData':
  28251. case 'topLoadedMetadata':
  28252. case 'topLoadStart':
  28253. case 'topPause':
  28254. case 'topPlay':
  28255. case 'topPlaying':
  28256. case 'topProgress':
  28257. case 'topRateChange':
  28258. case 'topReset':
  28259. case 'topSeeked':
  28260. case 'topSeeking':
  28261. case 'topStalled':
  28262. case 'topSubmit':
  28263. case 'topSuspend':
  28264. case 'topTimeUpdate':
  28265. case 'topVolumeChange':
  28266. case 'topWaiting':
  28267. // HTML Events
  28268. // @see http://www.w3.org/TR/html5/index.html#events-0
  28269. EventConstructor = SyntheticEvent;
  28270. break;
  28271. case 'topKeyPress':
  28272. // Firefox creates a keypress event for function keys too. This removes
  28273. // the unwanted keypress events. Enter is however both printable and
  28274. // non-printable. One would expect Tab to be as well (but it isn't).
  28275. if (getEventCharCode(nativeEvent) === 0) {
  28276. return null;
  28277. }
  28278. /* falls through */
  28279. case 'topKeyDown':
  28280. case 'topKeyUp':
  28281. EventConstructor = SyntheticKeyboardEvent;
  28282. break;
  28283. case 'topBlur':
  28284. case 'topFocus':
  28285. EventConstructor = SyntheticFocusEvent;
  28286. break;
  28287. case 'topClick':
  28288. // Firefox creates a click event on right mouse clicks. This removes the
  28289. // unwanted click events.
  28290. if (nativeEvent.button === 2) {
  28291. return null;
  28292. }
  28293. /* falls through */
  28294. case 'topDoubleClick':
  28295. case 'topMouseDown':
  28296. case 'topMouseMove':
  28297. case 'topMouseUp':
  28298. // TODO: Disabled elements should not respond to mouse events
  28299. /* falls through */
  28300. case 'topMouseOut':
  28301. case 'topMouseOver':
  28302. case 'topContextMenu':
  28303. EventConstructor = SyntheticMouseEvent;
  28304. break;
  28305. case 'topDrag':
  28306. case 'topDragEnd':
  28307. case 'topDragEnter':
  28308. case 'topDragExit':
  28309. case 'topDragLeave':
  28310. case 'topDragOver':
  28311. case 'topDragStart':
  28312. case 'topDrop':
  28313. EventConstructor = SyntheticDragEvent;
  28314. break;
  28315. case 'topTouchCancel':
  28316. case 'topTouchEnd':
  28317. case 'topTouchMove':
  28318. case 'topTouchStart':
  28319. EventConstructor = SyntheticTouchEvent;
  28320. break;
  28321. case 'topAnimationEnd':
  28322. case 'topAnimationIteration':
  28323. case 'topAnimationStart':
  28324. EventConstructor = SyntheticAnimationEvent;
  28325. break;
  28326. case 'topTransitionEnd':
  28327. EventConstructor = SyntheticTransitionEvent;
  28328. break;
  28329. case 'topScroll':
  28330. EventConstructor = SyntheticUIEvent;
  28331. break;
  28332. case 'topWheel':
  28333. EventConstructor = SyntheticWheelEvent;
  28334. break;
  28335. case 'topCopy':
  28336. case 'topCut':
  28337. case 'topPaste':
  28338. EventConstructor = SyntheticClipboardEvent;
  28339. break;
  28340. }
  28341. !EventConstructor ? false ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
  28342. var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
  28343. EventPropagators.accumulateTwoPhaseDispatches(event);
  28344. return event;
  28345. },
  28346. didPutListener: function (inst, registrationName, listener) {
  28347. // Mobile Safari does not fire properly bubble click events on
  28348. // non-interactive elements, which means delegated click listeners do not
  28349. // fire. The workaround for this bug involves attaching an empty click
  28350. // listener on the target node.
  28351. // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  28352. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  28353. var key = getDictionaryKey(inst);
  28354. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  28355. if (!onClickListeners[key]) {
  28356. onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
  28357. }
  28358. }
  28359. },
  28360. willDeleteListener: function (inst, registrationName) {
  28361. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  28362. var key = getDictionaryKey(inst);
  28363. onClickListeners[key].remove();
  28364. delete onClickListeners[key];
  28365. }
  28366. }
  28367. };
  28368. module.exports = SimpleEventPlugin;
  28369. /***/ }),
  28370. /* 194 */
  28371. /***/ (function(module, exports, __webpack_require__) {
  28372. "use strict";
  28373. /**
  28374. * Copyright 2013-present, Facebook, Inc.
  28375. * All rights reserved.
  28376. *
  28377. * This source code is licensed under the BSD-style license found in the
  28378. * LICENSE file in the root directory of this source tree. An additional grant
  28379. * of patent rights can be found in the PATENTS file in the same directory.
  28380. *
  28381. */
  28382. var SyntheticEvent = __webpack_require__(13);
  28383. /**
  28384. * @interface Event
  28385. * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  28386. * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
  28387. */
  28388. var AnimationEventInterface = {
  28389. animationName: null,
  28390. elapsedTime: null,
  28391. pseudoElement: null
  28392. };
  28393. /**
  28394. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28395. * @param {string} dispatchMarker Marker identifying the event target.
  28396. * @param {object} nativeEvent Native browser event.
  28397. * @extends {SyntheticEvent}
  28398. */
  28399. function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28400. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28401. }
  28402. SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
  28403. module.exports = SyntheticAnimationEvent;
  28404. /***/ }),
  28405. /* 195 */
  28406. /***/ (function(module, exports, __webpack_require__) {
  28407. "use strict";
  28408. /**
  28409. * Copyright 2013-present, Facebook, Inc.
  28410. * All rights reserved.
  28411. *
  28412. * This source code is licensed under the BSD-style license found in the
  28413. * LICENSE file in the root directory of this source tree. An additional grant
  28414. * of patent rights can be found in the PATENTS file in the same directory.
  28415. *
  28416. */
  28417. var SyntheticEvent = __webpack_require__(13);
  28418. /**
  28419. * @interface Event
  28420. * @see http://www.w3.org/TR/clipboard-apis/
  28421. */
  28422. var ClipboardEventInterface = {
  28423. clipboardData: function (event) {
  28424. return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  28425. }
  28426. };
  28427. /**
  28428. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28429. * @param {string} dispatchMarker Marker identifying the event target.
  28430. * @param {object} nativeEvent Native browser event.
  28431. * @extends {SyntheticUIEvent}
  28432. */
  28433. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28434. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28435. }
  28436. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  28437. module.exports = SyntheticClipboardEvent;
  28438. /***/ }),
  28439. /* 196 */
  28440. /***/ (function(module, exports, __webpack_require__) {
  28441. "use strict";
  28442. /**
  28443. * Copyright 2013-present, Facebook, Inc.
  28444. * All rights reserved.
  28445. *
  28446. * This source code is licensed under the BSD-style license found in the
  28447. * LICENSE file in the root directory of this source tree. An additional grant
  28448. * of patent rights can be found in the PATENTS file in the same directory.
  28449. *
  28450. */
  28451. var SyntheticEvent = __webpack_require__(13);
  28452. /**
  28453. * @interface Event
  28454. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  28455. */
  28456. var CompositionEventInterface = {
  28457. data: null
  28458. };
  28459. /**
  28460. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28461. * @param {string} dispatchMarker Marker identifying the event target.
  28462. * @param {object} nativeEvent Native browser event.
  28463. * @extends {SyntheticUIEvent}
  28464. */
  28465. function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28466. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28467. }
  28468. SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
  28469. module.exports = SyntheticCompositionEvent;
  28470. /***/ }),
  28471. /* 197 */
  28472. /***/ (function(module, exports, __webpack_require__) {
  28473. "use strict";
  28474. /**
  28475. * Copyright 2013-present, Facebook, Inc.
  28476. * All rights reserved.
  28477. *
  28478. * This source code is licensed under the BSD-style license found in the
  28479. * LICENSE file in the root directory of this source tree. An additional grant
  28480. * of patent rights can be found in the PATENTS file in the same directory.
  28481. *
  28482. */
  28483. var SyntheticMouseEvent = __webpack_require__(32);
  28484. /**
  28485. * @interface DragEvent
  28486. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28487. */
  28488. var DragEventInterface = {
  28489. dataTransfer: null
  28490. };
  28491. /**
  28492. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28493. * @param {string} dispatchMarker Marker identifying the event target.
  28494. * @param {object} nativeEvent Native browser event.
  28495. * @extends {SyntheticUIEvent}
  28496. */
  28497. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28498. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28499. }
  28500. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  28501. module.exports = SyntheticDragEvent;
  28502. /***/ }),
  28503. /* 198 */
  28504. /***/ (function(module, exports, __webpack_require__) {
  28505. "use strict";
  28506. /**
  28507. * Copyright 2013-present, Facebook, Inc.
  28508. * All rights reserved.
  28509. *
  28510. * This source code is licensed under the BSD-style license found in the
  28511. * LICENSE file in the root directory of this source tree. An additional grant
  28512. * of patent rights can be found in the PATENTS file in the same directory.
  28513. *
  28514. */
  28515. var SyntheticUIEvent = __webpack_require__(29);
  28516. /**
  28517. * @interface FocusEvent
  28518. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28519. */
  28520. var FocusEventInterface = {
  28521. relatedTarget: null
  28522. };
  28523. /**
  28524. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28525. * @param {string} dispatchMarker Marker identifying the event target.
  28526. * @param {object} nativeEvent Native browser event.
  28527. * @extends {SyntheticUIEvent}
  28528. */
  28529. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28530. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28531. }
  28532. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  28533. module.exports = SyntheticFocusEvent;
  28534. /***/ }),
  28535. /* 199 */
  28536. /***/ (function(module, exports, __webpack_require__) {
  28537. "use strict";
  28538. /**
  28539. * Copyright 2013-present, Facebook, Inc.
  28540. * All rights reserved.
  28541. *
  28542. * This source code is licensed under the BSD-style license found in the
  28543. * LICENSE file in the root directory of this source tree. An additional grant
  28544. * of patent rights can be found in the PATENTS file in the same directory.
  28545. *
  28546. */
  28547. var SyntheticEvent = __webpack_require__(13);
  28548. /**
  28549. * @interface Event
  28550. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  28551. * /#events-inputevents
  28552. */
  28553. var InputEventInterface = {
  28554. data: null
  28555. };
  28556. /**
  28557. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28558. * @param {string} dispatchMarker Marker identifying the event target.
  28559. * @param {object} nativeEvent Native browser event.
  28560. * @extends {SyntheticUIEvent}
  28561. */
  28562. function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28563. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28564. }
  28565. SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
  28566. module.exports = SyntheticInputEvent;
  28567. /***/ }),
  28568. /* 200 */
  28569. /***/ (function(module, exports, __webpack_require__) {
  28570. "use strict";
  28571. /**
  28572. * Copyright 2013-present, Facebook, Inc.
  28573. * All rights reserved.
  28574. *
  28575. * This source code is licensed under the BSD-style license found in the
  28576. * LICENSE file in the root directory of this source tree. An additional grant
  28577. * of patent rights can be found in the PATENTS file in the same directory.
  28578. *
  28579. */
  28580. var SyntheticUIEvent = __webpack_require__(29);
  28581. var getEventCharCode = __webpack_require__(61);
  28582. var getEventKey = __webpack_require__(208);
  28583. var getEventModifierState = __webpack_require__(62);
  28584. /**
  28585. * @interface KeyboardEvent
  28586. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28587. */
  28588. var KeyboardEventInterface = {
  28589. key: getEventKey,
  28590. location: null,
  28591. ctrlKey: null,
  28592. shiftKey: null,
  28593. altKey: null,
  28594. metaKey: null,
  28595. repeat: null,
  28596. locale: null,
  28597. getModifierState: getEventModifierState,
  28598. // Legacy Interface
  28599. charCode: function (event) {
  28600. // `charCode` is the result of a KeyPress event and represents the value of
  28601. // the actual printable character.
  28602. // KeyPress is deprecated, but its replacement is not yet final and not
  28603. // implemented in any major browser. Only KeyPress has charCode.
  28604. if (event.type === 'keypress') {
  28605. return getEventCharCode(event);
  28606. }
  28607. return 0;
  28608. },
  28609. keyCode: function (event) {
  28610. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  28611. // physical keyboard key.
  28612. // The actual meaning of the value depends on the users' keyboard layout
  28613. // which cannot be detected. Assuming that it is a US keyboard layout
  28614. // provides a surprisingly accurate mapping for US and European users.
  28615. // Due to this, it is left to the user to implement at this time.
  28616. if (event.type === 'keydown' || event.type === 'keyup') {
  28617. return event.keyCode;
  28618. }
  28619. return 0;
  28620. },
  28621. which: function (event) {
  28622. // `which` is an alias for either `keyCode` or `charCode` depending on the
  28623. // type of the event.
  28624. if (event.type === 'keypress') {
  28625. return getEventCharCode(event);
  28626. }
  28627. if (event.type === 'keydown' || event.type === 'keyup') {
  28628. return event.keyCode;
  28629. }
  28630. return 0;
  28631. }
  28632. };
  28633. /**
  28634. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28635. * @param {string} dispatchMarker Marker identifying the event target.
  28636. * @param {object} nativeEvent Native browser event.
  28637. * @extends {SyntheticUIEvent}
  28638. */
  28639. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28640. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28641. }
  28642. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  28643. module.exports = SyntheticKeyboardEvent;
  28644. /***/ }),
  28645. /* 201 */
  28646. /***/ (function(module, exports, __webpack_require__) {
  28647. "use strict";
  28648. /**
  28649. * Copyright 2013-present, Facebook, Inc.
  28650. * All rights reserved.
  28651. *
  28652. * This source code is licensed under the BSD-style license found in the
  28653. * LICENSE file in the root directory of this source tree. An additional grant
  28654. * of patent rights can be found in the PATENTS file in the same directory.
  28655. *
  28656. */
  28657. var SyntheticUIEvent = __webpack_require__(29);
  28658. var getEventModifierState = __webpack_require__(62);
  28659. /**
  28660. * @interface TouchEvent
  28661. * @see http://www.w3.org/TR/touch-events/
  28662. */
  28663. var TouchEventInterface = {
  28664. touches: null,
  28665. targetTouches: null,
  28666. changedTouches: null,
  28667. altKey: null,
  28668. metaKey: null,
  28669. ctrlKey: null,
  28670. shiftKey: null,
  28671. getModifierState: getEventModifierState
  28672. };
  28673. /**
  28674. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28675. * @param {string} dispatchMarker Marker identifying the event target.
  28676. * @param {object} nativeEvent Native browser event.
  28677. * @extends {SyntheticUIEvent}
  28678. */
  28679. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28680. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28681. }
  28682. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  28683. module.exports = SyntheticTouchEvent;
  28684. /***/ }),
  28685. /* 202 */
  28686. /***/ (function(module, exports, __webpack_require__) {
  28687. "use strict";
  28688. /**
  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. var SyntheticEvent = __webpack_require__(13);
  28698. /**
  28699. * @interface Event
  28700. * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
  28701. * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
  28702. */
  28703. var TransitionEventInterface = {
  28704. propertyName: null,
  28705. elapsedTime: null,
  28706. pseudoElement: null
  28707. };
  28708. /**
  28709. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28710. * @param {string} dispatchMarker Marker identifying the event target.
  28711. * @param {object} nativeEvent Native browser event.
  28712. * @extends {SyntheticEvent}
  28713. */
  28714. function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28715. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28716. }
  28717. SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
  28718. module.exports = SyntheticTransitionEvent;
  28719. /***/ }),
  28720. /* 203 */
  28721. /***/ (function(module, exports, __webpack_require__) {
  28722. "use strict";
  28723. /**
  28724. * Copyright 2013-present, Facebook, Inc.
  28725. * All rights reserved.
  28726. *
  28727. * This source code is licensed under the BSD-style license found in the
  28728. * LICENSE file in the root directory of this source tree. An additional grant
  28729. * of patent rights can be found in the PATENTS file in the same directory.
  28730. *
  28731. */
  28732. var SyntheticMouseEvent = __webpack_require__(32);
  28733. /**
  28734. * @interface WheelEvent
  28735. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28736. */
  28737. var WheelEventInterface = {
  28738. deltaX: function (event) {
  28739. return 'deltaX' in event ? event.deltaX :
  28740. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  28741. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
  28742. },
  28743. deltaY: function (event) {
  28744. return 'deltaY' in event ? event.deltaY :
  28745. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  28746. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  28747. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  28748. 'wheelDelta' in event ? -event.wheelDelta : 0;
  28749. },
  28750. deltaZ: null,
  28751. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  28752. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  28753. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  28754. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  28755. deltaMode: null
  28756. };
  28757. /**
  28758. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28759. * @param {string} dispatchMarker Marker identifying the event target.
  28760. * @param {object} nativeEvent Native browser event.
  28761. * @extends {SyntheticMouseEvent}
  28762. */
  28763. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28764. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28765. }
  28766. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  28767. module.exports = SyntheticWheelEvent;
  28768. /***/ }),
  28769. /* 204 */
  28770. /***/ (function(module, exports, __webpack_require__) {
  28771. "use strict";
  28772. /**
  28773. * Copyright 2013-present, Facebook, Inc.
  28774. * All rights reserved.
  28775. *
  28776. * This source code is licensed under the BSD-style license found in the
  28777. * LICENSE file in the root directory of this source tree. An additional grant
  28778. * of patent rights can be found in the PATENTS file in the same directory.
  28779. *
  28780. *
  28781. */
  28782. var MOD = 65521;
  28783. // adler32 is not cryptographically strong, and is only used to sanity check that
  28784. // markup generated on the server matches the markup generated on the client.
  28785. // This implementation (a modified version of the SheetJS version) has been optimized
  28786. // for our use case, at the expense of conforming to the adler32 specification
  28787. // for non-ascii inputs.
  28788. function adler32(data) {
  28789. var a = 1;
  28790. var b = 0;
  28791. var i = 0;
  28792. var l = data.length;
  28793. var m = l & ~0x3;
  28794. while (i < m) {
  28795. var n = Math.min(i + 4096, m);
  28796. for (; i < n; i += 4) {
  28797. b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
  28798. }
  28799. a %= MOD;
  28800. b %= MOD;
  28801. }
  28802. for (; i < l; i++) {
  28803. b += a += data.charCodeAt(i);
  28804. }
  28805. a %= MOD;
  28806. b %= MOD;
  28807. return a | b << 16;
  28808. }
  28809. module.exports = adler32;
  28810. /***/ }),
  28811. /* 205 */
  28812. /***/ (function(module, exports, __webpack_require__) {
  28813. "use strict";
  28814. /**
  28815. * Copyright 2013-present, Facebook, Inc.
  28816. * All rights reserved.
  28817. *
  28818. * This source code is licensed under the BSD-style license found in the
  28819. * LICENSE file in the root directory of this source tree. An additional grant
  28820. * of patent rights can be found in the PATENTS file in the same directory.
  28821. *
  28822. */
  28823. var CSSProperty = __webpack_require__(76);
  28824. var warning = __webpack_require__(1);
  28825. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  28826. var styleWarnings = {};
  28827. /**
  28828. * Convert a value into the proper css writable value. The style name `name`
  28829. * should be logical (no hyphens), as specified
  28830. * in `CSSProperty.isUnitlessNumber`.
  28831. *
  28832. * @param {string} name CSS property name such as `topMargin`.
  28833. * @param {*} value CSS property value such as `10px`.
  28834. * @param {ReactDOMComponent} component
  28835. * @return {string} Normalized style value with dimensions applied.
  28836. */
  28837. function dangerousStyleValue(name, value, component) {
  28838. // Note that we've removed escapeTextForBrowser() calls here since the
  28839. // whole string will be escaped when the attribute is injected into
  28840. // the markup. If you provide unsafe user data here they can inject
  28841. // arbitrary CSS which may be problematic (I couldn't repro this):
  28842. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  28843. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  28844. // This is not an XSS hole but instead a potential CSS injection issue
  28845. // which has lead to a greater discussion about how we're going to
  28846. // trust URLs moving forward. See #2115901
  28847. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  28848. if (isEmpty) {
  28849. return '';
  28850. }
  28851. var isNonNumeric = isNaN(value);
  28852. if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  28853. return '' + value; // cast to string
  28854. }
  28855. if (typeof value === 'string') {
  28856. if (false) {
  28857. // Allow '0' to pass through without warning. 0 is already special and
  28858. // doesn't require units, so we don't need to warn about it.
  28859. if (component && value !== '0') {
  28860. var owner = component._currentElement._owner;
  28861. var ownerName = owner ? owner.getName() : null;
  28862. if (ownerName && !styleWarnings[ownerName]) {
  28863. styleWarnings[ownerName] = {};
  28864. }
  28865. var warned = false;
  28866. if (ownerName) {
  28867. var warnings = styleWarnings[ownerName];
  28868. warned = warnings[name];
  28869. if (!warned) {
  28870. warnings[name] = true;
  28871. }
  28872. }
  28873. if (!warned) {
  28874. 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;
  28875. }
  28876. }
  28877. }
  28878. value = value.trim();
  28879. }
  28880. return value + 'px';
  28881. }
  28882. module.exports = dangerousStyleValue;
  28883. /***/ }),
  28884. /* 206 */
  28885. /***/ (function(module, exports, __webpack_require__) {
  28886. "use strict";
  28887. /**
  28888. * Copyright 2013-present, Facebook, Inc.
  28889. * All rights reserved.
  28890. *
  28891. * This source code is licensed under the BSD-style license found in the
  28892. * LICENSE file in the root directory of this source tree. An additional grant
  28893. * of patent rights can be found in the PATENTS file in the same directory.
  28894. *
  28895. */
  28896. var _prodInvariant = __webpack_require__(2);
  28897. var ReactCurrentOwner = __webpack_require__(14);
  28898. var ReactDOMComponentTree = __webpack_require__(5);
  28899. var ReactInstanceMap = __webpack_require__(28);
  28900. var getHostComponentFromComposite = __webpack_require__(90);
  28901. var invariant = __webpack_require__(0);
  28902. var warning = __webpack_require__(1);
  28903. /**
  28904. * Returns the DOM node rendered by this element.
  28905. *
  28906. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
  28907. *
  28908. * @param {ReactComponent|DOMElement} componentOrElement
  28909. * @return {?DOMElement} The root node of this element.
  28910. */
  28911. function findDOMNode(componentOrElement) {
  28912. if (false) {
  28913. var owner = ReactCurrentOwner.current;
  28914. if (owner !== null) {
  28915. 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;
  28916. owner._warnedAboutRefsInRender = true;
  28917. }
  28918. }
  28919. if (componentOrElement == null) {
  28920. return null;
  28921. }
  28922. if (componentOrElement.nodeType === 1) {
  28923. return componentOrElement;
  28924. }
  28925. var inst = ReactInstanceMap.get(componentOrElement);
  28926. if (inst) {
  28927. inst = getHostComponentFromComposite(inst);
  28928. return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
  28929. }
  28930. if (typeof componentOrElement.render === 'function') {
  28931. true ? false ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
  28932. } else {
  28933. true ? false ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
  28934. }
  28935. }
  28936. module.exports = findDOMNode;
  28937. /***/ }),
  28938. /* 207 */
  28939. /***/ (function(module, exports, __webpack_require__) {
  28940. "use strict";
  28941. /* WEBPACK VAR INJECTION */(function(process) {/**
  28942. * Copyright 2013-present, Facebook, Inc.
  28943. * All rights reserved.
  28944. *
  28945. * This source code is licensed under the BSD-style license found in the
  28946. * LICENSE file in the root directory of this source tree. An additional grant
  28947. * of patent rights can be found in the PATENTS file in the same directory.
  28948. *
  28949. *
  28950. */
  28951. var KeyEscapeUtils = __webpack_require__(55);
  28952. var traverseAllChildren = __webpack_require__(95);
  28953. var warning = __webpack_require__(1);
  28954. var ReactComponentTreeHook;
  28955. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  28956. // Temporary hack.
  28957. // Inline requires don't work well with Jest:
  28958. // https://github.com/facebook/react/issues/7240
  28959. // Remove the inline requires when we don't need them anymore:
  28960. // https://github.com/facebook/react/pull/7178
  28961. ReactComponentTreeHook = __webpack_require__(96);
  28962. }
  28963. /**
  28964. * @param {function} traverseContext Context passed through traversal.
  28965. * @param {?ReactComponent} child React child component.
  28966. * @param {!string} name String name of key path to child.
  28967. * @param {number=} selfDebugID Optional debugID of the current internal instance.
  28968. */
  28969. function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
  28970. // We found a component instance.
  28971. if (traverseContext && typeof traverseContext === 'object') {
  28972. var result = traverseContext;
  28973. var keyUnique = result[name] === undefined;
  28974. if (false) {
  28975. if (!ReactComponentTreeHook) {
  28976. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  28977. }
  28978. if (!keyUnique) {
  28979. 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;
  28980. }
  28981. }
  28982. if (keyUnique && child != null) {
  28983. result[name] = child;
  28984. }
  28985. }
  28986. }
  28987. /**
  28988. * Flattens children that are typically specified as `props.children`. Any null
  28989. * children will not be included in the resulting object.
  28990. * @return {!object} flattened children keyed by name.
  28991. */
  28992. function flattenChildren(children, selfDebugID) {
  28993. if (children == null) {
  28994. return children;
  28995. }
  28996. var result = {};
  28997. if (false) {
  28998. traverseAllChildren(children, function (traverseContext, child, name) {
  28999. return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID);
  29000. }, result);
  29001. } else {
  29002. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  29003. }
  29004. return result;
  29005. }
  29006. module.exports = flattenChildren;
  29007. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
  29008. /***/ }),
  29009. /* 208 */
  29010. /***/ (function(module, exports, __webpack_require__) {
  29011. "use strict";
  29012. /**
  29013. * Copyright 2013-present, Facebook, Inc.
  29014. * All rights reserved.
  29015. *
  29016. * This source code is licensed under the BSD-style license found in the
  29017. * LICENSE file in the root directory of this source tree. An additional grant
  29018. * of patent rights can be found in the PATENTS file in the same directory.
  29019. *
  29020. */
  29021. var getEventCharCode = __webpack_require__(61);
  29022. /**
  29023. * Normalization of deprecated HTML5 `key` values
  29024. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  29025. */
  29026. var normalizeKey = {
  29027. 'Esc': 'Escape',
  29028. 'Spacebar': ' ',
  29029. 'Left': 'ArrowLeft',
  29030. 'Up': 'ArrowUp',
  29031. 'Right': 'ArrowRight',
  29032. 'Down': 'ArrowDown',
  29033. 'Del': 'Delete',
  29034. 'Win': 'OS',
  29035. 'Menu': 'ContextMenu',
  29036. 'Apps': 'ContextMenu',
  29037. 'Scroll': 'ScrollLock',
  29038. 'MozPrintableKey': 'Unidentified'
  29039. };
  29040. /**
  29041. * Translation from legacy `keyCode` to HTML5 `key`
  29042. * Only special keys supported, all others depend on keyboard layout or browser
  29043. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  29044. */
  29045. var translateToKey = {
  29046. 8: 'Backspace',
  29047. 9: 'Tab',
  29048. 12: 'Clear',
  29049. 13: 'Enter',
  29050. 16: 'Shift',
  29051. 17: 'Control',
  29052. 18: 'Alt',
  29053. 19: 'Pause',
  29054. 20: 'CapsLock',
  29055. 27: 'Escape',
  29056. 32: ' ',
  29057. 33: 'PageUp',
  29058. 34: 'PageDown',
  29059. 35: 'End',
  29060. 36: 'Home',
  29061. 37: 'ArrowLeft',
  29062. 38: 'ArrowUp',
  29063. 39: 'ArrowRight',
  29064. 40: 'ArrowDown',
  29065. 45: 'Insert',
  29066. 46: 'Delete',
  29067. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  29068. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  29069. 144: 'NumLock',
  29070. 145: 'ScrollLock',
  29071. 224: 'Meta'
  29072. };
  29073. /**
  29074. * @param {object} nativeEvent Native browser event.
  29075. * @return {string} Normalized `key` property.
  29076. */
  29077. function getEventKey(nativeEvent) {
  29078. if (nativeEvent.key) {
  29079. // Normalize inconsistent values reported by browsers due to
  29080. // implementations of a working draft specification.
  29081. // FireFox implements `key` but returns `MozPrintableKey` for all
  29082. // printable characters (normalized to `Unidentified`), ignore it.
  29083. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  29084. if (key !== 'Unidentified') {
  29085. return key;
  29086. }
  29087. }
  29088. // Browser does not implement `key`, polyfill as much of it as we can.
  29089. if (nativeEvent.type === 'keypress') {
  29090. var charCode = getEventCharCode(nativeEvent);
  29091. // The enter-key is technically both printable and non-printable and can
  29092. // thus be captured by `keypress`, no other non-printable key should.
  29093. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  29094. }
  29095. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  29096. // While user keyboard layout determines the actual meaning of each
  29097. // `keyCode` value, almost all function keys have a universal value.
  29098. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  29099. }
  29100. return '';
  29101. }
  29102. module.exports = getEventKey;
  29103. /***/ }),
  29104. /* 209 */
  29105. /***/ (function(module, exports, __webpack_require__) {
  29106. "use strict";
  29107. /**
  29108. * Copyright 2013-present, Facebook, Inc.
  29109. * All rights reserved.
  29110. *
  29111. * This source code is licensed under the BSD-style license found in the
  29112. * LICENSE file in the root directory of this source tree. An additional grant
  29113. * of patent rights can be found in the PATENTS file in the same directory.
  29114. *
  29115. *
  29116. */
  29117. /* global Symbol */
  29118. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  29119. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  29120. /**
  29121. * Returns the iterator method function contained on the iterable object.
  29122. *
  29123. * Be sure to invoke the function with the iterable as context:
  29124. *
  29125. * var iteratorFn = getIteratorFn(myIterable);
  29126. * if (iteratorFn) {
  29127. * var iterator = iteratorFn.call(myIterable);
  29128. * ...
  29129. * }
  29130. *
  29131. * @param {?object} maybeIterable
  29132. * @return {?function}
  29133. */
  29134. function getIteratorFn(maybeIterable) {
  29135. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  29136. if (typeof iteratorFn === 'function') {
  29137. return iteratorFn;
  29138. }
  29139. }
  29140. module.exports = getIteratorFn;
  29141. /***/ }),
  29142. /* 210 */
  29143. /***/ (function(module, exports, __webpack_require__) {
  29144. "use strict";
  29145. /**
  29146. * Copyright 2013-present, Facebook, Inc.
  29147. * All rights reserved.
  29148. *
  29149. * This source code is licensed under the BSD-style license found in the
  29150. * LICENSE file in the root directory of this source tree. An additional grant
  29151. * of patent rights can be found in the PATENTS file in the same directory.
  29152. *
  29153. */
  29154. /**
  29155. * Given any node return the first leaf node without children.
  29156. *
  29157. * @param {DOMElement|DOMTextNode} node
  29158. * @return {DOMElement|DOMTextNode}
  29159. */
  29160. function getLeafNode(node) {
  29161. while (node && node.firstChild) {
  29162. node = node.firstChild;
  29163. }
  29164. return node;
  29165. }
  29166. /**
  29167. * Get the next sibling within a container. This will walk up the
  29168. * DOM if a node's siblings have been exhausted.
  29169. *
  29170. * @param {DOMElement|DOMTextNode} node
  29171. * @return {?DOMElement|DOMTextNode}
  29172. */
  29173. function getSiblingNode(node) {
  29174. while (node) {
  29175. if (node.nextSibling) {
  29176. return node.nextSibling;
  29177. }
  29178. node = node.parentNode;
  29179. }
  29180. }
  29181. /**
  29182. * Get object describing the nodes which contain characters at offset.
  29183. *
  29184. * @param {DOMElement|DOMTextNode} root
  29185. * @param {number} offset
  29186. * @return {?object}
  29187. */
  29188. function getNodeForCharacterOffset(root, offset) {
  29189. var node = getLeafNode(root);
  29190. var nodeStart = 0;
  29191. var nodeEnd = 0;
  29192. while (node) {
  29193. if (node.nodeType === 3) {
  29194. nodeEnd = nodeStart + node.textContent.length;
  29195. if (nodeStart <= offset && nodeEnd >= offset) {
  29196. return {
  29197. node: node,
  29198. offset: offset - nodeStart
  29199. };
  29200. }
  29201. nodeStart = nodeEnd;
  29202. }
  29203. node = getLeafNode(getSiblingNode(node));
  29204. }
  29205. }
  29206. module.exports = getNodeForCharacterOffset;
  29207. /***/ }),
  29208. /* 211 */
  29209. /***/ (function(module, exports, __webpack_require__) {
  29210. "use strict";
  29211. /**
  29212. * Copyright 2013-present, Facebook, Inc.
  29213. * All rights reserved.
  29214. *
  29215. * This source code is licensed under the BSD-style license found in the
  29216. * LICENSE file in the root directory of this source tree. An additional grant
  29217. * of patent rights can be found in the PATENTS file in the same directory.
  29218. *
  29219. */
  29220. var ExecutionEnvironment = __webpack_require__(8);
  29221. /**
  29222. * Generate a mapping of standard vendor prefixes using the defined style property and event name.
  29223. *
  29224. * @param {string} styleProp
  29225. * @param {string} eventName
  29226. * @returns {object}
  29227. */
  29228. function makePrefixMap(styleProp, eventName) {
  29229. var prefixes = {};
  29230. prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
  29231. prefixes['Webkit' + styleProp] = 'webkit' + eventName;
  29232. prefixes['Moz' + styleProp] = 'moz' + eventName;
  29233. prefixes['ms' + styleProp] = 'MS' + eventName;
  29234. prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
  29235. return prefixes;
  29236. }
  29237. /**
  29238. * A list of event names to a configurable list of vendor prefixes.
  29239. */
  29240. var vendorPrefixes = {
  29241. animationend: makePrefixMap('Animation', 'AnimationEnd'),
  29242. animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
  29243. animationstart: makePrefixMap('Animation', 'AnimationStart'),
  29244. transitionend: makePrefixMap('Transition', 'TransitionEnd')
  29245. };
  29246. /**
  29247. * Event names that have already been detected and prefixed (if applicable).
  29248. */
  29249. var prefixedEventNames = {};
  29250. /**
  29251. * Element to check for prefixes on.
  29252. */
  29253. var style = {};
  29254. /**
  29255. * Bootstrap if a DOM exists.
  29256. */
  29257. if (ExecutionEnvironment.canUseDOM) {
  29258. style = document.createElement('div').style;
  29259. // On some platforms, in particular some releases of Android 4.x,
  29260. // the un-prefixed "animation" and "transition" properties are defined on the
  29261. // style object but the events that fire will still be prefixed, so we need
  29262. // to check if the un-prefixed events are usable, and if not remove them from the map.
  29263. if (!('AnimationEvent' in window)) {
  29264. delete vendorPrefixes.animationend.animation;
  29265. delete vendorPrefixes.animationiteration.animation;
  29266. delete vendorPrefixes.animationstart.animation;
  29267. }
  29268. // Same as above
  29269. if (!('TransitionEvent' in window)) {
  29270. delete vendorPrefixes.transitionend.transition;
  29271. }
  29272. }
  29273. /**
  29274. * Attempts to determine the correct vendor prefixed event name.
  29275. *
  29276. * @param {string} eventName
  29277. * @returns {string}
  29278. */
  29279. function getVendorPrefixedEventName(eventName) {
  29280. if (prefixedEventNames[eventName]) {
  29281. return prefixedEventNames[eventName];
  29282. } else if (!vendorPrefixes[eventName]) {
  29283. return eventName;
  29284. }
  29285. var prefixMap = vendorPrefixes[eventName];
  29286. for (var styleProp in prefixMap) {
  29287. if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
  29288. return prefixedEventNames[eventName] = prefixMap[styleProp];
  29289. }
  29290. }
  29291. return '';
  29292. }
  29293. module.exports = getVendorPrefixedEventName;
  29294. /***/ }),
  29295. /* 212 */
  29296. /***/ (function(module, exports, __webpack_require__) {
  29297. "use strict";
  29298. /**
  29299. * Copyright 2013-present, Facebook, Inc.
  29300. * All rights reserved.
  29301. *
  29302. * This source code is licensed under the BSD-style license found in the
  29303. * LICENSE file in the root directory of this source tree. An additional grant
  29304. * of patent rights can be found in the PATENTS file in the same directory.
  29305. *
  29306. */
  29307. var escapeTextContentForBrowser = __webpack_require__(34);
  29308. /**
  29309. * Escapes attribute value to prevent scripting attacks.
  29310. *
  29311. * @param {*} value Value to escape.
  29312. * @return {string} An escaped string.
  29313. */
  29314. function quoteAttributeValueForBrowser(value) {
  29315. return '"' + escapeTextContentForBrowser(value) + '"';
  29316. }
  29317. module.exports = quoteAttributeValueForBrowser;
  29318. /***/ }),
  29319. /* 213 */
  29320. /***/ (function(module, exports, __webpack_require__) {
  29321. "use strict";
  29322. /**
  29323. * Copyright 2013-present, Facebook, Inc.
  29324. * All rights reserved.
  29325. *
  29326. * This source code is licensed under the BSD-style license found in the
  29327. * LICENSE file in the root directory of this source tree. An additional grant
  29328. * of patent rights can be found in the PATENTS file in the same directory.
  29329. *
  29330. */
  29331. var ReactMount = __webpack_require__(85);
  29332. module.exports = ReactMount.renderSubtreeIntoContainer;
  29333. /***/ }),
  29334. /* 214 */
  29335. /***/ (function(module, exports, __webpack_require__) {
  29336. "use strict";
  29337. /**
  29338. * Copyright 2013-present, Facebook, Inc.
  29339. * All rights reserved.
  29340. *
  29341. * This source code is licensed under the BSD-style license found in the
  29342. * LICENSE file in the root directory of this source tree. An additional grant
  29343. * of patent rights can be found in the PATENTS file in the same directory.
  29344. *
  29345. *
  29346. */
  29347. /**
  29348. * Escape and wrap key so it is safe to use as a reactid
  29349. *
  29350. * @param {string} key to be escaped.
  29351. * @return {string} the escaped key.
  29352. */
  29353. function escape(key) {
  29354. var escapeRegex = /[=:]/g;
  29355. var escaperLookup = {
  29356. '=': '=0',
  29357. ':': '=2'
  29358. };
  29359. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  29360. return escaperLookup[match];
  29361. });
  29362. return '$' + escapedString;
  29363. }
  29364. /**
  29365. * Unescape and unwrap key for human-readable display
  29366. *
  29367. * @param {string} key to unescape.
  29368. * @return {string} the unescaped key.
  29369. */
  29370. function unescape(key) {
  29371. var unescapeRegex = /(=0|=2)/g;
  29372. var unescaperLookup = {
  29373. '=0': '=',
  29374. '=2': ':'
  29375. };
  29376. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  29377. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  29378. return unescaperLookup[match];
  29379. });
  29380. }
  29381. var KeyEscapeUtils = {
  29382. escape: escape,
  29383. unescape: unescape
  29384. };
  29385. module.exports = KeyEscapeUtils;
  29386. /***/ }),
  29387. /* 215 */
  29388. /***/ (function(module, exports, __webpack_require__) {
  29389. "use strict";
  29390. /**
  29391. * Copyright 2013-present, Facebook, Inc.
  29392. * All rights reserved.
  29393. *
  29394. * This source code is licensed under the BSD-style license found in the
  29395. * LICENSE file in the root directory of this source tree. An additional grant
  29396. * of patent rights can be found in the PATENTS file in the same directory.
  29397. *
  29398. *
  29399. */
  29400. var _prodInvariant = __webpack_require__(23);
  29401. var invariant = __webpack_require__(0);
  29402. /**
  29403. * Static poolers. Several custom versions for each potential number of
  29404. * arguments. A completely generic pooler is easy to implement, but would
  29405. * require accessing the `arguments` object. In each of these, `this` refers to
  29406. * the Class itself, not an instance. If any others are needed, simply add them
  29407. * here, or in their own files.
  29408. */
  29409. var oneArgumentPooler = function (copyFieldsFrom) {
  29410. var Klass = this;
  29411. if (Klass.instancePool.length) {
  29412. var instance = Klass.instancePool.pop();
  29413. Klass.call(instance, copyFieldsFrom);
  29414. return instance;
  29415. } else {
  29416. return new Klass(copyFieldsFrom);
  29417. }
  29418. };
  29419. var twoArgumentPooler = function (a1, a2) {
  29420. var Klass = this;
  29421. if (Klass.instancePool.length) {
  29422. var instance = Klass.instancePool.pop();
  29423. Klass.call(instance, a1, a2);
  29424. return instance;
  29425. } else {
  29426. return new Klass(a1, a2);
  29427. }
  29428. };
  29429. var threeArgumentPooler = function (a1, a2, a3) {
  29430. var Klass = this;
  29431. if (Klass.instancePool.length) {
  29432. var instance = Klass.instancePool.pop();
  29433. Klass.call(instance, a1, a2, a3);
  29434. return instance;
  29435. } else {
  29436. return new Klass(a1, a2, a3);
  29437. }
  29438. };
  29439. var fourArgumentPooler = function (a1, a2, a3, a4) {
  29440. var Klass = this;
  29441. if (Klass.instancePool.length) {
  29442. var instance = Klass.instancePool.pop();
  29443. Klass.call(instance, a1, a2, a3, a4);
  29444. return instance;
  29445. } else {
  29446. return new Klass(a1, a2, a3, a4);
  29447. }
  29448. };
  29449. var standardReleaser = function (instance) {
  29450. var Klass = this;
  29451. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  29452. instance.destructor();
  29453. if (Klass.instancePool.length < Klass.poolSize) {
  29454. Klass.instancePool.push(instance);
  29455. }
  29456. };
  29457. var DEFAULT_POOL_SIZE = 10;
  29458. var DEFAULT_POOLER = oneArgumentPooler;
  29459. /**
  29460. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  29461. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  29462. * you give this may have a `poolSize` property, and will look for a
  29463. * prototypical `destructor` on instances.
  29464. *
  29465. * @param {Function} CopyConstructor Constructor that can be used to reset.
  29466. * @param {Function} pooler Customizable pooler.
  29467. */
  29468. var addPoolingTo = function (CopyConstructor, pooler) {
  29469. // Casting as any so that flow ignores the actual implementation and trusts
  29470. // it to match the type we declared
  29471. var NewKlass = CopyConstructor;
  29472. NewKlass.instancePool = [];
  29473. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  29474. if (!NewKlass.poolSize) {
  29475. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  29476. }
  29477. NewKlass.release = standardReleaser;
  29478. return NewKlass;
  29479. };
  29480. var PooledClass = {
  29481. addPoolingTo: addPoolingTo,
  29482. oneArgumentPooler: oneArgumentPooler,
  29483. twoArgumentPooler: twoArgumentPooler,
  29484. threeArgumentPooler: threeArgumentPooler,
  29485. fourArgumentPooler: fourArgumentPooler
  29486. };
  29487. module.exports = PooledClass;
  29488. /***/ }),
  29489. /* 216 */
  29490. /***/ (function(module, exports, __webpack_require__) {
  29491. "use strict";
  29492. /**
  29493. * Copyright 2013-present, Facebook, Inc.
  29494. * All rights reserved.
  29495. *
  29496. * This source code is licensed under the BSD-style license found in the
  29497. * LICENSE file in the root directory of this source tree. An additional grant
  29498. * of patent rights can be found in the PATENTS file in the same directory.
  29499. *
  29500. */
  29501. var PooledClass = __webpack_require__(215);
  29502. var ReactElement = __webpack_require__(22);
  29503. var emptyFunction = __webpack_require__(10);
  29504. var traverseAllChildren = __webpack_require__(226);
  29505. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  29506. var fourArgumentPooler = PooledClass.fourArgumentPooler;
  29507. var userProvidedKeyEscapeRegex = /\/+/g;
  29508. function escapeUserProvidedKey(text) {
  29509. return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
  29510. }
  29511. /**
  29512. * PooledClass representing the bookkeeping associated with performing a child
  29513. * traversal. Allows avoiding binding callbacks.
  29514. *
  29515. * @constructor ForEachBookKeeping
  29516. * @param {!function} forEachFunction Function to perform traversal with.
  29517. * @param {?*} forEachContext Context to perform context with.
  29518. */
  29519. function ForEachBookKeeping(forEachFunction, forEachContext) {
  29520. this.func = forEachFunction;
  29521. this.context = forEachContext;
  29522. this.count = 0;
  29523. }
  29524. ForEachBookKeeping.prototype.destructor = function () {
  29525. this.func = null;
  29526. this.context = null;
  29527. this.count = 0;
  29528. };
  29529. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  29530. function forEachSingleChild(bookKeeping, child, name) {
  29531. var func = bookKeeping.func,
  29532. context = bookKeeping.context;
  29533. func.call(context, child, bookKeeping.count++);
  29534. }
  29535. /**
  29536. * Iterates through children that are typically specified as `props.children`.
  29537. *
  29538. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
  29539. *
  29540. * The provided forEachFunc(child, index) will be called for each
  29541. * leaf child.
  29542. *
  29543. * @param {?*} children Children tree container.
  29544. * @param {function(*, int)} forEachFunc
  29545. * @param {*} forEachContext Context for forEachContext.
  29546. */
  29547. function forEachChildren(children, forEachFunc, forEachContext) {
  29548. if (children == null) {
  29549. return children;
  29550. }
  29551. var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  29552. traverseAllChildren(children, forEachSingleChild, traverseContext);
  29553. ForEachBookKeeping.release(traverseContext);
  29554. }
  29555. /**
  29556. * PooledClass representing the bookkeeping associated with performing a child
  29557. * mapping. Allows avoiding binding callbacks.
  29558. *
  29559. * @constructor MapBookKeeping
  29560. * @param {!*} mapResult Object containing the ordered map of results.
  29561. * @param {!function} mapFunction Function to perform mapping with.
  29562. * @param {?*} mapContext Context to perform mapping with.
  29563. */
  29564. function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
  29565. this.result = mapResult;
  29566. this.keyPrefix = keyPrefix;
  29567. this.func = mapFunction;
  29568. this.context = mapContext;
  29569. this.count = 0;
  29570. }
  29571. MapBookKeeping.prototype.destructor = function () {
  29572. this.result = null;
  29573. this.keyPrefix = null;
  29574. this.func = null;
  29575. this.context = null;
  29576. this.count = 0;
  29577. };
  29578. PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
  29579. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  29580. var result = bookKeeping.result,
  29581. keyPrefix = bookKeeping.keyPrefix,
  29582. func = bookKeeping.func,
  29583. context = bookKeeping.context;
  29584. var mappedChild = func.call(context, child, bookKeeping.count++);
  29585. if (Array.isArray(mappedChild)) {
  29586. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
  29587. } else if (mappedChild != null) {
  29588. if (ReactElement.isValidElement(mappedChild)) {
  29589. mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
  29590. // Keep both the (mapped) and old keys if they differ, just as
  29591. // traverseAllChildren used to do for objects as children
  29592. keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
  29593. }
  29594. result.push(mappedChild);
  29595. }
  29596. }
  29597. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  29598. var escapedPrefix = '';
  29599. if (prefix != null) {
  29600. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  29601. }
  29602. var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
  29603. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  29604. MapBookKeeping.release(traverseContext);
  29605. }
  29606. /**
  29607. * Maps children that are typically specified as `props.children`.
  29608. *
  29609. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
  29610. *
  29611. * The provided mapFunction(child, key, index) will be called for each
  29612. * leaf child.
  29613. *
  29614. * @param {?*} children Children tree container.
  29615. * @param {function(*, int)} func The map function.
  29616. * @param {*} context Context for mapFunction.
  29617. * @return {object} Object containing the ordered map of results.
  29618. */
  29619. function mapChildren(children, func, context) {
  29620. if (children == null) {
  29621. return children;
  29622. }
  29623. var result = [];
  29624. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  29625. return result;
  29626. }
  29627. function forEachSingleChildDummy(traverseContext, child, name) {
  29628. return null;
  29629. }
  29630. /**
  29631. * Count the number of children that are typically specified as
  29632. * `props.children`.
  29633. *
  29634. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
  29635. *
  29636. * @param {?*} children Children tree container.
  29637. * @return {number} The number of children.
  29638. */
  29639. function countChildren(children, context) {
  29640. return traverseAllChildren(children, forEachSingleChildDummy, null);
  29641. }
  29642. /**
  29643. * Flatten a children object (typically specified as `props.children`) and
  29644. * return an array with appropriately re-keyed children.
  29645. *
  29646. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
  29647. */
  29648. function toArray(children) {
  29649. var result = [];
  29650. mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
  29651. return result;
  29652. }
  29653. var ReactChildren = {
  29654. forEach: forEachChildren,
  29655. map: mapChildren,
  29656. mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
  29657. count: countChildren,
  29658. toArray: toArray
  29659. };
  29660. module.exports = ReactChildren;
  29661. /***/ }),
  29662. /* 217 */
  29663. /***/ (function(module, exports, __webpack_require__) {
  29664. "use strict";
  29665. /**
  29666. * Copyright 2013-present, Facebook, Inc.
  29667. * All rights reserved.
  29668. *
  29669. * This source code is licensed under the BSD-style license found in the
  29670. * LICENSE file in the root directory of this source tree. An additional grant
  29671. * of patent rights can be found in the PATENTS file in the same directory.
  29672. *
  29673. */
  29674. var _prodInvariant = __webpack_require__(23),
  29675. _assign = __webpack_require__(3);
  29676. var ReactComponent = __webpack_require__(67);
  29677. var ReactElement = __webpack_require__(22);
  29678. var ReactPropTypeLocationNames = __webpack_require__(219);
  29679. var ReactNoopUpdateQueue = __webpack_require__(68);
  29680. var emptyObject = __webpack_require__(25);
  29681. var invariant = __webpack_require__(0);
  29682. var warning = __webpack_require__(1);
  29683. var MIXINS_KEY = 'mixins';
  29684. // Helper function to allow the creation of anonymous functions which do not
  29685. // have .name set to the name of the variable being assigned to.
  29686. function identity(fn) {
  29687. return fn;
  29688. }
  29689. /**
  29690. * Policies that describe methods in `ReactClassInterface`.
  29691. */
  29692. var injectedMixins = [];
  29693. /**
  29694. * Composite components are higher-level components that compose other composite
  29695. * or host components.
  29696. *
  29697. * To create a new type of `ReactClass`, pass a specification of
  29698. * your new class to `React.createClass`. The only requirement of your class
  29699. * specification is that you implement a `render` method.
  29700. *
  29701. * var MyComponent = React.createClass({
  29702. * render: function() {
  29703. * return <div>Hello World</div>;
  29704. * }
  29705. * });
  29706. *
  29707. * The class specification supports a specific protocol of methods that have
  29708. * special meaning (e.g. `render`). See `ReactClassInterface` for
  29709. * more the comprehensive protocol. Any other properties and methods in the
  29710. * class specification will be available on the prototype.
  29711. *
  29712. * @interface ReactClassInterface
  29713. * @internal
  29714. */
  29715. var ReactClassInterface = {
  29716. /**
  29717. * An array of Mixin objects to include when defining your component.
  29718. *
  29719. * @type {array}
  29720. * @optional
  29721. */
  29722. mixins: 'DEFINE_MANY',
  29723. /**
  29724. * An object containing properties and methods that should be defined on
  29725. * the component's constructor instead of its prototype (static methods).
  29726. *
  29727. * @type {object}
  29728. * @optional
  29729. */
  29730. statics: 'DEFINE_MANY',
  29731. /**
  29732. * Definition of prop types for this component.
  29733. *
  29734. * @type {object}
  29735. * @optional
  29736. */
  29737. propTypes: 'DEFINE_MANY',
  29738. /**
  29739. * Definition of context types for this component.
  29740. *
  29741. * @type {object}
  29742. * @optional
  29743. */
  29744. contextTypes: 'DEFINE_MANY',
  29745. /**
  29746. * Definition of context types this component sets for its children.
  29747. *
  29748. * @type {object}
  29749. * @optional
  29750. */
  29751. childContextTypes: 'DEFINE_MANY',
  29752. // ==== Definition methods ====
  29753. /**
  29754. * Invoked when the component is mounted. Values in the mapping will be set on
  29755. * `this.props` if that prop is not specified (i.e. using an `in` check).
  29756. *
  29757. * This method is invoked before `getInitialState` and therefore cannot rely
  29758. * on `this.state` or use `this.setState`.
  29759. *
  29760. * @return {object}
  29761. * @optional
  29762. */
  29763. getDefaultProps: 'DEFINE_MANY_MERGED',
  29764. /**
  29765. * Invoked once before the component is mounted. The return value will be used
  29766. * as the initial value of `this.state`.
  29767. *
  29768. * getInitialState: function() {
  29769. * return {
  29770. * isOn: false,
  29771. * fooBaz: new BazFoo()
  29772. * }
  29773. * }
  29774. *
  29775. * @return {object}
  29776. * @optional
  29777. */
  29778. getInitialState: 'DEFINE_MANY_MERGED',
  29779. /**
  29780. * @return {object}
  29781. * @optional
  29782. */
  29783. getChildContext: 'DEFINE_MANY_MERGED',
  29784. /**
  29785. * Uses props from `this.props` and state from `this.state` to render the
  29786. * structure of the component.
  29787. *
  29788. * No guarantees are made about when or how often this method is invoked, so
  29789. * it must not have side effects.
  29790. *
  29791. * render: function() {
  29792. * var name = this.props.name;
  29793. * return <div>Hello, {name}!</div>;
  29794. * }
  29795. *
  29796. * @return {ReactComponent}
  29797. * @required
  29798. */
  29799. render: 'DEFINE_ONCE',
  29800. // ==== Delegate methods ====
  29801. /**
  29802. * Invoked when the component is initially created and about to be mounted.
  29803. * This may have side effects, but any external subscriptions or data created
  29804. * by this method must be cleaned up in `componentWillUnmount`.
  29805. *
  29806. * @optional
  29807. */
  29808. componentWillMount: 'DEFINE_MANY',
  29809. /**
  29810. * Invoked when the component has been mounted and has a DOM representation.
  29811. * However, there is no guarantee that the DOM node is in the document.
  29812. *
  29813. * Use this as an opportunity to operate on the DOM when the component has
  29814. * been mounted (initialized and rendered) for the first time.
  29815. *
  29816. * @param {DOMElement} rootNode DOM element representing the component.
  29817. * @optional
  29818. */
  29819. componentDidMount: 'DEFINE_MANY',
  29820. /**
  29821. * Invoked before the component receives new props.
  29822. *
  29823. * Use this as an opportunity to react to a prop transition by updating the
  29824. * state using `this.setState`. Current props are accessed via `this.props`.
  29825. *
  29826. * componentWillReceiveProps: function(nextProps, nextContext) {
  29827. * this.setState({
  29828. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  29829. * });
  29830. * }
  29831. *
  29832. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  29833. * transition may cause a state change, but the opposite is not true. If you
  29834. * need it, you are probably looking for `componentWillUpdate`.
  29835. *
  29836. * @param {object} nextProps
  29837. * @optional
  29838. */
  29839. componentWillReceiveProps: 'DEFINE_MANY',
  29840. /**
  29841. * Invoked while deciding if the component should be updated as a result of
  29842. * receiving new props, state and/or context.
  29843. *
  29844. * Use this as an opportunity to `return false` when you're certain that the
  29845. * transition to the new props/state/context will not require a component
  29846. * update.
  29847. *
  29848. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  29849. * return !equal(nextProps, this.props) ||
  29850. * !equal(nextState, this.state) ||
  29851. * !equal(nextContext, this.context);
  29852. * }
  29853. *
  29854. * @param {object} nextProps
  29855. * @param {?object} nextState
  29856. * @param {?object} nextContext
  29857. * @return {boolean} True if the component should update.
  29858. * @optional
  29859. */
  29860. shouldComponentUpdate: 'DEFINE_ONCE',
  29861. /**
  29862. * Invoked when the component is about to update due to a transition from
  29863. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  29864. * and `nextContext`.
  29865. *
  29866. * Use this as an opportunity to perform preparation before an update occurs.
  29867. *
  29868. * NOTE: You **cannot** use `this.setState()` in this method.
  29869. *
  29870. * @param {object} nextProps
  29871. * @param {?object} nextState
  29872. * @param {?object} nextContext
  29873. * @param {ReactReconcileTransaction} transaction
  29874. * @optional
  29875. */
  29876. componentWillUpdate: 'DEFINE_MANY',
  29877. /**
  29878. * Invoked when the component's DOM representation has been updated.
  29879. *
  29880. * Use this as an opportunity to operate on the DOM when the component has
  29881. * been updated.
  29882. *
  29883. * @param {object} prevProps
  29884. * @param {?object} prevState
  29885. * @param {?object} prevContext
  29886. * @param {DOMElement} rootNode DOM element representing the component.
  29887. * @optional
  29888. */
  29889. componentDidUpdate: 'DEFINE_MANY',
  29890. /**
  29891. * Invoked when the component is about to be removed from its parent and have
  29892. * its DOM representation destroyed.
  29893. *
  29894. * Use this as an opportunity to deallocate any external resources.
  29895. *
  29896. * NOTE: There is no `componentDidUnmount` since your component will have been
  29897. * destroyed by that point.
  29898. *
  29899. * @optional
  29900. */
  29901. componentWillUnmount: 'DEFINE_MANY',
  29902. // ==== Advanced methods ====
  29903. /**
  29904. * Updates the component's currently mounted DOM representation.
  29905. *
  29906. * By default, this implements React's rendering and reconciliation algorithm.
  29907. * Sophisticated clients may wish to override this.
  29908. *
  29909. * @param {ReactReconcileTransaction} transaction
  29910. * @internal
  29911. * @overridable
  29912. */
  29913. updateComponent: 'OVERRIDE_BASE'
  29914. };
  29915. /**
  29916. * Mapping from class specification keys to special processing functions.
  29917. *
  29918. * Although these are declared like instance properties in the specification
  29919. * when defining classes using `React.createClass`, they are actually static
  29920. * and are accessible on the constructor instead of the prototype. Despite
  29921. * being static, they must be defined outside of the "statics" key under
  29922. * which all other static methods are defined.
  29923. */
  29924. var RESERVED_SPEC_KEYS = {
  29925. displayName: function (Constructor, displayName) {
  29926. Constructor.displayName = displayName;
  29927. },
  29928. mixins: function (Constructor, mixins) {
  29929. if (mixins) {
  29930. for (var i = 0; i < mixins.length; i++) {
  29931. mixSpecIntoComponent(Constructor, mixins[i]);
  29932. }
  29933. }
  29934. },
  29935. childContextTypes: function (Constructor, childContextTypes) {
  29936. if (false) {
  29937. validateTypeDef(Constructor, childContextTypes, 'childContext');
  29938. }
  29939. Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
  29940. },
  29941. contextTypes: function (Constructor, contextTypes) {
  29942. if (false) {
  29943. validateTypeDef(Constructor, contextTypes, 'context');
  29944. }
  29945. Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
  29946. },
  29947. /**
  29948. * Special case getDefaultProps which should move into statics but requires
  29949. * automatic merging.
  29950. */
  29951. getDefaultProps: function (Constructor, getDefaultProps) {
  29952. if (Constructor.getDefaultProps) {
  29953. Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
  29954. } else {
  29955. Constructor.getDefaultProps = getDefaultProps;
  29956. }
  29957. },
  29958. propTypes: function (Constructor, propTypes) {
  29959. if (false) {
  29960. validateTypeDef(Constructor, propTypes, 'prop');
  29961. }
  29962. Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
  29963. },
  29964. statics: function (Constructor, statics) {
  29965. mixStaticSpecIntoComponent(Constructor, statics);
  29966. },
  29967. autobind: function () {} };
  29968. function validateTypeDef(Constructor, typeDef, location) {
  29969. for (var propName in typeDef) {
  29970. if (typeDef.hasOwnProperty(propName)) {
  29971. // use a warning instead of an invariant so components
  29972. // don't show up in prod but only in __DEV__
  29973. 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;
  29974. }
  29975. }
  29976. }
  29977. function validateMethodOverride(isAlreadyDefined, name) {
  29978. var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
  29979. // Disallow overriding of base class methods unless explicitly allowed.
  29980. if (ReactClassMixin.hasOwnProperty(name)) {
  29981. !(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;
  29982. }
  29983. // Disallow defining methods more than once unless explicitly allowed.
  29984. if (isAlreadyDefined) {
  29985. !(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;
  29986. }
  29987. }
  29988. /**
  29989. * Mixin helper which handles policy validation and reserved
  29990. * specification keys when building React classes.
  29991. */
  29992. function mixSpecIntoComponent(Constructor, spec) {
  29993. if (!spec) {
  29994. if (false) {
  29995. var typeofSpec = typeof spec;
  29996. var isMixinValid = typeofSpec === 'object' && spec !== null;
  29997. 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;
  29998. }
  29999. return;
  30000. }
  30001. !(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;
  30002. !!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;
  30003. var proto = Constructor.prototype;
  30004. var autoBindPairs = proto.__reactAutoBindPairs;
  30005. // By handling mixins before any other properties, we ensure the same
  30006. // chaining order is applied to methods with DEFINE_MANY policy, whether
  30007. // mixins are listed before or after these methods in the spec.
  30008. if (spec.hasOwnProperty(MIXINS_KEY)) {
  30009. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  30010. }
  30011. for (var name in spec) {
  30012. if (!spec.hasOwnProperty(name)) {
  30013. continue;
  30014. }
  30015. if (name === MIXINS_KEY) {
  30016. // We have already handled mixins in a special case above.
  30017. continue;
  30018. }
  30019. var property = spec[name];
  30020. var isAlreadyDefined = proto.hasOwnProperty(name);
  30021. validateMethodOverride(isAlreadyDefined, name);
  30022. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  30023. RESERVED_SPEC_KEYS[name](Constructor, property);
  30024. } else {
  30025. // Setup methods on prototype:
  30026. // The following member methods should not be automatically bound:
  30027. // 1. Expected ReactClass methods (in the "interface").
  30028. // 2. Overridden methods (that were mixed in).
  30029. var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
  30030. var isFunction = typeof property === 'function';
  30031. var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
  30032. if (shouldAutoBind) {
  30033. autoBindPairs.push(name, property);
  30034. proto[name] = property;
  30035. } else {
  30036. if (isAlreadyDefined) {
  30037. var specPolicy = ReactClassInterface[name];
  30038. // These cases should already be caught by validateMethodOverride.
  30039. !(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;
  30040. // For methods which are defined more than once, call the existing
  30041. // methods before calling the new property, merging if appropriate.
  30042. if (specPolicy === 'DEFINE_MANY_MERGED') {
  30043. proto[name] = createMergedResultFunction(proto[name], property);
  30044. } else if (specPolicy === 'DEFINE_MANY') {
  30045. proto[name] = createChainedFunction(proto[name], property);
  30046. }
  30047. } else {
  30048. proto[name] = property;
  30049. if (false) {
  30050. // Add verbose displayName to the function, which helps when looking
  30051. // at profiling tools.
  30052. if (typeof property === 'function' && spec.displayName) {
  30053. proto[name].displayName = spec.displayName + '_' + name;
  30054. }
  30055. }
  30056. }
  30057. }
  30058. }
  30059. }
  30060. }
  30061. function mixStaticSpecIntoComponent(Constructor, statics) {
  30062. if (!statics) {
  30063. return;
  30064. }
  30065. for (var name in statics) {
  30066. var property = statics[name];
  30067. if (!statics.hasOwnProperty(name)) {
  30068. continue;
  30069. }
  30070. var isReserved = name in RESERVED_SPEC_KEYS;
  30071. !!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;
  30072. var isInherited = name in Constructor;
  30073. !!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;
  30074. Constructor[name] = property;
  30075. }
  30076. }
  30077. /**
  30078. * Merge two objects, but throw if both contain the same key.
  30079. *
  30080. * @param {object} one The first object, which is mutated.
  30081. * @param {object} two The second object
  30082. * @return {object} one after it has been mutated to contain everything in two.
  30083. */
  30084. function mergeIntoWithNoDuplicateKeys(one, two) {
  30085. !(one && two && typeof one === 'object' && typeof two === 'object') ? false ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
  30086. for (var key in two) {
  30087. if (two.hasOwnProperty(key)) {
  30088. !(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;
  30089. one[key] = two[key];
  30090. }
  30091. }
  30092. return one;
  30093. }
  30094. /**
  30095. * Creates a function that invokes two functions and merges their return values.
  30096. *
  30097. * @param {function} one Function to invoke first.
  30098. * @param {function} two Function to invoke second.
  30099. * @return {function} Function that invokes the two argument functions.
  30100. * @private
  30101. */
  30102. function createMergedResultFunction(one, two) {
  30103. return function mergedResult() {
  30104. var a = one.apply(this, arguments);
  30105. var b = two.apply(this, arguments);
  30106. if (a == null) {
  30107. return b;
  30108. } else if (b == null) {
  30109. return a;
  30110. }
  30111. var c = {};
  30112. mergeIntoWithNoDuplicateKeys(c, a);
  30113. mergeIntoWithNoDuplicateKeys(c, b);
  30114. return c;
  30115. };
  30116. }
  30117. /**
  30118. * Creates a function that invokes two functions and ignores their return vales.
  30119. *
  30120. * @param {function} one Function to invoke first.
  30121. * @param {function} two Function to invoke second.
  30122. * @return {function} Function that invokes the two argument functions.
  30123. * @private
  30124. */
  30125. function createChainedFunction(one, two) {
  30126. return function chainedFunction() {
  30127. one.apply(this, arguments);
  30128. two.apply(this, arguments);
  30129. };
  30130. }
  30131. /**
  30132. * Binds a method to the component.
  30133. *
  30134. * @param {object} component Component whose method is going to be bound.
  30135. * @param {function} method Method to be bound.
  30136. * @return {function} The bound method.
  30137. */
  30138. function bindAutoBindMethod(component, method) {
  30139. var boundMethod = method.bind(component);
  30140. if (false) {
  30141. boundMethod.__reactBoundContext = component;
  30142. boundMethod.__reactBoundMethod = method;
  30143. boundMethod.__reactBoundArguments = null;
  30144. var componentName = component.constructor.displayName;
  30145. var _bind = boundMethod.bind;
  30146. boundMethod.bind = function (newThis) {
  30147. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  30148. args[_key - 1] = arguments[_key];
  30149. }
  30150. // User is trying to bind() an autobound method; we effectively will
  30151. // ignore the value of "this" that the user is trying to use, so
  30152. // let's warn.
  30153. if (newThis !== component && newThis !== null) {
  30154. process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
  30155. } else if (!args.length) {
  30156. 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;
  30157. return boundMethod;
  30158. }
  30159. var reboundMethod = _bind.apply(boundMethod, arguments);
  30160. reboundMethod.__reactBoundContext = component;
  30161. reboundMethod.__reactBoundMethod = method;
  30162. reboundMethod.__reactBoundArguments = args;
  30163. return reboundMethod;
  30164. };
  30165. }
  30166. return boundMethod;
  30167. }
  30168. /**
  30169. * Binds all auto-bound methods in a component.
  30170. *
  30171. * @param {object} component Component whose method is going to be bound.
  30172. */
  30173. function bindAutoBindMethods(component) {
  30174. var pairs = component.__reactAutoBindPairs;
  30175. for (var i = 0; i < pairs.length; i += 2) {
  30176. var autoBindKey = pairs[i];
  30177. var method = pairs[i + 1];
  30178. component[autoBindKey] = bindAutoBindMethod(component, method);
  30179. }
  30180. }
  30181. /**
  30182. * Add more to the ReactClass base class. These are all legacy features and
  30183. * therefore not already part of the modern ReactComponent.
  30184. */
  30185. var ReactClassMixin = {
  30186. /**
  30187. * TODO: This will be deprecated because state should always keep a consistent
  30188. * type signature and the only use case for this, is to avoid that.
  30189. */
  30190. replaceState: function (newState, callback) {
  30191. this.updater.enqueueReplaceState(this, newState);
  30192. if (callback) {
  30193. this.updater.enqueueCallback(this, callback, 'replaceState');
  30194. }
  30195. },
  30196. /**
  30197. * Checks whether or not this composite component is mounted.
  30198. * @return {boolean} True if mounted, false otherwise.
  30199. * @protected
  30200. * @final
  30201. */
  30202. isMounted: function () {
  30203. return this.updater.isMounted(this);
  30204. }
  30205. };
  30206. var ReactClassComponent = function () {};
  30207. _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
  30208. var didWarnDeprecated = false;
  30209. /**
  30210. * Module for creating composite components.
  30211. *
  30212. * @class ReactClass
  30213. */
  30214. var ReactClass = {
  30215. /**
  30216. * Creates a composite component class given a class specification.
  30217. * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
  30218. *
  30219. * @param {object} spec Class specification (which must define `render`).
  30220. * @return {function} Component constructor function.
  30221. * @public
  30222. */
  30223. createClass: function (spec) {
  30224. if (false) {
  30225. process.env.NODE_ENV !== 'production' ? warning(didWarnDeprecated, '%s: React.createClass is deprecated and will be removed in version 16. ' + 'Use plain JavaScript classes instead. If you\'re not yet ready to ' + 'migrate, create-react-class is available on npm as a ' + 'drop-in replacement.', spec && spec.displayName || 'A Component') : void 0;
  30226. didWarnDeprecated = true;
  30227. }
  30228. // To keep our warnings more understandable, we'll use a little hack here to
  30229. // ensure that Constructor.name !== 'Constructor'. This makes sure we don't
  30230. // unnecessarily identify a class without displayName as 'Constructor'.
  30231. var Constructor = identity(function (props, context, updater) {
  30232. // This constructor gets overridden by mocks. The argument is used
  30233. // by mocks to assert on what gets mounted.
  30234. if (false) {
  30235. 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;
  30236. }
  30237. // Wire up auto-binding
  30238. if (this.__reactAutoBindPairs.length) {
  30239. bindAutoBindMethods(this);
  30240. }
  30241. this.props = props;
  30242. this.context = context;
  30243. this.refs = emptyObject;
  30244. this.updater = updater || ReactNoopUpdateQueue;
  30245. this.state = null;
  30246. // ReactClasses doesn't have constructors. Instead, they use the
  30247. // getInitialState and componentWillMount methods for initialization.
  30248. var initialState = this.getInitialState ? this.getInitialState() : null;
  30249. if (false) {
  30250. // We allow auto-mocks to proceed as if they're returning null.
  30251. if (initialState === undefined && this.getInitialState._isMockFunction) {
  30252. // This is probably bad practice. Consider warning here and
  30253. // deprecating this convenience.
  30254. initialState = null;
  30255. }
  30256. }
  30257. !(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;
  30258. this.state = initialState;
  30259. });
  30260. Constructor.prototype = new ReactClassComponent();
  30261. Constructor.prototype.constructor = Constructor;
  30262. Constructor.prototype.__reactAutoBindPairs = [];
  30263. injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
  30264. mixSpecIntoComponent(Constructor, spec);
  30265. // Initialize the defaultProps property after all mixins have been merged.
  30266. if (Constructor.getDefaultProps) {
  30267. Constructor.defaultProps = Constructor.getDefaultProps();
  30268. }
  30269. if (false) {
  30270. // This is a tag to indicate that the use of these method names is ok,
  30271. // since it's used with createClass. If it's not, then it's likely a
  30272. // mistake so we'll warn you to use the static property, property
  30273. // initializer or constructor respectively.
  30274. if (Constructor.getDefaultProps) {
  30275. Constructor.getDefaultProps.isReactClassApproved = {};
  30276. }
  30277. if (Constructor.prototype.getInitialState) {
  30278. Constructor.prototype.getInitialState.isReactClassApproved = {};
  30279. }
  30280. }
  30281. !Constructor.prototype.render ? false ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
  30282. if (false) {
  30283. 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;
  30284. 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;
  30285. }
  30286. // Reduce time spent doing lookups by setting these on the prototype.
  30287. for (var methodName in ReactClassInterface) {
  30288. if (!Constructor.prototype[methodName]) {
  30289. Constructor.prototype[methodName] = null;
  30290. }
  30291. }
  30292. return Constructor;
  30293. },
  30294. injection: {
  30295. injectMixin: function (mixin) {
  30296. injectedMixins.push(mixin);
  30297. }
  30298. }
  30299. };
  30300. module.exports = ReactClass;
  30301. /***/ }),
  30302. /* 218 */
  30303. /***/ (function(module, exports, __webpack_require__) {
  30304. "use strict";
  30305. /**
  30306. * Copyright 2013-present, Facebook, Inc.
  30307. * All rights reserved.
  30308. *
  30309. * This source code is licensed under the BSD-style license found in the
  30310. * LICENSE file in the root directory of this source tree. An additional grant
  30311. * of patent rights can be found in the PATENTS file in the same directory.
  30312. *
  30313. */
  30314. var ReactElement = __webpack_require__(22);
  30315. /**
  30316. * Create a factory that creates HTML tag elements.
  30317. *
  30318. * @private
  30319. */
  30320. var createDOMFactory = ReactElement.createFactory;
  30321. if (false) {
  30322. var ReactElementValidator = require('./ReactElementValidator');
  30323. createDOMFactory = ReactElementValidator.createFactory;
  30324. }
  30325. /**
  30326. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  30327. * This is also accessible via `React.DOM`.
  30328. *
  30329. * @public
  30330. */
  30331. var ReactDOMFactories = {
  30332. a: createDOMFactory('a'),
  30333. abbr: createDOMFactory('abbr'),
  30334. address: createDOMFactory('address'),
  30335. area: createDOMFactory('area'),
  30336. article: createDOMFactory('article'),
  30337. aside: createDOMFactory('aside'),
  30338. audio: createDOMFactory('audio'),
  30339. b: createDOMFactory('b'),
  30340. base: createDOMFactory('base'),
  30341. bdi: createDOMFactory('bdi'),
  30342. bdo: createDOMFactory('bdo'),
  30343. big: createDOMFactory('big'),
  30344. blockquote: createDOMFactory('blockquote'),
  30345. body: createDOMFactory('body'),
  30346. br: createDOMFactory('br'),
  30347. button: createDOMFactory('button'),
  30348. canvas: createDOMFactory('canvas'),
  30349. caption: createDOMFactory('caption'),
  30350. cite: createDOMFactory('cite'),
  30351. code: createDOMFactory('code'),
  30352. col: createDOMFactory('col'),
  30353. colgroup: createDOMFactory('colgroup'),
  30354. data: createDOMFactory('data'),
  30355. datalist: createDOMFactory('datalist'),
  30356. dd: createDOMFactory('dd'),
  30357. del: createDOMFactory('del'),
  30358. details: createDOMFactory('details'),
  30359. dfn: createDOMFactory('dfn'),
  30360. dialog: createDOMFactory('dialog'),
  30361. div: createDOMFactory('div'),
  30362. dl: createDOMFactory('dl'),
  30363. dt: createDOMFactory('dt'),
  30364. em: createDOMFactory('em'),
  30365. embed: createDOMFactory('embed'),
  30366. fieldset: createDOMFactory('fieldset'),
  30367. figcaption: createDOMFactory('figcaption'),
  30368. figure: createDOMFactory('figure'),
  30369. footer: createDOMFactory('footer'),
  30370. form: createDOMFactory('form'),
  30371. h1: createDOMFactory('h1'),
  30372. h2: createDOMFactory('h2'),
  30373. h3: createDOMFactory('h3'),
  30374. h4: createDOMFactory('h4'),
  30375. h5: createDOMFactory('h5'),
  30376. h6: createDOMFactory('h6'),
  30377. head: createDOMFactory('head'),
  30378. header: createDOMFactory('header'),
  30379. hgroup: createDOMFactory('hgroup'),
  30380. hr: createDOMFactory('hr'),
  30381. html: createDOMFactory('html'),
  30382. i: createDOMFactory('i'),
  30383. iframe: createDOMFactory('iframe'),
  30384. img: createDOMFactory('img'),
  30385. input: createDOMFactory('input'),
  30386. ins: createDOMFactory('ins'),
  30387. kbd: createDOMFactory('kbd'),
  30388. keygen: createDOMFactory('keygen'),
  30389. label: createDOMFactory('label'),
  30390. legend: createDOMFactory('legend'),
  30391. li: createDOMFactory('li'),
  30392. link: createDOMFactory('link'),
  30393. main: createDOMFactory('main'),
  30394. map: createDOMFactory('map'),
  30395. mark: createDOMFactory('mark'),
  30396. menu: createDOMFactory('menu'),
  30397. menuitem: createDOMFactory('menuitem'),
  30398. meta: createDOMFactory('meta'),
  30399. meter: createDOMFactory('meter'),
  30400. nav: createDOMFactory('nav'),
  30401. noscript: createDOMFactory('noscript'),
  30402. object: createDOMFactory('object'),
  30403. ol: createDOMFactory('ol'),
  30404. optgroup: createDOMFactory('optgroup'),
  30405. option: createDOMFactory('option'),
  30406. output: createDOMFactory('output'),
  30407. p: createDOMFactory('p'),
  30408. param: createDOMFactory('param'),
  30409. picture: createDOMFactory('picture'),
  30410. pre: createDOMFactory('pre'),
  30411. progress: createDOMFactory('progress'),
  30412. q: createDOMFactory('q'),
  30413. rp: createDOMFactory('rp'),
  30414. rt: createDOMFactory('rt'),
  30415. ruby: createDOMFactory('ruby'),
  30416. s: createDOMFactory('s'),
  30417. samp: createDOMFactory('samp'),
  30418. script: createDOMFactory('script'),
  30419. section: createDOMFactory('section'),
  30420. select: createDOMFactory('select'),
  30421. small: createDOMFactory('small'),
  30422. source: createDOMFactory('source'),
  30423. span: createDOMFactory('span'),
  30424. strong: createDOMFactory('strong'),
  30425. style: createDOMFactory('style'),
  30426. sub: createDOMFactory('sub'),
  30427. summary: createDOMFactory('summary'),
  30428. sup: createDOMFactory('sup'),
  30429. table: createDOMFactory('table'),
  30430. tbody: createDOMFactory('tbody'),
  30431. td: createDOMFactory('td'),
  30432. textarea: createDOMFactory('textarea'),
  30433. tfoot: createDOMFactory('tfoot'),
  30434. th: createDOMFactory('th'),
  30435. thead: createDOMFactory('thead'),
  30436. time: createDOMFactory('time'),
  30437. title: createDOMFactory('title'),
  30438. tr: createDOMFactory('tr'),
  30439. track: createDOMFactory('track'),
  30440. u: createDOMFactory('u'),
  30441. ul: createDOMFactory('ul'),
  30442. 'var': createDOMFactory('var'),
  30443. video: createDOMFactory('video'),
  30444. wbr: createDOMFactory('wbr'),
  30445. // SVG
  30446. circle: createDOMFactory('circle'),
  30447. clipPath: createDOMFactory('clipPath'),
  30448. defs: createDOMFactory('defs'),
  30449. ellipse: createDOMFactory('ellipse'),
  30450. g: createDOMFactory('g'),
  30451. image: createDOMFactory('image'),
  30452. line: createDOMFactory('line'),
  30453. linearGradient: createDOMFactory('linearGradient'),
  30454. mask: createDOMFactory('mask'),
  30455. path: createDOMFactory('path'),
  30456. pattern: createDOMFactory('pattern'),
  30457. polygon: createDOMFactory('polygon'),
  30458. polyline: createDOMFactory('polyline'),
  30459. radialGradient: createDOMFactory('radialGradient'),
  30460. rect: createDOMFactory('rect'),
  30461. stop: createDOMFactory('stop'),
  30462. svg: createDOMFactory('svg'),
  30463. text: createDOMFactory('text'),
  30464. tspan: createDOMFactory('tspan')
  30465. };
  30466. module.exports = ReactDOMFactories;
  30467. /***/ }),
  30468. /* 219 */
  30469. /***/ (function(module, exports, __webpack_require__) {
  30470. "use strict";
  30471. /**
  30472. * Copyright 2013-present, Facebook, Inc.
  30473. * All rights reserved.
  30474. *
  30475. * This source code is licensed under the BSD-style license found in the
  30476. * LICENSE file in the root directory of this source tree. An additional grant
  30477. * of patent rights can be found in the PATENTS file in the same directory.
  30478. *
  30479. *
  30480. */
  30481. var ReactPropTypeLocationNames = {};
  30482. if (false) {
  30483. ReactPropTypeLocationNames = {
  30484. prop: 'prop',
  30485. context: 'context',
  30486. childContext: 'child context'
  30487. };
  30488. }
  30489. module.exports = ReactPropTypeLocationNames;
  30490. /***/ }),
  30491. /* 220 */
  30492. /***/ (function(module, exports, __webpack_require__) {
  30493. "use strict";
  30494. /**
  30495. * Copyright 2013-present, Facebook, Inc.
  30496. * All rights reserved.
  30497. *
  30498. * This source code is licensed under the BSD-style license found in the
  30499. * LICENSE file in the root directory of this source tree. An additional grant
  30500. * of patent rights can be found in the PATENTS file in the same directory.
  30501. *
  30502. */
  30503. var _require = __webpack_require__(22),
  30504. isValidElement = _require.isValidElement;
  30505. var factory = __webpack_require__(75);
  30506. module.exports = factory(isValidElement);
  30507. /***/ }),
  30508. /* 221 */
  30509. /***/ (function(module, exports, __webpack_require__) {
  30510. "use strict";
  30511. /**
  30512. * Copyright 2013-present, Facebook, Inc.
  30513. * All rights reserved.
  30514. *
  30515. * This source code is licensed under the BSD-style license found in the
  30516. * LICENSE file in the root directory of this source tree. An additional grant
  30517. * of patent rights can be found in the PATENTS file in the same directory.
  30518. *
  30519. */
  30520. var _assign = __webpack_require__(3);
  30521. var ReactComponent = __webpack_require__(67);
  30522. var ReactNoopUpdateQueue = __webpack_require__(68);
  30523. var emptyObject = __webpack_require__(25);
  30524. /**
  30525. * Base class helpers for the updating state of a component.
  30526. */
  30527. function ReactPureComponent(props, context, updater) {
  30528. // Duplicated from ReactComponent.
  30529. this.props = props;
  30530. this.context = context;
  30531. this.refs = emptyObject;
  30532. // We initialize the default updater but the real one gets injected by the
  30533. // renderer.
  30534. this.updater = updater || ReactNoopUpdateQueue;
  30535. }
  30536. function ComponentDummy() {}
  30537. ComponentDummy.prototype = ReactComponent.prototype;
  30538. ReactPureComponent.prototype = new ComponentDummy();
  30539. ReactPureComponent.prototype.constructor = ReactPureComponent;
  30540. // Avoid an extra prototype jump for these methods.
  30541. _assign(ReactPureComponent.prototype, ReactComponent.prototype);
  30542. ReactPureComponent.prototype.isPureReactComponent = true;
  30543. module.exports = ReactPureComponent;
  30544. /***/ }),
  30545. /* 222 */
  30546. /***/ (function(module, exports, __webpack_require__) {
  30547. "use strict";
  30548. /**
  30549. * Copyright 2013-present, Facebook, Inc.
  30550. * All rights reserved.
  30551. *
  30552. * This source code is licensed under the BSD-style license found in the
  30553. * LICENSE file in the root directory of this source tree. An additional grant
  30554. * of patent rights can be found in the PATENTS file in the same directory.
  30555. *
  30556. */
  30557. module.exports = '15.5.4';
  30558. /***/ }),
  30559. /* 223 */
  30560. /***/ (function(module, exports, __webpack_require__) {
  30561. "use strict";
  30562. /**
  30563. * Copyright 2013-present, Facebook, Inc.
  30564. * All rights reserved.
  30565. *
  30566. * This source code is licensed under the BSD-style license found in the
  30567. * LICENSE file in the root directory of this source tree. An additional grant
  30568. * of patent rights can be found in the PATENTS file in the same directory.
  30569. *
  30570. *
  30571. */
  30572. /* global Symbol */
  30573. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  30574. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  30575. /**
  30576. * Returns the iterator method function contained on the iterable object.
  30577. *
  30578. * Be sure to invoke the function with the iterable as context:
  30579. *
  30580. * var iteratorFn = getIteratorFn(myIterable);
  30581. * if (iteratorFn) {
  30582. * var iterator = iteratorFn.call(myIterable);
  30583. * ...
  30584. * }
  30585. *
  30586. * @param {?object} maybeIterable
  30587. * @return {?function}
  30588. */
  30589. function getIteratorFn(maybeIterable) {
  30590. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  30591. if (typeof iteratorFn === 'function') {
  30592. return iteratorFn;
  30593. }
  30594. }
  30595. module.exports = getIteratorFn;
  30596. /***/ }),
  30597. /* 224 */
  30598. /***/ (function(module, exports, __webpack_require__) {
  30599. "use strict";
  30600. /**
  30601. * Copyright 2013-present, Facebook, Inc.
  30602. * All rights reserved.
  30603. *
  30604. * This source code is licensed under the BSD-style license found in the
  30605. * LICENSE file in the root directory of this source tree. An additional grant
  30606. * of patent rights can be found in the PATENTS file in the same directory.
  30607. *
  30608. *
  30609. */
  30610. var nextDebugID = 1;
  30611. function getNextDebugID() {
  30612. return nextDebugID++;
  30613. }
  30614. module.exports = getNextDebugID;
  30615. /***/ }),
  30616. /* 225 */
  30617. /***/ (function(module, exports, __webpack_require__) {
  30618. "use strict";
  30619. /**
  30620. * Copyright 2013-present, Facebook, Inc.
  30621. * All rights reserved.
  30622. *
  30623. * This source code is licensed under the BSD-style license found in the
  30624. * LICENSE file in the root directory of this source tree. An additional grant
  30625. * of patent rights can be found in the PATENTS file in the same directory.
  30626. *
  30627. */
  30628. var _prodInvariant = __webpack_require__(23);
  30629. var ReactElement = __webpack_require__(22);
  30630. var invariant = __webpack_require__(0);
  30631. /**
  30632. * Returns the first child in a collection of children and verifies that there
  30633. * is only one child in the collection.
  30634. *
  30635. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
  30636. *
  30637. * The current implementation of this function assumes that a single child gets
  30638. * passed without a wrapper, but the purpose of this helper function is to
  30639. * abstract away the particular structure of children.
  30640. *
  30641. * @param {?object} children Child collection structure.
  30642. * @return {ReactElement} The first and only `ReactElement` contained in the
  30643. * structure.
  30644. */
  30645. function onlyChild(children) {
  30646. !ReactElement.isValidElement(children) ? false ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
  30647. return children;
  30648. }
  30649. module.exports = onlyChild;
  30650. /***/ }),
  30651. /* 226 */
  30652. /***/ (function(module, exports, __webpack_require__) {
  30653. "use strict";
  30654. /**
  30655. * Copyright 2013-present, Facebook, Inc.
  30656. * All rights reserved.
  30657. *
  30658. * This source code is licensed under the BSD-style license found in the
  30659. * LICENSE file in the root directory of this source tree. An additional grant
  30660. * of patent rights can be found in the PATENTS file in the same directory.
  30661. *
  30662. */
  30663. var _prodInvariant = __webpack_require__(23);
  30664. var ReactCurrentOwner = __webpack_require__(14);
  30665. var REACT_ELEMENT_TYPE = __webpack_require__(97);
  30666. var getIteratorFn = __webpack_require__(223);
  30667. var invariant = __webpack_require__(0);
  30668. var KeyEscapeUtils = __webpack_require__(214);
  30669. var warning = __webpack_require__(1);
  30670. var SEPARATOR = '.';
  30671. var SUBSEPARATOR = ':';
  30672. /**
  30673. * This is inlined from ReactElement since this file is shared between
  30674. * isomorphic and renderers. We could extract this to a
  30675. *
  30676. */
  30677. /**
  30678. * TODO: Test that a single child and an array with one item have the same key
  30679. * pattern.
  30680. */
  30681. var didWarnAboutMaps = false;
  30682. /**
  30683. * Generate a key string that identifies a component within a set.
  30684. *
  30685. * @param {*} component A component that could contain a manual key.
  30686. * @param {number} index Index that is used if a manual key is not provided.
  30687. * @return {string}
  30688. */
  30689. function getComponentKey(component, index) {
  30690. // Do some typechecking here since we call this blindly. We want to ensure
  30691. // that we don't block potential future ES APIs.
  30692. if (component && typeof component === 'object' && component.key != null) {
  30693. // Explicit key
  30694. return KeyEscapeUtils.escape(component.key);
  30695. }
  30696. // Implicit key determined by the index in the set
  30697. return index.toString(36);
  30698. }
  30699. /**
  30700. * @param {?*} children Children tree container.
  30701. * @param {!string} nameSoFar Name of the key path so far.
  30702. * @param {!function} callback Callback to invoke with each child found.
  30703. * @param {?*} traverseContext Used to pass information throughout the traversal
  30704. * process.
  30705. * @return {!number} The number of children in this subtree.
  30706. */
  30707. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  30708. var type = typeof children;
  30709. if (type === 'undefined' || type === 'boolean') {
  30710. // All of the above are perceived as null.
  30711. children = null;
  30712. }
  30713. if (children === null || type === 'string' || type === 'number' ||
  30714. // The following is inlined from ReactElement. This means we can optimize
  30715. // some checks. React Fiber also inlines this logic for similar purposes.
  30716. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  30717. callback(traverseContext, children,
  30718. // If it's the only child, treat the name as if it was wrapped in an array
  30719. // so that it's consistent if the number of children grows.
  30720. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  30721. return 1;
  30722. }
  30723. var child;
  30724. var nextName;
  30725. var subtreeCount = 0; // Count of children found in the current subtree.
  30726. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  30727. if (Array.isArray(children)) {
  30728. for (var i = 0; i < children.length; i++) {
  30729. child = children[i];
  30730. nextName = nextNamePrefix + getComponentKey(child, i);
  30731. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30732. }
  30733. } else {
  30734. var iteratorFn = getIteratorFn(children);
  30735. if (iteratorFn) {
  30736. var iterator = iteratorFn.call(children);
  30737. var step;
  30738. if (iteratorFn !== children.entries) {
  30739. var ii = 0;
  30740. while (!(step = iterator.next()).done) {
  30741. child = step.value;
  30742. nextName = nextNamePrefix + getComponentKey(child, ii++);
  30743. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30744. }
  30745. } else {
  30746. if (false) {
  30747. var mapsAsChildrenAddendum = '';
  30748. if (ReactCurrentOwner.current) {
  30749. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  30750. if (mapsAsChildrenOwnerName) {
  30751. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  30752. }
  30753. }
  30754. 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;
  30755. didWarnAboutMaps = true;
  30756. }
  30757. // Iterator will provide entry [k,v] tuples rather than values.
  30758. while (!(step = iterator.next()).done) {
  30759. var entry = step.value;
  30760. if (entry) {
  30761. child = entry[1];
  30762. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  30763. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30764. }
  30765. }
  30766. }
  30767. } else if (type === 'object') {
  30768. var addendum = '';
  30769. if (false) {
  30770. 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.';
  30771. if (children._isReactElement) {
  30772. 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.';
  30773. }
  30774. if (ReactCurrentOwner.current) {
  30775. var name = ReactCurrentOwner.current.getName();
  30776. if (name) {
  30777. addendum += ' Check the render method of `' + name + '`.';
  30778. }
  30779. }
  30780. }
  30781. var childrenString = String(children);
  30782. 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;
  30783. }
  30784. }
  30785. return subtreeCount;
  30786. }
  30787. /**
  30788. * Traverses children that are typically specified as `props.children`, but
  30789. * might also be specified through attributes:
  30790. *
  30791. * - `traverseAllChildren(this.props.children, ...)`
  30792. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  30793. *
  30794. * The `traverseContext` is an optional argument that is passed through the
  30795. * entire traversal. It can be used to store accumulations or anything else that
  30796. * the callback might find relevant.
  30797. *
  30798. * @param {?*} children Children tree object.
  30799. * @param {!function} callback To invoke upon traversing each child.
  30800. * @param {?*} traverseContext Context for traversal.
  30801. * @return {!number} The number of children in this subtree.
  30802. */
  30803. function traverseAllChildren(children, callback, traverseContext) {
  30804. if (children == null) {
  30805. return 0;
  30806. }
  30807. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  30808. }
  30809. module.exports = traverseAllChildren;
  30810. /***/ }),
  30811. /* 227 */
  30812. /***/ (function(module, exports) {
  30813. /**
  30814. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  30815. * embed the css on the page. This breaks all relative urls because now they are relative to a
  30816. * bundle instead of the current page.
  30817. *
  30818. * One solution is to only use full urls, but that may be impossible.
  30819. *
  30820. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  30821. *
  30822. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  30823. *
  30824. */
  30825. module.exports = function (css) {
  30826. // get current location
  30827. var location = typeof window !== "undefined" && window.location;
  30828. if (!location) {
  30829. throw new Error("fixUrls requires window.location");
  30830. }
  30831. // blank or null?
  30832. if (!css || typeof css !== "string") {
  30833. return css;
  30834. }
  30835. var baseUrl = location.protocol + "//" + location.host;
  30836. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  30837. // convert each url(...)
  30838. /*
  30839. This regular expression is just a way to recursively match brackets within
  30840. a string.
  30841. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  30842. ( = Start a capturing group
  30843. (?: = Start a non-capturing group
  30844. [^)(] = Match anything that isn't a parentheses
  30845. | = OR
  30846. \( = Match a start parentheses
  30847. (?: = Start another non-capturing groups
  30848. [^)(]+ = Match anything that isn't a parentheses
  30849. | = OR
  30850. \( = Match a start parentheses
  30851. [^)(]* = Match anything that isn't a parentheses
  30852. \) = Match a end parentheses
  30853. ) = End Group
  30854. *\) = Match anything and then a close parens
  30855. ) = Close non-capturing group
  30856. * = Match anything
  30857. ) = Close capturing group
  30858. \) = Match a close parens
  30859. /gi = Get all matches, not the first. Be case insensitive.
  30860. */
  30861. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  30862. // strip quotes (if they exist)
  30863. var unquotedOrigUrl = origUrl
  30864. .trim()
  30865. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  30866. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  30867. // already a full url? no change
  30868. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) {
  30869. return fullMatch;
  30870. }
  30871. // convert the url to a full url
  30872. var newUrl;
  30873. if (unquotedOrigUrl.indexOf("//") === 0) {
  30874. //TODO: should we add protocol?
  30875. newUrl = unquotedOrigUrl;
  30876. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  30877. // path should be relative to the base url
  30878. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  30879. } else {
  30880. // path should be relative to current directory
  30881. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  30882. }
  30883. // send back the fixed url(...)
  30884. return "url(" + JSON.stringify(newUrl) + ")";
  30885. });
  30886. // send back the fixed css
  30887. return fixedCss;
  30888. };
  30889. /***/ }),
  30890. /* 228 */
  30891. /***/ (function(module, exports, __webpack_require__) {
  30892. // style-loader: Adds some css to the DOM by adding a <style> tag
  30893. // load the styles
  30894. var content = __webpack_require__(121);
  30895. if(typeof content === 'string') content = [[module.i, content, '']];
  30896. // add the styles to the DOM
  30897. var update = __webpack_require__(9)(content, {});
  30898. if(content.locals) module.exports = content.locals;
  30899. // Hot Module Replacement
  30900. if(false) {
  30901. // When the styles change, update the <style> tags
  30902. if(!content.locals) {
  30903. module.hot.accept("!!../../[email protected]@css-loader/index.js!./codemirror.css", function() {
  30904. var newContent = require("!!../../[email protected]@css-loader/index.js!./codemirror.css");
  30905. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30906. update(newContent);
  30907. });
  30908. }
  30909. // When the module is disposed, remove the <style> tags
  30910. module.hot.dispose(function() { update(); });
  30911. }
  30912. /***/ }),
  30913. /* 229 */
  30914. /***/ (function(module, exports, __webpack_require__) {
  30915. // style-loader: Adds some css to the DOM by adding a <style> tag
  30916. // load the styles
  30917. var content = __webpack_require__(122);
  30918. if(typeof content === 'string') content = [[module.i, content, '']];
  30919. // add the styles to the DOM
  30920. var update = __webpack_require__(9)(content, {});
  30921. if(content.locals) module.exports = content.locals;
  30922. // Hot Module Replacement
  30923. if(false) {
  30924. // When the styles change, update the <style> tags
  30925. if(!content.locals) {
  30926. module.hot.accept("!!../node_modules/[email protected]@css-loader/index.js!../node_modules/[email protected]@less-loader/dist/index.js!./app.less", function() {
  30927. var newContent = require("!!../node_modules/[email protected]@css-loader/index.js!../node_modules/[email protected]@less-loader/dist/index.js!./app.less");
  30928. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30929. update(newContent);
  30930. });
  30931. }
  30932. // When the module is disposed, remove the <style> tags
  30933. module.hot.dispose(function() { update(); });
  30934. }
  30935. /***/ }),
  30936. /* 230 */
  30937. /***/ (function(module, exports, __webpack_require__) {
  30938. // style-loader: Adds some css to the DOM by adding a <style> tag
  30939. // load the styles
  30940. var content = __webpack_require__(123);
  30941. if(typeof content === 'string') content = [[module.i, content, '']];
  30942. // add the styles to the DOM
  30943. var update = __webpack_require__(9)(content, {});
  30944. if(content.locals) module.exports = content.locals;
  30945. // Hot Module Replacement
  30946. if(false) {
  30947. // When the styles change, update the <style> tags
  30948. if(!content.locals) {
  30949. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./content.less", function() {
  30950. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./content.less");
  30951. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30952. update(newContent);
  30953. });
  30954. }
  30955. // When the module is disposed, remove the <style> tags
  30956. module.hot.dispose(function() { update(); });
  30957. }
  30958. /***/ }),
  30959. /* 231 */
  30960. /***/ (function(module, exports, __webpack_require__) {
  30961. // style-loader: Adds some css to the DOM by adding a <style> tag
  30962. // load the styles
  30963. var content = __webpack_require__(124);
  30964. if(typeof content === 'string') content = [[module.i, content, '']];
  30965. // add the styles to the DOM
  30966. var update = __webpack_require__(9)(content, {});
  30967. if(content.locals) module.exports = content.locals;
  30968. // Hot Module Replacement
  30969. if(false) {
  30970. // When the styles change, update the <style> tags
  30971. if(!content.locals) {
  30972. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./editor.less", function() {
  30973. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./editor.less");
  30974. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30975. update(newContent);
  30976. });
  30977. }
  30978. // When the module is disposed, remove the <style> tags
  30979. module.hot.dispose(function() { update(); });
  30980. }
  30981. /***/ }),
  30982. /* 232 */
  30983. /***/ (function(module, exports, __webpack_require__) {
  30984. // style-loader: Adds some css to the DOM by adding a <style> tag
  30985. // load the styles
  30986. var content = __webpack_require__(125);
  30987. if(typeof content === 'string') content = [[module.i, content, '']];
  30988. // add the styles to the DOM
  30989. var update = __webpack_require__(9)(content, {});
  30990. if(content.locals) module.exports = content.locals;
  30991. // Hot Module Replacement
  30992. if(false) {
  30993. // When the styles change, update the <style> tags
  30994. if(!content.locals) {
  30995. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./edit.less", function() {
  30996. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./edit.less");
  30997. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  30998. update(newContent);
  30999. });
  31000. }
  31001. // When the module is disposed, remove the <style> tags
  31002. module.hot.dispose(function() { update(); });
  31003. }
  31004. /***/ }),
  31005. /* 233 */
  31006. /***/ (function(module, exports, __webpack_require__) {
  31007. // style-loader: Adds some css to the DOM by adding a <style> tag
  31008. // load the styles
  31009. var content = __webpack_require__(126);
  31010. if(typeof content === 'string') content = [[module.i, content, '']];
  31011. // add the styles to the DOM
  31012. var update = __webpack_require__(9)(content, {});
  31013. if(content.locals) module.exports = content.locals;
  31014. // Hot Module Replacement
  31015. if(false) {
  31016. // When the styles change, update the <style> tags
  31017. if(!content.locals) {
  31018. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./frame.less", function() {
  31019. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./frame.less");
  31020. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31021. update(newContent);
  31022. });
  31023. }
  31024. // When the module is disposed, remove the <style> tags
  31025. module.hot.dispose(function() { update(); });
  31026. }
  31027. /***/ }),
  31028. /* 234 */
  31029. /***/ (function(module, exports, __webpack_require__) {
  31030. // style-loader: Adds some css to the DOM by adding a <style> tag
  31031. // load the styles
  31032. var content = __webpack_require__(127);
  31033. if(typeof content === 'string') content = [[module.i, content, '']];
  31034. // add the styles to the DOM
  31035. var update = __webpack_require__(9)(content, {});
  31036. if(content.locals) module.exports = content.locals;
  31037. // Hot Module Replacement
  31038. if(false) {
  31039. // When the styles change, update the <style> tags
  31040. if(!content.locals) {
  31041. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./group.less", function() {
  31042. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./group.less");
  31043. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31044. update(newContent);
  31045. });
  31046. }
  31047. // When the module is disposed, remove the <style> tags
  31048. module.hot.dispose(function() { update(); });
  31049. }
  31050. /***/ }),
  31051. /* 235 */
  31052. /***/ (function(module, exports, __webpack_require__) {
  31053. // style-loader: Adds some css to the DOM by adding a <style> tag
  31054. // load the styles
  31055. var content = __webpack_require__(128);
  31056. if(typeof content === 'string') content = [[module.i, content, '']];
  31057. // add the styles to the DOM
  31058. var update = __webpack_require__(9)(content, {});
  31059. if(content.locals) module.exports = content.locals;
  31060. // Hot Module Replacement
  31061. if(false) {
  31062. // When the styles change, update the <style> tags
  31063. if(!content.locals) {
  31064. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./preferences.less", function() {
  31065. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./preferences.less");
  31066. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31067. update(newContent);
  31068. });
  31069. }
  31070. // When the module is disposed, remove the <style> tags
  31071. module.hot.dispose(function() { update(); });
  31072. }
  31073. /***/ }),
  31074. /* 236 */
  31075. /***/ (function(module, exports, __webpack_require__) {
  31076. // style-loader: Adds some css to the DOM by adding a <style> tag
  31077. // load the styles
  31078. var content = __webpack_require__(129);
  31079. if(typeof content === 'string') content = [[module.i, content, '']];
  31080. // add the styles to the DOM
  31081. var update = __webpack_require__(9)(content, {});
  31082. if(content.locals) module.exports = content.locals;
  31083. // Hot Module Replacement
  31084. if(false) {
  31085. // When the styles change, update the <style> tags
  31086. if(!content.locals) {
  31087. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./sudo.less", function() {
  31088. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./sudo.less");
  31089. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31090. update(newContent);
  31091. });
  31092. }
  31093. // When the module is disposed, remove the <style> tags
  31094. module.hot.dispose(function() { update(); });
  31095. }
  31096. /***/ }),
  31097. /* 237 */
  31098. /***/ (function(module, exports, __webpack_require__) {
  31099. // style-loader: Adds some css to the DOM by adding a <style> tag
  31100. // load the styles
  31101. var content = __webpack_require__(130);
  31102. if(typeof content === 'string') content = [[module.i, content, '']];
  31103. // add the styles to the DOM
  31104. var update = __webpack_require__(9)(content, {});
  31105. if(content.locals) module.exports = content.locals;
  31106. // Hot Module Replacement
  31107. if(false) {
  31108. // When the styles change, update the <style> tags
  31109. if(!content.locals) {
  31110. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./buttons.less", function() {
  31111. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./buttons.less");
  31112. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31113. update(newContent);
  31114. });
  31115. }
  31116. // When the module is disposed, remove the <style> tags
  31117. module.hot.dispose(function() { update(); });
  31118. }
  31119. /***/ }),
  31120. /* 238 */
  31121. /***/ (function(module, exports, __webpack_require__) {
  31122. // style-loader: Adds some css to the DOM by adding a <style> tag
  31123. // load the styles
  31124. var content = __webpack_require__(131);
  31125. if(typeof content === 'string') content = [[module.i, content, '']];
  31126. // add the styles to the DOM
  31127. var update = __webpack_require__(9)(content, {});
  31128. if(content.locals) module.exports = content.locals;
  31129. // Hot Module Replacement
  31130. if(false) {
  31131. // When the styles change, update the <style> tags
  31132. if(!content.locals) {
  31133. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./list-item.less", function() {
  31134. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./list-item.less");
  31135. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31136. update(newContent);
  31137. });
  31138. }
  31139. // When the module is disposed, remove the <style> tags
  31140. module.hot.dispose(function() { update(); });
  31141. }
  31142. /***/ }),
  31143. /* 239 */
  31144. /***/ (function(module, exports, __webpack_require__) {
  31145. // style-loader: Adds some css to the DOM by adding a <style> tag
  31146. // load the styles
  31147. var content = __webpack_require__(132);
  31148. if(typeof content === 'string') content = [[module.i, content, '']];
  31149. // add the styles to the DOM
  31150. var update = __webpack_require__(9)(content, {});
  31151. if(content.locals) module.exports = content.locals;
  31152. // Hot Module Replacement
  31153. if(false) {
  31154. // When the styles change, update the <style> tags
  31155. if(!content.locals) {
  31156. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./list.less", function() {
  31157. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./list.less");
  31158. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31159. update(newContent);
  31160. });
  31161. }
  31162. // When the module is disposed, remove the <style> tags
  31163. module.hot.dispose(function() { update(); });
  31164. }
  31165. /***/ }),
  31166. /* 240 */
  31167. /***/ (function(module, exports, __webpack_require__) {
  31168. // style-loader: Adds some css to the DOM by adding a <style> tag
  31169. // load the styles
  31170. var content = __webpack_require__(133);
  31171. if(typeof content === 'string') content = [[module.i, content, '']];
  31172. // add the styles to the DOM
  31173. var update = __webpack_require__(9)(content, {});
  31174. if(content.locals) module.exports = content.locals;
  31175. // Hot Module Replacement
  31176. if(false) {
  31177. // When the styles change, update the <style> tags
  31178. if(!content.locals) {
  31179. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./panel.less", function() {
  31180. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./panel.less");
  31181. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31182. update(newContent);
  31183. });
  31184. }
  31185. // When the module is disposed, remove the <style> tags
  31186. module.hot.dispose(function() { update(); });
  31187. }
  31188. /***/ }),
  31189. /* 241 */
  31190. /***/ (function(module, exports, __webpack_require__) {
  31191. // style-loader: Adds some css to the DOM by adding a <style> tag
  31192. // load the styles
  31193. var content = __webpack_require__(134);
  31194. if(typeof content === 'string') content = [[module.i, content, '']];
  31195. // add the styles to the DOM
  31196. var update = __webpack_require__(9)(content, {});
  31197. if(content.locals) module.exports = content.locals;
  31198. // Hot Module Replacement
  31199. if(false) {
  31200. // When the styles change, update the <style> tags
  31201. if(!content.locals) {
  31202. module.hot.accept("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./searchbar.less", function() {
  31203. var newContent = require("!!../../node_modules/[email protected]@css-loader/index.js!../../node_modules/[email protected]@less-loader/dist/index.js!./searchbar.less");
  31204. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  31205. update(newContent);
  31206. });
  31207. }
  31208. // When the module is disposed, remove the <style> tags
  31209. module.hot.dispose(function() { update(); });
  31210. }
  31211. /***/ }),
  31212. /* 242 */
  31213. /***/ (function(module, exports) {
  31214. 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=="
  31215. /***/ }),
  31216. /* 243 */
  31217. /***/ (function(module, exports) {
  31218. 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=="
  31219. /***/ }),
  31220. /* 244 */
  31221. /***/ (function(module, exports) {
  31222. 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=="
  31223. /***/ }),
  31224. /* 245 */
  31225. /***/ (function(module, exports, __webpack_require__) {
  31226. "use strict";
  31227. /**
  31228. * @author oldj
  31229. * @blog https://oldj.net
  31230. */
  31231. module.exports = (element) => {
  31232. let rect = element.getBoundingClientRect()
  31233. let docEl = document.documentElement
  31234. return (
  31235. rect.top >= 0 &&
  31236. rect.left >= 0 &&
  31237. rect.bottom <= (window.innerHeight || docEl.clientHeight) &&
  31238. rect.right <= (window.innerWidth || docEl.clientWidth)
  31239. )
  31240. }
  31241. /***/ }),
  31242. /* 246 */
  31243. /***/ (function(module, exports, __webpack_require__) {
  31244. var map = {
  31245. "./alert": 36,
  31246. "./alert.js": 36,
  31247. "./check_hosts_refresh": 37,
  31248. "./check_hosts_refresh.js": 37,
  31249. "./del_hosts": 38,
  31250. "./del_hosts.js": 38,
  31251. "./esc": 39,
  31252. "./esc.js": 39,
  31253. "./get_on_hosts": 40,
  31254. "./get_on_hosts.js": 40,
  31255. "./index": 30,
  31256. "./index.js": 30,
  31257. "./list_updated": 17,
  31258. "./list_updated.js": 17,
  31259. "./reload": 41,
  31260. "./reload.js": 41,
  31261. "./save": 24,
  31262. "./save.js": 24,
  31263. "./sort": 42,
  31264. "./sort.js": 42,
  31265. "./sudo_cancel": 43,
  31266. "./sudo_cancel.js": 43,
  31267. "./sudo_pswd": 44,
  31268. "./sudo_pswd.js": 44,
  31269. "./toggle_hosts": 45,
  31270. "./toggle_hosts.js": 45,
  31271. "./top_toggle": 46,
  31272. "./top_toggle.js": 46,
  31273. "./update_hosts": 47,
  31274. "./update_hosts.js": 47
  31275. };
  31276. function webpackContext(req) {
  31277. return __webpack_require__(webpackContextResolve(req));
  31278. };
  31279. function webpackContextResolve(req) {
  31280. var id = map[req];
  31281. if(!(id + 1)) // check for number or string
  31282. throw new Error("Cannot find module '" + req + "'.");
  31283. return id;
  31284. };
  31285. webpackContext.keys = function webpackContextKeys() {
  31286. return Object.keys(map);
  31287. };
  31288. webpackContext.resolve = webpackContextResolve;
  31289. module.exports = webpackContext;
  31290. webpackContext.id = 246;
  31291. /***/ }),
  31292. /* 247 */
  31293. /***/ (function(module, exports, __webpack_require__) {
  31294. var map = {
  31295. "./alert.js": 36,
  31296. "./check_hosts_refresh.js": 37,
  31297. "./del_hosts.js": 38,
  31298. "./esc.js": 39,
  31299. "./get_on_hosts.js": 40,
  31300. "./index.js": 30,
  31301. "./list_updated.js": 17,
  31302. "./reload.js": 41,
  31303. "./save.js": 24,
  31304. "./sort.js": 42,
  31305. "./sudo_cancel.js": 43,
  31306. "./sudo_pswd.js": 44,
  31307. "./toggle_hosts.js": 45,
  31308. "./top_toggle.js": 46,
  31309. "./update_hosts.js": 47
  31310. };
  31311. function webpackContext(req) {
  31312. return __webpack_require__(webpackContextResolve(req));
  31313. };
  31314. function webpackContextResolve(req) {
  31315. var id = map[req];
  31316. if(!(id + 1)) // check for number or string
  31317. throw new Error("Cannot find module '" + req + "'.");
  31318. return id;
  31319. };
  31320. webpackContext.keys = function webpackContextKeys() {
  31321. return Object.keys(map);
  31322. };
  31323. webpackContext.resolve = webpackContextResolve;
  31324. module.exports = webpackContext;
  31325. webpackContext.id = 247;
  31326. /***/ })
  31327. /******/ ]);
  31328. //# sourceMappingURL=bundle.js.map