bundle.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092
  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 = 148);
  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__(81);
  375. var invariant = __webpack_require__(0);
  376. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  377. var Flags = ReactDOMComponentFlags;
  378. var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
  379. /**
  380. * Check if a given node should be cached.
  381. */
  382. function shouldPrecacheNode(node, nodeID) {
  383. return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
  384. }
  385. /**
  386. * Drill down (through composites and empty components) until we get a host or
  387. * host text component.
  388. *
  389. * This is pretty polymorphic but unavoidable with the current structure we have
  390. * for `_renderedChildren`.
  391. */
  392. function getRenderedHostOrTextFromComponent(component) {
  393. var rendered;
  394. while (rendered = component._renderedComponent) {
  395. component = rendered;
  396. }
  397. return component;
  398. }
  399. /**
  400. * Populate `_hostNode` on the rendered host/text component with the given
  401. * DOM node. The passed `inst` can be a composite.
  402. */
  403. function precacheNode(inst, node) {
  404. var hostInst = getRenderedHostOrTextFromComponent(inst);
  405. hostInst._hostNode = node;
  406. node[internalInstanceKey] = hostInst;
  407. }
  408. function uncacheNode(inst) {
  409. var node = inst._hostNode;
  410. if (node) {
  411. delete node[internalInstanceKey];
  412. inst._hostNode = null;
  413. }
  414. }
  415. /**
  416. * Populate `_hostNode` on each child of `inst`, assuming that the children
  417. * match up with the DOM (element) children of `node`.
  418. *
  419. * We cache entire levels at once to avoid an n^2 problem where we access the
  420. * children of a node sequentially and have to walk from the start to our target
  421. * node every time.
  422. *
  423. * Since we update `_renderedChildren` and the actual DOM at (slightly)
  424. * different times, we could race here and see a newer `_renderedChildren` than
  425. * the DOM nodes we see. To avoid this, ReactMultiChild calls
  426. * `prepareToManageChildren` before we change `_renderedChildren`, at which
  427. * time the container's child nodes are always cached (until it unmounts).
  428. */
  429. function precacheChildNodes(inst, node) {
  430. if (inst._flags & Flags.hasCachedChildNodes) {
  431. return;
  432. }
  433. var children = inst._renderedChildren;
  434. var childNode = node.firstChild;
  435. outer: for (var name in children) {
  436. if (!children.hasOwnProperty(name)) {
  437. continue;
  438. }
  439. var childInst = children[name];
  440. var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
  441. if (childID === 0) {
  442. // We're currently unmounting this child in ReactMultiChild; skip it.
  443. continue;
  444. }
  445. // We assume the child nodes are in the same order as the child instances.
  446. for (; childNode !== null; childNode = childNode.nextSibling) {
  447. if (shouldPrecacheNode(childNode, childID)) {
  448. precacheNode(childInst, childNode);
  449. continue outer;
  450. }
  451. }
  452. // We reached the end of the DOM children without finding an ID match.
  453. true ? false ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0;
  454. }
  455. inst._flags |= Flags.hasCachedChildNodes;
  456. }
  457. /**
  458. * Given a DOM node, return the closest ReactDOMComponent or
  459. * ReactDOMTextComponent instance ancestor.
  460. */
  461. function getClosestInstanceFromNode(node) {
  462. if (node[internalInstanceKey]) {
  463. return node[internalInstanceKey];
  464. }
  465. // Walk up the tree until we find an ancestor whose instance we have cached.
  466. var parents = [];
  467. while (!node[internalInstanceKey]) {
  468. parents.push(node);
  469. if (node.parentNode) {
  470. node = node.parentNode;
  471. } else {
  472. // Top of the tree. This node must not be part of a React tree (or is
  473. // unmounted, potentially).
  474. return null;
  475. }
  476. }
  477. var closest;
  478. var inst;
  479. for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
  480. closest = inst;
  481. if (parents.length) {
  482. precacheChildNodes(inst, node);
  483. }
  484. }
  485. return closest;
  486. }
  487. /**
  488. * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
  489. * instance, or null if the node was not rendered by this React.
  490. */
  491. function getInstanceFromNode(node) {
  492. var inst = getClosestInstanceFromNode(node);
  493. if (inst != null && inst._hostNode === node) {
  494. return inst;
  495. } else {
  496. return null;
  497. }
  498. }
  499. /**
  500. * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
  501. * DOM node.
  502. */
  503. function getNodeFromInstance(inst) {
  504. // Without this first invariant, passing a non-DOM-component triggers the next
  505. // invariant for a missing parent, which is super confusing.
  506. !(inst._hostNode !== undefined) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  507. if (inst._hostNode) {
  508. return inst._hostNode;
  509. }
  510. // Walk up the tree until we find an ancestor whose DOM node we have cached.
  511. var parents = [];
  512. while (!inst._hostNode) {
  513. parents.push(inst);
  514. !inst._hostParent ? false ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0;
  515. inst = inst._hostParent;
  516. }
  517. // Now parents contains each ancestor that does *not* have a cached native
  518. // node, and `inst` is the deepest ancestor that does.
  519. for (; parents.length; inst = parents.pop()) {
  520. precacheChildNodes(inst, inst._hostNode);
  521. }
  522. return inst._hostNode;
  523. }
  524. var ReactDOMComponentTree = {
  525. getClosestInstanceFromNode: getClosestInstanceFromNode,
  526. getInstanceFromNode: getInstanceFromNode,
  527. getNodeFromInstance: getNodeFromInstance,
  528. precacheChildNodes: precacheChildNodes,
  529. precacheNode: precacheNode,
  530. uncacheNode: uncacheNode
  531. };
  532. module.exports = ReactDOMComponentTree;
  533. /***/ }),
  534. /* 6 */
  535. /***/ (function(module, exports) {
  536. /*
  537. MIT License http://www.opensource.org/licenses/mit-license.php
  538. Author Tobias Koppers @sokra
  539. */
  540. // css base code, injected by the css-loader
  541. module.exports = function() {
  542. var list = [];
  543. // return the list of modules as css string
  544. list.toString = function toString() {
  545. var result = [];
  546. for(var i = 0; i < this.length; i++) {
  547. var item = this[i];
  548. if(item[2]) {
  549. result.push("@media " + item[2] + "{" + item[1] + "}");
  550. } else {
  551. result.push(item[1]);
  552. }
  553. }
  554. return result.join("");
  555. };
  556. // import a list of modules into the list
  557. list.i = function(modules, mediaQuery) {
  558. if(typeof modules === "string")
  559. modules = [[null, modules, ""]];
  560. var alreadyImportedModules = {};
  561. for(var i = 0; i < this.length; i++) {
  562. var id = this[i][0];
  563. if(typeof id === "number")
  564. alreadyImportedModules[id] = true;
  565. }
  566. for(i = 0; i < modules.length; i++) {
  567. var item = modules[i];
  568. // skip already imported module
  569. // this implementation is not 100% perfect for weird media query combinations
  570. // when a module is imported multiple times with different media queries.
  571. // I hope this will never occur (Hey this way we have smaller bundles)
  572. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  573. if(mediaQuery && !item[2]) {
  574. item[2] = mediaQuery;
  575. } else if(mediaQuery) {
  576. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  577. }
  578. list.push(item);
  579. }
  580. }
  581. };
  582. return list;
  583. };
  584. /***/ }),
  585. /* 7 */
  586. /***/ (function(module, exports, __webpack_require__) {
  587. "use strict";
  588. module.exports = __webpack_require__(21);
  589. /***/ }),
  590. /* 8 */
  591. /***/ (function(module, exports, __webpack_require__) {
  592. /*
  593. MIT License http://www.opensource.org/licenses/mit-license.php
  594. Author Tobias Koppers @sokra
  595. */
  596. var stylesInDom = {},
  597. memoize = function(fn) {
  598. var memo;
  599. return function () {
  600. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  601. return memo;
  602. };
  603. },
  604. isOldIE = memoize(function() {
  605. // Test for IE <= 9 as proposed by Browserhacks
  606. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  607. // Tests for existence of standard globals is to allow style-loader
  608. // to operate correctly into non-standard environments
  609. // @see https://github.com/webpack-contrib/style-loader/issues/177
  610. return window && document && document.all && !window.atob;
  611. }),
  612. getElement = (function(fn) {
  613. var memo = {};
  614. return function(selector) {
  615. if (typeof memo[selector] === "undefined") {
  616. memo[selector] = fn.call(this, selector);
  617. }
  618. return memo[selector]
  619. };
  620. })(function (styleTarget) {
  621. return document.querySelector(styleTarget)
  622. }),
  623. singletonElement = null,
  624. singletonCounter = 0,
  625. styleElementsInsertedAtTop = [],
  626. fixUrls = __webpack_require__(105);
  627. module.exports = function(list, options) {
  628. if(typeof DEBUG !== "undefined" && DEBUG) {
  629. if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  630. }
  631. options = options || {};
  632. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  633. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  634. // tags it will allow on a page
  635. if (typeof options.singleton === "undefined") options.singleton = isOldIE();
  636. // By default, add <style> tags to the <head> element
  637. if (typeof options.insertInto === "undefined") options.insertInto = "head";
  638. // By default, add <style> tags to the bottom of the target
  639. if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
  640. var styles = listToStyles(list);
  641. addStylesToDom(styles, options);
  642. return function update(newList) {
  643. var mayRemove = [];
  644. for(var i = 0; i < styles.length; i++) {
  645. var item = styles[i];
  646. var domStyle = stylesInDom[item.id];
  647. domStyle.refs--;
  648. mayRemove.push(domStyle);
  649. }
  650. if(newList) {
  651. var newStyles = listToStyles(newList);
  652. addStylesToDom(newStyles, options);
  653. }
  654. for(var i = 0; i < mayRemove.length; i++) {
  655. var domStyle = mayRemove[i];
  656. if(domStyle.refs === 0) {
  657. for(var j = 0; j < domStyle.parts.length; j++)
  658. domStyle.parts[j]();
  659. delete stylesInDom[domStyle.id];
  660. }
  661. }
  662. };
  663. };
  664. function addStylesToDom(styles, options) {
  665. for(var i = 0; i < styles.length; i++) {
  666. var item = styles[i];
  667. var domStyle = stylesInDom[item.id];
  668. if(domStyle) {
  669. domStyle.refs++;
  670. for(var j = 0; j < domStyle.parts.length; j++) {
  671. domStyle.parts[j](item.parts[j]);
  672. }
  673. for(; j < item.parts.length; j++) {
  674. domStyle.parts.push(addStyle(item.parts[j], options));
  675. }
  676. } else {
  677. var parts = [];
  678. for(var j = 0; j < item.parts.length; j++) {
  679. parts.push(addStyle(item.parts[j], options));
  680. }
  681. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  682. }
  683. }
  684. }
  685. function listToStyles(list) {
  686. var styles = [];
  687. var newStyles = {};
  688. for(var i = 0; i < list.length; i++) {
  689. var item = list[i];
  690. var id = item[0];
  691. var css = item[1];
  692. var media = item[2];
  693. var sourceMap = item[3];
  694. var part = {css: css, media: media, sourceMap: sourceMap};
  695. if(!newStyles[id])
  696. styles.push(newStyles[id] = {id: id, parts: [part]});
  697. else
  698. newStyles[id].parts.push(part);
  699. }
  700. return styles;
  701. }
  702. function insertStyleElement(options, styleElement) {
  703. var styleTarget = getElement(options.insertInto)
  704. if (!styleTarget) {
  705. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  706. }
  707. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  708. if (options.insertAt === "top") {
  709. if(!lastStyleElementInsertedAtTop) {
  710. styleTarget.insertBefore(styleElement, styleTarget.firstChild);
  711. } else if(lastStyleElementInsertedAtTop.nextSibling) {
  712. styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
  713. } else {
  714. styleTarget.appendChild(styleElement);
  715. }
  716. styleElementsInsertedAtTop.push(styleElement);
  717. } else if (options.insertAt === "bottom") {
  718. styleTarget.appendChild(styleElement);
  719. } else {
  720. throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  721. }
  722. }
  723. function removeStyleElement(styleElement) {
  724. styleElement.parentNode.removeChild(styleElement);
  725. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  726. if(idx >= 0) {
  727. styleElementsInsertedAtTop.splice(idx, 1);
  728. }
  729. }
  730. function createStyleElement(options) {
  731. var styleElement = document.createElement("style");
  732. options.attrs.type = "text/css";
  733. attachTagAttrs(styleElement, options.attrs);
  734. insertStyleElement(options, styleElement);
  735. return styleElement;
  736. }
  737. function createLinkElement(options) {
  738. var linkElement = document.createElement("link");
  739. options.attrs.type = "text/css";
  740. options.attrs.rel = "stylesheet";
  741. attachTagAttrs(linkElement, options.attrs);
  742. insertStyleElement(options, linkElement);
  743. return linkElement;
  744. }
  745. function attachTagAttrs(element, attrs) {
  746. Object.keys(attrs).forEach(function (key) {
  747. element.setAttribute(key, attrs[key]);
  748. });
  749. }
  750. function addStyle(obj, options) {
  751. var styleElement, update, remove;
  752. if (options.singleton) {
  753. var styleIndex = singletonCounter++;
  754. styleElement = singletonElement || (singletonElement = createStyleElement(options));
  755. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
  756. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
  757. } else if(obj.sourceMap &&
  758. typeof URL === "function" &&
  759. typeof URL.createObjectURL === "function" &&
  760. typeof URL.revokeObjectURL === "function" &&
  761. typeof Blob === "function" &&
  762. typeof btoa === "function") {
  763. styleElement = createLinkElement(options);
  764. update = updateLink.bind(null, styleElement, options);
  765. remove = function() {
  766. removeStyleElement(styleElement);
  767. if(styleElement.href)
  768. URL.revokeObjectURL(styleElement.href);
  769. };
  770. } else {
  771. styleElement = createStyleElement(options);
  772. update = applyToTag.bind(null, styleElement);
  773. remove = function() {
  774. removeStyleElement(styleElement);
  775. };
  776. }
  777. update(obj);
  778. return function updateStyle(newObj) {
  779. if(newObj) {
  780. if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
  781. return;
  782. update(obj = newObj);
  783. } else {
  784. remove();
  785. }
  786. };
  787. }
  788. var replaceText = (function () {
  789. var textStore = [];
  790. return function (index, replacement) {
  791. textStore[index] = replacement;
  792. return textStore.filter(Boolean).join('\n');
  793. };
  794. })();
  795. function applyToSingletonTag(styleElement, index, remove, obj) {
  796. var css = remove ? "" : obj.css;
  797. if (styleElement.styleSheet) {
  798. styleElement.styleSheet.cssText = replaceText(index, css);
  799. } else {
  800. var cssNode = document.createTextNode(css);
  801. var childNodes = styleElement.childNodes;
  802. if (childNodes[index]) styleElement.removeChild(childNodes[index]);
  803. if (childNodes.length) {
  804. styleElement.insertBefore(cssNode, childNodes[index]);
  805. } else {
  806. styleElement.appendChild(cssNode);
  807. }
  808. }
  809. }
  810. function applyToTag(styleElement, obj) {
  811. var css = obj.css;
  812. var media = obj.media;
  813. if(media) {
  814. styleElement.setAttribute("media", media)
  815. }
  816. if(styleElement.styleSheet) {
  817. styleElement.styleSheet.cssText = css;
  818. } else {
  819. while(styleElement.firstChild) {
  820. styleElement.removeChild(styleElement.firstChild);
  821. }
  822. styleElement.appendChild(document.createTextNode(css));
  823. }
  824. }
  825. function updateLink(linkElement, options, obj) {
  826. var css = obj.css;
  827. var sourceMap = obj.sourceMap;
  828. /* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  829. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  830. on by default. Otherwise default to the convertToAbsoluteUrls option
  831. directly
  832. */
  833. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  834. if (options.convertToAbsoluteUrls || autoFixUrls){
  835. css = fixUrls(css);
  836. }
  837. if(sourceMap) {
  838. // http://stackoverflow.com/a/26603875
  839. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  840. }
  841. var blob = new Blob([css], { type: "text/css" });
  842. var oldSrc = linkElement.href;
  843. linkElement.href = URL.createObjectURL(blob);
  844. if(oldSrc)
  845. URL.revokeObjectURL(oldSrc);
  846. }
  847. /***/ }),
  848. /* 9 */
  849. /***/ (function(module, exports, __webpack_require__) {
  850. "use strict";
  851. /**
  852. * Copyright (c) 2013-present, Facebook, Inc.
  853. * All rights reserved.
  854. *
  855. * This source code is licensed under the BSD-style license found in the
  856. * LICENSE file in the root directory of this source tree. An additional grant
  857. * of patent rights can be found in the PATENTS file in the same directory.
  858. *
  859. */
  860. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  861. /**
  862. * Simple, lightweight module assisting with the detection and context of
  863. * Worker. Helps avoid circular dependencies and allows code to reason about
  864. * whether or not they are in a Worker, even if they never include the main
  865. * `ReactWorker` dependency.
  866. */
  867. var ExecutionEnvironment = {
  868. canUseDOM: canUseDOM,
  869. canUseWorkers: typeof Worker !== 'undefined',
  870. canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
  871. canUseViewport: canUseDOM && !!window.screen,
  872. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  873. };
  874. module.exports = ExecutionEnvironment;
  875. /***/ }),
  876. /* 10 */
  877. /***/ (function(module, exports, __webpack_require__) {
  878. "use strict";
  879. /**
  880. * Copyright (c) 2013-present, Facebook, Inc.
  881. * All rights reserved.
  882. *
  883. * This source code is licensed under the BSD-style license found in the
  884. * LICENSE file in the root directory of this source tree. An additional grant
  885. * of patent rights can be found in the PATENTS file in the same directory.
  886. *
  887. *
  888. */
  889. function makeEmptyFunction(arg) {
  890. return function () {
  891. return arg;
  892. };
  893. }
  894. /**
  895. * This function accepts and discards inputs; it has no side effects. This is
  896. * primarily useful idiomatically for overridable function endpoints which
  897. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  898. */
  899. var emptyFunction = function emptyFunction() {};
  900. emptyFunction.thatReturns = makeEmptyFunction;
  901. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  902. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  903. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  904. emptyFunction.thatReturnsThis = function () {
  905. return this;
  906. };
  907. emptyFunction.thatReturnsArgument = function (arg) {
  908. return arg;
  909. };
  910. module.exports = emptyFunction;
  911. /***/ }),
  912. /* 11 */
  913. /***/ (function(module, exports, __webpack_require__) {
  914. "use strict";
  915. /**
  916. * Copyright 2016-present, Facebook, Inc.
  917. * All rights reserved.
  918. *
  919. * This source code is licensed under the BSD-style license found in the
  920. * LICENSE file in the root directory of this source tree. An additional grant
  921. * of patent rights can be found in the PATENTS file in the same directory.
  922. *
  923. *
  924. */
  925. // Trust the developer to only use ReactInstrumentation with a __DEV__ check
  926. var debugTool = null;
  927. if (false) {
  928. var ReactDebugTool = require('./ReactDebugTool');
  929. debugTool = ReactDebugTool;
  930. }
  931. module.exports = { debugTool: debugTool };
  932. /***/ }),
  933. /* 12 */
  934. /***/ (function(module, exports, __webpack_require__) {
  935. "use strict";
  936. /**
  937. * Copyright 2013-present, Facebook, Inc.
  938. * All rights reserved.
  939. *
  940. * This source code is licensed under the BSD-style license found in the
  941. * LICENSE file in the root directory of this source tree. An additional grant
  942. * of patent rights can be found in the PATENTS file in the same directory.
  943. *
  944. */
  945. var _prodInvariant = __webpack_require__(2),
  946. _assign = __webpack_require__(3);
  947. var CallbackQueue = __webpack_require__(79);
  948. var PooledClass = __webpack_require__(15);
  949. var ReactFeatureFlags = __webpack_require__(84);
  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__(15);
  1162. var emptyFunction = __webpack_require__(10);
  1163. var warning = __webpack_require__(1);
  1164. var didWarnForAddedNewProperty = false;
  1165. var isProxySupported = typeof Proxy === 'function';
  1166. var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
  1167. /**
  1168. * @interface Event
  1169. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  1170. */
  1171. var EventInterface = {
  1172. type: null,
  1173. target: null,
  1174. // currentTarget is set when dispatching; no use in copying it here
  1175. currentTarget: emptyFunction.thatReturnsNull,
  1176. eventPhase: null,
  1177. bubbles: null,
  1178. cancelable: null,
  1179. timeStamp: function (event) {
  1180. return event.timeStamp || Date.now();
  1181. },
  1182. defaultPrevented: null,
  1183. isTrusted: null
  1184. };
  1185. /**
  1186. * Synthetic events are dispatched by event plugins, typically in response to a
  1187. * top-level event delegation handler.
  1188. *
  1189. * These systems should generally use pooling to reduce the frequency of garbage
  1190. * collection. The system should check `isPersistent` to determine whether the
  1191. * event should be released into the pool after being dispatched. Users that
  1192. * need a persisted event should invoke `persist`.
  1193. *
  1194. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  1195. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  1196. * DOM interface; custom application-specific events can also subclass this.
  1197. *
  1198. * @param {object} dispatchConfig Configuration used to dispatch this event.
  1199. * @param {*} targetInst Marker identifying the event target.
  1200. * @param {object} nativeEvent Native browser event.
  1201. * @param {DOMEventTarget} nativeEventTarget Target node.
  1202. */
  1203. function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
  1204. if (false) {
  1205. // these have a getter/setter for warnings
  1206. delete this.nativeEvent;
  1207. delete this.preventDefault;
  1208. delete this.stopPropagation;
  1209. }
  1210. this.dispatchConfig = dispatchConfig;
  1211. this._targetInst = targetInst;
  1212. this.nativeEvent = nativeEvent;
  1213. var Interface = this.constructor.Interface;
  1214. for (var propName in Interface) {
  1215. if (!Interface.hasOwnProperty(propName)) {
  1216. continue;
  1217. }
  1218. if (false) {
  1219. delete this[propName]; // this has a getter/setter for warnings
  1220. }
  1221. var normalize = Interface[propName];
  1222. if (normalize) {
  1223. this[propName] = normalize(nativeEvent);
  1224. } else {
  1225. if (propName === 'target') {
  1226. this.target = nativeEventTarget;
  1227. } else {
  1228. this[propName] = nativeEvent[propName];
  1229. }
  1230. }
  1231. }
  1232. var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
  1233. if (defaultPrevented) {
  1234. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  1235. } else {
  1236. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  1237. }
  1238. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  1239. return this;
  1240. }
  1241. _assign(SyntheticEvent.prototype, {
  1242. preventDefault: function () {
  1243. this.defaultPrevented = true;
  1244. var event = this.nativeEvent;
  1245. if (!event) {
  1246. return;
  1247. }
  1248. if (event.preventDefault) {
  1249. event.preventDefault();
  1250. } else if (typeof event.returnValue !== 'unknown') {
  1251. // eslint-disable-line valid-typeof
  1252. event.returnValue = false;
  1253. }
  1254. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  1255. },
  1256. stopPropagation: function () {
  1257. var event = this.nativeEvent;
  1258. if (!event) {
  1259. return;
  1260. }
  1261. if (event.stopPropagation) {
  1262. event.stopPropagation();
  1263. } else if (typeof event.cancelBubble !== 'unknown') {
  1264. // eslint-disable-line valid-typeof
  1265. // The ChangeEventPlugin registers a "propertychange" event for
  1266. // IE. This event does not support bubbling or cancelling, and
  1267. // any references to cancelBubble throw "Member not found". A
  1268. // typeof check of "unknown" circumvents this issue (and is also
  1269. // IE specific).
  1270. event.cancelBubble = true;
  1271. }
  1272. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  1273. },
  1274. /**
  1275. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  1276. * them back into the pool. This allows a way to hold onto a reference that
  1277. * won't be added back into the pool.
  1278. */
  1279. persist: function () {
  1280. this.isPersistent = emptyFunction.thatReturnsTrue;
  1281. },
  1282. /**
  1283. * Checks if this event should be released back into the pool.
  1284. *
  1285. * @return {boolean} True if this should not be released, false otherwise.
  1286. */
  1287. isPersistent: emptyFunction.thatReturnsFalse,
  1288. /**
  1289. * `PooledClass` looks for `destructor` on each instance it releases.
  1290. */
  1291. destructor: function () {
  1292. var Interface = this.constructor.Interface;
  1293. for (var propName in Interface) {
  1294. if (false) {
  1295. Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
  1296. } else {
  1297. this[propName] = null;
  1298. }
  1299. }
  1300. for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
  1301. this[shouldBeReleasedProperties[i]] = null;
  1302. }
  1303. if (false) {
  1304. Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
  1305. Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
  1306. Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
  1307. }
  1308. }
  1309. });
  1310. SyntheticEvent.Interface = EventInterface;
  1311. if (false) {
  1312. if (isProxySupported) {
  1313. /*eslint-disable no-func-assign */
  1314. SyntheticEvent = new Proxy(SyntheticEvent, {
  1315. construct: function (target, args) {
  1316. return this.apply(target, Object.create(target.prototype), args);
  1317. },
  1318. apply: function (constructor, that, args) {
  1319. return new Proxy(constructor.apply(that, args), {
  1320. set: function (target, prop, value) {
  1321. if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
  1322. process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
  1323. didWarnForAddedNewProperty = true;
  1324. }
  1325. target[prop] = value;
  1326. return true;
  1327. }
  1328. });
  1329. }
  1330. });
  1331. /*eslint-enable no-func-assign */
  1332. }
  1333. }
  1334. /**
  1335. * Helper to reduce boilerplate when creating subclasses.
  1336. *
  1337. * @param {function} Class
  1338. * @param {?object} Interface
  1339. */
  1340. SyntheticEvent.augmentClass = function (Class, Interface) {
  1341. var Super = this;
  1342. var E = function () {};
  1343. E.prototype = Super.prototype;
  1344. var prototype = new E();
  1345. _assign(prototype, Class.prototype);
  1346. Class.prototype = prototype;
  1347. Class.prototype.constructor = Class;
  1348. Class.Interface = _assign({}, Super.Interface, Interface);
  1349. Class.augmentClass = Super.augmentClass;
  1350. PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
  1351. };
  1352. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
  1353. module.exports = SyntheticEvent;
  1354. /**
  1355. * Helper to nullify syntheticEvent instance properties when destructing
  1356. *
  1357. * @param {object} SyntheticEvent
  1358. * @param {String} propName
  1359. * @return {object} defineProperty object
  1360. */
  1361. function getPooledWarningPropertyDefinition(propName, getVal) {
  1362. var isFunction = typeof getVal === 'function';
  1363. return {
  1364. configurable: true,
  1365. set: set,
  1366. get: get
  1367. };
  1368. function set(val) {
  1369. var action = isFunction ? 'setting the method' : 'setting the property';
  1370. warn(action, 'This is effectively a no-op');
  1371. return val;
  1372. }
  1373. function get() {
  1374. var action = isFunction ? 'accessing the method' : 'accessing the property';
  1375. var result = isFunction ? 'This is a no-op function' : 'This is set to null';
  1376. warn(action, result);
  1377. return getVal;
  1378. }
  1379. function warn(action, result) {
  1380. var warningCondition = false;
  1381. false ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
  1382. }
  1383. }
  1384. /***/ }),
  1385. /* 14 */
  1386. /***/ (function(module, exports, __webpack_require__) {
  1387. "use strict";
  1388. /**
  1389. * Copyright 2013-present, Facebook, Inc.
  1390. * All rights reserved.
  1391. *
  1392. * This source code is licensed under the BSD-style license found in the
  1393. * LICENSE file in the root directory of this source tree. An additional grant
  1394. * of patent rights can be found in the PATENTS file in the same directory.
  1395. *
  1396. *
  1397. */
  1398. /**
  1399. * Keeps track of the current owner.
  1400. *
  1401. * The current owner is the component who should own any components that are
  1402. * currently being constructed.
  1403. */
  1404. var ReactCurrentOwner = {
  1405. /**
  1406. * @internal
  1407. * @type {ReactComponent}
  1408. */
  1409. current: null
  1410. };
  1411. module.exports = ReactCurrentOwner;
  1412. /***/ }),
  1413. /* 15 */
  1414. /***/ (function(module, exports, __webpack_require__) {
  1415. "use strict";
  1416. /**
  1417. * Copyright 2013-present, Facebook, Inc.
  1418. * All rights reserved.
  1419. *
  1420. * This source code is licensed under the BSD-style license found in the
  1421. * LICENSE file in the root directory of this source tree. An additional grant
  1422. * of patent rights can be found in the PATENTS file in the same directory.
  1423. *
  1424. *
  1425. */
  1426. var _prodInvariant = __webpack_require__(2);
  1427. var invariant = __webpack_require__(0);
  1428. /**
  1429. * Static poolers. Several custom versions for each potential number of
  1430. * arguments. A completely generic pooler is easy to implement, but would
  1431. * require accessing the `arguments` object. In each of these, `this` refers to
  1432. * the Class itself, not an instance. If any others are needed, simply add them
  1433. * here, or in their own files.
  1434. */
  1435. var oneArgumentPooler = function (copyFieldsFrom) {
  1436. var Klass = this;
  1437. if (Klass.instancePool.length) {
  1438. var instance = Klass.instancePool.pop();
  1439. Klass.call(instance, copyFieldsFrom);
  1440. return instance;
  1441. } else {
  1442. return new Klass(copyFieldsFrom);
  1443. }
  1444. };
  1445. var twoArgumentPooler = function (a1, a2) {
  1446. var Klass = this;
  1447. if (Klass.instancePool.length) {
  1448. var instance = Klass.instancePool.pop();
  1449. Klass.call(instance, a1, a2);
  1450. return instance;
  1451. } else {
  1452. return new Klass(a1, a2);
  1453. }
  1454. };
  1455. var threeArgumentPooler = function (a1, a2, a3) {
  1456. var Klass = this;
  1457. if (Klass.instancePool.length) {
  1458. var instance = Klass.instancePool.pop();
  1459. Klass.call(instance, a1, a2, a3);
  1460. return instance;
  1461. } else {
  1462. return new Klass(a1, a2, a3);
  1463. }
  1464. };
  1465. var fourArgumentPooler = function (a1, a2, a3, a4) {
  1466. var Klass = this;
  1467. if (Klass.instancePool.length) {
  1468. var instance = Klass.instancePool.pop();
  1469. Klass.call(instance, a1, a2, a3, a4);
  1470. return instance;
  1471. } else {
  1472. return new Klass(a1, a2, a3, a4);
  1473. }
  1474. };
  1475. var standardReleaser = function (instance) {
  1476. var Klass = this;
  1477. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  1478. instance.destructor();
  1479. if (Klass.instancePool.length < Klass.poolSize) {
  1480. Klass.instancePool.push(instance);
  1481. }
  1482. };
  1483. var DEFAULT_POOL_SIZE = 10;
  1484. var DEFAULT_POOLER = oneArgumentPooler;
  1485. /**
  1486. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  1487. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  1488. * you give this may have a `poolSize` property, and will look for a
  1489. * prototypical `destructor` on instances.
  1490. *
  1491. * @param {Function} CopyConstructor Constructor that can be used to reset.
  1492. * @param {Function} pooler Customizable pooler.
  1493. */
  1494. var addPoolingTo = function (CopyConstructor, pooler) {
  1495. // Casting as any so that flow ignores the actual implementation and trusts
  1496. // it to match the type we declared
  1497. var NewKlass = CopyConstructor;
  1498. NewKlass.instancePool = [];
  1499. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  1500. if (!NewKlass.poolSize) {
  1501. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  1502. }
  1503. NewKlass.release = standardReleaser;
  1504. return NewKlass;
  1505. };
  1506. var PooledClass = {
  1507. addPoolingTo: addPoolingTo,
  1508. oneArgumentPooler: oneArgumentPooler,
  1509. twoArgumentPooler: twoArgumentPooler,
  1510. threeArgumentPooler: threeArgumentPooler,
  1511. fourArgumentPooler: fourArgumentPooler
  1512. };
  1513. module.exports = PooledClass;
  1514. /***/ }),
  1515. /* 16 */
  1516. /***/ (function(module, exports, __webpack_require__) {
  1517. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  1518. Copyright (c) 2016 Jed Watson.
  1519. Licensed under the MIT License (MIT), see
  1520. http://jedwatson.github.io/classnames
  1521. */
  1522. /* global define */
  1523. (function () {
  1524. 'use strict';
  1525. var hasOwn = {}.hasOwnProperty;
  1526. function classNames () {
  1527. var classes = [];
  1528. for (var i = 0; i < arguments.length; i++) {
  1529. var arg = arguments[i];
  1530. if (!arg) continue;
  1531. var argType = typeof arg;
  1532. if (argType === 'string' || argType === 'number') {
  1533. classes.push(arg);
  1534. } else if (Array.isArray(arg)) {
  1535. classes.push(classNames.apply(null, arg));
  1536. } else if (argType === 'object') {
  1537. for (var key in arg) {
  1538. if (hasOwn.call(arg, key) && arg[key]) {
  1539. classes.push(key);
  1540. }
  1541. }
  1542. }
  1543. }
  1544. return classes.join(' ');
  1545. }
  1546. if (typeof module !== 'undefined' && module.exports) {
  1547. module.exports = classNames;
  1548. } else if (true) {
  1549. // register as 'classnames', consistent with npm package name
  1550. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
  1551. return classNames;
  1552. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  1553. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1554. } else {
  1555. window.classNames = classNames;
  1556. }
  1557. }());
  1558. /***/ }),
  1559. /* 17 */
  1560. /***/ (function(module, exports, __webpack_require__) {
  1561. "use strict";
  1562. /**
  1563. * @author oldj
  1564. * @blog https://oldj.net
  1565. */
  1566. var _Agent = __webpack_require__(4);
  1567. var _Agent2 = _interopRequireDefault(_Agent);
  1568. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1569. module.exports = function (app, new_list) {
  1570. var hosts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1571. var state = { list: new_list };
  1572. _Agent2.default.pact('getSysHosts').then(function (sys_hosts) {
  1573. state.sys_hosts = sys_hosts;
  1574. if (hosts) {
  1575. state.current = hosts;
  1576. }
  1577. var current = app.state.current;
  1578. if (current.is_sys) {
  1579. state.current = sys_hosts;
  1580. }
  1581. app.setState(state, function () {
  1582. if (hosts) {
  1583. _Agent2.default.emit('select', hosts.id);
  1584. }
  1585. });
  1586. });
  1587. };
  1588. /***/ }),
  1589. /* 18 */
  1590. /***/ (function(module, exports, __webpack_require__) {
  1591. "use strict";
  1592. /**
  1593. * Copyright 2015-present, Facebook, Inc.
  1594. * All rights reserved.
  1595. *
  1596. * This source code is licensed under the BSD-style license found in the
  1597. * LICENSE file in the root directory of this source tree. An additional grant
  1598. * of patent rights can be found in the PATENTS file in the same directory.
  1599. *
  1600. */
  1601. var DOMNamespaces = __webpack_require__(51);
  1602. var setInnerHTML = __webpack_require__(35);
  1603. var createMicrosoftUnsafeLocalFunction = __webpack_require__(59);
  1604. var setTextContent = __webpack_require__(96);
  1605. var ELEMENT_NODE_TYPE = 1;
  1606. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  1607. /**
  1608. * In IE (8-11) and Edge, appending nodes with no children is dramatically
  1609. * faster than appending a full subtree, so we essentially queue up the
  1610. * .appendChild calls here and apply them so each node is added to its parent
  1611. * before any children are added.
  1612. *
  1613. * In other browsers, doing so is slower or neutral compared to the other order
  1614. * (in Firefox, twice as slow) so we only do this inversion in IE.
  1615. *
  1616. * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
  1617. */
  1618. var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
  1619. function insertTreeChildren(tree) {
  1620. if (!enableLazy) {
  1621. return;
  1622. }
  1623. var node = tree.node;
  1624. var children = tree.children;
  1625. if (children.length) {
  1626. for (var i = 0; i < children.length; i++) {
  1627. insertTreeBefore(node, children[i], null);
  1628. }
  1629. } else if (tree.html != null) {
  1630. setInnerHTML(node, tree.html);
  1631. } else if (tree.text != null) {
  1632. setTextContent(node, tree.text);
  1633. }
  1634. }
  1635. var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
  1636. // DocumentFragments aren't actually part of the DOM after insertion so
  1637. // appending children won't update the DOM. We need to ensure the fragment
  1638. // is properly populated first, breaking out of our lazy approach for just
  1639. // this level. Also, some <object> plugins (like Flash Player) will read
  1640. // <param> nodes immediately upon insertion into the DOM, so <object>
  1641. // must also be populated prior to insertion into the DOM.
  1642. if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) {
  1643. insertTreeChildren(tree);
  1644. parentNode.insertBefore(tree.node, referenceNode);
  1645. } else {
  1646. parentNode.insertBefore(tree.node, referenceNode);
  1647. insertTreeChildren(tree);
  1648. }
  1649. });
  1650. function replaceChildWithTree(oldNode, newTree) {
  1651. oldNode.parentNode.replaceChild(newTree.node, oldNode);
  1652. insertTreeChildren(newTree);
  1653. }
  1654. function queueChild(parentTree, childTree) {
  1655. if (enableLazy) {
  1656. parentTree.children.push(childTree);
  1657. } else {
  1658. parentTree.node.appendChild(childTree.node);
  1659. }
  1660. }
  1661. function queueHTML(tree, html) {
  1662. if (enableLazy) {
  1663. tree.html = html;
  1664. } else {
  1665. setInnerHTML(tree.node, html);
  1666. }
  1667. }
  1668. function queueText(tree, text) {
  1669. if (enableLazy) {
  1670. tree.text = text;
  1671. } else {
  1672. setTextContent(tree.node, text);
  1673. }
  1674. }
  1675. function toString() {
  1676. return this.node.nodeName;
  1677. }
  1678. function DOMLazyTree(node) {
  1679. return {
  1680. node: node,
  1681. children: [],
  1682. html: null,
  1683. text: null,
  1684. toString: toString
  1685. };
  1686. }
  1687. DOMLazyTree.insertTreeBefore = insertTreeBefore;
  1688. DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
  1689. DOMLazyTree.queueChild = queueChild;
  1690. DOMLazyTree.queueHTML = queueHTML;
  1691. DOMLazyTree.queueText = queueText;
  1692. module.exports = DOMLazyTree;
  1693. /***/ }),
  1694. /* 19 */
  1695. /***/ (function(module, exports, __webpack_require__) {
  1696. "use strict";
  1697. /**
  1698. * Copyright 2013-present, Facebook, Inc.
  1699. * All rights reserved.
  1700. *
  1701. * This source code is licensed under the BSD-style license found in the
  1702. * LICENSE file in the root directory of this source tree. An additional grant
  1703. * of patent rights can be found in the PATENTS file in the same directory.
  1704. *
  1705. */
  1706. var _prodInvariant = __webpack_require__(2);
  1707. var invariant = __webpack_require__(0);
  1708. function checkMask(value, bitmask) {
  1709. return (value & bitmask) === bitmask;
  1710. }
  1711. var DOMPropertyInjection = {
  1712. /**
  1713. * Mapping from normalized, camelcased property names to a configuration that
  1714. * specifies how the associated DOM property should be accessed or rendered.
  1715. */
  1716. MUST_USE_PROPERTY: 0x1,
  1717. HAS_BOOLEAN_VALUE: 0x4,
  1718. HAS_NUMERIC_VALUE: 0x8,
  1719. HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
  1720. HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
  1721. /**
  1722. * Inject some specialized knowledge about the DOM. This takes a config object
  1723. * with the following properties:
  1724. *
  1725. * isCustomAttribute: function that given an attribute name will return true
  1726. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1727. * attributes where it's impossible to enumerate all of the possible
  1728. * attribute names,
  1729. *
  1730. * Properties: object mapping DOM property name to one of the
  1731. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1732. * it won't get written to the DOM.
  1733. *
  1734. * DOMAttributeNames: object mapping React attribute name to the DOM
  1735. * attribute name. Attribute names not specified use the **lowercase**
  1736. * normalized name.
  1737. *
  1738. * DOMAttributeNamespaces: object mapping React attribute name to the DOM
  1739. * attribute namespace URL. (Attribute names not specified use no namespace.)
  1740. *
  1741. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1742. * Property names not specified use the normalized name.
  1743. *
  1744. * DOMMutationMethods: Properties that require special mutation methods. If
  1745. * `value` is undefined, the mutation method should unset the property.
  1746. *
  1747. * @param {object} domPropertyConfig the config as described above.
  1748. */
  1749. injectDOMPropertyConfig: function (domPropertyConfig) {
  1750. var Injection = DOMPropertyInjection;
  1751. var Properties = domPropertyConfig.Properties || {};
  1752. var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
  1753. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1754. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1755. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1756. if (domPropertyConfig.isCustomAttribute) {
  1757. DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
  1758. }
  1759. for (var propName in Properties) {
  1760. !!DOMProperty.properties.hasOwnProperty(propName) ? false ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0;
  1761. var lowerCased = propName.toLowerCase();
  1762. var propConfig = Properties[propName];
  1763. var propertyInfo = {
  1764. attributeName: lowerCased,
  1765. attributeNamespace: null,
  1766. propertyName: propName,
  1767. mutationMethod: null,
  1768. mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
  1769. hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
  1770. hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
  1771. hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
  1772. hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
  1773. };
  1774. !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? false ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;
  1775. if (false) {
  1776. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1777. }
  1778. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1779. var attributeName = DOMAttributeNames[propName];
  1780. propertyInfo.attributeName = attributeName;
  1781. if (false) {
  1782. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1783. }
  1784. }
  1785. if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
  1786. propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
  1787. }
  1788. if (DOMPropertyNames.hasOwnProperty(propName)) {
  1789. propertyInfo.propertyName = DOMPropertyNames[propName];
  1790. }
  1791. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1792. propertyInfo.mutationMethod = DOMMutationMethods[propName];
  1793. }
  1794. DOMProperty.properties[propName] = propertyInfo;
  1795. }
  1796. }
  1797. };
  1798. /* eslint-disable max-len */
  1799. var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
  1800. /* eslint-enable max-len */
  1801. /**
  1802. * DOMProperty exports lookup objects that can be used like functions:
  1803. *
  1804. * > DOMProperty.isValid['id']
  1805. * true
  1806. * > DOMProperty.isValid['foobar']
  1807. * undefined
  1808. *
  1809. * Although this may be confusing, it performs better in general.
  1810. *
  1811. * @see http://jsperf.com/key-exists
  1812. * @see http://jsperf.com/key-missing
  1813. */
  1814. var DOMProperty = {
  1815. ID_ATTRIBUTE_NAME: 'data-reactid',
  1816. ROOT_ATTRIBUTE_NAME: 'data-reactroot',
  1817. ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
  1818. ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
  1819. /**
  1820. * Map from property "standard name" to an object with info about how to set
  1821. * the property in the DOM. Each object contains:
  1822. *
  1823. * attributeName:
  1824. * Used when rendering markup or with `*Attribute()`.
  1825. * attributeNamespace
  1826. * propertyName:
  1827. * Used on DOM node instances. (This includes properties that mutate due to
  1828. * external factors.)
  1829. * mutationMethod:
  1830. * If non-null, used instead of the property or `setAttribute()` after
  1831. * initial render.
  1832. * mustUseProperty:
  1833. * Whether the property must be accessed and mutated as an object property.
  1834. * hasBooleanValue:
  1835. * Whether the property should be removed when set to a falsey value.
  1836. * hasNumericValue:
  1837. * Whether the property must be numeric or parse as a numeric and should be
  1838. * removed when set to a falsey value.
  1839. * hasPositiveNumericValue:
  1840. * Whether the property must be positive numeric or parse as a positive
  1841. * numeric and should be removed when set to a falsey value.
  1842. * hasOverloadedBooleanValue:
  1843. * Whether the property can be used as a flag as well as with a value.
  1844. * Removed when strictly equal to false; present without a value when
  1845. * strictly equal to true; present with a value otherwise.
  1846. */
  1847. properties: {},
  1848. /**
  1849. * Mapping from lowercase property names to the properly cased version, used
  1850. * to warn in the case of missing properties. Available only in __DEV__.
  1851. *
  1852. * autofocus is predefined, because adding it to the property whitelist
  1853. * causes unintended side effects.
  1854. *
  1855. * @type {Object}
  1856. */
  1857. getPossibleStandardName: false ? { autofocus: 'autoFocus' } : null,
  1858. /**
  1859. * All of the isCustomAttribute() functions that have been injected.
  1860. */
  1861. _isCustomAttributeFunctions: [],
  1862. /**
  1863. * Checks whether a property name is a custom attribute.
  1864. * @method
  1865. */
  1866. isCustomAttribute: function (attributeName) {
  1867. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1868. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1869. if (isCustomAttributeFn(attributeName)) {
  1870. return true;
  1871. }
  1872. }
  1873. return false;
  1874. },
  1875. injection: DOMPropertyInjection
  1876. };
  1877. module.exports = DOMProperty;
  1878. /***/ }),
  1879. /* 20 */
  1880. /***/ (function(module, exports, __webpack_require__) {
  1881. "use strict";
  1882. /**
  1883. * Copyright 2013-present, Facebook, Inc.
  1884. * All rights reserved.
  1885. *
  1886. * This source code is licensed under the BSD-style license found in the
  1887. * LICENSE file in the root directory of this source tree. An additional grant
  1888. * of patent rights can be found in the PATENTS file in the same directory.
  1889. *
  1890. */
  1891. var ReactRef = __webpack_require__(205);
  1892. var ReactInstrumentation = __webpack_require__(11);
  1893. var warning = __webpack_require__(1);
  1894. /**
  1895. * Helper to call ReactRef.attachRefs with this composite component, split out
  1896. * to avoid allocations in the transaction mount-ready queue.
  1897. */
  1898. function attachRefs() {
  1899. ReactRef.attachRefs(this, this._currentElement);
  1900. }
  1901. var ReactReconciler = {
  1902. /**
  1903. * Initializes the component, renders markup, and registers event listeners.
  1904. *
  1905. * @param {ReactComponent} internalInstance
  1906. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  1907. * @param {?object} the containing host component instance
  1908. * @param {?object} info about the host container
  1909. * @return {?string} Rendered markup to be inserted into the DOM.
  1910. * @final
  1911. * @internal
  1912. */
  1913. mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
  1914. ) {
  1915. if (false) {
  1916. if (internalInstance._debugID !== 0) {
  1917. ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
  1918. }
  1919. }
  1920. var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);
  1921. if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1922. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  1923. }
  1924. if (false) {
  1925. if (internalInstance._debugID !== 0) {
  1926. ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
  1927. }
  1928. }
  1929. return markup;
  1930. },
  1931. /**
  1932. * Returns a value that can be passed to
  1933. * ReactComponentEnvironment.replaceNodeWithMarkup.
  1934. */
  1935. getHostNode: function (internalInstance) {
  1936. return internalInstance.getHostNode();
  1937. },
  1938. /**
  1939. * Releases any resources allocated by `mountComponent`.
  1940. *
  1941. * @final
  1942. * @internal
  1943. */
  1944. unmountComponent: function (internalInstance, safely) {
  1945. if (false) {
  1946. if (internalInstance._debugID !== 0) {
  1947. ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);
  1948. }
  1949. }
  1950. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  1951. internalInstance.unmountComponent(safely);
  1952. if (false) {
  1953. if (internalInstance._debugID !== 0) {
  1954. ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
  1955. }
  1956. }
  1957. },
  1958. /**
  1959. * Update a component using a new element.
  1960. *
  1961. * @param {ReactComponent} internalInstance
  1962. * @param {ReactElement} nextElement
  1963. * @param {ReactReconcileTransaction} transaction
  1964. * @param {object} context
  1965. * @internal
  1966. */
  1967. receiveComponent: function (internalInstance, nextElement, transaction, context) {
  1968. var prevElement = internalInstance._currentElement;
  1969. if (nextElement === prevElement && context === internalInstance._context) {
  1970. // Since elements are immutable after the owner is rendered,
  1971. // we can do a cheap identity compare here to determine if this is a
  1972. // superfluous reconcile. It's possible for state to be mutable but such
  1973. // change should trigger an update of the owner which would recreate
  1974. // the element. We explicitly check for the existence of an owner since
  1975. // it's possible for an element created outside a composite to be
  1976. // deeply mutated and reused.
  1977. // TODO: Bailing out early is just a perf optimization right?
  1978. // TODO: Removing the return statement should affect correctness?
  1979. return;
  1980. }
  1981. if (false) {
  1982. if (internalInstance._debugID !== 0) {
  1983. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
  1984. }
  1985. }
  1986. var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
  1987. if (refsChanged) {
  1988. ReactRef.detachRefs(internalInstance, prevElement);
  1989. }
  1990. internalInstance.receiveComponent(nextElement, transaction, context);
  1991. if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
  1992. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  1993. }
  1994. if (false) {
  1995. if (internalInstance._debugID !== 0) {
  1996. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  1997. }
  1998. }
  1999. },
  2000. /**
  2001. * Flush any dirty changes in a component.
  2002. *
  2003. * @param {ReactComponent} internalInstance
  2004. * @param {ReactReconcileTransaction} transaction
  2005. * @internal
  2006. */
  2007. performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
  2008. if (internalInstance._updateBatchNumber !== updateBatchNumber) {
  2009. // The component's enqueued batch number should always be the current
  2010. // batch or the following one.
  2011. false ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;
  2012. return;
  2013. }
  2014. if (false) {
  2015. if (internalInstance._debugID !== 0) {
  2016. ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
  2017. }
  2018. }
  2019. internalInstance.performUpdateIfNecessary(transaction);
  2020. if (false) {
  2021. if (internalInstance._debugID !== 0) {
  2022. ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
  2023. }
  2024. }
  2025. }
  2026. };
  2027. module.exports = ReactReconciler;
  2028. /***/ }),
  2029. /* 21 */
  2030. /***/ (function(module, exports, __webpack_require__) {
  2031. "use strict";
  2032. /**
  2033. * Copyright 2013-present, Facebook, Inc.
  2034. * All rights reserved.
  2035. *
  2036. * This source code is licensed under the BSD-style license found in the
  2037. * LICENSE file in the root directory of this source tree. An additional grant
  2038. * of patent rights can be found in the PATENTS file in the same directory.
  2039. *
  2040. */
  2041. var _assign = __webpack_require__(3);
  2042. var ReactChildren = __webpack_require__(235);
  2043. var ReactComponent = __webpack_require__(66);
  2044. var ReactPureComponent = __webpack_require__(240);
  2045. var ReactClass = __webpack_require__(236);
  2046. var ReactDOMFactories = __webpack_require__(237);
  2047. var ReactElement = __webpack_require__(22);
  2048. var ReactPropTypes = __webpack_require__(238);
  2049. var ReactVersion = __webpack_require__(241);
  2050. var onlyChild = __webpack_require__(242);
  2051. var warning = __webpack_require__(1);
  2052. var createElement = ReactElement.createElement;
  2053. var createFactory = ReactElement.createFactory;
  2054. var cloneElement = ReactElement.cloneElement;
  2055. if (false) {
  2056. var ReactElementValidator = require('./ReactElementValidator');
  2057. createElement = ReactElementValidator.createElement;
  2058. createFactory = ReactElementValidator.createFactory;
  2059. cloneElement = ReactElementValidator.cloneElement;
  2060. }
  2061. var __spread = _assign;
  2062. if (false) {
  2063. var warned = false;
  2064. __spread = function () {
  2065. process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
  2066. warned = true;
  2067. return _assign.apply(null, arguments);
  2068. };
  2069. }
  2070. var React = {
  2071. // Modern
  2072. Children: {
  2073. map: ReactChildren.map,
  2074. forEach: ReactChildren.forEach,
  2075. count: ReactChildren.count,
  2076. toArray: ReactChildren.toArray,
  2077. only: onlyChild
  2078. },
  2079. Component: ReactComponent,
  2080. PureComponent: ReactPureComponent,
  2081. createElement: createElement,
  2082. cloneElement: cloneElement,
  2083. isValidElement: ReactElement.isValidElement,
  2084. // Classic
  2085. PropTypes: ReactPropTypes,
  2086. createClass: ReactClass.createClass,
  2087. createFactory: createFactory,
  2088. createMixin: function (mixin) {
  2089. // Currently a noop. Will be used to validate and trace mixins.
  2090. return mixin;
  2091. },
  2092. // This looks DOM specific but these are actually isomorphic helpers
  2093. // since they are just generating DOM strings.
  2094. DOM: ReactDOMFactories,
  2095. version: ReactVersion,
  2096. // Deprecated hook for JSX spread, don't use this for anything.
  2097. __spread: __spread
  2098. };
  2099. module.exports = React;
  2100. /***/ }),
  2101. /* 22 */
  2102. /***/ (function(module, exports, __webpack_require__) {
  2103. "use strict";
  2104. /**
  2105. * Copyright 2014-present, Facebook, Inc.
  2106. * All rights reserved.
  2107. *
  2108. * This source code is licensed under the BSD-style license found in the
  2109. * LICENSE file in the root directory of this source tree. An additional grant
  2110. * of patent rights can be found in the PATENTS file in the same directory.
  2111. *
  2112. */
  2113. var _assign = __webpack_require__(3);
  2114. var ReactCurrentOwner = __webpack_require__(14);
  2115. var warning = __webpack_require__(1);
  2116. var canDefineProperty = __webpack_require__(101);
  2117. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2118. var REACT_ELEMENT_TYPE = __webpack_require__(99);
  2119. var RESERVED_PROPS = {
  2120. key: true,
  2121. ref: true,
  2122. __self: true,
  2123. __source: true
  2124. };
  2125. var specialPropKeyWarningShown, specialPropRefWarningShown;
  2126. function hasValidRef(config) {
  2127. if (false) {
  2128. if (hasOwnProperty.call(config, 'ref')) {
  2129. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  2130. if (getter && getter.isReactWarning) {
  2131. return false;
  2132. }
  2133. }
  2134. }
  2135. return config.ref !== undefined;
  2136. }
  2137. function hasValidKey(config) {
  2138. if (false) {
  2139. if (hasOwnProperty.call(config, 'key')) {
  2140. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  2141. if (getter && getter.isReactWarning) {
  2142. return false;
  2143. }
  2144. }
  2145. }
  2146. return config.key !== undefined;
  2147. }
  2148. function defineKeyPropWarningGetter(props, displayName) {
  2149. var warnAboutAccessingKey = function () {
  2150. if (!specialPropKeyWarningShown) {
  2151. specialPropKeyWarningShown = true;
  2152. false ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
  2153. }
  2154. };
  2155. warnAboutAccessingKey.isReactWarning = true;
  2156. Object.defineProperty(props, 'key', {
  2157. get: warnAboutAccessingKey,
  2158. configurable: true
  2159. });
  2160. }
  2161. function defineRefPropWarningGetter(props, displayName) {
  2162. var warnAboutAccessingRef = function () {
  2163. if (!specialPropRefWarningShown) {
  2164. specialPropRefWarningShown = true;
  2165. false ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
  2166. }
  2167. };
  2168. warnAboutAccessingRef.isReactWarning = true;
  2169. Object.defineProperty(props, 'ref', {
  2170. get: warnAboutAccessingRef,
  2171. configurable: true
  2172. });
  2173. }
  2174. /**
  2175. * Factory method to create a new React element. This no longer adheres to
  2176. * the class pattern, so do not use new to call it. Also, no instanceof check
  2177. * will work. Instead test $$typeof field against Symbol.for('react.element') to check
  2178. * if something is a React Element.
  2179. *
  2180. * @param {*} type
  2181. * @param {*} key
  2182. * @param {string|object} ref
  2183. * @param {*} self A *temporary* helper to detect places where `this` is
  2184. * different from the `owner` when React.createElement is called, so that we
  2185. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  2186. * functions, and as long as `this` and owner are the same, there will be no
  2187. * change in behavior.
  2188. * @param {*} source An annotation object (added by a transpiler or otherwise)
  2189. * indicating filename, line number, and/or other information.
  2190. * @param {*} owner
  2191. * @param {*} props
  2192. * @internal
  2193. */
  2194. var ReactElement = function (type, key, ref, self, source, owner, props) {
  2195. var element = {
  2196. // This tag allow us to uniquely identify this as a React Element
  2197. $$typeof: REACT_ELEMENT_TYPE,
  2198. // Built-in properties that belong on the element
  2199. type: type,
  2200. key: key,
  2201. ref: ref,
  2202. props: props,
  2203. // Record the component responsible for creating this element.
  2204. _owner: owner
  2205. };
  2206. if (false) {
  2207. // The validation flag is currently mutative. We put it on
  2208. // an external backing store so that we can freeze the whole object.
  2209. // This can be replaced with a WeakMap once they are implemented in
  2210. // commonly used development environments.
  2211. element._store = {};
  2212. // To make comparing ReactElements easier for testing purposes, we make
  2213. // the validation flag non-enumerable (where possible, which should
  2214. // include every environment we run tests in), so the test framework
  2215. // ignores it.
  2216. if (canDefineProperty) {
  2217. Object.defineProperty(element._store, 'validated', {
  2218. configurable: false,
  2219. enumerable: false,
  2220. writable: true,
  2221. value: false
  2222. });
  2223. // self and source are DEV only properties.
  2224. Object.defineProperty(element, '_self', {
  2225. configurable: false,
  2226. enumerable: false,
  2227. writable: false,
  2228. value: self
  2229. });
  2230. // Two elements created in two different places should be considered
  2231. // equal for testing purposes and therefore we hide it from enumeration.
  2232. Object.defineProperty(element, '_source', {
  2233. configurable: false,
  2234. enumerable: false,
  2235. writable: false,
  2236. value: source
  2237. });
  2238. } else {
  2239. element._store.validated = false;
  2240. element._self = self;
  2241. element._source = source;
  2242. }
  2243. if (Object.freeze) {
  2244. Object.freeze(element.props);
  2245. Object.freeze(element);
  2246. }
  2247. }
  2248. return element;
  2249. };
  2250. /**
  2251. * Create and return a new ReactElement of the given type.
  2252. * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
  2253. */
  2254. ReactElement.createElement = function (type, config, children) {
  2255. var propName;
  2256. // Reserved names are extracted
  2257. var props = {};
  2258. var key = null;
  2259. var ref = null;
  2260. var self = null;
  2261. var source = null;
  2262. if (config != null) {
  2263. if (hasValidRef(config)) {
  2264. ref = config.ref;
  2265. }
  2266. if (hasValidKey(config)) {
  2267. key = '' + config.key;
  2268. }
  2269. self = config.__self === undefined ? null : config.__self;
  2270. source = config.__source === undefined ? null : config.__source;
  2271. // Remaining properties are added to a new props object
  2272. for (propName in config) {
  2273. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2274. props[propName] = config[propName];
  2275. }
  2276. }
  2277. }
  2278. // Children can be more than one argument, and those are transferred onto
  2279. // the newly allocated props object.
  2280. var childrenLength = arguments.length - 2;
  2281. if (childrenLength === 1) {
  2282. props.children = children;
  2283. } else if (childrenLength > 1) {
  2284. var childArray = Array(childrenLength);
  2285. for (var i = 0; i < childrenLength; i++) {
  2286. childArray[i] = arguments[i + 2];
  2287. }
  2288. if (false) {
  2289. if (Object.freeze) {
  2290. Object.freeze(childArray);
  2291. }
  2292. }
  2293. props.children = childArray;
  2294. }
  2295. // Resolve default props
  2296. if (type && type.defaultProps) {
  2297. var defaultProps = type.defaultProps;
  2298. for (propName in defaultProps) {
  2299. if (props[propName] === undefined) {
  2300. props[propName] = defaultProps[propName];
  2301. }
  2302. }
  2303. }
  2304. if (false) {
  2305. if (key || ref) {
  2306. if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
  2307. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  2308. if (key) {
  2309. defineKeyPropWarningGetter(props, displayName);
  2310. }
  2311. if (ref) {
  2312. defineRefPropWarningGetter(props, displayName);
  2313. }
  2314. }
  2315. }
  2316. }
  2317. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  2318. };
  2319. /**
  2320. * Return a function that produces ReactElements of a given type.
  2321. * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
  2322. */
  2323. ReactElement.createFactory = function (type) {
  2324. var factory = ReactElement.createElement.bind(null, type);
  2325. // Expose the type on the factory and the prototype so that it can be
  2326. // easily accessed on elements. E.g. `<Foo />.type === Foo`.
  2327. // This should not be named `constructor` since this may not be the function
  2328. // that created the element, and it may not even be a constructor.
  2329. // Legacy hook TODO: Warn if this is accessed
  2330. factory.type = type;
  2331. return factory;
  2332. };
  2333. ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
  2334. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  2335. return newElement;
  2336. };
  2337. /**
  2338. * Clone and return a new ReactElement using element as the starting point.
  2339. * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
  2340. */
  2341. ReactElement.cloneElement = function (element, config, children) {
  2342. var propName;
  2343. // Original props are copied
  2344. var props = _assign({}, element.props);
  2345. // Reserved names are extracted
  2346. var key = element.key;
  2347. var ref = element.ref;
  2348. // Self is preserved since the owner is preserved.
  2349. var self = element._self;
  2350. // Source is preserved since cloneElement is unlikely to be targeted by a
  2351. // transpiler, and the original source is probably a better indicator of the
  2352. // true owner.
  2353. var source = element._source;
  2354. // Owner will be preserved, unless ref is overridden
  2355. var owner = element._owner;
  2356. if (config != null) {
  2357. if (hasValidRef(config)) {
  2358. // Silently steal the ref from the parent.
  2359. ref = config.ref;
  2360. owner = ReactCurrentOwner.current;
  2361. }
  2362. if (hasValidKey(config)) {
  2363. key = '' + config.key;
  2364. }
  2365. // Remaining properties override existing props
  2366. var defaultProps;
  2367. if (element.type && element.type.defaultProps) {
  2368. defaultProps = element.type.defaultProps;
  2369. }
  2370. for (propName in config) {
  2371. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2372. if (config[propName] === undefined && defaultProps !== undefined) {
  2373. // Resolve default props
  2374. props[propName] = defaultProps[propName];
  2375. } else {
  2376. props[propName] = config[propName];
  2377. }
  2378. }
  2379. }
  2380. }
  2381. // Children can be more than one argument, and those are transferred onto
  2382. // the newly allocated props object.
  2383. var childrenLength = arguments.length - 2;
  2384. if (childrenLength === 1) {
  2385. props.children = children;
  2386. } else if (childrenLength > 1) {
  2387. var childArray = Array(childrenLength);
  2388. for (var i = 0; i < childrenLength; i++) {
  2389. childArray[i] = arguments[i + 2];
  2390. }
  2391. props.children = childArray;
  2392. }
  2393. return ReactElement(element.type, key, ref, self, source, owner, props);
  2394. };
  2395. /**
  2396. * Verifies the object is a ReactElement.
  2397. * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
  2398. * @param {?object} object
  2399. * @return {boolean} True if `object` is a valid component.
  2400. * @final
  2401. */
  2402. ReactElement.isValidElement = function (object) {
  2403. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  2404. };
  2405. module.exports = ReactElement;
  2406. /***/ }),
  2407. /* 23 */
  2408. /***/ (function(module, exports, __webpack_require__) {
  2409. "use strict";
  2410. /**
  2411. * Copyright (c) 2013-present, Facebook, Inc.
  2412. * All rights reserved.
  2413. *
  2414. * This source code is licensed under the BSD-style license found in the
  2415. * LICENSE file in the root directory of this source tree. An additional grant
  2416. * of patent rights can be found in the PATENTS file in the same directory.
  2417. *
  2418. *
  2419. */
  2420. /**
  2421. * WARNING: DO NOT manually require this module.
  2422. * This is a replacement for `invariant(...)` used by the error code system
  2423. * and will _only_ be required by the corresponding babel pass.
  2424. * It always throws.
  2425. */
  2426. function reactProdInvariant(code) {
  2427. var argCount = arguments.length - 1;
  2428. var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
  2429. for (var argIdx = 0; argIdx < argCount; argIdx++) {
  2430. message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  2431. }
  2432. message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
  2433. var error = new Error(message);
  2434. error.name = 'Invariant Violation';
  2435. error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
  2436. throw error;
  2437. }
  2438. module.exports = reactProdInvariant;
  2439. /***/ }),
  2440. /* 24 */
  2441. /***/ (function(module, exports, __webpack_require__) {
  2442. "use strict";
  2443. /**
  2444. * @author oldj
  2445. * @blog https://oldj.net
  2446. */
  2447. var _Agent = __webpack_require__(4);
  2448. var _Agent2 = _interopRequireDefault(_Agent);
  2449. var _list_updated = __webpack_require__(17);
  2450. var _list_updated2 = _interopRequireDefault(_list_updated);
  2451. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2452. module.exports = function (app, list) {
  2453. var hosts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  2454. _Agent2.default.pact('saveHosts', list).then(function (new_list) {
  2455. (0, _list_updated2.default)(app, new_list, hosts);
  2456. }).catch(function (e) {
  2457. console.log(e);
  2458. });
  2459. };
  2460. /***/ }),
  2461. /* 25 */
  2462. /***/ (function(module, exports, __webpack_require__) {
  2463. "use strict";
  2464. /**
  2465. * Copyright (c) 2013-present, Facebook, Inc.
  2466. * All rights reserved.
  2467. *
  2468. * This source code is licensed under the BSD-style license found in the
  2469. * LICENSE file in the root directory of this source tree. An additional grant
  2470. * of patent rights can be found in the PATENTS file in the same directory.
  2471. *
  2472. */
  2473. var emptyObject = {};
  2474. if (false) {
  2475. Object.freeze(emptyObject);
  2476. }
  2477. module.exports = emptyObject;
  2478. /***/ }),
  2479. /* 26 */
  2480. /***/ (function(module, exports, __webpack_require__) {
  2481. "use strict";
  2482. /**
  2483. * Copyright 2013-present, Facebook, Inc.
  2484. * All rights reserved.
  2485. *
  2486. * This source code is licensed under the BSD-style license found in the
  2487. * LICENSE file in the root directory of this source tree. An additional grant
  2488. * of patent rights can be found in the PATENTS file in the same directory.
  2489. *
  2490. */
  2491. var _prodInvariant = __webpack_require__(2);
  2492. var EventPluginRegistry = __webpack_require__(52);
  2493. var EventPluginUtils = __webpack_require__(53);
  2494. var ReactErrorUtils = __webpack_require__(57);
  2495. var accumulateInto = __webpack_require__(90);
  2496. var forEachAccumulated = __webpack_require__(91);
  2497. var invariant = __webpack_require__(0);
  2498. /**
  2499. * Internal store for event listeners
  2500. */
  2501. var listenerBank = {};
  2502. /**
  2503. * Internal queue of events that have accumulated their dispatches and are
  2504. * waiting to have their dispatches executed.
  2505. */
  2506. var eventQueue = null;
  2507. /**
  2508. * Dispatches an event and releases it back into the pool, unless persistent.
  2509. *
  2510. * @param {?object} event Synthetic event to be dispatched.
  2511. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  2512. * @private
  2513. */
  2514. var executeDispatchesAndRelease = function (event, simulated) {
  2515. if (event) {
  2516. EventPluginUtils.executeDispatchesInOrder(event, simulated);
  2517. if (!event.isPersistent()) {
  2518. event.constructor.release(event);
  2519. }
  2520. }
  2521. };
  2522. var executeDispatchesAndReleaseSimulated = function (e) {
  2523. return executeDispatchesAndRelease(e, true);
  2524. };
  2525. var executeDispatchesAndReleaseTopLevel = function (e) {
  2526. return executeDispatchesAndRelease(e, false);
  2527. };
  2528. var getDictionaryKey = function (inst) {
  2529. // Prevents V8 performance issue:
  2530. // https://github.com/facebook/react/pull/7232
  2531. return '.' + inst._rootNodeID;
  2532. };
  2533. function isInteractive(tag) {
  2534. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  2535. }
  2536. function shouldPreventMouseEvent(name, type, props) {
  2537. switch (name) {
  2538. case 'onClick':
  2539. case 'onClickCapture':
  2540. case 'onDoubleClick':
  2541. case 'onDoubleClickCapture':
  2542. case 'onMouseDown':
  2543. case 'onMouseDownCapture':
  2544. case 'onMouseMove':
  2545. case 'onMouseMoveCapture':
  2546. case 'onMouseUp':
  2547. case 'onMouseUpCapture':
  2548. return !!(props.disabled && isInteractive(type));
  2549. default:
  2550. return false;
  2551. }
  2552. }
  2553. /**
  2554. * This is a unified interface for event plugins to be installed and configured.
  2555. *
  2556. * Event plugins can implement the following properties:
  2557. *
  2558. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2559. * Required. When a top-level event is fired, this method is expected to
  2560. * extract synthetic events that will in turn be queued and dispatched.
  2561. *
  2562. * `eventTypes` {object}
  2563. * Optional, plugins that fire events must publish a mapping of registration
  2564. * names that are used to register listeners. Values of this mapping must
  2565. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2566. *
  2567. * `executeDispatch` {function(object, function, string)}
  2568. * Optional, allows plugins to override how an event gets dispatched. By
  2569. * default, the listener is simply invoked.
  2570. *
  2571. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2572. *
  2573. * @public
  2574. */
  2575. var EventPluginHub = {
  2576. /**
  2577. * Methods for injecting dependencies.
  2578. */
  2579. injection: {
  2580. /**
  2581. * @param {array} InjectedEventPluginOrder
  2582. * @public
  2583. */
  2584. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2585. /**
  2586. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2587. */
  2588. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2589. },
  2590. /**
  2591. * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
  2592. *
  2593. * @param {object} inst The instance, which is the source of events.
  2594. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2595. * @param {function} listener The callback to store.
  2596. */
  2597. putListener: function (inst, registrationName, listener) {
  2598. !(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;
  2599. var key = getDictionaryKey(inst);
  2600. var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2601. bankForRegistrationName[key] = listener;
  2602. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2603. if (PluginModule && PluginModule.didPutListener) {
  2604. PluginModule.didPutListener(inst, registrationName, listener);
  2605. }
  2606. },
  2607. /**
  2608. * @param {object} inst The instance, which is the source of events.
  2609. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2610. * @return {?function} The stored callback.
  2611. */
  2612. getListener: function (inst, registrationName) {
  2613. // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
  2614. // live here; needs to be moved to a better place soon
  2615. var bankForRegistrationName = listenerBank[registrationName];
  2616. if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) {
  2617. return null;
  2618. }
  2619. var key = getDictionaryKey(inst);
  2620. return bankForRegistrationName && bankForRegistrationName[key];
  2621. },
  2622. /**
  2623. * Deletes a listener from the registration bank.
  2624. *
  2625. * @param {object} inst The instance, which is the source of events.
  2626. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2627. */
  2628. deleteListener: function (inst, registrationName) {
  2629. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2630. if (PluginModule && PluginModule.willDeleteListener) {
  2631. PluginModule.willDeleteListener(inst, registrationName);
  2632. }
  2633. var bankForRegistrationName = listenerBank[registrationName];
  2634. // TODO: This should never be null -- when is it?
  2635. if (bankForRegistrationName) {
  2636. var key = getDictionaryKey(inst);
  2637. delete bankForRegistrationName[key];
  2638. }
  2639. },
  2640. /**
  2641. * Deletes all listeners for the DOM element with the supplied ID.
  2642. *
  2643. * @param {object} inst The instance, which is the source of events.
  2644. */
  2645. deleteAllListeners: function (inst) {
  2646. var key = getDictionaryKey(inst);
  2647. for (var registrationName in listenerBank) {
  2648. if (!listenerBank.hasOwnProperty(registrationName)) {
  2649. continue;
  2650. }
  2651. if (!listenerBank[registrationName][key]) {
  2652. continue;
  2653. }
  2654. var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
  2655. if (PluginModule && PluginModule.willDeleteListener) {
  2656. PluginModule.willDeleteListener(inst, registrationName);
  2657. }
  2658. delete listenerBank[registrationName][key];
  2659. }
  2660. },
  2661. /**
  2662. * Allows registered plugins an opportunity to extract events from top-level
  2663. * native browser events.
  2664. *
  2665. * @return {*} An accumulation of synthetic events.
  2666. * @internal
  2667. */
  2668. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  2669. var events;
  2670. var plugins = EventPluginRegistry.plugins;
  2671. for (var i = 0; i < plugins.length; i++) {
  2672. // Not every plugin in the ordering may be loaded at runtime.
  2673. var possiblePlugin = plugins[i];
  2674. if (possiblePlugin) {
  2675. var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  2676. if (extractedEvents) {
  2677. events = accumulateInto(events, extractedEvents);
  2678. }
  2679. }
  2680. }
  2681. return events;
  2682. },
  2683. /**
  2684. * Enqueues a synthetic event that should be dispatched when
  2685. * `processEventQueue` is invoked.
  2686. *
  2687. * @param {*} events An accumulation of synthetic events.
  2688. * @internal
  2689. */
  2690. enqueueEvents: function (events) {
  2691. if (events) {
  2692. eventQueue = accumulateInto(eventQueue, events);
  2693. }
  2694. },
  2695. /**
  2696. * Dispatches all synthetic events on the event queue.
  2697. *
  2698. * @internal
  2699. */
  2700. processEventQueue: function (simulated) {
  2701. // Set `eventQueue` to null before processing it so that we can tell if more
  2702. // events get enqueued while processing.
  2703. var processingEventQueue = eventQueue;
  2704. eventQueue = null;
  2705. if (simulated) {
  2706. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
  2707. } else {
  2708. forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
  2709. }
  2710. !!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;
  2711. // This would be a good time to rethrow if any of the event handlers threw.
  2712. ReactErrorUtils.rethrowCaughtError();
  2713. },
  2714. /**
  2715. * These are needed for tests only. Do not use!
  2716. */
  2717. __purge: function () {
  2718. listenerBank = {};
  2719. },
  2720. __getListenerBank: function () {
  2721. return listenerBank;
  2722. }
  2723. };
  2724. module.exports = EventPluginHub;
  2725. /***/ }),
  2726. /* 27 */
  2727. /***/ (function(module, exports, __webpack_require__) {
  2728. "use strict";
  2729. /**
  2730. * Copyright 2013-present, Facebook, Inc.
  2731. * All rights reserved.
  2732. *
  2733. * This source code is licensed under the BSD-style license found in the
  2734. * LICENSE file in the root directory of this source tree. An additional grant
  2735. * of patent rights can be found in the PATENTS file in the same directory.
  2736. *
  2737. */
  2738. var EventPluginHub = __webpack_require__(26);
  2739. var EventPluginUtils = __webpack_require__(53);
  2740. var accumulateInto = __webpack_require__(90);
  2741. var forEachAccumulated = __webpack_require__(91);
  2742. var warning = __webpack_require__(1);
  2743. var getListener = EventPluginHub.getListener;
  2744. /**
  2745. * Some event types have a notion of different registration names for different
  2746. * "phases" of propagation. This finds listeners by a given phase.
  2747. */
  2748. function listenerAtPhase(inst, event, propagationPhase) {
  2749. var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  2750. return getListener(inst, registrationName);
  2751. }
  2752. /**
  2753. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  2754. * here, allows us to not have to bind or create functions for each event.
  2755. * Mutating the event's members allows us to not have to create a wrapping
  2756. * "dispatch" object that pairs the event with the listener.
  2757. */
  2758. function accumulateDirectionalDispatches(inst, phase, event) {
  2759. if (false) {
  2760. process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
  2761. }
  2762. var listener = listenerAtPhase(inst, event, phase);
  2763. if (listener) {
  2764. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2765. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2766. }
  2767. }
  2768. /**
  2769. * Collect dispatches (must be entirely collected before dispatching - see unit
  2770. * tests). Lazily allocate the array to conserve memory. We must loop through
  2771. * each event and perform the traversal for each one. We cannot perform a
  2772. * single traversal for the entire collection of events because each event may
  2773. * have a different target.
  2774. */
  2775. function accumulateTwoPhaseDispatchesSingle(event) {
  2776. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2777. EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
  2778. }
  2779. }
  2780. /**
  2781. * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
  2782. */
  2783. function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
  2784. if (event && event.dispatchConfig.phasedRegistrationNames) {
  2785. var targetInst = event._targetInst;
  2786. var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
  2787. EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
  2788. }
  2789. }
  2790. /**
  2791. * Accumulates without regard to direction, does not look for phased
  2792. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  2793. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  2794. */
  2795. function accumulateDispatches(inst, ignoredDirection, event) {
  2796. if (event && event.dispatchConfig.registrationName) {
  2797. var registrationName = event.dispatchConfig.registrationName;
  2798. var listener = getListener(inst, registrationName);
  2799. if (listener) {
  2800. event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
  2801. event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
  2802. }
  2803. }
  2804. }
  2805. /**
  2806. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  2807. * `dispatchMarker`.
  2808. * @param {SyntheticEvent} event
  2809. */
  2810. function accumulateDirectDispatchesSingle(event) {
  2811. if (event && event.dispatchConfig.registrationName) {
  2812. accumulateDispatches(event._targetInst, null, event);
  2813. }
  2814. }
  2815. function accumulateTwoPhaseDispatches(events) {
  2816. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  2817. }
  2818. function accumulateTwoPhaseDispatchesSkipTarget(events) {
  2819. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
  2820. }
  2821. function accumulateEnterLeaveDispatches(leave, enter, from, to) {
  2822. EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
  2823. }
  2824. function accumulateDirectDispatches(events) {
  2825. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  2826. }
  2827. /**
  2828. * A small set of propagation patterns, each of which will accept a small amount
  2829. * of information, and generate a set of "dispatch ready event objects" - which
  2830. * are sets of events that have already been annotated with a set of dispatched
  2831. * listener functions/ids. The API is designed this way to discourage these
  2832. * propagation strategies from actually executing the dispatches, since we
  2833. * always want to collect the entire set of dispatches before executing event a
  2834. * single one.
  2835. *
  2836. * @constructor EventPropagators
  2837. */
  2838. var EventPropagators = {
  2839. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  2840. accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
  2841. accumulateDirectDispatches: accumulateDirectDispatches,
  2842. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  2843. };
  2844. module.exports = EventPropagators;
  2845. /***/ }),
  2846. /* 28 */
  2847. /***/ (function(module, exports, __webpack_require__) {
  2848. "use strict";
  2849. /**
  2850. * Copyright 2013-present, Facebook, Inc.
  2851. * All rights reserved.
  2852. *
  2853. * This source code is licensed under the BSD-style license found in the
  2854. * LICENSE file in the root directory of this source tree. An additional grant
  2855. * of patent rights can be found in the PATENTS file in the same directory.
  2856. *
  2857. */
  2858. /**
  2859. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  2860. * instance (key) and the internal representation (value). This allows public
  2861. * methods to accept the user facing instance as an argument and map them back
  2862. * to internal methods.
  2863. */
  2864. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  2865. var ReactInstanceMap = {
  2866. /**
  2867. * This API should be called `delete` but we'd have to make sure to always
  2868. * transform these to strings for IE support. When this transform is fully
  2869. * supported we can rename it.
  2870. */
  2871. remove: function (key) {
  2872. key._reactInternalInstance = undefined;
  2873. },
  2874. get: function (key) {
  2875. return key._reactInternalInstance;
  2876. },
  2877. has: function (key) {
  2878. return key._reactInternalInstance !== undefined;
  2879. },
  2880. set: function (key, value) {
  2881. key._reactInternalInstance = value;
  2882. }
  2883. };
  2884. module.exports = ReactInstanceMap;
  2885. /***/ }),
  2886. /* 29 */
  2887. /***/ (function(module, exports, __webpack_require__) {
  2888. "use strict";
  2889. /**
  2890. * Copyright 2013-present, Facebook, Inc.
  2891. * All rights reserved.
  2892. *
  2893. * This source code is licensed under the BSD-style license found in the
  2894. * LICENSE file in the root directory of this source tree. An additional grant
  2895. * of patent rights can be found in the PATENTS file in the same directory.
  2896. *
  2897. */
  2898. var SyntheticEvent = __webpack_require__(13);
  2899. var getEventTarget = __webpack_require__(62);
  2900. /**
  2901. * @interface UIEvent
  2902. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  2903. */
  2904. var UIEventInterface = {
  2905. view: function (event) {
  2906. if (event.view) {
  2907. return event.view;
  2908. }
  2909. var target = getEventTarget(event);
  2910. if (target.window === target) {
  2911. // target is a window object
  2912. return target;
  2913. }
  2914. var doc = target.ownerDocument;
  2915. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2916. if (doc) {
  2917. return doc.defaultView || doc.parentWindow;
  2918. } else {
  2919. return window;
  2920. }
  2921. },
  2922. detail: function (event) {
  2923. return event.detail || 0;
  2924. }
  2925. };
  2926. /**
  2927. * @param {object} dispatchConfig Configuration used to dispatch this event.
  2928. * @param {string} dispatchMarker Marker identifying the event target.
  2929. * @param {object} nativeEvent Native browser event.
  2930. * @extends {SyntheticEvent}
  2931. */
  2932. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  2933. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  2934. }
  2935. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  2936. module.exports = SyntheticUIEvent;
  2937. /***/ }),
  2938. /* 30 */
  2939. /***/ (function(module, exports, __webpack_require__) {
  2940. "use strict";
  2941. /**
  2942. * @author oldj
  2943. * @blog https://oldj.net
  2944. */
  2945. var _Agent = __webpack_require__(4);
  2946. var _Agent2 = _interopRequireDefault(_Agent);
  2947. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2948. var req = __webpack_require__(155);
  2949. exports.reg = function (app) {
  2950. req.keys().map(function (fn) {
  2951. var m = fn.match(/^\.\/([\w\-]+)\.js$/);
  2952. var name = m ? m[1] : null;
  2953. if (!name || name === 'index') return;
  2954. _Agent2.default.on(name, function () {
  2955. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  2956. args[_key] = arguments[_key];
  2957. }
  2958. var fn = __webpack_require__(154)("./" + name);
  2959. fn.apply(undefined, [app].concat(args));
  2960. });
  2961. });
  2962. };
  2963. /***/ }),
  2964. /* 31 */
  2965. /***/ (function(module, exports, __webpack_require__) {
  2966. "use strict";
  2967. /**
  2968. * Copyright 2013-present, Facebook, Inc.
  2969. * All rights reserved.
  2970. *
  2971. * This source code is licensed under the BSD-style license found in the
  2972. * LICENSE file in the root directory of this source tree. An additional grant
  2973. * of patent rights can be found in the PATENTS file in the same directory.
  2974. *
  2975. */
  2976. var _assign = __webpack_require__(3);
  2977. var EventPluginRegistry = __webpack_require__(52);
  2978. var ReactEventEmitterMixin = __webpack_require__(197);
  2979. var ViewportMetrics = __webpack_require__(89);
  2980. var getVendorPrefixedEventName = __webpack_require__(230);
  2981. var isEventSupported = __webpack_require__(63);
  2982. /**
  2983. * Summary of `ReactBrowserEventEmitter` event handling:
  2984. *
  2985. * - Top-level delegation is used to trap most native browser events. This
  2986. * may only occur in the main thread and is the responsibility of
  2987. * ReactEventListener, which is injected and can therefore support pluggable
  2988. * event sources. This is the only work that occurs in the main thread.
  2989. *
  2990. * - We normalize and de-duplicate events to account for browser quirks. This
  2991. * may be done in the worker thread.
  2992. *
  2993. * - Forward these native events (with the associated top-level type used to
  2994. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  2995. * to extract any synthetic events.
  2996. *
  2997. * - The `EventPluginHub` will then process each event by annotating them with
  2998. * "dispatches", a sequence of listeners and IDs that care about that event.
  2999. *
  3000. * - The `EventPluginHub` then dispatches the events.
  3001. *
  3002. * Overview of React and the event system:
  3003. *
  3004. * +------------+ .
  3005. * | DOM | .
  3006. * +------------+ .
  3007. * | .
  3008. * v .
  3009. * +------------+ .
  3010. * | ReactEvent | .
  3011. * | Listener | .
  3012. * +------------+ . +-----------+
  3013. * | . +--------+|SimpleEvent|
  3014. * | . | |Plugin |
  3015. * +-----|------+ . v +-----------+
  3016. * | | | . +--------------+ +------------+
  3017. * | +-----------.--->|EventPluginHub| | Event |
  3018. * | | . | | +-----------+ | Propagators|
  3019. * | ReactEvent | . | | |TapEvent | |------------|
  3020. * | Emitter | . | |<---+|Plugin | |other plugin|
  3021. * | | . | | +-----------+ | utilities |
  3022. * | +-----------.--->| | +------------+
  3023. * | | | . +--------------+
  3024. * +-----|------+ . ^ +-----------+
  3025. * | . | |Enter/Leave|
  3026. * + . +-------+|Plugin |
  3027. * +-------------+ . +-----------+
  3028. * | application | .
  3029. * |-------------| .
  3030. * | | .
  3031. * | | .
  3032. * +-------------+ .
  3033. * .
  3034. * React Core . General Purpose Event Plugin System
  3035. */
  3036. var hasEventPageXY;
  3037. var alreadyListeningTo = {};
  3038. var isMonitoringScrollValue = false;
  3039. var reactTopListenersCounter = 0;
  3040. // For events like 'submit' which don't consistently bubble (which we trap at a
  3041. // lower node than `document`), binding at `document` would cause duplicate
  3042. // events so we don't include them here
  3043. var topEventMapping = {
  3044. topAbort: 'abort',
  3045. topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
  3046. topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
  3047. topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
  3048. topBlur: 'blur',
  3049. topCanPlay: 'canplay',
  3050. topCanPlayThrough: 'canplaythrough',
  3051. topChange: 'change',
  3052. topClick: 'click',
  3053. topCompositionEnd: 'compositionend',
  3054. topCompositionStart: 'compositionstart',
  3055. topCompositionUpdate: 'compositionupdate',
  3056. topContextMenu: 'contextmenu',
  3057. topCopy: 'copy',
  3058. topCut: 'cut',
  3059. topDoubleClick: 'dblclick',
  3060. topDrag: 'drag',
  3061. topDragEnd: 'dragend',
  3062. topDragEnter: 'dragenter',
  3063. topDragExit: 'dragexit',
  3064. topDragLeave: 'dragleave',
  3065. topDragOver: 'dragover',
  3066. topDragStart: 'dragstart',
  3067. topDrop: 'drop',
  3068. topDurationChange: 'durationchange',
  3069. topEmptied: 'emptied',
  3070. topEncrypted: 'encrypted',
  3071. topEnded: 'ended',
  3072. topError: 'error',
  3073. topFocus: 'focus',
  3074. topInput: 'input',
  3075. topKeyDown: 'keydown',
  3076. topKeyPress: 'keypress',
  3077. topKeyUp: 'keyup',
  3078. topLoadedData: 'loadeddata',
  3079. topLoadedMetadata: 'loadedmetadata',
  3080. topLoadStart: 'loadstart',
  3081. topMouseDown: 'mousedown',
  3082. topMouseMove: 'mousemove',
  3083. topMouseOut: 'mouseout',
  3084. topMouseOver: 'mouseover',
  3085. topMouseUp: 'mouseup',
  3086. topPaste: 'paste',
  3087. topPause: 'pause',
  3088. topPlay: 'play',
  3089. topPlaying: 'playing',
  3090. topProgress: 'progress',
  3091. topRateChange: 'ratechange',
  3092. topScroll: 'scroll',
  3093. topSeeked: 'seeked',
  3094. topSeeking: 'seeking',
  3095. topSelectionChange: 'selectionchange',
  3096. topStalled: 'stalled',
  3097. topSuspend: 'suspend',
  3098. topTextInput: 'textInput',
  3099. topTimeUpdate: 'timeupdate',
  3100. topTouchCancel: 'touchcancel',
  3101. topTouchEnd: 'touchend',
  3102. topTouchMove: 'touchmove',
  3103. topTouchStart: 'touchstart',
  3104. topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
  3105. topVolumeChange: 'volumechange',
  3106. topWaiting: 'waiting',
  3107. topWheel: 'wheel'
  3108. };
  3109. /**
  3110. * To ensure no conflicts with other potential React instances on the page
  3111. */
  3112. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3113. function getListeningForDocument(mountAt) {
  3114. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3115. // directly.
  3116. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3117. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3118. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3119. }
  3120. return alreadyListeningTo[mountAt[topListenersIDKey]];
  3121. }
  3122. /**
  3123. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  3124. * example:
  3125. *
  3126. * EventPluginHub.putListener('myID', 'onClick', myFunction);
  3127. *
  3128. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  3129. *
  3130. * @internal
  3131. */
  3132. var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
  3133. /**
  3134. * Injectable event backend
  3135. */
  3136. ReactEventListener: null,
  3137. injection: {
  3138. /**
  3139. * @param {object} ReactEventListener
  3140. */
  3141. injectReactEventListener: function (ReactEventListener) {
  3142. ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
  3143. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  3144. }
  3145. },
  3146. /**
  3147. * Sets whether or not any created callbacks should be enabled.
  3148. *
  3149. * @param {boolean} enabled True if callbacks should be enabled.
  3150. */
  3151. setEnabled: function (enabled) {
  3152. if (ReactBrowserEventEmitter.ReactEventListener) {
  3153. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  3154. }
  3155. },
  3156. /**
  3157. * @return {boolean} True if callbacks are enabled.
  3158. */
  3159. isEnabled: function () {
  3160. return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
  3161. },
  3162. /**
  3163. * We listen for bubbled touch events on the document object.
  3164. *
  3165. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  3166. * mounting `onmousemove` events at some node that was not the document
  3167. * element. The symptoms were that if your mouse is not moving over something
  3168. * contained within that mount point (for example on the background) the
  3169. * top-level listeners for `onmousemove` won't be called. However, if you
  3170. * register the `mousemove` on the document object, then it will of course
  3171. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  3172. * top-level listeners to the document object only, at least for these
  3173. * movement types of events and possibly all events.
  3174. *
  3175. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  3176. *
  3177. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  3178. * they bubble to document.
  3179. *
  3180. * @param {string} registrationName Name of listener (e.g. `onClick`).
  3181. * @param {object} contentDocumentHandle Document which owns the container
  3182. */
  3183. listenTo: function (registrationName, contentDocumentHandle) {
  3184. var mountAt = contentDocumentHandle;
  3185. var isListening = getListeningForDocument(mountAt);
  3186. var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
  3187. for (var i = 0; i < dependencies.length; i++) {
  3188. var dependency = dependencies[i];
  3189. if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
  3190. if (dependency === 'topWheel') {
  3191. if (isEventSupported('wheel')) {
  3192. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt);
  3193. } else if (isEventSupported('mousewheel')) {
  3194. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt);
  3195. } else {
  3196. // Firefox needs to capture a different mouse scroll event.
  3197. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  3198. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt);
  3199. }
  3200. } else if (dependency === 'topScroll') {
  3201. if (isEventSupported('scroll', true)) {
  3202. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt);
  3203. } else {
  3204. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
  3205. }
  3206. } else if (dependency === 'topFocus' || dependency === 'topBlur') {
  3207. if (isEventSupported('focus', true)) {
  3208. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt);
  3209. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt);
  3210. } else if (isEventSupported('focusin')) {
  3211. // IE has `focusin` and `focusout` events which bubble.
  3212. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  3213. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt);
  3214. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt);
  3215. }
  3216. // to make sure blur and focus event listeners are only attached once
  3217. isListening.topBlur = true;
  3218. isListening.topFocus = true;
  3219. } else if (topEventMapping.hasOwnProperty(dependency)) {
  3220. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
  3221. }
  3222. isListening[dependency] = true;
  3223. }
  3224. }
  3225. },
  3226. trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
  3227. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
  3228. },
  3229. trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
  3230. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
  3231. },
  3232. /**
  3233. * Protect against document.createEvent() returning null
  3234. * Some popup blocker extensions appear to do this:
  3235. * https://github.com/facebook/react/issues/6887
  3236. */
  3237. supportsEventPageXY: function () {
  3238. if (!document.createEvent) {
  3239. return false;
  3240. }
  3241. var ev = document.createEvent('MouseEvent');
  3242. return ev != null && 'pageX' in ev;
  3243. },
  3244. /**
  3245. * Listens to window scroll and resize events. We cache scroll values so that
  3246. * application code can access them without triggering reflows.
  3247. *
  3248. * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
  3249. * pageX/pageY isn't supported (legacy browsers).
  3250. *
  3251. * NOTE: Scroll events do not bubble.
  3252. *
  3253. * @see http://www.quirksmode.org/dom/events/scroll.html
  3254. */
  3255. ensureScrollValueMonitoring: function () {
  3256. if (hasEventPageXY === undefined) {
  3257. hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
  3258. }
  3259. if (!hasEventPageXY && !isMonitoringScrollValue) {
  3260. var refresh = ViewportMetrics.refreshScrollValues;
  3261. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  3262. isMonitoringScrollValue = true;
  3263. }
  3264. }
  3265. });
  3266. module.exports = ReactBrowserEventEmitter;
  3267. /***/ }),
  3268. /* 32 */
  3269. /***/ (function(module, exports, __webpack_require__) {
  3270. "use strict";
  3271. /**
  3272. * Copyright 2013-present, Facebook, Inc.
  3273. * All rights reserved.
  3274. *
  3275. * This source code is licensed under the BSD-style license found in the
  3276. * LICENSE file in the root directory of this source tree. An additional grant
  3277. * of patent rights can be found in the PATENTS file in the same directory.
  3278. *
  3279. */
  3280. var SyntheticUIEvent = __webpack_require__(29);
  3281. var ViewportMetrics = __webpack_require__(89);
  3282. var getEventModifierState = __webpack_require__(61);
  3283. /**
  3284. * @interface MouseEvent
  3285. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  3286. */
  3287. var MouseEventInterface = {
  3288. screenX: null,
  3289. screenY: null,
  3290. clientX: null,
  3291. clientY: null,
  3292. ctrlKey: null,
  3293. shiftKey: null,
  3294. altKey: null,
  3295. metaKey: null,
  3296. getModifierState: getEventModifierState,
  3297. button: function (event) {
  3298. // Webkit, Firefox, IE9+
  3299. // which: 1 2 3
  3300. // button: 0 1 2 (standard)
  3301. var button = event.button;
  3302. if ('which' in event) {
  3303. return button;
  3304. }
  3305. // IE<9
  3306. // which: undefined
  3307. // button: 0 0 0
  3308. // button: 1 4 2 (onmouseup)
  3309. return button === 2 ? 2 : button === 4 ? 1 : 0;
  3310. },
  3311. buttons: null,
  3312. relatedTarget: function (event) {
  3313. return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
  3314. },
  3315. // "Proprietary" Interface.
  3316. pageX: function (event) {
  3317. return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
  3318. },
  3319. pageY: function (event) {
  3320. return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
  3321. }
  3322. };
  3323. /**
  3324. * @param {object} dispatchConfig Configuration used to dispatch this event.
  3325. * @param {string} dispatchMarker Marker identifying the event target.
  3326. * @param {object} nativeEvent Native browser event.
  3327. * @extends {SyntheticUIEvent}
  3328. */
  3329. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  3330. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  3331. }
  3332. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  3333. module.exports = SyntheticMouseEvent;
  3334. /***/ }),
  3335. /* 33 */
  3336. /***/ (function(module, exports, __webpack_require__) {
  3337. "use strict";
  3338. /**
  3339. * Copyright 2013-present, Facebook, Inc.
  3340. * All rights reserved.
  3341. *
  3342. * This source code is licensed under the BSD-style license found in the
  3343. * LICENSE file in the root directory of this source tree. An additional grant
  3344. * of patent rights can be found in the PATENTS file in the same directory.
  3345. *
  3346. *
  3347. */
  3348. var _prodInvariant = __webpack_require__(2);
  3349. var invariant = __webpack_require__(0);
  3350. var OBSERVED_ERROR = {};
  3351. /**
  3352. * `Transaction` creates a black box that is able to wrap any method such that
  3353. * certain invariants are maintained before and after the method is invoked
  3354. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  3355. * instantiates a transaction can provide enforcers of the invariants at
  3356. * creation time. The `Transaction` class itself will supply one additional
  3357. * automatic invariant for you - the invariant that any transaction instance
  3358. * should not be run while it is already being run. You would typically create a
  3359. * single instance of a `Transaction` for reuse multiple times, that potentially
  3360. * is used to wrap several different methods. Wrappers are extremely simple -
  3361. * they only require implementing two methods.
  3362. *
  3363. * <pre>
  3364. * wrappers (injected at creation time)
  3365. * + +
  3366. * | |
  3367. * +-----------------|--------|--------------+
  3368. * | v | |
  3369. * | +---------------+ | |
  3370. * | +--| wrapper1 |---|----+ |
  3371. * | | +---------------+ v | |
  3372. * | | +-------------+ | |
  3373. * | | +----| wrapper2 |--------+ |
  3374. * | | | +-------------+ | | |
  3375. * | | | | | |
  3376. * | v v v v | wrapper
  3377. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  3378. * perform(anyMethod) | | | | | | | | | | | | maintained
  3379. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  3380. * | | | | | | | | | | | |
  3381. * | | | | | | | | | | | |
  3382. * | | | | | | | | | | | |
  3383. * | +---+ +---+ +---------+ +---+ +---+ |
  3384. * | initialize close |
  3385. * +-----------------------------------------+
  3386. * </pre>
  3387. *
  3388. * Use cases:
  3389. * - Preserving the input selection ranges before/after reconciliation.
  3390. * Restoring selection even in the event of an unexpected error.
  3391. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  3392. * while guaranteeing that afterwards, the event system is reactivated.
  3393. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  3394. * reconciliation takes place in a worker thread.
  3395. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  3396. * content.
  3397. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  3398. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  3399. * - (Future use case): Layout calculations before and after DOM updates.
  3400. *
  3401. * Transactional plugin API:
  3402. * - A module that has an `initialize` method that returns any precomputation.
  3403. * - and a `close` method that accepts the precomputation. `close` is invoked
  3404. * when the wrapped process is completed, or has failed.
  3405. *
  3406. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  3407. * that implement `initialize` and `close`.
  3408. * @return {Transaction} Single transaction for reuse in thread.
  3409. *
  3410. * @class Transaction
  3411. */
  3412. var TransactionImpl = {
  3413. /**
  3414. * Sets up this instance so that it is prepared for collecting metrics. Does
  3415. * so such that this setup method may be used on an instance that is already
  3416. * initialized, in a way that does not consume additional memory upon reuse.
  3417. * That can be useful if you decide to make your subclass of this mixin a
  3418. * "PooledClass".
  3419. */
  3420. reinitializeTransaction: function () {
  3421. this.transactionWrappers = this.getTransactionWrappers();
  3422. if (this.wrapperInitData) {
  3423. this.wrapperInitData.length = 0;
  3424. } else {
  3425. this.wrapperInitData = [];
  3426. }
  3427. this._isInTransaction = false;
  3428. },
  3429. _isInTransaction: false,
  3430. /**
  3431. * @abstract
  3432. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  3433. */
  3434. getTransactionWrappers: null,
  3435. isInTransaction: function () {
  3436. return !!this._isInTransaction;
  3437. },
  3438. /**
  3439. * Executes the function within a safety window. Use this for the top level
  3440. * methods that result in large amounts of computation/mutations that would
  3441. * need to be safety checked. The optional arguments helps prevent the need
  3442. * to bind in many cases.
  3443. *
  3444. * @param {function} method Member of scope to call.
  3445. * @param {Object} scope Scope to invoke from.
  3446. * @param {Object?=} a Argument to pass to the method.
  3447. * @param {Object?=} b Argument to pass to the method.
  3448. * @param {Object?=} c Argument to pass to the method.
  3449. * @param {Object?=} d Argument to pass to the method.
  3450. * @param {Object?=} e Argument to pass to the method.
  3451. * @param {Object?=} f Argument to pass to the method.
  3452. *
  3453. * @return {*} Return value from `method`.
  3454. */
  3455. perform: function (method, scope, a, b, c, d, e, f) {
  3456. !!this.isInTransaction() ? false ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
  3457. var errorThrown;
  3458. var ret;
  3459. try {
  3460. this._isInTransaction = true;
  3461. // Catching errors makes debugging more difficult, so we start with
  3462. // errorThrown set to true before setting it to false after calling
  3463. // close -- if it's still set to true in the finally block, it means
  3464. // one of these calls threw.
  3465. errorThrown = true;
  3466. this.initializeAll(0);
  3467. ret = method.call(scope, a, b, c, d, e, f);
  3468. errorThrown = false;
  3469. } finally {
  3470. try {
  3471. if (errorThrown) {
  3472. // If `method` throws, prefer to show that stack trace over any thrown
  3473. // by invoking `closeAll`.
  3474. try {
  3475. this.closeAll(0);
  3476. } catch (err) {}
  3477. } else {
  3478. // Since `method` didn't throw, we don't want to silence the exception
  3479. // here.
  3480. this.closeAll(0);
  3481. }
  3482. } finally {
  3483. this._isInTransaction = false;
  3484. }
  3485. }
  3486. return ret;
  3487. },
  3488. initializeAll: function (startIndex) {
  3489. var transactionWrappers = this.transactionWrappers;
  3490. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3491. var wrapper = transactionWrappers[i];
  3492. try {
  3493. // Catching errors makes debugging more difficult, so we start with the
  3494. // OBSERVED_ERROR state before overwriting it with the real return value
  3495. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  3496. // block, it means wrapper.initialize threw.
  3497. this.wrapperInitData[i] = OBSERVED_ERROR;
  3498. this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
  3499. } finally {
  3500. if (this.wrapperInitData[i] === OBSERVED_ERROR) {
  3501. // The initializer for wrapper i threw an error; initialize the
  3502. // remaining wrappers but silence any exceptions from them to ensure
  3503. // that the first error is the one to bubble up.
  3504. try {
  3505. this.initializeAll(i + 1);
  3506. } catch (err) {}
  3507. }
  3508. }
  3509. }
  3510. },
  3511. /**
  3512. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  3513. * them the respective return values of `this.transactionWrappers.init[i]`
  3514. * (`close`rs that correspond to initializers that failed will not be
  3515. * invoked).
  3516. */
  3517. closeAll: function (startIndex) {
  3518. !this.isInTransaction() ? false ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
  3519. var transactionWrappers = this.transactionWrappers;
  3520. for (var i = startIndex; i < transactionWrappers.length; i++) {
  3521. var wrapper = transactionWrappers[i];
  3522. var initData = this.wrapperInitData[i];
  3523. var errorThrown;
  3524. try {
  3525. // Catching errors makes debugging more difficult, so we start with
  3526. // errorThrown set to true before setting it to false after calling
  3527. // close -- if it's still set to true in the finally block, it means
  3528. // wrapper.close threw.
  3529. errorThrown = true;
  3530. if (initData !== OBSERVED_ERROR && wrapper.close) {
  3531. wrapper.close.call(this, initData);
  3532. }
  3533. errorThrown = false;
  3534. } finally {
  3535. if (errorThrown) {
  3536. // The closer for wrapper i threw an error; close the remaining
  3537. // wrappers but silence any exceptions from them to ensure that the
  3538. // first error is the one to bubble up.
  3539. try {
  3540. this.closeAll(i + 1);
  3541. } catch (e) {}
  3542. }
  3543. }
  3544. }
  3545. this.wrapperInitData.length = 0;
  3546. }
  3547. };
  3548. module.exports = TransactionImpl;
  3549. /***/ }),
  3550. /* 34 */
  3551. /***/ (function(module, exports, __webpack_require__) {
  3552. "use strict";
  3553. /**
  3554. * Copyright 2016-present, Facebook, Inc.
  3555. * All rights reserved.
  3556. *
  3557. * This source code is licensed under the BSD-style license found in the
  3558. * LICENSE file in the root directory of this source tree. An additional grant
  3559. * of patent rights can be found in the PATENTS file in the same directory.
  3560. *
  3561. * Based on the escape-html library, which is used under the MIT License below:
  3562. *
  3563. * Copyright (c) 2012-2013 TJ Holowaychuk
  3564. * Copyright (c) 2015 Andreas Lubbe
  3565. * Copyright (c) 2015 Tiancheng "Timothy" Gu
  3566. *
  3567. * Permission is hereby granted, free of charge, to any person obtaining
  3568. * a copy of this software and associated documentation files (the
  3569. * 'Software'), to deal in the Software without restriction, including
  3570. * without limitation the rights to use, copy, modify, merge, publish,
  3571. * distribute, sublicense, and/or sell copies of the Software, and to
  3572. * permit persons to whom the Software is furnished to do so, subject to
  3573. * the following conditions:
  3574. *
  3575. * The above copyright notice and this permission notice shall be
  3576. * included in all copies or substantial portions of the Software.
  3577. *
  3578. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  3579. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  3580. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  3581. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  3582. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  3583. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  3584. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  3585. *
  3586. */
  3587. // code copied and modified from escape-html
  3588. /**
  3589. * Module variables.
  3590. * @private
  3591. */
  3592. var matchHtmlRegExp = /["'&<>]/;
  3593. /**
  3594. * Escape special characters in the given string of html.
  3595. *
  3596. * @param {string} string The string to escape for inserting into HTML
  3597. * @return {string}
  3598. * @public
  3599. */
  3600. function escapeHtml(string) {
  3601. var str = '' + string;
  3602. var match = matchHtmlRegExp.exec(str);
  3603. if (!match) {
  3604. return str;
  3605. }
  3606. var escape;
  3607. var html = '';
  3608. var index = 0;
  3609. var lastIndex = 0;
  3610. for (index = match.index; index < str.length; index++) {
  3611. switch (str.charCodeAt(index)) {
  3612. case 34:
  3613. // "
  3614. escape = '&quot;';
  3615. break;
  3616. case 38:
  3617. // &
  3618. escape = '&amp;';
  3619. break;
  3620. case 39:
  3621. // '
  3622. escape = '&#x27;'; // modified from escape-html; used to be '&#39'
  3623. break;
  3624. case 60:
  3625. // <
  3626. escape = '&lt;';
  3627. break;
  3628. case 62:
  3629. // >
  3630. escape = '&gt;';
  3631. break;
  3632. default:
  3633. continue;
  3634. }
  3635. if (lastIndex !== index) {
  3636. html += str.substring(lastIndex, index);
  3637. }
  3638. lastIndex = index + 1;
  3639. html += escape;
  3640. }
  3641. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  3642. }
  3643. // end code copied and modified from escape-html
  3644. /**
  3645. * Escapes text to prevent scripting attacks.
  3646. *
  3647. * @param {*} text Text value to escape.
  3648. * @return {string} An escaped string.
  3649. */
  3650. function escapeTextContentForBrowser(text) {
  3651. if (typeof text === 'boolean' || typeof text === 'number') {
  3652. // this shortcircuit helps perf for types that we know will never have
  3653. // special characters, especially given that this function is used often
  3654. // for numeric dom ids.
  3655. return '' + text;
  3656. }
  3657. return escapeHtml(text);
  3658. }
  3659. module.exports = escapeTextContentForBrowser;
  3660. /***/ }),
  3661. /* 35 */
  3662. /***/ (function(module, exports, __webpack_require__) {
  3663. "use strict";
  3664. /**
  3665. * Copyright 2013-present, Facebook, Inc.
  3666. * All rights reserved.
  3667. *
  3668. * This source code is licensed under the BSD-style license found in the
  3669. * LICENSE file in the root directory of this source tree. An additional grant
  3670. * of patent rights can be found in the PATENTS file in the same directory.
  3671. *
  3672. */
  3673. var ExecutionEnvironment = __webpack_require__(9);
  3674. var DOMNamespaces = __webpack_require__(51);
  3675. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  3676. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  3677. var createMicrosoftUnsafeLocalFunction = __webpack_require__(59);
  3678. // SVG temp container for IE lacking innerHTML
  3679. var reusableSVGContainer;
  3680. /**
  3681. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  3682. * even in IE8.
  3683. *
  3684. * @param {DOMElement} node
  3685. * @param {string} html
  3686. * @internal
  3687. */
  3688. var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
  3689. // IE does not have innerHTML for SVG nodes, so instead we inject the
  3690. // new markup in a temp node and then move the child nodes across into
  3691. // the target node
  3692. if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
  3693. reusableSVGContainer = reusableSVGContainer || document.createElement('div');
  3694. reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
  3695. var svgNode = reusableSVGContainer.firstChild;
  3696. while (svgNode.firstChild) {
  3697. node.appendChild(svgNode.firstChild);
  3698. }
  3699. } else {
  3700. node.innerHTML = html;
  3701. }
  3702. });
  3703. if (ExecutionEnvironment.canUseDOM) {
  3704. // IE8: When updating a just created node with innerHTML only leading
  3705. // whitespace is removed. When updating an existing node with innerHTML
  3706. // whitespace in root TextNodes is also collapsed.
  3707. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  3708. // Feature detection; only IE8 is known to behave improperly like this.
  3709. var testElement = document.createElement('div');
  3710. testElement.innerHTML = ' ';
  3711. if (testElement.innerHTML === '') {
  3712. setInnerHTML = function (node, html) {
  3713. // Magic theory: IE8 supposedly differentiates between added and updated
  3714. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  3715. // from worse whitespace behavior. Re-adding a node like this triggers
  3716. // the initial and more favorable whitespace behavior.
  3717. // TODO: What to do on a detached node?
  3718. if (node.parentNode) {
  3719. node.parentNode.replaceChild(node, node);
  3720. }
  3721. // We also implement a workaround for non-visible tags disappearing into
  3722. // thin air on IE8, this only happens if there is no visible text
  3723. // in-front of the non-visible tags. Piggyback on the whitespace fix
  3724. // and simply check if any non-visible tags appear in the source.
  3725. if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  3726. // Recover leading whitespace by temporarily prepending any character.
  3727. // \uFEFF has the potential advantage of being zero-width/invisible.
  3728. // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
  3729. // in hopes that this is preserved even if "\uFEFF" is transformed to
  3730. // the actual Unicode character (by Babel, for example).
  3731. // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
  3732. node.innerHTML = String.fromCharCode(0xFEFF) + html;
  3733. // deleteData leaves an empty `TextNode` which offsets the index of all
  3734. // children. Definitely want to avoid this.
  3735. var textNode = node.firstChild;
  3736. if (textNode.data.length === 1) {
  3737. node.removeChild(textNode);
  3738. } else {
  3739. textNode.deleteData(0, 1);
  3740. }
  3741. } else {
  3742. node.innerHTML = html;
  3743. }
  3744. };
  3745. }
  3746. testElement = null;
  3747. }
  3748. module.exports = setInnerHTML;
  3749. /***/ }),
  3750. /* 36 */
  3751. /***/ (function(module, exports, __webpack_require__) {
  3752. "use strict";
  3753. /**
  3754. * @author oldj
  3755. * @blog http://oldj.net
  3756. */
  3757. module.exports = function (app, msg) {
  3758. alert(msg);
  3759. };
  3760. /***/ }),
  3761. /* 37 */
  3762. /***/ (function(module, exports, __webpack_require__) {
  3763. "use strict";
  3764. /**
  3765. * @author oldj
  3766. * @blog https://oldj.net
  3767. */
  3768. var _Agent = __webpack_require__(4);
  3769. var _Agent2 = _interopRequireDefault(_Agent);
  3770. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3771. module.exports = function (app, hosts) {
  3772. var list = app.state.list;
  3773. _Agent2.default.pact('checkNeedRemoteRefresh', list, hosts).then(function (list) {
  3774. if (!list) return;
  3775. _Agent2.default.emit('list_updated', list);
  3776. }).catch(function (e) {
  3777. console.log(e);
  3778. });
  3779. };
  3780. /***/ }),
  3781. /* 38 */
  3782. /***/ (function(module, exports, __webpack_require__) {
  3783. "use strict";
  3784. /**
  3785. * @author oldj
  3786. * @blog https://oldj.net
  3787. */
  3788. var _Agent = __webpack_require__(4);
  3789. var _Agent2 = _interopRequireDefault(_Agent);
  3790. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3791. module.exports = function (app, hosts) {
  3792. var list = app.state.list;
  3793. var idx = list.findIndex(function (item) {
  3794. return item.id === hosts.id;
  3795. });
  3796. if (idx === -1) {
  3797. return;
  3798. }
  3799. list.splice(idx, 1);
  3800. _Agent2.default.pact('saveHosts', list).then(function () {
  3801. app.setState({ list: list }, function () {
  3802. // 选中下一个 hosts
  3803. var next_hosts = list[idx] || list[idx - 1] || null;
  3804. if (next_hosts) {
  3805. app.setState({ current: next_hosts });
  3806. }
  3807. });
  3808. }).catch(function (e) {
  3809. return console.log(e);
  3810. });
  3811. };
  3812. /***/ }),
  3813. /* 39 */
  3814. /***/ (function(module, exports, __webpack_require__) {
  3815. "use strict";
  3816. /**
  3817. * @author oldj
  3818. * @blog https://oldj.net
  3819. */
  3820. var _Agent = __webpack_require__(4);
  3821. var _Agent2 = _interopRequireDefault(_Agent);
  3822. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3823. module.exports = function () {
  3824. _Agent2.default.pact('esc');
  3825. _Agent2.default.pact('sudoCancel');
  3826. };
  3827. /***/ }),
  3828. /* 40 */
  3829. /***/ (function(module, exports, __webpack_require__) {
  3830. "use strict";
  3831. /**
  3832. * @author oldj
  3833. * @blog https://oldj.net
  3834. */
  3835. module.exports = function (app, callback) {
  3836. var list = app.state.list;
  3837. var ids = list.filter(function (item) {
  3838. return item.on;
  3839. }).map(function (item) {
  3840. return item.id;
  3841. });
  3842. callback(ids);
  3843. };
  3844. /***/ }),
  3845. /* 41 */
  3846. /***/ (function(module, exports, __webpack_require__) {
  3847. "use strict";
  3848. /**
  3849. * @author oldj
  3850. * @blog https://oldj.net
  3851. */
  3852. module.exports = function (app) {
  3853. app.loadHosts();
  3854. };
  3855. /***/ }),
  3856. /* 42 */
  3857. /***/ (function(module, exports, __webpack_require__) {
  3858. "use strict";
  3859. /**
  3860. * @author oldj
  3861. * @blog https://oldj.net
  3862. */
  3863. var _Agent = __webpack_require__(4);
  3864. var _Agent2 = _interopRequireDefault(_Agent);
  3865. var _list_updated = __webpack_require__(17);
  3866. var _list_updated2 = _interopRequireDefault(_list_updated);
  3867. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3868. module.exports = function (app, ids) {
  3869. var list = app.state.list;
  3870. var new_list = [];
  3871. ids.map(function (id) {
  3872. var item = list.find(function (i) {
  3873. return i.id === id;
  3874. });
  3875. if (item) {
  3876. new_list.push(item);
  3877. }
  3878. });
  3879. _Agent2.default.pact('saveHosts', new_list).then(function (list) {
  3880. (0, _list_updated2.default)(app, list);
  3881. }).catch(function (e) {
  3882. return console.log(e);
  3883. });
  3884. };
  3885. /***/ }),
  3886. /* 43 */
  3887. /***/ (function(module, exports, __webpack_require__) {
  3888. "use strict";
  3889. /**
  3890. * @author oldj
  3891. * @blog https://oldj.net
  3892. */
  3893. var _Agent = __webpack_require__(4);
  3894. var _Agent2 = _interopRequireDefault(_Agent);
  3895. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3896. module.exports = function () {
  3897. _Agent2.default.pact('sudoCancel');
  3898. };
  3899. /***/ }),
  3900. /* 44 */
  3901. /***/ (function(module, exports, __webpack_require__) {
  3902. "use strict";
  3903. /**
  3904. * @author oldj
  3905. * @blog https://oldj.net
  3906. */
  3907. var _Agent = __webpack_require__(4);
  3908. var _Agent2 = _interopRequireDefault(_Agent);
  3909. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3910. module.exports = function (app, pswd) {
  3911. _Agent2.default.pact('sudoPSWD', pswd);
  3912. };
  3913. /***/ }),
  3914. /* 45 */
  3915. /***/ (function(module, exports, __webpack_require__) {
  3916. "use strict";
  3917. /**
  3918. * @author oldj
  3919. * @blog https://oldj.net
  3920. */
  3921. var _Agent = __webpack_require__(4);
  3922. var _Agent2 = _interopRequireDefault(_Agent);
  3923. var _save = __webpack_require__(24);
  3924. var _save2 = _interopRequireDefault(_save);
  3925. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3926. module.exports = function (app, hosts) {
  3927. hosts.on = !hosts.on;
  3928. _Agent2.default.pact('getPref').then(function (pref) {
  3929. var list = app.state.list.slice(0);
  3930. var is_single = pref.choice_mode === 'single';
  3931. if (is_single && hosts.on) {
  3932. list.map(function (item) {
  3933. if (item.id !== hosts.id) {
  3934. item.on = false;
  3935. }
  3936. });
  3937. }
  3938. return list;
  3939. }).then(function (list) {
  3940. var idx = list.findIndex(function (item) {
  3941. return item.id === hosts.id;
  3942. });
  3943. if (idx === -1) {
  3944. list.push(Object.assign({}, hosts));
  3945. } else {
  3946. var old_hosts = list[idx];
  3947. list.splice(idx, 1, Object.assign({}, old_hosts, hosts));
  3948. }
  3949. (0, _save2.default)(app, list, hosts);
  3950. });
  3951. _Agent2.default.pact('statRecord', 'switch');
  3952. };
  3953. /***/ }),
  3954. /* 46 */
  3955. /***/ (function(module, exports, __webpack_require__) {
  3956. "use strict";
  3957. /**
  3958. * @author oldj
  3959. * @blog https://oldj.net
  3960. */
  3961. var _Agent = __webpack_require__(4);
  3962. var _Agent2 = _interopRequireDefault(_Agent);
  3963. var _list_updated = __webpack_require__(17);
  3964. var _list_updated2 = _interopRequireDefault(_list_updated);
  3965. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3966. module.exports = function (app, on, on_ids, callback) {
  3967. var list = app.state.list;
  3968. var new_list = list.map(function (item) {
  3969. var new_item = Object.assign({}, item);
  3970. new_item.on = !!(on && on_ids.includes(item.id));
  3971. return new_item;
  3972. });
  3973. _Agent2.default.pact('saveHosts', new_list).then(function () {
  3974. //app.setState({list: new_list})
  3975. (0, _list_updated2.default)(app, new_list);
  3976. //app.forceUpdate()
  3977. callback();
  3978. }).catch(function (e) {
  3979. return callback(e);
  3980. });
  3981. };
  3982. /***/ }),
  3983. /* 47 */
  3984. /***/ (function(module, exports, __webpack_require__) {
  3985. "use strict";
  3986. /**
  3987. * @author oldj
  3988. * @blog https://oldj.net
  3989. */
  3990. //import Agent from '../Agent'
  3991. //import cleanData from '../../app/server/cleanData'
  3992. var _save = __webpack_require__(24);
  3993. var _save2 = _interopRequireDefault(_save);
  3994. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3995. module.exports = function (app, hosts) {
  3996. var list = app.state.list.slice(0);
  3997. var idx = list.findIndex(function (item) {
  3998. return item.id === hosts.id;
  3999. });
  4000. if (idx === -1) {
  4001. list.push(Object.assign({}, hosts));
  4002. } else {
  4003. var old_hosts = list[idx];
  4004. list.splice(idx, 1, Object.assign({}, old_hosts, hosts));
  4005. }
  4006. //list = cleanData(list)
  4007. (0, _save2.default)(app, list, hosts);
  4008. };
  4009. /***/ }),
  4010. /* 48 */
  4011. /***/ (function(module, exports, __webpack_require__) {
  4012. "use strict";
  4013. /**
  4014. * @author oldj
  4015. * @blog http://oldj.net
  4016. */
  4017. Object.defineProperty(exports, "__esModule", {
  4018. value: true
  4019. });
  4020. 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; }; }();
  4021. var _react = __webpack_require__(7);
  4022. var _react2 = _interopRequireDefault(_react);
  4023. var _Agent = __webpack_require__(4);
  4024. var _Agent2 = _interopRequireDefault(_Agent);
  4025. __webpack_require__(110);
  4026. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4027. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4028. 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; }
  4029. 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; }
  4030. var MyFrame = function (_React$Component) {
  4031. _inherits(MyFrame, _React$Component);
  4032. function MyFrame(props) {
  4033. _classCallCheck(this, MyFrame);
  4034. return _possibleConstructorReturn(this, (MyFrame.__proto__ || Object.getPrototypeOf(MyFrame)).call(this, props));
  4035. }
  4036. _createClass(MyFrame, [{
  4037. key: 'componentDidMount',
  4038. value: function componentDidMount() {
  4039. var _this2 = this;
  4040. _Agent2.default.on('esc', function () {
  4041. _this2.onCancel();
  4042. });
  4043. }
  4044. }, {
  4045. key: 'onOK',
  4046. value: function onOK() {
  4047. this.props.onOK();
  4048. }
  4049. }, {
  4050. key: 'onCancel',
  4051. value: function onCancel() {
  4052. this.props.onCancel();
  4053. }
  4054. }, {
  4055. key: 'renderFootButtons',
  4056. value: function renderFootButtons() {
  4057. var html = [];
  4058. var lang = this.props.lang;
  4059. html.push(_react2.default.createElement(
  4060. 'div',
  4061. {
  4062. className: 'button btn-cancel',
  4063. key: 'btn-cancel',
  4064. onClick: this.onCancel.bind(this)
  4065. },
  4066. this.props.cancel_title || lang.cancel
  4067. ));
  4068. html.push(_react2.default.createElement(
  4069. 'div',
  4070. {
  4071. className: 'button btn-ok btn-default',
  4072. key: 'btn-ok',
  4073. onClick: this.onOK.bind(this)
  4074. },
  4075. this.props.ok_title || lang.ok
  4076. ));
  4077. return html;
  4078. }
  4079. }, {
  4080. key: 'render',
  4081. value: function render() {
  4082. if (!this.props.show) {
  4083. return null;
  4084. }
  4085. return _react2.default.createElement(
  4086. 'div',
  4087. { className: 'frame', ref: 'frame' },
  4088. _react2.default.createElement('div', { className: 'overlay' }),
  4089. _react2.default.createElement(
  4090. 'div',
  4091. { className: 'prompt' },
  4092. _react2.default.createElement(
  4093. 'div',
  4094. { className: 'head' },
  4095. this.props.head
  4096. ),
  4097. _react2.default.createElement(
  4098. 'div',
  4099. { className: 'body' },
  4100. this.props.body
  4101. ),
  4102. _react2.default.createElement(
  4103. 'div',
  4104. { className: 'foot' },
  4105. this.renderFootButtons()
  4106. )
  4107. )
  4108. );
  4109. }
  4110. }]);
  4111. return MyFrame;
  4112. }(_react2.default.Component);
  4113. exports.default = MyFrame;
  4114. /***/ }),
  4115. /* 49 */
  4116. /***/ (function(module, exports, __webpack_require__) {
  4117. "use strict";
  4118. /**
  4119. * Copyright (c) 2013-present, Facebook, Inc.
  4120. * All rights reserved.
  4121. *
  4122. * This source code is licensed under the BSD-style license found in the
  4123. * LICENSE file in the root directory of this source tree. An additional grant
  4124. * of patent rights can be found in the PATENTS file in the same directory.
  4125. *
  4126. * @typechecks
  4127. *
  4128. */
  4129. /*eslint-disable no-self-compare */
  4130. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4131. /**
  4132. * inlined Object.is polyfill to avoid requiring consumers ship their own
  4133. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  4134. */
  4135. function is(x, y) {
  4136. // SameValue algorithm
  4137. if (x === y) {
  4138. // Steps 1-5, 7-10
  4139. // Steps 6.b-6.e: +0 != -0
  4140. // Added the nonzero y check to make Flow happy, but it is redundant
  4141. return x !== 0 || y !== 0 || 1 / x === 1 / y;
  4142. } else {
  4143. // Step 6.a: NaN == NaN
  4144. return x !== x && y !== y;
  4145. }
  4146. }
  4147. /**
  4148. * Performs equality by iterating through keys on an object and returning false
  4149. * when any key has values which are not strictly equal between the arguments.
  4150. * Returns true when the values of all keys are strictly equal.
  4151. */
  4152. function shallowEqual(objA, objB) {
  4153. if (is(objA, objB)) {
  4154. return true;
  4155. }
  4156. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  4157. return false;
  4158. }
  4159. var keysA = Object.keys(objA);
  4160. var keysB = Object.keys(objB);
  4161. if (keysA.length !== keysB.length) {
  4162. return false;
  4163. }
  4164. // Test for A's keys different from B.
  4165. for (var i = 0; i < keysA.length; i++) {
  4166. if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
  4167. return false;
  4168. }
  4169. }
  4170. return true;
  4171. }
  4172. module.exports = shallowEqual;
  4173. /***/ }),
  4174. /* 50 */
  4175. /***/ (function(module, exports, __webpack_require__) {
  4176. "use strict";
  4177. /**
  4178. * Copyright 2013-present, Facebook, Inc.
  4179. * All rights reserved.
  4180. *
  4181. * This source code is licensed under the BSD-style license found in the
  4182. * LICENSE file in the root directory of this source tree. An additional grant
  4183. * of patent rights can be found in the PATENTS file in the same directory.
  4184. *
  4185. */
  4186. var DOMLazyTree = __webpack_require__(18);
  4187. var Danger = __webpack_require__(174);
  4188. var ReactDOMComponentTree = __webpack_require__(5);
  4189. var ReactInstrumentation = __webpack_require__(11);
  4190. var createMicrosoftUnsafeLocalFunction = __webpack_require__(59);
  4191. var setInnerHTML = __webpack_require__(35);
  4192. var setTextContent = __webpack_require__(96);
  4193. function getNodeAfter(parentNode, node) {
  4194. // Special case for text components, which return [open, close] comments
  4195. // from getHostNode.
  4196. if (Array.isArray(node)) {
  4197. node = node[1];
  4198. }
  4199. return node ? node.nextSibling : parentNode.firstChild;
  4200. }
  4201. /**
  4202. * Inserts `childNode` as a child of `parentNode` at the `index`.
  4203. *
  4204. * @param {DOMElement} parentNode Parent node in which to insert.
  4205. * @param {DOMElement} childNode Child node to insert.
  4206. * @param {number} index Index at which to insert the child.
  4207. * @internal
  4208. */
  4209. var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
  4210. // We rely exclusively on `insertBefore(node, null)` instead of also using
  4211. // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
  4212. // we are careful to use `null`.)
  4213. parentNode.insertBefore(childNode, referenceNode);
  4214. });
  4215. function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
  4216. DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
  4217. }
  4218. function moveChild(parentNode, childNode, referenceNode) {
  4219. if (Array.isArray(childNode)) {
  4220. moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
  4221. } else {
  4222. insertChildAt(parentNode, childNode, referenceNode);
  4223. }
  4224. }
  4225. function removeChild(parentNode, childNode) {
  4226. if (Array.isArray(childNode)) {
  4227. var closingComment = childNode[1];
  4228. childNode = childNode[0];
  4229. removeDelimitedText(parentNode, childNode, closingComment);
  4230. parentNode.removeChild(closingComment);
  4231. }
  4232. parentNode.removeChild(childNode);
  4233. }
  4234. function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
  4235. var node = openingComment;
  4236. while (true) {
  4237. var nextNode = node.nextSibling;
  4238. insertChildAt(parentNode, node, referenceNode);
  4239. if (node === closingComment) {
  4240. break;
  4241. }
  4242. node = nextNode;
  4243. }
  4244. }
  4245. function removeDelimitedText(parentNode, startNode, closingComment) {
  4246. while (true) {
  4247. var node = startNode.nextSibling;
  4248. if (node === closingComment) {
  4249. // The closing comment is removed by ReactMultiChild.
  4250. break;
  4251. } else {
  4252. parentNode.removeChild(node);
  4253. }
  4254. }
  4255. }
  4256. function replaceDelimitedText(openingComment, closingComment, stringText) {
  4257. var parentNode = openingComment.parentNode;
  4258. var nodeAfterComment = openingComment.nextSibling;
  4259. if (nodeAfterComment === closingComment) {
  4260. // There are no text nodes between the opening and closing comments; insert
  4261. // a new one if stringText isn't empty.
  4262. if (stringText) {
  4263. insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
  4264. }
  4265. } else {
  4266. if (stringText) {
  4267. // Set the text content of the first node after the opening comment, and
  4268. // remove all following nodes up until the closing comment.
  4269. setTextContent(nodeAfterComment, stringText);
  4270. removeDelimitedText(parentNode, nodeAfterComment, closingComment);
  4271. } else {
  4272. removeDelimitedText(parentNode, openingComment, closingComment);
  4273. }
  4274. }
  4275. if (false) {
  4276. ReactInstrumentation.debugTool.onHostOperation({
  4277. instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID,
  4278. type: 'replace text',
  4279. payload: stringText
  4280. });
  4281. }
  4282. }
  4283. var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
  4284. if (false) {
  4285. dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
  4286. Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
  4287. if (prevInstance._debugID !== 0) {
  4288. ReactInstrumentation.debugTool.onHostOperation({
  4289. instanceID: prevInstance._debugID,
  4290. type: 'replace with',
  4291. payload: markup.toString()
  4292. });
  4293. } else {
  4294. var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
  4295. if (nextInstance._debugID !== 0) {
  4296. ReactInstrumentation.debugTool.onHostOperation({
  4297. instanceID: nextInstance._debugID,
  4298. type: 'mount',
  4299. payload: markup.toString()
  4300. });
  4301. }
  4302. }
  4303. };
  4304. }
  4305. /**
  4306. * Operations for updating with DOM children.
  4307. */
  4308. var DOMChildrenOperations = {
  4309. dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
  4310. replaceDelimitedText: replaceDelimitedText,
  4311. /**
  4312. * Updates a component's children by processing a series of updates. The
  4313. * update configurations are each expected to have a `parentNode` property.
  4314. *
  4315. * @param {array<object>} updates List of update configurations.
  4316. * @internal
  4317. */
  4318. processUpdates: function (parentNode, updates) {
  4319. if (false) {
  4320. var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
  4321. }
  4322. for (var k = 0; k < updates.length; k++) {
  4323. var update = updates[k];
  4324. switch (update.type) {
  4325. case 'INSERT_MARKUP':
  4326. insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
  4327. if (false) {
  4328. ReactInstrumentation.debugTool.onHostOperation({
  4329. instanceID: parentNodeDebugID,
  4330. type: 'insert child',
  4331. payload: { toIndex: update.toIndex, content: update.content.toString() }
  4332. });
  4333. }
  4334. break;
  4335. case 'MOVE_EXISTING':
  4336. moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
  4337. if (false) {
  4338. ReactInstrumentation.debugTool.onHostOperation({
  4339. instanceID: parentNodeDebugID,
  4340. type: 'move child',
  4341. payload: { fromIndex: update.fromIndex, toIndex: update.toIndex }
  4342. });
  4343. }
  4344. break;
  4345. case 'SET_MARKUP':
  4346. setInnerHTML(parentNode, update.content);
  4347. if (false) {
  4348. ReactInstrumentation.debugTool.onHostOperation({
  4349. instanceID: parentNodeDebugID,
  4350. type: 'replace children',
  4351. payload: update.content.toString()
  4352. });
  4353. }
  4354. break;
  4355. case 'TEXT_CONTENT':
  4356. setTextContent(parentNode, update.content);
  4357. if (false) {
  4358. ReactInstrumentation.debugTool.onHostOperation({
  4359. instanceID: parentNodeDebugID,
  4360. type: 'replace text',
  4361. payload: update.content.toString()
  4362. });
  4363. }
  4364. break;
  4365. case 'REMOVE_NODE':
  4366. removeChild(parentNode, update.fromNode);
  4367. if (false) {
  4368. ReactInstrumentation.debugTool.onHostOperation({
  4369. instanceID: parentNodeDebugID,
  4370. type: 'remove child',
  4371. payload: { fromIndex: update.fromIndex }
  4372. });
  4373. }
  4374. break;
  4375. }
  4376. }
  4377. }
  4378. };
  4379. module.exports = DOMChildrenOperations;
  4380. /***/ }),
  4381. /* 51 */
  4382. /***/ (function(module, exports, __webpack_require__) {
  4383. "use strict";
  4384. /**
  4385. * Copyright 2013-present, Facebook, Inc.
  4386. * All rights reserved.
  4387. *
  4388. * This source code is licensed under the BSD-style license found in the
  4389. * LICENSE file in the root directory of this source tree. An additional grant
  4390. * of patent rights can be found in the PATENTS file in the same directory.
  4391. *
  4392. */
  4393. var DOMNamespaces = {
  4394. html: 'http://www.w3.org/1999/xhtml',
  4395. mathml: 'http://www.w3.org/1998/Math/MathML',
  4396. svg: 'http://www.w3.org/2000/svg'
  4397. };
  4398. module.exports = DOMNamespaces;
  4399. /***/ }),
  4400. /* 52 */
  4401. /***/ (function(module, exports, __webpack_require__) {
  4402. "use strict";
  4403. /**
  4404. * Copyright 2013-present, Facebook, Inc.
  4405. * All rights reserved.
  4406. *
  4407. * This source code is licensed under the BSD-style license found in the
  4408. * LICENSE file in the root directory of this source tree. An additional grant
  4409. * of patent rights can be found in the PATENTS file in the same directory.
  4410. *
  4411. *
  4412. */
  4413. var _prodInvariant = __webpack_require__(2);
  4414. var invariant = __webpack_require__(0);
  4415. /**
  4416. * Injectable ordering of event plugins.
  4417. */
  4418. var eventPluginOrder = null;
  4419. /**
  4420. * Injectable mapping from names to event plugin modules.
  4421. */
  4422. var namesToPlugins = {};
  4423. /**
  4424. * Recomputes the plugin list using the injected plugins and plugin ordering.
  4425. *
  4426. * @private
  4427. */
  4428. function recomputePluginOrdering() {
  4429. if (!eventPluginOrder) {
  4430. // Wait until an `eventPluginOrder` is injected.
  4431. return;
  4432. }
  4433. for (var pluginName in namesToPlugins) {
  4434. var pluginModule = namesToPlugins[pluginName];
  4435. var pluginIndex = eventPluginOrder.indexOf(pluginName);
  4436. !(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;
  4437. if (EventPluginRegistry.plugins[pluginIndex]) {
  4438. continue;
  4439. }
  4440. !pluginModule.extractEvents ? false ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
  4441. EventPluginRegistry.plugins[pluginIndex] = pluginModule;
  4442. var publishedEvents = pluginModule.eventTypes;
  4443. for (var eventName in publishedEvents) {
  4444. !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;
  4445. }
  4446. }
  4447. }
  4448. /**
  4449. * Publishes an event so that it can be dispatched by the supplied plugin.
  4450. *
  4451. * @param {object} dispatchConfig Dispatch configuration for the event.
  4452. * @param {object} PluginModule Plugin publishing the event.
  4453. * @return {boolean} True if the event was successfully published.
  4454. * @private
  4455. */
  4456. function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
  4457. !!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;
  4458. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  4459. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  4460. if (phasedRegistrationNames) {
  4461. for (var phaseName in phasedRegistrationNames) {
  4462. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  4463. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  4464. publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
  4465. }
  4466. }
  4467. return true;
  4468. } else if (dispatchConfig.registrationName) {
  4469. publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
  4470. return true;
  4471. }
  4472. return false;
  4473. }
  4474. /**
  4475. * Publishes a registration name that is used to identify dispatched events and
  4476. * can be used with `EventPluginHub.putListener` to register listeners.
  4477. *
  4478. * @param {string} registrationName Registration name to add.
  4479. * @param {object} PluginModule Plugin publishing the event.
  4480. * @private
  4481. */
  4482. function publishRegistrationName(registrationName, pluginModule, eventName) {
  4483. !!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;
  4484. EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
  4485. EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
  4486. if (false) {
  4487. var lowerCasedName = registrationName.toLowerCase();
  4488. EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
  4489. if (registrationName === 'onDoubleClick') {
  4490. EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
  4491. }
  4492. }
  4493. }
  4494. /**
  4495. * Registers plugins so that they can extract and dispatch events.
  4496. *
  4497. * @see {EventPluginHub}
  4498. */
  4499. var EventPluginRegistry = {
  4500. /**
  4501. * Ordered list of injected plugins.
  4502. */
  4503. plugins: [],
  4504. /**
  4505. * Mapping from event name to dispatch config
  4506. */
  4507. eventNameDispatchConfigs: {},
  4508. /**
  4509. * Mapping from registration name to plugin module
  4510. */
  4511. registrationNameModules: {},
  4512. /**
  4513. * Mapping from registration name to event name
  4514. */
  4515. registrationNameDependencies: {},
  4516. /**
  4517. * Mapping from lowercase registration names to the properly cased version,
  4518. * used to warn in the case of missing event handlers. Available
  4519. * only in __DEV__.
  4520. * @type {Object}
  4521. */
  4522. possibleRegistrationNames: false ? {} : null,
  4523. // Trust the developer to only use possibleRegistrationNames in __DEV__
  4524. /**
  4525. * Injects an ordering of plugins (by plugin name). This allows the ordering
  4526. * to be decoupled from injection of the actual plugins so that ordering is
  4527. * always deterministic regardless of packaging, on-the-fly injection, etc.
  4528. *
  4529. * @param {array} InjectedEventPluginOrder
  4530. * @internal
  4531. * @see {EventPluginHub.injection.injectEventPluginOrder}
  4532. */
  4533. injectEventPluginOrder: function (injectedEventPluginOrder) {
  4534. !!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;
  4535. // Clone the ordering so it cannot be dynamically mutated.
  4536. eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
  4537. recomputePluginOrdering();
  4538. },
  4539. /**
  4540. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  4541. * in the ordering injected by `injectEventPluginOrder`.
  4542. *
  4543. * Plugins can be injected as part of page initialization or on-the-fly.
  4544. *
  4545. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  4546. * @internal
  4547. * @see {EventPluginHub.injection.injectEventPluginsByName}
  4548. */
  4549. injectEventPluginsByName: function (injectedNamesToPlugins) {
  4550. var isOrderingDirty = false;
  4551. for (var pluginName in injectedNamesToPlugins) {
  4552. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  4553. continue;
  4554. }
  4555. var pluginModule = injectedNamesToPlugins[pluginName];
  4556. if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
  4557. !!namesToPlugins[pluginName] ? false ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
  4558. namesToPlugins[pluginName] = pluginModule;
  4559. isOrderingDirty = true;
  4560. }
  4561. }
  4562. if (isOrderingDirty) {
  4563. recomputePluginOrdering();
  4564. }
  4565. },
  4566. /**
  4567. * Looks up the plugin for the supplied event.
  4568. *
  4569. * @param {object} event A synthetic event.
  4570. * @return {?object} The plugin that created the supplied event.
  4571. * @internal
  4572. */
  4573. getPluginModuleForEvent: function (event) {
  4574. var dispatchConfig = event.dispatchConfig;
  4575. if (dispatchConfig.registrationName) {
  4576. return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
  4577. }
  4578. if (dispatchConfig.phasedRegistrationNames !== undefined) {
  4579. // pulling phasedRegistrationNames out of dispatchConfig helps Flow see
  4580. // that it is not undefined.
  4581. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  4582. for (var phase in phasedRegistrationNames) {
  4583. if (!phasedRegistrationNames.hasOwnProperty(phase)) {
  4584. continue;
  4585. }
  4586. var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]];
  4587. if (pluginModule) {
  4588. return pluginModule;
  4589. }
  4590. }
  4591. }
  4592. return null;
  4593. },
  4594. /**
  4595. * Exposed for unit testing.
  4596. * @private
  4597. */
  4598. _resetEventPlugins: function () {
  4599. eventPluginOrder = null;
  4600. for (var pluginName in namesToPlugins) {
  4601. if (namesToPlugins.hasOwnProperty(pluginName)) {
  4602. delete namesToPlugins[pluginName];
  4603. }
  4604. }
  4605. EventPluginRegistry.plugins.length = 0;
  4606. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  4607. for (var eventName in eventNameDispatchConfigs) {
  4608. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  4609. delete eventNameDispatchConfigs[eventName];
  4610. }
  4611. }
  4612. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  4613. for (var registrationName in registrationNameModules) {
  4614. if (registrationNameModules.hasOwnProperty(registrationName)) {
  4615. delete registrationNameModules[registrationName];
  4616. }
  4617. }
  4618. if (false) {
  4619. var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
  4620. for (var lowerCasedName in possibleRegistrationNames) {
  4621. if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
  4622. delete possibleRegistrationNames[lowerCasedName];
  4623. }
  4624. }
  4625. }
  4626. }
  4627. };
  4628. module.exports = EventPluginRegistry;
  4629. /***/ }),
  4630. /* 53 */
  4631. /***/ (function(module, exports, __webpack_require__) {
  4632. "use strict";
  4633. /**
  4634. * Copyright 2013-present, Facebook, Inc.
  4635. * All rights reserved.
  4636. *
  4637. * This source code is licensed under the BSD-style license found in the
  4638. * LICENSE file in the root directory of this source tree. An additional grant
  4639. * of patent rights can be found in the PATENTS file in the same directory.
  4640. *
  4641. */
  4642. var _prodInvariant = __webpack_require__(2);
  4643. var ReactErrorUtils = __webpack_require__(57);
  4644. var invariant = __webpack_require__(0);
  4645. var warning = __webpack_require__(1);
  4646. /**
  4647. * Injected dependencies:
  4648. */
  4649. /**
  4650. * - `ComponentTree`: [required] Module that can convert between React instances
  4651. * and actual node references.
  4652. */
  4653. var ComponentTree;
  4654. var TreeTraversal;
  4655. var injection = {
  4656. injectComponentTree: function (Injected) {
  4657. ComponentTree = Injected;
  4658. if (false) {
  4659. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
  4660. }
  4661. },
  4662. injectTreeTraversal: function (Injected) {
  4663. TreeTraversal = Injected;
  4664. if (false) {
  4665. process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
  4666. }
  4667. }
  4668. };
  4669. function isEndish(topLevelType) {
  4670. return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
  4671. }
  4672. function isMoveish(topLevelType) {
  4673. return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
  4674. }
  4675. function isStartish(topLevelType) {
  4676. return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
  4677. }
  4678. var validateEventDispatches;
  4679. if (false) {
  4680. validateEventDispatches = function (event) {
  4681. var dispatchListeners = event._dispatchListeners;
  4682. var dispatchInstances = event._dispatchInstances;
  4683. var listenersIsArr = Array.isArray(dispatchListeners);
  4684. var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
  4685. var instancesIsArr = Array.isArray(dispatchInstances);
  4686. var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
  4687. process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
  4688. };
  4689. }
  4690. /**
  4691. * Dispatch the event to the listener.
  4692. * @param {SyntheticEvent} event SyntheticEvent to handle
  4693. * @param {boolean} simulated If the event is simulated (changes exn behavior)
  4694. * @param {function} listener Application-level callback
  4695. * @param {*} inst Internal component instance
  4696. */
  4697. function executeDispatch(event, simulated, listener, inst) {
  4698. var type = event.type || 'unknown-event';
  4699. event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
  4700. if (simulated) {
  4701. ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
  4702. } else {
  4703. ReactErrorUtils.invokeGuardedCallback(type, listener, event);
  4704. }
  4705. event.currentTarget = null;
  4706. }
  4707. /**
  4708. * Standard/simple iteration through an event's collected dispatches.
  4709. */
  4710. function executeDispatchesInOrder(event, simulated) {
  4711. var dispatchListeners = event._dispatchListeners;
  4712. var dispatchInstances = event._dispatchInstances;
  4713. if (false) {
  4714. validateEventDispatches(event);
  4715. }
  4716. if (Array.isArray(dispatchListeners)) {
  4717. for (var i = 0; i < dispatchListeners.length; i++) {
  4718. if (event.isPropagationStopped()) {
  4719. break;
  4720. }
  4721. // Listeners and Instances are two parallel arrays that are always in sync.
  4722. executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
  4723. }
  4724. } else if (dispatchListeners) {
  4725. executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
  4726. }
  4727. event._dispatchListeners = null;
  4728. event._dispatchInstances = null;
  4729. }
  4730. /**
  4731. * Standard/simple iteration through an event's collected dispatches, but stops
  4732. * at the first dispatch execution returning true, and returns that id.
  4733. *
  4734. * @return {?string} id of the first dispatch execution who's listener returns
  4735. * true, or null if no listener returned true.
  4736. */
  4737. function executeDispatchesInOrderStopAtTrueImpl(event) {
  4738. var dispatchListeners = event._dispatchListeners;
  4739. var dispatchInstances = event._dispatchInstances;
  4740. if (false) {
  4741. validateEventDispatches(event);
  4742. }
  4743. if (Array.isArray(dispatchListeners)) {
  4744. for (var i = 0; i < dispatchListeners.length; i++) {
  4745. if (event.isPropagationStopped()) {
  4746. break;
  4747. }
  4748. // Listeners and Instances are two parallel arrays that are always in sync.
  4749. if (dispatchListeners[i](event, dispatchInstances[i])) {
  4750. return dispatchInstances[i];
  4751. }
  4752. }
  4753. } else if (dispatchListeners) {
  4754. if (dispatchListeners(event, dispatchInstances)) {
  4755. return dispatchInstances;
  4756. }
  4757. }
  4758. return null;
  4759. }
  4760. /**
  4761. * @see executeDispatchesInOrderStopAtTrueImpl
  4762. */
  4763. function executeDispatchesInOrderStopAtTrue(event) {
  4764. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  4765. event._dispatchInstances = null;
  4766. event._dispatchListeners = null;
  4767. return ret;
  4768. }
  4769. /**
  4770. * Execution of a "direct" dispatch - there must be at most one dispatch
  4771. * accumulated on the event or it is considered an error. It doesn't really make
  4772. * sense for an event with multiple dispatches (bubbled) to keep track of the
  4773. * return values at each dispatch execution, but it does tend to make sense when
  4774. * dealing with "direct" dispatches.
  4775. *
  4776. * @return {*} The return value of executing the single dispatch.
  4777. */
  4778. function executeDirectDispatch(event) {
  4779. if (false) {
  4780. validateEventDispatches(event);
  4781. }
  4782. var dispatchListener = event._dispatchListeners;
  4783. var dispatchInstance = event._dispatchInstances;
  4784. !!Array.isArray(dispatchListener) ? false ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
  4785. event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
  4786. var res = dispatchListener ? dispatchListener(event) : null;
  4787. event.currentTarget = null;
  4788. event._dispatchListeners = null;
  4789. event._dispatchInstances = null;
  4790. return res;
  4791. }
  4792. /**
  4793. * @param {SyntheticEvent} event
  4794. * @return {boolean} True iff number of dispatches accumulated is greater than 0.
  4795. */
  4796. function hasDispatches(event) {
  4797. return !!event._dispatchListeners;
  4798. }
  4799. /**
  4800. * General utilities that are useful in creating custom Event Plugins.
  4801. */
  4802. var EventPluginUtils = {
  4803. isEndish: isEndish,
  4804. isMoveish: isMoveish,
  4805. isStartish: isStartish,
  4806. executeDirectDispatch: executeDirectDispatch,
  4807. executeDispatchesInOrder: executeDispatchesInOrder,
  4808. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  4809. hasDispatches: hasDispatches,
  4810. getInstanceFromNode: function (node) {
  4811. return ComponentTree.getInstanceFromNode(node);
  4812. },
  4813. getNodeFromInstance: function (node) {
  4814. return ComponentTree.getNodeFromInstance(node);
  4815. },
  4816. isAncestor: function (a, b) {
  4817. return TreeTraversal.isAncestor(a, b);
  4818. },
  4819. getLowestCommonAncestor: function (a, b) {
  4820. return TreeTraversal.getLowestCommonAncestor(a, b);
  4821. },
  4822. getParentInstance: function (inst) {
  4823. return TreeTraversal.getParentInstance(inst);
  4824. },
  4825. traverseTwoPhase: function (target, fn, arg) {
  4826. return TreeTraversal.traverseTwoPhase(target, fn, arg);
  4827. },
  4828. traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
  4829. return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
  4830. },
  4831. injection: injection
  4832. };
  4833. module.exports = EventPluginUtils;
  4834. /***/ }),
  4835. /* 54 */
  4836. /***/ (function(module, exports, __webpack_require__) {
  4837. "use strict";
  4838. /**
  4839. * Copyright 2013-present, Facebook, Inc.
  4840. * All rights reserved.
  4841. *
  4842. * This source code is licensed under the BSD-style license found in the
  4843. * LICENSE file in the root directory of this source tree. An additional grant
  4844. * of patent rights can be found in the PATENTS file in the same directory.
  4845. *
  4846. *
  4847. */
  4848. /**
  4849. * Escape and wrap key so it is safe to use as a reactid
  4850. *
  4851. * @param {string} key to be escaped.
  4852. * @return {string} the escaped key.
  4853. */
  4854. function escape(key) {
  4855. var escapeRegex = /[=:]/g;
  4856. var escaperLookup = {
  4857. '=': '=0',
  4858. ':': '=2'
  4859. };
  4860. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  4861. return escaperLookup[match];
  4862. });
  4863. return '$' + escapedString;
  4864. }
  4865. /**
  4866. * Unescape and unwrap key for human-readable display
  4867. *
  4868. * @param {string} key to unescape.
  4869. * @return {string} the unescaped key.
  4870. */
  4871. function unescape(key) {
  4872. var unescapeRegex = /(=0|=2)/g;
  4873. var unescaperLookup = {
  4874. '=0': '=',
  4875. '=2': ':'
  4876. };
  4877. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  4878. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  4879. return unescaperLookup[match];
  4880. });
  4881. }
  4882. var KeyEscapeUtils = {
  4883. escape: escape,
  4884. unescape: unescape
  4885. };
  4886. module.exports = KeyEscapeUtils;
  4887. /***/ }),
  4888. /* 55 */
  4889. /***/ (function(module, exports, __webpack_require__) {
  4890. "use strict";
  4891. /**
  4892. * Copyright 2013-present, Facebook, Inc.
  4893. * All rights reserved.
  4894. *
  4895. * This source code is licensed under the BSD-style license found in the
  4896. * LICENSE file in the root directory of this source tree. An additional grant
  4897. * of patent rights can be found in the PATENTS file in the same directory.
  4898. *
  4899. */
  4900. var _prodInvariant = __webpack_require__(2);
  4901. var React = __webpack_require__(21);
  4902. var ReactPropTypesSecret = __webpack_require__(203);
  4903. var invariant = __webpack_require__(0);
  4904. var warning = __webpack_require__(1);
  4905. var hasReadOnlyValue = {
  4906. 'button': true,
  4907. 'checkbox': true,
  4908. 'image': true,
  4909. 'hidden': true,
  4910. 'radio': true,
  4911. 'reset': true,
  4912. 'submit': true
  4913. };
  4914. function _assertSingleLink(inputProps) {
  4915. !(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;
  4916. }
  4917. function _assertValueLink(inputProps) {
  4918. _assertSingleLink(inputProps);
  4919. !(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;
  4920. }
  4921. function _assertCheckedLink(inputProps) {
  4922. _assertSingleLink(inputProps);
  4923. !(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;
  4924. }
  4925. var propTypes = {
  4926. value: function (props, propName, componentName) {
  4927. if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
  4928. return null;
  4929. }
  4930. 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`.');
  4931. },
  4932. checked: function (props, propName, componentName) {
  4933. if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
  4934. return null;
  4935. }
  4936. 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`.');
  4937. },
  4938. onChange: React.PropTypes.func
  4939. };
  4940. var loggedTypeFailures = {};
  4941. function getDeclarationErrorAddendum(owner) {
  4942. if (owner) {
  4943. var name = owner.getName();
  4944. if (name) {
  4945. return ' Check the render method of `' + name + '`.';
  4946. }
  4947. }
  4948. return '';
  4949. }
  4950. /**
  4951. * Provide a linked `value` attribute for controlled forms. You should not use
  4952. * this outside of the ReactDOM controlled form components.
  4953. */
  4954. var LinkedValueUtils = {
  4955. checkPropTypes: function (tagName, props, owner) {
  4956. for (var propName in propTypes) {
  4957. if (propTypes.hasOwnProperty(propName)) {
  4958. var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
  4959. }
  4960. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  4961. // Only monitor this failure once because there tends to be a lot of the
  4962. // same error.
  4963. loggedTypeFailures[error.message] = true;
  4964. var addendum = getDeclarationErrorAddendum(owner);
  4965. false ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
  4966. }
  4967. }
  4968. },
  4969. /**
  4970. * @param {object} inputProps Props for form component
  4971. * @return {*} current value of the input either from value prop or link.
  4972. */
  4973. getValue: function (inputProps) {
  4974. if (inputProps.valueLink) {
  4975. _assertValueLink(inputProps);
  4976. return inputProps.valueLink.value;
  4977. }
  4978. return inputProps.value;
  4979. },
  4980. /**
  4981. * @param {object} inputProps Props for form component
  4982. * @return {*} current checked status of the input either from checked prop
  4983. * or link.
  4984. */
  4985. getChecked: function (inputProps) {
  4986. if (inputProps.checkedLink) {
  4987. _assertCheckedLink(inputProps);
  4988. return inputProps.checkedLink.value;
  4989. }
  4990. return inputProps.checked;
  4991. },
  4992. /**
  4993. * @param {object} inputProps Props for form component
  4994. * @param {SyntheticEvent} event change event to handle
  4995. */
  4996. executeOnChange: function (inputProps, event) {
  4997. if (inputProps.valueLink) {
  4998. _assertValueLink(inputProps);
  4999. return inputProps.valueLink.requestChange(event.target.value);
  5000. } else if (inputProps.checkedLink) {
  5001. _assertCheckedLink(inputProps);
  5002. return inputProps.checkedLink.requestChange(event.target.checked);
  5003. } else if (inputProps.onChange) {
  5004. return inputProps.onChange.call(undefined, event);
  5005. }
  5006. }
  5007. };
  5008. module.exports = LinkedValueUtils;
  5009. /***/ }),
  5010. /* 56 */
  5011. /***/ (function(module, exports, __webpack_require__) {
  5012. "use strict";
  5013. /**
  5014. * Copyright 2014-present, Facebook, Inc.
  5015. * All rights reserved.
  5016. *
  5017. * This source code is licensed under the BSD-style license found in the
  5018. * LICENSE file in the root directory of this source tree. An additional grant
  5019. * of patent rights can be found in the PATENTS file in the same directory.
  5020. *
  5021. *
  5022. */
  5023. var _prodInvariant = __webpack_require__(2);
  5024. var invariant = __webpack_require__(0);
  5025. var injected = false;
  5026. var ReactComponentEnvironment = {
  5027. /**
  5028. * Optionally injectable hook for swapping out mount images in the middle of
  5029. * the tree.
  5030. */
  5031. replaceNodeWithMarkup: null,
  5032. /**
  5033. * Optionally injectable hook for processing a queue of child updates. Will
  5034. * later move into MultiChildComponents.
  5035. */
  5036. processChildrenUpdates: null,
  5037. injection: {
  5038. injectEnvironment: function (environment) {
  5039. !!injected ? false ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
  5040. ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
  5041. ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
  5042. injected = true;
  5043. }
  5044. }
  5045. };
  5046. module.exports = ReactComponentEnvironment;
  5047. /***/ }),
  5048. /* 57 */
  5049. /***/ (function(module, exports, __webpack_require__) {
  5050. "use strict";
  5051. /**
  5052. * Copyright 2013-present, Facebook, Inc.
  5053. * All rights reserved.
  5054. *
  5055. * This source code is licensed under the BSD-style license found in the
  5056. * LICENSE file in the root directory of this source tree. An additional grant
  5057. * of patent rights can be found in the PATENTS file in the same directory.
  5058. *
  5059. *
  5060. */
  5061. var caughtError = null;
  5062. /**
  5063. * Call a function while guarding against errors that happens within it.
  5064. *
  5065. * @param {String} name of the guard to use for logging or debugging
  5066. * @param {Function} func The function to invoke
  5067. * @param {*} a First argument
  5068. * @param {*} b Second argument
  5069. */
  5070. function invokeGuardedCallback(name, func, a) {
  5071. try {
  5072. func(a);
  5073. } catch (x) {
  5074. if (caughtError === null) {
  5075. caughtError = x;
  5076. }
  5077. }
  5078. }
  5079. var ReactErrorUtils = {
  5080. invokeGuardedCallback: invokeGuardedCallback,
  5081. /**
  5082. * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
  5083. * handler are sure to be rethrown by rethrowCaughtError.
  5084. */
  5085. invokeGuardedCallbackWithCatch: invokeGuardedCallback,
  5086. /**
  5087. * During execution of guarded functions we will capture the first error which
  5088. * we will rethrow to be handled by the top level error handler.
  5089. */
  5090. rethrowCaughtError: function () {
  5091. if (caughtError) {
  5092. var error = caughtError;
  5093. caughtError = null;
  5094. throw error;
  5095. }
  5096. }
  5097. };
  5098. if (false) {
  5099. /**
  5100. * To help development we can get better devtools integration by simulating a
  5101. * real browser event.
  5102. */
  5103. if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
  5104. var fakeNode = document.createElement('react');
  5105. ReactErrorUtils.invokeGuardedCallback = function (name, func, a) {
  5106. var boundFunc = func.bind(null, a);
  5107. var evtType = 'react-' + name;
  5108. fakeNode.addEventListener(evtType, boundFunc, false);
  5109. var evt = document.createEvent('Event');
  5110. // $FlowFixMe https://github.com/facebook/flow/issues/2336
  5111. evt.initEvent(evtType, false, false);
  5112. fakeNode.dispatchEvent(evt);
  5113. fakeNode.removeEventListener(evtType, boundFunc, false);
  5114. };
  5115. }
  5116. }
  5117. module.exports = ReactErrorUtils;
  5118. /***/ }),
  5119. /* 58 */
  5120. /***/ (function(module, exports, __webpack_require__) {
  5121. "use strict";
  5122. /**
  5123. * Copyright 2015-present, Facebook, Inc.
  5124. * All rights reserved.
  5125. *
  5126. * This source code is licensed under the BSD-style license found in the
  5127. * LICENSE file in the root directory of this source tree. An additional grant
  5128. * of patent rights can be found in the PATENTS file in the same directory.
  5129. *
  5130. */
  5131. var _prodInvariant = __webpack_require__(2);
  5132. var ReactCurrentOwner = __webpack_require__(14);
  5133. var ReactInstanceMap = __webpack_require__(28);
  5134. var ReactInstrumentation = __webpack_require__(11);
  5135. var ReactUpdates = __webpack_require__(12);
  5136. var invariant = __webpack_require__(0);
  5137. var warning = __webpack_require__(1);
  5138. function enqueueUpdate(internalInstance) {
  5139. ReactUpdates.enqueueUpdate(internalInstance);
  5140. }
  5141. function formatUnexpectedArgument(arg) {
  5142. var type = typeof arg;
  5143. if (type !== 'object') {
  5144. return type;
  5145. }
  5146. var displayName = arg.constructor && arg.constructor.name || type;
  5147. var keys = Object.keys(arg);
  5148. if (keys.length > 0 && keys.length < 20) {
  5149. return displayName + ' (keys: ' + keys.join(', ') + ')';
  5150. }
  5151. return displayName;
  5152. }
  5153. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  5154. var internalInstance = ReactInstanceMap.get(publicInstance);
  5155. if (!internalInstance) {
  5156. if (false) {
  5157. var ctor = publicInstance.constructor;
  5158. // Only warn when we have a callerName. Otherwise we should be silent.
  5159. // We're probably calling from enqueueCallback. We don't want to warn
  5160. // there because we already warned for the corresponding lifecycle method.
  5161. 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;
  5162. }
  5163. return null;
  5164. }
  5165. if (false) {
  5166. 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;
  5167. }
  5168. return internalInstance;
  5169. }
  5170. /**
  5171. * ReactUpdateQueue allows for state updates to be scheduled into a later
  5172. * reconciliation step.
  5173. */
  5174. var ReactUpdateQueue = {
  5175. /**
  5176. * Checks whether or not this composite component is mounted.
  5177. * @param {ReactClass} publicInstance The instance we want to test.
  5178. * @return {boolean} True if mounted, false otherwise.
  5179. * @protected
  5180. * @final
  5181. */
  5182. isMounted: function (publicInstance) {
  5183. if (false) {
  5184. var owner = ReactCurrentOwner.current;
  5185. if (owner !== null) {
  5186. 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;
  5187. owner._warnedAboutRefsInRender = true;
  5188. }
  5189. }
  5190. var internalInstance = ReactInstanceMap.get(publicInstance);
  5191. if (internalInstance) {
  5192. // During componentWillMount and render this will still be null but after
  5193. // that will always render to something. At least for now. So we can use
  5194. // this hack.
  5195. return !!internalInstance._renderedComponent;
  5196. } else {
  5197. return false;
  5198. }
  5199. },
  5200. /**
  5201. * Enqueue a callback that will be executed after all the pending updates
  5202. * have processed.
  5203. *
  5204. * @param {ReactClass} publicInstance The instance to use as `this` context.
  5205. * @param {?function} callback Called after state is updated.
  5206. * @param {string} callerName Name of the calling function in the public API.
  5207. * @internal
  5208. */
  5209. enqueueCallback: function (publicInstance, callback, callerName) {
  5210. ReactUpdateQueue.validateCallback(callback, callerName);
  5211. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  5212. // Previously we would throw an error if we didn't have an internal
  5213. // instance. Since we want to make it a no-op instead, we mirror the same
  5214. // behavior we have in other enqueue* methods.
  5215. // We also need to ignore callbacks in componentWillMount. See
  5216. // enqueueUpdates.
  5217. if (!internalInstance) {
  5218. return null;
  5219. }
  5220. if (internalInstance._pendingCallbacks) {
  5221. internalInstance._pendingCallbacks.push(callback);
  5222. } else {
  5223. internalInstance._pendingCallbacks = [callback];
  5224. }
  5225. // TODO: The callback here is ignored when setState is called from
  5226. // componentWillMount. Either fix it or disallow doing so completely in
  5227. // favor of getInitialState. Alternatively, we can disallow
  5228. // componentWillMount during server-side rendering.
  5229. enqueueUpdate(internalInstance);
  5230. },
  5231. enqueueCallbackInternal: function (internalInstance, callback) {
  5232. if (internalInstance._pendingCallbacks) {
  5233. internalInstance._pendingCallbacks.push(callback);
  5234. } else {
  5235. internalInstance._pendingCallbacks = [callback];
  5236. }
  5237. enqueueUpdate(internalInstance);
  5238. },
  5239. /**
  5240. * Forces an update. This should only be invoked when it is known with
  5241. * certainty that we are **not** in a DOM transaction.
  5242. *
  5243. * You may want to call this when you know that some deeper aspect of the
  5244. * component's state has changed but `setState` was not called.
  5245. *
  5246. * This will not invoke `shouldComponentUpdate`, but it will invoke
  5247. * `componentWillUpdate` and `componentDidUpdate`.
  5248. *
  5249. * @param {ReactClass} publicInstance The instance that should rerender.
  5250. * @internal
  5251. */
  5252. enqueueForceUpdate: function (publicInstance) {
  5253. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
  5254. if (!internalInstance) {
  5255. return;
  5256. }
  5257. internalInstance._pendingForceUpdate = true;
  5258. enqueueUpdate(internalInstance);
  5259. },
  5260. /**
  5261. * Replaces all of the state. Always use this or `setState` to mutate state.
  5262. * You should treat `this.state` as immutable.
  5263. *
  5264. * There is no guarantee that `this.state` will be immediately updated, so
  5265. * accessing `this.state` after calling this method may return the old value.
  5266. *
  5267. * @param {ReactClass} publicInstance The instance that should rerender.
  5268. * @param {object} completeState Next state.
  5269. * @internal
  5270. */
  5271. enqueueReplaceState: function (publicInstance, completeState) {
  5272. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
  5273. if (!internalInstance) {
  5274. return;
  5275. }
  5276. internalInstance._pendingStateQueue = [completeState];
  5277. internalInstance._pendingReplaceState = true;
  5278. enqueueUpdate(internalInstance);
  5279. },
  5280. /**
  5281. * Sets a subset of the state. This only exists because _pendingState is
  5282. * internal. This provides a merging strategy that is not available to deep
  5283. * properties which is confusing. TODO: Expose pendingState or don't use it
  5284. * during the merge.
  5285. *
  5286. * @param {ReactClass} publicInstance The instance that should rerender.
  5287. * @param {object} partialState Next partial state to be merged with state.
  5288. * @internal
  5289. */
  5290. enqueueSetState: function (publicInstance, partialState) {
  5291. if (false) {
  5292. ReactInstrumentation.debugTool.onSetState();
  5293. process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
  5294. }
  5295. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
  5296. if (!internalInstance) {
  5297. return;
  5298. }
  5299. var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
  5300. queue.push(partialState);
  5301. enqueueUpdate(internalInstance);
  5302. },
  5303. enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
  5304. internalInstance._pendingElement = nextElement;
  5305. // TODO: introduce _pendingContext instead of setting it directly.
  5306. internalInstance._context = nextContext;
  5307. enqueueUpdate(internalInstance);
  5308. },
  5309. validateCallback: function (callback, callerName) {
  5310. !(!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;
  5311. }
  5312. };
  5313. module.exports = ReactUpdateQueue;
  5314. /***/ }),
  5315. /* 59 */
  5316. /***/ (function(module, exports, __webpack_require__) {
  5317. "use strict";
  5318. /**
  5319. * Copyright 2013-present, Facebook, Inc.
  5320. * All rights reserved.
  5321. *
  5322. * This source code is licensed under the BSD-style license found in the
  5323. * LICENSE file in the root directory of this source tree. An additional grant
  5324. * of patent rights can be found in the PATENTS file in the same directory.
  5325. *
  5326. */
  5327. /* globals MSApp */
  5328. /**
  5329. * Create a function which has 'unsafe' privileges (required by windows8 apps)
  5330. */
  5331. var createMicrosoftUnsafeLocalFunction = function (func) {
  5332. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  5333. return function (arg0, arg1, arg2, arg3) {
  5334. MSApp.execUnsafeLocalFunction(function () {
  5335. return func(arg0, arg1, arg2, arg3);
  5336. });
  5337. };
  5338. } else {
  5339. return func;
  5340. }
  5341. };
  5342. module.exports = createMicrosoftUnsafeLocalFunction;
  5343. /***/ }),
  5344. /* 60 */
  5345. /***/ (function(module, exports, __webpack_require__) {
  5346. "use strict";
  5347. /**
  5348. * Copyright 2013-present, Facebook, Inc.
  5349. * All rights reserved.
  5350. *
  5351. * This source code is licensed under the BSD-style license found in the
  5352. * LICENSE file in the root directory of this source tree. An additional grant
  5353. * of patent rights can be found in the PATENTS file in the same directory.
  5354. *
  5355. */
  5356. /**
  5357. * `charCode` represents the actual "character code" and is safe to use with
  5358. * `String.fromCharCode`. As such, only keys that correspond to printable
  5359. * characters produce a valid `charCode`, the only exception to this is Enter.
  5360. * The Tab-key is considered non-printable and does not have a `charCode`,
  5361. * presumably because it does not produce a tab-character in browsers.
  5362. *
  5363. * @param {object} nativeEvent Native browser event.
  5364. * @return {number} Normalized `charCode` property.
  5365. */
  5366. function getEventCharCode(nativeEvent) {
  5367. var charCode;
  5368. var keyCode = nativeEvent.keyCode;
  5369. if ('charCode' in nativeEvent) {
  5370. charCode = nativeEvent.charCode;
  5371. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  5372. if (charCode === 0 && keyCode === 13) {
  5373. charCode = 13;
  5374. }
  5375. } else {
  5376. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  5377. charCode = keyCode;
  5378. }
  5379. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  5380. // Must not discard the (non-)printable Enter-key.
  5381. if (charCode >= 32 || charCode === 13) {
  5382. return charCode;
  5383. }
  5384. return 0;
  5385. }
  5386. module.exports = getEventCharCode;
  5387. /***/ }),
  5388. /* 61 */
  5389. /***/ (function(module, exports, __webpack_require__) {
  5390. "use strict";
  5391. /**
  5392. * Copyright 2013-present, Facebook, Inc.
  5393. * All rights reserved.
  5394. *
  5395. * This source code is licensed under the BSD-style license found in the
  5396. * LICENSE file in the root directory of this source tree. An additional grant
  5397. * of patent rights can be found in the PATENTS file in the same directory.
  5398. *
  5399. */
  5400. /**
  5401. * Translation from modifier key to the associated property in the event.
  5402. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  5403. */
  5404. var modifierKeyToProp = {
  5405. 'Alt': 'altKey',
  5406. 'Control': 'ctrlKey',
  5407. 'Meta': 'metaKey',
  5408. 'Shift': 'shiftKey'
  5409. };
  5410. // IE8 does not implement getModifierState so we simply map it to the only
  5411. // modifier keys exposed by the event itself, does not support Lock-keys.
  5412. // Currently, all major browsers except Chrome seems to support Lock-keys.
  5413. function modifierStateGetter(keyArg) {
  5414. var syntheticEvent = this;
  5415. var nativeEvent = syntheticEvent.nativeEvent;
  5416. if (nativeEvent.getModifierState) {
  5417. return nativeEvent.getModifierState(keyArg);
  5418. }
  5419. var keyProp = modifierKeyToProp[keyArg];
  5420. return keyProp ? !!nativeEvent[keyProp] : false;
  5421. }
  5422. function getEventModifierState(nativeEvent) {
  5423. return modifierStateGetter;
  5424. }
  5425. module.exports = getEventModifierState;
  5426. /***/ }),
  5427. /* 62 */
  5428. /***/ (function(module, exports, __webpack_require__) {
  5429. "use strict";
  5430. /**
  5431. * Copyright 2013-present, Facebook, Inc.
  5432. * All rights reserved.
  5433. *
  5434. * This source code is licensed under the BSD-style license found in the
  5435. * LICENSE file in the root directory of this source tree. An additional grant
  5436. * of patent rights can be found in the PATENTS file in the same directory.
  5437. *
  5438. */
  5439. /**
  5440. * Gets the target node from a native browser event by accounting for
  5441. * inconsistencies in browser DOM APIs.
  5442. *
  5443. * @param {object} nativeEvent Native browser event.
  5444. * @return {DOMEventTarget} Target node.
  5445. */
  5446. function getEventTarget(nativeEvent) {
  5447. var target = nativeEvent.target || nativeEvent.srcElement || window;
  5448. // Normalize SVG <use> element events #4963
  5449. if (target.correspondingUseElement) {
  5450. target = target.correspondingUseElement;
  5451. }
  5452. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  5453. // @see http://www.quirksmode.org/js/events_properties.html
  5454. return target.nodeType === 3 ? target.parentNode : target;
  5455. }
  5456. module.exports = getEventTarget;
  5457. /***/ }),
  5458. /* 63 */
  5459. /***/ (function(module, exports, __webpack_require__) {
  5460. "use strict";
  5461. /**
  5462. * Copyright 2013-present, Facebook, Inc.
  5463. * All rights reserved.
  5464. *
  5465. * This source code is licensed under the BSD-style license found in the
  5466. * LICENSE file in the root directory of this source tree. An additional grant
  5467. * of patent rights can be found in the PATENTS file in the same directory.
  5468. *
  5469. */
  5470. var ExecutionEnvironment = __webpack_require__(9);
  5471. var useHasFeature;
  5472. if (ExecutionEnvironment.canUseDOM) {
  5473. useHasFeature = document.implementation && document.implementation.hasFeature &&
  5474. // always returns true in newer browsers as per the standard.
  5475. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  5476. document.implementation.hasFeature('', '') !== true;
  5477. }
  5478. /**
  5479. * Checks if an event is supported in the current execution environment.
  5480. *
  5481. * NOTE: This will not work correctly for non-generic events such as `change`,
  5482. * `reset`, `load`, `error`, and `select`.
  5483. *
  5484. * Borrows from Modernizr.
  5485. *
  5486. * @param {string} eventNameSuffix Event name, e.g. "click".
  5487. * @param {?boolean} capture Check if the capture phase is supported.
  5488. * @return {boolean} True if the event is supported.
  5489. * @internal
  5490. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  5491. */
  5492. function isEventSupported(eventNameSuffix, capture) {
  5493. if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
  5494. return false;
  5495. }
  5496. var eventName = 'on' + eventNameSuffix;
  5497. var isSupported = eventName in document;
  5498. if (!isSupported) {
  5499. var element = document.createElement('div');
  5500. element.setAttribute(eventName, 'return;');
  5501. isSupported = typeof element[eventName] === 'function';
  5502. }
  5503. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  5504. // This is the only way to test support for the `wheel` event in IE9+.
  5505. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  5506. }
  5507. return isSupported;
  5508. }
  5509. module.exports = isEventSupported;
  5510. /***/ }),
  5511. /* 64 */
  5512. /***/ (function(module, exports, __webpack_require__) {
  5513. "use strict";
  5514. /**
  5515. * Copyright 2013-present, Facebook, Inc.
  5516. * All rights reserved.
  5517. *
  5518. * This source code is licensed under the BSD-style license found in the
  5519. * LICENSE file in the root directory of this source tree. An additional grant
  5520. * of patent rights can be found in the PATENTS file in the same directory.
  5521. *
  5522. */
  5523. /**
  5524. * Given a `prevElement` and `nextElement`, determines if the existing
  5525. * instance should be updated as opposed to being destroyed or replaced by a new
  5526. * instance. Both arguments are elements. This ensures that this logic can
  5527. * operate on stateless trees without any backing instance.
  5528. *
  5529. * @param {?object} prevElement
  5530. * @param {?object} nextElement
  5531. * @return {boolean} True if the existing instance should be updated.
  5532. * @protected
  5533. */
  5534. function shouldUpdateReactComponent(prevElement, nextElement) {
  5535. var prevEmpty = prevElement === null || prevElement === false;
  5536. var nextEmpty = nextElement === null || nextElement === false;
  5537. if (prevEmpty || nextEmpty) {
  5538. return prevEmpty === nextEmpty;
  5539. }
  5540. var prevType = typeof prevElement;
  5541. var nextType = typeof nextElement;
  5542. if (prevType === 'string' || prevType === 'number') {
  5543. return nextType === 'string' || nextType === 'number';
  5544. } else {
  5545. return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
  5546. }
  5547. }
  5548. module.exports = shouldUpdateReactComponent;
  5549. /***/ }),
  5550. /* 65 */
  5551. /***/ (function(module, exports, __webpack_require__) {
  5552. "use strict";
  5553. /**
  5554. * Copyright 2015-present, Facebook, Inc.
  5555. * All rights reserved.
  5556. *
  5557. * This source code is licensed under the BSD-style license found in the
  5558. * LICENSE file in the root directory of this source tree. An additional grant
  5559. * of patent rights can be found in the PATENTS file in the same directory.
  5560. *
  5561. */
  5562. var _assign = __webpack_require__(3);
  5563. var emptyFunction = __webpack_require__(10);
  5564. var warning = __webpack_require__(1);
  5565. var validateDOMNesting = emptyFunction;
  5566. if (false) {
  5567. // This validation code was written based on the HTML5 parsing spec:
  5568. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  5569. //
  5570. // Note: this does not catch all invalid nesting, nor does it try to (as it's
  5571. // not clear what practical benefit doing so provides); instead, we warn only
  5572. // for cases where the parser will give a parse tree differing from what React
  5573. // intended. For example, <b><div></div></b> is invalid but we don't warn
  5574. // because it still parses correctly; we do warn for other cases like nested
  5575. // <p> tags where the beginning of the second element implicitly closes the
  5576. // first, causing a confusing mess.
  5577. // https://html.spec.whatwg.org/multipage/syntax.html#special
  5578. 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'];
  5579. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
  5580. var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
  5581. // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
  5582. // TODO: Distinguish by namespace here -- for <title>, including it here
  5583. // errs on the side of fewer warnings
  5584. 'foreignObject', 'desc', 'title'];
  5585. // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
  5586. var buttonScopeTags = inScopeTags.concat(['button']);
  5587. // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
  5588. var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
  5589. var emptyAncestorInfo = {
  5590. current: null,
  5591. formTag: null,
  5592. aTagInScope: null,
  5593. buttonTagInScope: null,
  5594. nobrTagInScope: null,
  5595. pTagInButtonScope: null,
  5596. listItemTagAutoclosing: null,
  5597. dlItemTagAutoclosing: null
  5598. };
  5599. var updatedAncestorInfo = function (oldInfo, tag, instance) {
  5600. var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
  5601. var info = { tag: tag, instance: instance };
  5602. if (inScopeTags.indexOf(tag) !== -1) {
  5603. ancestorInfo.aTagInScope = null;
  5604. ancestorInfo.buttonTagInScope = null;
  5605. ancestorInfo.nobrTagInScope = null;
  5606. }
  5607. if (buttonScopeTags.indexOf(tag) !== -1) {
  5608. ancestorInfo.pTagInButtonScope = null;
  5609. }
  5610. // See rules for 'li', 'dd', 'dt' start tags in
  5611. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  5612. if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
  5613. ancestorInfo.listItemTagAutoclosing = null;
  5614. ancestorInfo.dlItemTagAutoclosing = null;
  5615. }
  5616. ancestorInfo.current = info;
  5617. if (tag === 'form') {
  5618. ancestorInfo.formTag = info;
  5619. }
  5620. if (tag === 'a') {
  5621. ancestorInfo.aTagInScope = info;
  5622. }
  5623. if (tag === 'button') {
  5624. ancestorInfo.buttonTagInScope = info;
  5625. }
  5626. if (tag === 'nobr') {
  5627. ancestorInfo.nobrTagInScope = info;
  5628. }
  5629. if (tag === 'p') {
  5630. ancestorInfo.pTagInButtonScope = info;
  5631. }
  5632. if (tag === 'li') {
  5633. ancestorInfo.listItemTagAutoclosing = info;
  5634. }
  5635. if (tag === 'dd' || tag === 'dt') {
  5636. ancestorInfo.dlItemTagAutoclosing = info;
  5637. }
  5638. return ancestorInfo;
  5639. };
  5640. /**
  5641. * Returns whether
  5642. */
  5643. var isTagValidWithParent = function (tag, parentTag) {
  5644. // First, let's check if we're in an unusual parsing mode...
  5645. switch (parentTag) {
  5646. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
  5647. case 'select':
  5648. return tag === 'option' || tag === 'optgroup' || tag === '#text';
  5649. case 'optgroup':
  5650. return tag === 'option' || tag === '#text';
  5651. // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
  5652. // but
  5653. case 'option':
  5654. return tag === '#text';
  5655. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
  5656. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
  5657. // No special behavior since these rules fall back to "in body" mode for
  5658. // all except special table nodes which cause bad parsing behavior anyway.
  5659. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
  5660. case 'tr':
  5661. return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
  5662. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
  5663. case 'tbody':
  5664. case 'thead':
  5665. case 'tfoot':
  5666. return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
  5667. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
  5668. case 'colgroup':
  5669. return tag === 'col' || tag === 'template';
  5670. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
  5671. case 'table':
  5672. return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
  5673. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
  5674. case 'head':
  5675. return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
  5676. // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
  5677. case 'html':
  5678. return tag === 'head' || tag === 'body';
  5679. case '#document':
  5680. return tag === 'html';
  5681. }
  5682. // Probably in the "in body" parsing mode, so we outlaw only tag combos
  5683. // where the parsing rules cause implicit opens or closes to be added.
  5684. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
  5685. switch (tag) {
  5686. case 'h1':
  5687. case 'h2':
  5688. case 'h3':
  5689. case 'h4':
  5690. case 'h5':
  5691. case 'h6':
  5692. return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
  5693. case 'rp':
  5694. case 'rt':
  5695. return impliedEndTags.indexOf(parentTag) === -1;
  5696. case 'body':
  5697. case 'caption':
  5698. case 'col':
  5699. case 'colgroup':
  5700. case 'frame':
  5701. case 'head':
  5702. case 'html':
  5703. case 'tbody':
  5704. case 'td':
  5705. case 'tfoot':
  5706. case 'th':
  5707. case 'thead':
  5708. case 'tr':
  5709. // These tags are only valid with a few parents that have special child
  5710. // parsing rules -- if we're down here, then none of those matched and
  5711. // so we allow it only if we don't know what the parent is, as all other
  5712. // cases are invalid.
  5713. return parentTag == null;
  5714. }
  5715. return true;
  5716. };
  5717. /**
  5718. * Returns whether
  5719. */
  5720. var findInvalidAncestorForTag = function (tag, ancestorInfo) {
  5721. switch (tag) {
  5722. case 'address':
  5723. case 'article':
  5724. case 'aside':
  5725. case 'blockquote':
  5726. case 'center':
  5727. case 'details':
  5728. case 'dialog':
  5729. case 'dir':
  5730. case 'div':
  5731. case 'dl':
  5732. case 'fieldset':
  5733. case 'figcaption':
  5734. case 'figure':
  5735. case 'footer':
  5736. case 'header':
  5737. case 'hgroup':
  5738. case 'main':
  5739. case 'menu':
  5740. case 'nav':
  5741. case 'ol':
  5742. case 'p':
  5743. case 'section':
  5744. case 'summary':
  5745. case 'ul':
  5746. case 'pre':
  5747. case 'listing':
  5748. case 'table':
  5749. case 'hr':
  5750. case 'xmp':
  5751. case 'h1':
  5752. case 'h2':
  5753. case 'h3':
  5754. case 'h4':
  5755. case 'h5':
  5756. case 'h6':
  5757. return ancestorInfo.pTagInButtonScope;
  5758. case 'form':
  5759. return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
  5760. case 'li':
  5761. return ancestorInfo.listItemTagAutoclosing;
  5762. case 'dd':
  5763. case 'dt':
  5764. return ancestorInfo.dlItemTagAutoclosing;
  5765. case 'button':
  5766. return ancestorInfo.buttonTagInScope;
  5767. case 'a':
  5768. // Spec says something about storing a list of markers, but it sounds
  5769. // equivalent to this check.
  5770. return ancestorInfo.aTagInScope;
  5771. case 'nobr':
  5772. return ancestorInfo.nobrTagInScope;
  5773. }
  5774. return null;
  5775. };
  5776. /**
  5777. * Given a ReactCompositeComponent instance, return a list of its recursive
  5778. * owners, starting at the root and ending with the instance itself.
  5779. */
  5780. var findOwnerStack = function (instance) {
  5781. if (!instance) {
  5782. return [];
  5783. }
  5784. var stack = [];
  5785. do {
  5786. stack.push(instance);
  5787. } while (instance = instance._currentElement._owner);
  5788. stack.reverse();
  5789. return stack;
  5790. };
  5791. var didWarn = {};
  5792. validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) {
  5793. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  5794. var parentInfo = ancestorInfo.current;
  5795. var parentTag = parentInfo && parentInfo.tag;
  5796. if (childText != null) {
  5797. process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
  5798. childTag = '#text';
  5799. }
  5800. var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
  5801. var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
  5802. var problematic = invalidParent || invalidAncestor;
  5803. if (problematic) {
  5804. var ancestorTag = problematic.tag;
  5805. var ancestorInstance = problematic.instance;
  5806. var childOwner = childInstance && childInstance._currentElement._owner;
  5807. var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
  5808. var childOwners = findOwnerStack(childOwner);
  5809. var ancestorOwners = findOwnerStack(ancestorOwner);
  5810. var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
  5811. var i;
  5812. var deepestCommon = -1;
  5813. for (i = 0; i < minStackLen; i++) {
  5814. if (childOwners[i] === ancestorOwners[i]) {
  5815. deepestCommon = i;
  5816. } else {
  5817. break;
  5818. }
  5819. }
  5820. var UNKNOWN = '(unknown)';
  5821. var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
  5822. return inst.getName() || UNKNOWN;
  5823. });
  5824. var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
  5825. return inst.getName() || UNKNOWN;
  5826. });
  5827. var ownerInfo = [].concat(
  5828. // If the parent and child instances have a common owner ancestor, start
  5829. // with that -- otherwise we just start with the parent's owners.
  5830. deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
  5831. // If we're warning about an invalid (non-parent) ancestry, add '...'
  5832. invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
  5833. var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
  5834. if (didWarn[warnKey]) {
  5835. return;
  5836. }
  5837. didWarn[warnKey] = true;
  5838. var tagDisplayName = childTag;
  5839. var whitespaceInfo = '';
  5840. if (childTag === '#text') {
  5841. if (/\S/.test(childText)) {
  5842. tagDisplayName = 'Text nodes';
  5843. } else {
  5844. tagDisplayName = 'Whitespace text nodes';
  5845. whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.';
  5846. }
  5847. } else {
  5848. tagDisplayName = '<' + childTag + '>';
  5849. }
  5850. if (invalidParent) {
  5851. var info = '';
  5852. if (ancestorTag === 'table' && childTag === 'tr') {
  5853. info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
  5854. }
  5855. 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;
  5856. } else {
  5857. process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
  5858. }
  5859. }
  5860. };
  5861. validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
  5862. // For testing
  5863. validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
  5864. ancestorInfo = ancestorInfo || emptyAncestorInfo;
  5865. var parentInfo = ancestorInfo.current;
  5866. var parentTag = parentInfo && parentInfo.tag;
  5867. return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
  5868. };
  5869. }
  5870. module.exports = validateDOMNesting;
  5871. /***/ }),
  5872. /* 66 */
  5873. /***/ (function(module, exports, __webpack_require__) {
  5874. "use strict";
  5875. /**
  5876. * Copyright 2013-present, Facebook, Inc.
  5877. * All rights reserved.
  5878. *
  5879. * This source code is licensed under the BSD-style license found in the
  5880. * LICENSE file in the root directory of this source tree. An additional grant
  5881. * of patent rights can be found in the PATENTS file in the same directory.
  5882. *
  5883. */
  5884. var _prodInvariant = __webpack_require__(23);
  5885. var ReactNoopUpdateQueue = __webpack_require__(67);
  5886. var canDefineProperty = __webpack_require__(101);
  5887. var emptyObject = __webpack_require__(25);
  5888. var invariant = __webpack_require__(0);
  5889. var warning = __webpack_require__(1);
  5890. /**
  5891. * Base class helpers for the updating state of a component.
  5892. */
  5893. function ReactComponent(props, context, updater) {
  5894. this.props = props;
  5895. this.context = context;
  5896. this.refs = emptyObject;
  5897. // We initialize the default updater but the real one gets injected by the
  5898. // renderer.
  5899. this.updater = updater || ReactNoopUpdateQueue;
  5900. }
  5901. ReactComponent.prototype.isReactComponent = {};
  5902. /**
  5903. * Sets a subset of the state. Always use this to mutate
  5904. * state. You should treat `this.state` as immutable.
  5905. *
  5906. * There is no guarantee that `this.state` will be immediately updated, so
  5907. * accessing `this.state` after calling this method may return the old value.
  5908. *
  5909. * There is no guarantee that calls to `setState` will run synchronously,
  5910. * as they may eventually be batched together. You can provide an optional
  5911. * callback that will be executed when the call to setState is actually
  5912. * completed.
  5913. *
  5914. * When a function is provided to setState, it will be called at some point in
  5915. * the future (not synchronously). It will be called with the up to date
  5916. * component arguments (state, props, context). These values can be different
  5917. * from this.* because your function may be called after receiveProps but before
  5918. * shouldComponentUpdate, and this new state, props, and context will not yet be
  5919. * assigned to this.
  5920. *
  5921. * @param {object|function} partialState Next partial state or function to
  5922. * produce next partial state to be merged with current state.
  5923. * @param {?function} callback Called after state is updated.
  5924. * @final
  5925. * @protected
  5926. */
  5927. ReactComponent.prototype.setState = function (partialState, callback) {
  5928. !(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;
  5929. this.updater.enqueueSetState(this, partialState);
  5930. if (callback) {
  5931. this.updater.enqueueCallback(this, callback, 'setState');
  5932. }
  5933. };
  5934. /**
  5935. * Forces an update. This should only be invoked when it is known with
  5936. * certainty that we are **not** in a DOM transaction.
  5937. *
  5938. * You may want to call this when you know that some deeper aspect of the
  5939. * component's state has changed but `setState` was not called.
  5940. *
  5941. * This will not invoke `shouldComponentUpdate`, but it will invoke
  5942. * `componentWillUpdate` and `componentDidUpdate`.
  5943. *
  5944. * @param {?function} callback Called after update is complete.
  5945. * @final
  5946. * @protected
  5947. */
  5948. ReactComponent.prototype.forceUpdate = function (callback) {
  5949. this.updater.enqueueForceUpdate(this);
  5950. if (callback) {
  5951. this.updater.enqueueCallback(this, callback, 'forceUpdate');
  5952. }
  5953. };
  5954. /**
  5955. * Deprecated APIs. These APIs used to exist on classic React classes but since
  5956. * we would like to deprecate them, we're not going to move them over to this
  5957. * modern base class. Instead, we define a getter that warns if it's accessed.
  5958. */
  5959. if (false) {
  5960. var deprecatedAPIs = {
  5961. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  5962. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  5963. };
  5964. var defineDeprecationWarning = function (methodName, info) {
  5965. if (canDefineProperty) {
  5966. Object.defineProperty(ReactComponent.prototype, methodName, {
  5967. get: function () {
  5968. process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
  5969. return undefined;
  5970. }
  5971. });
  5972. }
  5973. };
  5974. for (var fnName in deprecatedAPIs) {
  5975. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  5976. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  5977. }
  5978. }
  5979. }
  5980. module.exports = ReactComponent;
  5981. /***/ }),
  5982. /* 67 */
  5983. /***/ (function(module, exports, __webpack_require__) {
  5984. "use strict";
  5985. /**
  5986. * Copyright 2015-present, Facebook, Inc.
  5987. * All rights reserved.
  5988. *
  5989. * This source code is licensed under the BSD-style license found in the
  5990. * LICENSE file in the root directory of this source tree. An additional grant
  5991. * of patent rights can be found in the PATENTS file in the same directory.
  5992. *
  5993. */
  5994. var warning = __webpack_require__(1);
  5995. function warnNoop(publicInstance, callerName) {
  5996. if (false) {
  5997. var constructor = publicInstance.constructor;
  5998. 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;
  5999. }
  6000. }
  6001. /**
  6002. * This is the abstract API for an update queue.
  6003. */
  6004. var ReactNoopUpdateQueue = {
  6005. /**
  6006. * Checks whether or not this composite component is mounted.
  6007. * @param {ReactClass} publicInstance The instance we want to test.
  6008. * @return {boolean} True if mounted, false otherwise.
  6009. * @protected
  6010. * @final
  6011. */
  6012. isMounted: function (publicInstance) {
  6013. return false;
  6014. },
  6015. /**
  6016. * Enqueue a callback that will be executed after all the pending updates
  6017. * have processed.
  6018. *
  6019. * @param {ReactClass} publicInstance The instance to use as `this` context.
  6020. * @param {?function} callback Called after state is updated.
  6021. * @internal
  6022. */
  6023. enqueueCallback: function (publicInstance, callback) {},
  6024. /**
  6025. * Forces an update. This should only be invoked when it is known with
  6026. * certainty that we are **not** in a DOM transaction.
  6027. *
  6028. * You may want to call this when you know that some deeper aspect of the
  6029. * component's state has changed but `setState` was not called.
  6030. *
  6031. * This will not invoke `shouldComponentUpdate`, but it will invoke
  6032. * `componentWillUpdate` and `componentDidUpdate`.
  6033. *
  6034. * @param {ReactClass} publicInstance The instance that should rerender.
  6035. * @internal
  6036. */
  6037. enqueueForceUpdate: function (publicInstance) {
  6038. warnNoop(publicInstance, 'forceUpdate');
  6039. },
  6040. /**
  6041. * Replaces all of the state. Always use this or `setState` to mutate state.
  6042. * You should treat `this.state` as immutable.
  6043. *
  6044. * There is no guarantee that `this.state` will be immediately updated, so
  6045. * accessing `this.state` after calling this method may return the old value.
  6046. *
  6047. * @param {ReactClass} publicInstance The instance that should rerender.
  6048. * @param {object} completeState Next state.
  6049. * @internal
  6050. */
  6051. enqueueReplaceState: function (publicInstance, completeState) {
  6052. warnNoop(publicInstance, 'replaceState');
  6053. },
  6054. /**
  6055. * Sets a subset of the state. This only exists because _pendingState is
  6056. * internal. This provides a merging strategy that is not available to deep
  6057. * properties which is confusing. TODO: Expose pendingState or don't use it
  6058. * during the merge.
  6059. *
  6060. * @param {ReactClass} publicInstance The instance that should rerender.
  6061. * @param {object} partialState Next partial state to be merged with state.
  6062. * @internal
  6063. */
  6064. enqueueSetState: function (publicInstance, partialState) {
  6065. warnNoop(publicInstance, 'setState');
  6066. }
  6067. };
  6068. module.exports = ReactNoopUpdateQueue;
  6069. /***/ }),
  6070. /* 68 */
  6071. /***/ (function(module, exports, __webpack_require__) {
  6072. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  6073. // Distributed under an MIT license: http://codemirror.net/LICENSE
  6074. // This is CodeMirror (http://codemirror.net), a code editor
  6075. // implemented in JavaScript on top of the browser's DOM.
  6076. //
  6077. // You can find some technical background for some of the code below
  6078. // at http://marijnhaverbeke.nl/blog/#cm-internals .
  6079. (function (global, factory) {
  6080. true ? module.exports = factory() :
  6081. typeof define === 'function' && define.amd ? define(factory) :
  6082. (global.CodeMirror = factory());
  6083. }(this, (function () { 'use strict';
  6084. // Kludges for bugs and behavior differences that can't be feature
  6085. // detected are enabled based on userAgent etc sniffing.
  6086. var userAgent = navigator.userAgent;
  6087. var platform = navigator.platform;
  6088. var gecko = /gecko\/\d/i.test(userAgent);
  6089. var ie_upto10 = /MSIE \d/.test(userAgent);
  6090. var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
  6091. var edge = /Edge\/(\d+)/.exec(userAgent);
  6092. var ie = ie_upto10 || ie_11up || edge;
  6093. var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
  6094. var webkit = !edge && /WebKit\//.test(userAgent);
  6095. var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
  6096. var chrome = !edge && /Chrome\//.test(userAgent);
  6097. var presto = /Opera\//.test(userAgent);
  6098. var safari = /Apple Computer/.test(navigator.vendor);
  6099. var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
  6100. var phantom = /PhantomJS/.test(userAgent);
  6101. var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
  6102. var android = /Android/.test(userAgent);
  6103. // This is woefully incomplete. Suggestions for alternative methods welcome.
  6104. var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
  6105. var mac = ios || /Mac/.test(platform);
  6106. var chromeOS = /\bCrOS\b/.test(userAgent);
  6107. var windows = /win/i.test(platform);
  6108. var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
  6109. if (presto_version) { presto_version = Number(presto_version[1]); }
  6110. if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
  6111. // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
  6112. var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
  6113. var captureRightClick = gecko || (ie && ie_version >= 9);
  6114. function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
  6115. var rmClass = function(node, cls) {
  6116. var current = node.className;
  6117. var match = classTest(cls).exec(current);
  6118. if (match) {
  6119. var after = current.slice(match.index + match[0].length);
  6120. node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
  6121. }
  6122. };
  6123. function removeChildren(e) {
  6124. for (var count = e.childNodes.length; count > 0; --count)
  6125. { e.removeChild(e.firstChild); }
  6126. return e
  6127. }
  6128. function removeChildrenAndAdd(parent, e) {
  6129. return removeChildren(parent).appendChild(e)
  6130. }
  6131. function elt(tag, content, className, style) {
  6132. var e = document.createElement(tag);
  6133. if (className) { e.className = className; }
  6134. if (style) { e.style.cssText = style; }
  6135. if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
  6136. else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
  6137. return e
  6138. }
  6139. // wrapper for elt, which removes the elt from the accessibility tree
  6140. function eltP(tag, content, className, style) {
  6141. var e = elt(tag, content, className, style);
  6142. e.setAttribute("role", "presentation");
  6143. return e
  6144. }
  6145. var range;
  6146. if (document.createRange) { range = function(node, start, end, endNode) {
  6147. var r = document.createRange();
  6148. r.setEnd(endNode || node, end);
  6149. r.setStart(node, start);
  6150. return r
  6151. }; }
  6152. else { range = function(node, start, end) {
  6153. var r = document.body.createTextRange();
  6154. try { r.moveToElementText(node.parentNode); }
  6155. catch(e) { return r }
  6156. r.collapse(true);
  6157. r.moveEnd("character", end);
  6158. r.moveStart("character", start);
  6159. return r
  6160. }; }
  6161. function contains(parent, child) {
  6162. if (child.nodeType == 3) // Android browser always returns false when child is a textnode
  6163. { child = child.parentNode; }
  6164. if (parent.contains)
  6165. { return parent.contains(child) }
  6166. do {
  6167. if (child.nodeType == 11) { child = child.host; }
  6168. if (child == parent) { return true }
  6169. } while (child = child.parentNode)
  6170. }
  6171. function activeElt() {
  6172. // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
  6173. // IE < 10 will throw when accessed while the page is loading or in an iframe.
  6174. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
  6175. var activeElement;
  6176. try {
  6177. activeElement = document.activeElement;
  6178. } catch(e) {
  6179. activeElement = document.body || null;
  6180. }
  6181. while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
  6182. { activeElement = activeElement.shadowRoot.activeElement; }
  6183. return activeElement
  6184. }
  6185. function addClass(node, cls) {
  6186. var current = node.className;
  6187. if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
  6188. }
  6189. function joinClasses(a, b) {
  6190. var as = a.split(" ");
  6191. for (var i = 0; i < as.length; i++)
  6192. { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
  6193. return b
  6194. }
  6195. var selectInput = function(node) { node.select(); };
  6196. if (ios) // Mobile Safari apparently has a bug where select() is broken.
  6197. { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
  6198. else if (ie) // Suppress mysterious IE10 errors
  6199. { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
  6200. function bind(f) {
  6201. var args = Array.prototype.slice.call(arguments, 1);
  6202. return function(){return f.apply(null, args)}
  6203. }
  6204. function copyObj(obj, target, overwrite) {
  6205. if (!target) { target = {}; }
  6206. for (var prop in obj)
  6207. { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
  6208. { target[prop] = obj[prop]; } }
  6209. return target
  6210. }
  6211. // Counts the column offset in a string, taking tabs into account.
  6212. // Used mostly to find indentation.
  6213. function countColumn(string, end, tabSize, startIndex, startValue) {
  6214. if (end == null) {
  6215. end = string.search(/[^\s\u00a0]/);
  6216. if (end == -1) { end = string.length; }
  6217. }
  6218. for (var i = startIndex || 0, n = startValue || 0;;) {
  6219. var nextTab = string.indexOf("\t", i);
  6220. if (nextTab < 0 || nextTab >= end)
  6221. { return n + (end - i) }
  6222. n += nextTab - i;
  6223. n += tabSize - (n % tabSize);
  6224. i = nextTab + 1;
  6225. }
  6226. }
  6227. var Delayed = function() {this.id = null;};
  6228. Delayed.prototype.set = function (ms, f) {
  6229. clearTimeout(this.id);
  6230. this.id = setTimeout(f, ms);
  6231. };
  6232. function indexOf(array, elt) {
  6233. for (var i = 0; i < array.length; ++i)
  6234. { if (array[i] == elt) { return i } }
  6235. return -1
  6236. }
  6237. // Number of pixels added to scroller and sizer to hide scrollbar
  6238. var scrollerGap = 30;
  6239. // Returned or thrown by various protocols to signal 'I'm not
  6240. // handling this'.
  6241. var Pass = {toString: function(){return "CodeMirror.Pass"}};
  6242. // Reused option objects for setSelection & friends
  6243. var sel_dontScroll = {scroll: false};
  6244. var sel_mouse = {origin: "*mouse"};
  6245. var sel_move = {origin: "+move"};
  6246. // The inverse of countColumn -- find the offset that corresponds to
  6247. // a particular column.
  6248. function findColumn(string, goal, tabSize) {
  6249. for (var pos = 0, col = 0;;) {
  6250. var nextTab = string.indexOf("\t", pos);
  6251. if (nextTab == -1) { nextTab = string.length; }
  6252. var skipped = nextTab - pos;
  6253. if (nextTab == string.length || col + skipped >= goal)
  6254. { return pos + Math.min(skipped, goal - col) }
  6255. col += nextTab - pos;
  6256. col += tabSize - (col % tabSize);
  6257. pos = nextTab + 1;
  6258. if (col >= goal) { return pos }
  6259. }
  6260. }
  6261. var spaceStrs = [""];
  6262. function spaceStr(n) {
  6263. while (spaceStrs.length <= n)
  6264. { spaceStrs.push(lst(spaceStrs) + " "); }
  6265. return spaceStrs[n]
  6266. }
  6267. function lst(arr) { return arr[arr.length-1] }
  6268. function map(array, f) {
  6269. var out = [];
  6270. for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
  6271. return out
  6272. }
  6273. function insertSorted(array, value, score) {
  6274. var pos = 0, priority = score(value);
  6275. while (pos < array.length && score(array[pos]) <= priority) { pos++; }
  6276. array.splice(pos, 0, value);
  6277. }
  6278. function nothing() {}
  6279. function createObj(base, props) {
  6280. var inst;
  6281. if (Object.create) {
  6282. inst = Object.create(base);
  6283. } else {
  6284. nothing.prototype = base;
  6285. inst = new nothing();
  6286. }
  6287. if (props) { copyObj(props, inst); }
  6288. return inst
  6289. }
  6290. var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
  6291. function isWordCharBasic(ch) {
  6292. return /\w/.test(ch) || ch > "\x80" &&
  6293. (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
  6294. }
  6295. function isWordChar(ch, helper) {
  6296. if (!helper) { return isWordCharBasic(ch) }
  6297. if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
  6298. return helper.test(ch)
  6299. }
  6300. function isEmpty(obj) {
  6301. for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
  6302. return true
  6303. }
  6304. // Extending unicode characters. A series of a non-extending char +
  6305. // any number of extending chars is treated as a single unit as far
  6306. // as editing and measuring is concerned. This is not fully correct,
  6307. // since some scripts/fonts/browsers also treat other configurations
  6308. // of code points as a group.
  6309. 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]/;
  6310. function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
  6311. // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
  6312. function skipExtendingChars(str, pos, dir) {
  6313. while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
  6314. return pos
  6315. }
  6316. // Returns the value from the range [`from`; `to`] that satisfies
  6317. // `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
  6318. function findFirst(pred, from, to) {
  6319. for (;;) {
  6320. if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
  6321. var mid = Math.floor((from + to) / 2);
  6322. if (pred(mid)) { to = mid; }
  6323. else { from = mid; }
  6324. }
  6325. }
  6326. // The display handles the DOM integration, both for input reading
  6327. // and content drawing. It holds references to DOM nodes and
  6328. // display-related state.
  6329. function Display(place, doc, input) {
  6330. var d = this;
  6331. this.input = input;
  6332. // Covers bottom-right square when both scrollbars are present.
  6333. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
  6334. d.scrollbarFiller.setAttribute("cm-not-content", "true");
  6335. // Covers bottom of gutter when coverGutterNextToScrollbar is on
  6336. // and h scrollbar is present.
  6337. d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
  6338. d.gutterFiller.setAttribute("cm-not-content", "true");
  6339. // Will contain the actual code, positioned to cover the viewport.
  6340. d.lineDiv = eltP("div", null, "CodeMirror-code");
  6341. // Elements are added to these to represent selection and cursors.
  6342. d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
  6343. d.cursorDiv = elt("div", null, "CodeMirror-cursors");
  6344. // A visibility: hidden element used to find the size of things.
  6345. d.measure = elt("div", null, "CodeMirror-measure");
  6346. // When lines outside of the viewport are measured, they are drawn in this.
  6347. d.lineMeasure = elt("div", null, "CodeMirror-measure");
  6348. // Wraps everything that needs to exist inside the vertically-padded coordinate system
  6349. d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
  6350. null, "position: relative; outline: none");
  6351. var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
  6352. // Moved around its parent to cover visible view.
  6353. d.mover = elt("div", [lines], null, "position: relative");
  6354. // Set to the height of the document, allowing scrolling.
  6355. d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
  6356. d.sizerWidth = null;
  6357. // Behavior of elts with overflow: auto and padding is
  6358. // inconsistent across browsers. This is used to ensure the
  6359. // scrollable area is big enough.
  6360. d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
  6361. // Will contain the gutters, if any.
  6362. d.gutters = elt("div", null, "CodeMirror-gutters");
  6363. d.lineGutter = null;
  6364. // Actual scrollable element.
  6365. d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
  6366. d.scroller.setAttribute("tabIndex", "-1");
  6367. // The element in which the editor lives.
  6368. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
  6369. // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
  6370. if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
  6371. if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
  6372. if (place) {
  6373. if (place.appendChild) { place.appendChild(d.wrapper); }
  6374. else { place(d.wrapper); }
  6375. }
  6376. // Current rendered range (may be bigger than the view window).
  6377. d.viewFrom = d.viewTo = doc.first;
  6378. d.reportedViewFrom = d.reportedViewTo = doc.first;
  6379. // Information about the rendered lines.
  6380. d.view = [];
  6381. d.renderedView = null;
  6382. // Holds info about a single rendered line when it was rendered
  6383. // for measurement, while not in view.
  6384. d.externalMeasured = null;
  6385. // Empty space (in pixels) above the view
  6386. d.viewOffset = 0;
  6387. d.lastWrapHeight = d.lastWrapWidth = 0;
  6388. d.updateLineNumbers = null;
  6389. d.nativeBarWidth = d.barHeight = d.barWidth = 0;
  6390. d.scrollbarsClipped = false;
  6391. // Used to only resize the line number gutter when necessary (when
  6392. // the amount of lines crosses a boundary that makes its width change)
  6393. d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
  6394. // Set to true when a non-horizontal-scrolling line widget is
  6395. // added. As an optimization, line widget aligning is skipped when
  6396. // this is false.
  6397. d.alignWidgets = false;
  6398. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  6399. // Tracks the maximum line length so that the horizontal scrollbar
  6400. // can be kept static when scrolling.
  6401. d.maxLine = null;
  6402. d.maxLineLength = 0;
  6403. d.maxLineChanged = false;
  6404. // Used for measuring wheel scrolling granularity
  6405. d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
  6406. // True when shift is held down.
  6407. d.shift = false;
  6408. // Used to track whether anything happened since the context menu
  6409. // was opened.
  6410. d.selForContextMenu = null;
  6411. d.activeTouch = null;
  6412. input.init(d);
  6413. }
  6414. // Find the line object corresponding to the given line number.
  6415. function getLine(doc, n) {
  6416. n -= doc.first;
  6417. if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
  6418. var chunk = doc;
  6419. while (!chunk.lines) {
  6420. for (var i = 0;; ++i) {
  6421. var child = chunk.children[i], sz = child.chunkSize();
  6422. if (n < sz) { chunk = child; break }
  6423. n -= sz;
  6424. }
  6425. }
  6426. return chunk.lines[n]
  6427. }
  6428. // Get the part of a document between two positions, as an array of
  6429. // strings.
  6430. function getBetween(doc, start, end) {
  6431. var out = [], n = start.line;
  6432. doc.iter(start.line, end.line + 1, function (line) {
  6433. var text = line.text;
  6434. if (n == end.line) { text = text.slice(0, end.ch); }
  6435. if (n == start.line) { text = text.slice(start.ch); }
  6436. out.push(text);
  6437. ++n;
  6438. });
  6439. return out
  6440. }
  6441. // Get the lines between from and to, as array of strings.
  6442. function getLines(doc, from, to) {
  6443. var out = [];
  6444. doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
  6445. return out
  6446. }
  6447. // Update the height of a line, propagating the height change
  6448. // upwards to parent nodes.
  6449. function updateLineHeight(line, height) {
  6450. var diff = height - line.height;
  6451. if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
  6452. }
  6453. // Given a line object, find its line number by walking up through
  6454. // its parent links.
  6455. function lineNo(line) {
  6456. if (line.parent == null) { return null }
  6457. var cur = line.parent, no = indexOf(cur.lines, line);
  6458. for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
  6459. for (var i = 0;; ++i) {
  6460. if (chunk.children[i] == cur) { break }
  6461. no += chunk.children[i].chunkSize();
  6462. }
  6463. }
  6464. return no + cur.first
  6465. }
  6466. // Find the line at the given vertical position, using the height
  6467. // information in the document tree.
  6468. function lineAtHeight(chunk, h) {
  6469. var n = chunk.first;
  6470. outer: do {
  6471. for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
  6472. var child = chunk.children[i$1], ch = child.height;
  6473. if (h < ch) { chunk = child; continue outer }
  6474. h -= ch;
  6475. n += child.chunkSize();
  6476. }
  6477. return n
  6478. } while (!chunk.lines)
  6479. var i = 0;
  6480. for (; i < chunk.lines.length; ++i) {
  6481. var line = chunk.lines[i], lh = line.height;
  6482. if (h < lh) { break }
  6483. h -= lh;
  6484. }
  6485. return n + i
  6486. }
  6487. function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
  6488. function lineNumberFor(options, i) {
  6489. return String(options.lineNumberFormatter(i + options.firstLineNumber))
  6490. }
  6491. // A Pos instance represents a position within the text.
  6492. function Pos(line, ch, sticky) {
  6493. if ( sticky === void 0 ) sticky = null;
  6494. if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
  6495. this.line = line;
  6496. this.ch = ch;
  6497. this.sticky = sticky;
  6498. }
  6499. // Compare two positions, return 0 if they are the same, a negative
  6500. // number when a is less, and a positive number otherwise.
  6501. function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
  6502. function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
  6503. function copyPos(x) {return Pos(x.line, x.ch)}
  6504. function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
  6505. function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
  6506. // Most of the external API clips given positions to make sure they
  6507. // actually exist within the document.
  6508. function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
  6509. function clipPos(doc, pos) {
  6510. if (pos.line < doc.first) { return Pos(doc.first, 0) }
  6511. var last = doc.first + doc.size - 1;
  6512. if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
  6513. return clipToLen(pos, getLine(doc, pos.line).text.length)
  6514. }
  6515. function clipToLen(pos, linelen) {
  6516. var ch = pos.ch;
  6517. if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
  6518. else if (ch < 0) { return Pos(pos.line, 0) }
  6519. else { return pos }
  6520. }
  6521. function clipPosArray(doc, array) {
  6522. var out = [];
  6523. for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
  6524. return out
  6525. }
  6526. // Optimize some code when these features are not used.
  6527. var sawReadOnlySpans = false;
  6528. var sawCollapsedSpans = false;
  6529. function seeReadOnlySpans() {
  6530. sawReadOnlySpans = true;
  6531. }
  6532. function seeCollapsedSpans() {
  6533. sawCollapsedSpans = true;
  6534. }
  6535. // TEXTMARKER SPANS
  6536. function MarkedSpan(marker, from, to) {
  6537. this.marker = marker;
  6538. this.from = from; this.to = to;
  6539. }
  6540. // Search an array of spans for a span matching the given marker.
  6541. function getMarkedSpanFor(spans, marker) {
  6542. if (spans) { for (var i = 0; i < spans.length; ++i) {
  6543. var span = spans[i];
  6544. if (span.marker == marker) { return span }
  6545. } }
  6546. }
  6547. // Remove a span from an array, returning undefined if no spans are
  6548. // left (we don't store arrays for lines without spans).
  6549. function removeMarkedSpan(spans, span) {
  6550. var r;
  6551. for (var i = 0; i < spans.length; ++i)
  6552. { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
  6553. return r
  6554. }
  6555. // Add a span to a line.
  6556. function addMarkedSpan(line, span) {
  6557. line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
  6558. span.marker.attachLine(line);
  6559. }
  6560. // Used for the algorithm that adjusts markers for a change in the
  6561. // document. These functions cut an array of spans at a given
  6562. // character position, returning an array of remaining chunks (or
  6563. // undefined if nothing remains).
  6564. function markedSpansBefore(old, startCh, isInsert) {
  6565. var nw;
  6566. if (old) { for (var i = 0; i < old.length; ++i) {
  6567. var span = old[i], marker = span.marker;
  6568. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
  6569. if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
  6570. 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));
  6571. }
  6572. } }
  6573. return nw
  6574. }
  6575. function markedSpansAfter(old, endCh, isInsert) {
  6576. var nw;
  6577. if (old) { for (var i = 0; i < old.length; ++i) {
  6578. var span = old[i], marker = span.marker;
  6579. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
  6580. if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
  6581. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
  6582. span.to == null ? null : span.to - endCh));
  6583. }
  6584. } }
  6585. return nw
  6586. }
  6587. // Given a change object, compute the new set of marker spans that
  6588. // cover the line in which the change took place. Removes spans
  6589. // entirely within the change, reconnects spans belonging to the
  6590. // same marker that appear on both sides of the change, and cuts off
  6591. // spans partially within the change. Returns an array of span
  6592. // arrays with one element for each line in (after) the change.
  6593. function stretchSpansOverChange(doc, change) {
  6594. if (change.full) { return null }
  6595. var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
  6596. var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
  6597. if (!oldFirst && !oldLast) { return null }
  6598. var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
  6599. // Get the spans that 'stick out' on both sides
  6600. var first = markedSpansBefore(oldFirst, startCh, isInsert);
  6601. var last = markedSpansAfter(oldLast, endCh, isInsert);
  6602. // Next, merge those two ends
  6603. var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
  6604. if (first) {
  6605. // Fix up .to properties of first
  6606. for (var i = 0; i < first.length; ++i) {
  6607. var span = first[i];
  6608. if (span.to == null) {
  6609. var found = getMarkedSpanFor(last, span.marker);
  6610. if (!found) { span.to = startCh; }
  6611. else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
  6612. }
  6613. }
  6614. }
  6615. if (last) {
  6616. // Fix up .from in last (or move them into first in case of sameLine)
  6617. for (var i$1 = 0; i$1 < last.length; ++i$1) {
  6618. var span$1 = last[i$1];
  6619. if (span$1.to != null) { span$1.to += offset; }
  6620. if (span$1.from == null) {
  6621. var found$1 = getMarkedSpanFor(first, span$1.marker);
  6622. if (!found$1) {
  6623. span$1.from = offset;
  6624. if (sameLine) { (first || (first = [])).push(span$1); }
  6625. }
  6626. } else {
  6627. span$1.from += offset;
  6628. if (sameLine) { (first || (first = [])).push(span$1); }
  6629. }
  6630. }
  6631. }
  6632. // Make sure we didn't create any zero-length spans
  6633. if (first) { first = clearEmptySpans(first); }
  6634. if (last && last != first) { last = clearEmptySpans(last); }
  6635. var newMarkers = [first];
  6636. if (!sameLine) {
  6637. // Fill gap with whole-line-spans
  6638. var gap = change.text.length - 2, gapMarkers;
  6639. if (gap > 0 && first)
  6640. { for (var i$2 = 0; i$2 < first.length; ++i$2)
  6641. { if (first[i$2].to == null)
  6642. { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
  6643. for (var i$3 = 0; i$3 < gap; ++i$3)
  6644. { newMarkers.push(gapMarkers); }
  6645. newMarkers.push(last);
  6646. }
  6647. return newMarkers
  6648. }
  6649. // Remove spans that are empty and don't have a clearWhenEmpty
  6650. // option of false.
  6651. function clearEmptySpans(spans) {
  6652. for (var i = 0; i < spans.length; ++i) {
  6653. var span = spans[i];
  6654. if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
  6655. { spans.splice(i--, 1); }
  6656. }
  6657. if (!spans.length) { return null }
  6658. return spans
  6659. }
  6660. // Used to 'clip' out readOnly ranges when making a change.
  6661. function removeReadOnlyRanges(doc, from, to) {
  6662. var markers = null;
  6663. doc.iter(from.line, to.line + 1, function (line) {
  6664. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  6665. var mark = line.markedSpans[i].marker;
  6666. if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
  6667. { (markers || (markers = [])).push(mark); }
  6668. } }
  6669. });
  6670. if (!markers) { return null }
  6671. var parts = [{from: from, to: to}];
  6672. for (var i = 0; i < markers.length; ++i) {
  6673. var mk = markers[i], m = mk.find(0);
  6674. for (var j = 0; j < parts.length; ++j) {
  6675. var p = parts[j];
  6676. if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
  6677. var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
  6678. if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
  6679. { newParts.push({from: p.from, to: m.from}); }
  6680. if (dto > 0 || !mk.inclusiveRight && !dto)
  6681. { newParts.push({from: m.to, to: p.to}); }
  6682. parts.splice.apply(parts, newParts);
  6683. j += newParts.length - 3;
  6684. }
  6685. }
  6686. return parts
  6687. }
  6688. // Connect or disconnect spans from a line.
  6689. function detachMarkedSpans(line) {
  6690. var spans = line.markedSpans;
  6691. if (!spans) { return }
  6692. for (var i = 0; i < spans.length; ++i)
  6693. { spans[i].marker.detachLine(line); }
  6694. line.markedSpans = null;
  6695. }
  6696. function attachMarkedSpans(line, spans) {
  6697. if (!spans) { return }
  6698. for (var i = 0; i < spans.length; ++i)
  6699. { spans[i].marker.attachLine(line); }
  6700. line.markedSpans = spans;
  6701. }
  6702. // Helpers used when computing which overlapping collapsed span
  6703. // counts as the larger one.
  6704. function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
  6705. function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
  6706. // Returns a number indicating which of two overlapping collapsed
  6707. // spans is larger (and thus includes the other). Falls back to
  6708. // comparing ids when the spans cover exactly the same range.
  6709. function compareCollapsedMarkers(a, b) {
  6710. var lenDiff = a.lines.length - b.lines.length;
  6711. if (lenDiff != 0) { return lenDiff }
  6712. var aPos = a.find(), bPos = b.find();
  6713. var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
  6714. if (fromCmp) { return -fromCmp }
  6715. var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
  6716. if (toCmp) { return toCmp }
  6717. return b.id - a.id
  6718. }
  6719. // Find out whether a line ends or starts in a collapsed span. If
  6720. // so, return the marker for that span.
  6721. function collapsedSpanAtSide(line, start) {
  6722. var sps = sawCollapsedSpans && line.markedSpans, found;
  6723. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  6724. sp = sps[i];
  6725. if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
  6726. (!found || compareCollapsedMarkers(found, sp.marker) < 0))
  6727. { found = sp.marker; }
  6728. } }
  6729. return found
  6730. }
  6731. function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
  6732. function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
  6733. // Test whether there exists a collapsed span that partially
  6734. // overlaps (covers the start or end, but not both) of a new span.
  6735. // Such overlap is not allowed.
  6736. function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
  6737. var line = getLine(doc, lineNo$$1);
  6738. var sps = sawCollapsedSpans && line.markedSpans;
  6739. if (sps) { for (var i = 0; i < sps.length; ++i) {
  6740. var sp = sps[i];
  6741. if (!sp.marker.collapsed) { continue }
  6742. var found = sp.marker.find(0);
  6743. var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
  6744. var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
  6745. if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
  6746. if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
  6747. fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
  6748. { return true }
  6749. } }
  6750. }
  6751. // A visual line is a line as drawn on the screen. Folding, for
  6752. // example, can cause multiple logical lines to appear on the same
  6753. // visual line. This finds the start of the visual line that the
  6754. // given line is part of (usually that is the line itself).
  6755. function visualLine(line) {
  6756. var merged;
  6757. while (merged = collapsedSpanAtStart(line))
  6758. { line = merged.find(-1, true).line; }
  6759. return line
  6760. }
  6761. function visualLineEnd(line) {
  6762. var merged;
  6763. while (merged = collapsedSpanAtEnd(line))
  6764. { line = merged.find(1, true).line; }
  6765. return line
  6766. }
  6767. // Returns an array of logical lines that continue the visual line
  6768. // started by the argument, or undefined if there are no such lines.
  6769. function visualLineContinued(line) {
  6770. var merged, lines;
  6771. while (merged = collapsedSpanAtEnd(line)) {
  6772. line = merged.find(1, true).line
  6773. ;(lines || (lines = [])).push(line);
  6774. }
  6775. return lines
  6776. }
  6777. // Get the line number of the start of the visual line that the
  6778. // given line number is part of.
  6779. function visualLineNo(doc, lineN) {
  6780. var line = getLine(doc, lineN), vis = visualLine(line);
  6781. if (line == vis) { return lineN }
  6782. return lineNo(vis)
  6783. }
  6784. // Get the line number of the start of the next visual line after
  6785. // the given line.
  6786. function visualLineEndNo(doc, lineN) {
  6787. if (lineN > doc.lastLine()) { return lineN }
  6788. var line = getLine(doc, lineN), merged;
  6789. if (!lineIsHidden(doc, line)) { return lineN }
  6790. while (merged = collapsedSpanAtEnd(line))
  6791. { line = merged.find(1, true).line; }
  6792. return lineNo(line) + 1
  6793. }
  6794. // Compute whether a line is hidden. Lines count as hidden when they
  6795. // are part of a visual line that starts with another line, or when
  6796. // they are entirely covered by collapsed, non-widget span.
  6797. function lineIsHidden(doc, line) {
  6798. var sps = sawCollapsedSpans && line.markedSpans;
  6799. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  6800. sp = sps[i];
  6801. if (!sp.marker.collapsed) { continue }
  6802. if (sp.from == null) { return true }
  6803. if (sp.marker.widgetNode) { continue }
  6804. if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
  6805. { return true }
  6806. } }
  6807. }
  6808. function lineIsHiddenInner(doc, line, span) {
  6809. if (span.to == null) {
  6810. var end = span.marker.find(1, true);
  6811. return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
  6812. }
  6813. if (span.marker.inclusiveRight && span.to == line.text.length)
  6814. { return true }
  6815. for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
  6816. sp = line.markedSpans[i];
  6817. if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
  6818. (sp.to == null || sp.to != span.from) &&
  6819. (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
  6820. lineIsHiddenInner(doc, line, sp)) { return true }
  6821. }
  6822. }
  6823. // Find the height above the given line.
  6824. function heightAtLine(lineObj) {
  6825. lineObj = visualLine(lineObj);
  6826. var h = 0, chunk = lineObj.parent;
  6827. for (var i = 0; i < chunk.lines.length; ++i) {
  6828. var line = chunk.lines[i];
  6829. if (line == lineObj) { break }
  6830. else { h += line.height; }
  6831. }
  6832. for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
  6833. for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
  6834. var cur = p.children[i$1];
  6835. if (cur == chunk) { break }
  6836. else { h += cur.height; }
  6837. }
  6838. }
  6839. return h
  6840. }
  6841. // Compute the character length of a line, taking into account
  6842. // collapsed ranges (see markText) that might hide parts, and join
  6843. // other lines onto it.
  6844. function lineLength(line) {
  6845. if (line.height == 0) { return 0 }
  6846. var len = line.text.length, merged, cur = line;
  6847. while (merged = collapsedSpanAtStart(cur)) {
  6848. var found = merged.find(0, true);
  6849. cur = found.from.line;
  6850. len += found.from.ch - found.to.ch;
  6851. }
  6852. cur = line;
  6853. while (merged = collapsedSpanAtEnd(cur)) {
  6854. var found$1 = merged.find(0, true);
  6855. len -= cur.text.length - found$1.from.ch;
  6856. cur = found$1.to.line;
  6857. len += cur.text.length - found$1.to.ch;
  6858. }
  6859. return len
  6860. }
  6861. // Find the longest line in the document.
  6862. function findMaxLine(cm) {
  6863. var d = cm.display, doc = cm.doc;
  6864. d.maxLine = getLine(doc, doc.first);
  6865. d.maxLineLength = lineLength(d.maxLine);
  6866. d.maxLineChanged = true;
  6867. doc.iter(function (line) {
  6868. var len = lineLength(line);
  6869. if (len > d.maxLineLength) {
  6870. d.maxLineLength = len;
  6871. d.maxLine = line;
  6872. }
  6873. });
  6874. }
  6875. // BIDI HELPERS
  6876. function iterateBidiSections(order, from, to, f) {
  6877. if (!order) { return f(from, to, "ltr") }
  6878. var found = false;
  6879. for (var i = 0; i < order.length; ++i) {
  6880. var part = order[i];
  6881. if (part.from < to && part.to > from || from == to && part.to == from) {
  6882. f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
  6883. found = true;
  6884. }
  6885. }
  6886. if (!found) { f(from, to, "ltr"); }
  6887. }
  6888. var bidiOther = null;
  6889. function getBidiPartAt(order, ch, sticky) {
  6890. var found;
  6891. bidiOther = null;
  6892. for (var i = 0; i < order.length; ++i) {
  6893. var cur = order[i];
  6894. if (cur.from < ch && cur.to > ch) { return i }
  6895. if (cur.to == ch) {
  6896. if (cur.from != cur.to && sticky == "before") { found = i; }
  6897. else { bidiOther = i; }
  6898. }
  6899. if (cur.from == ch) {
  6900. if (cur.from != cur.to && sticky != "before") { found = i; }
  6901. else { bidiOther = i; }
  6902. }
  6903. }
  6904. return found != null ? found : bidiOther
  6905. }
  6906. // Bidirectional ordering algorithm
  6907. // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
  6908. // that this (partially) implements.
  6909. // One-char codes used for character types:
  6910. // L (L): Left-to-Right
  6911. // R (R): Right-to-Left
  6912. // r (AL): Right-to-Left Arabic
  6913. // 1 (EN): European Number
  6914. // + (ES): European Number Separator
  6915. // % (ET): European Number Terminator
  6916. // n (AN): Arabic Number
  6917. // , (CS): Common Number Separator
  6918. // m (NSM): Non-Spacing Mark
  6919. // b (BN): Boundary Neutral
  6920. // s (B): Paragraph Separator
  6921. // t (S): Segment Separator
  6922. // w (WS): Whitespace
  6923. // N (ON): Other Neutrals
  6924. // Returns null if characters are ordered as they appear
  6925. // (left-to-right), or an array of sections ({from, to, level}
  6926. // objects) in the order in which they occur visually.
  6927. var bidiOrdering = (function() {
  6928. // Character types for codepoints 0 to 0xff
  6929. var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
  6930. // Character types for codepoints 0x600 to 0x6f9
  6931. var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
  6932. function charType(code) {
  6933. if (code <= 0xf7) { return lowTypes.charAt(code) }
  6934. else if (0x590 <= code && code <= 0x5f4) { return "R" }
  6935. else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
  6936. else if (0x6ee <= code && code <= 0x8ac) { return "r" }
  6937. else if (0x2000 <= code && code <= 0x200b) { return "w" }
  6938. else if (code == 0x200c) { return "b" }
  6939. else { return "L" }
  6940. }
  6941. var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
  6942. var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
  6943. function BidiSpan(level, from, to) {
  6944. this.level = level;
  6945. this.from = from; this.to = to;
  6946. }
  6947. return function(str, direction) {
  6948. var outerType = direction == "ltr" ? "L" : "R";
  6949. if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
  6950. var len = str.length, types = [];
  6951. for (var i = 0; i < len; ++i)
  6952. { types.push(charType(str.charCodeAt(i))); }
  6953. // W1. Examine each non-spacing mark (NSM) in the level run, and
  6954. // change the type of the NSM to the type of the previous
  6955. // character. If the NSM is at the start of the level run, it will
  6956. // get the type of sor.
  6957. for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
  6958. var type = types[i$1];
  6959. if (type == "m") { types[i$1] = prev; }
  6960. else { prev = type; }
  6961. }
  6962. // W2. Search backwards from each instance of a European number
  6963. // until the first strong type (R, L, AL, or sor) is found. If an
  6964. // AL is found, change the type of the European number to Arabic
  6965. // number.
  6966. // W3. Change all ALs to R.
  6967. for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
  6968. var type$1 = types[i$2];
  6969. if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
  6970. else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
  6971. }
  6972. // W4. A single European separator between two European numbers
  6973. // changes to a European number. A single common separator between
  6974. // two numbers of the same type changes to that type.
  6975. for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
  6976. var type$2 = types[i$3];
  6977. if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
  6978. else if (type$2 == "," && prev$1 == types[i$3+1] &&
  6979. (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
  6980. prev$1 = type$2;
  6981. }
  6982. // W5. A sequence of European terminators adjacent to European
  6983. // numbers changes to all European numbers.
  6984. // W6. Otherwise, separators and terminators change to Other
  6985. // Neutral.
  6986. for (var i$4 = 0; i$4 < len; ++i$4) {
  6987. var type$3 = types[i$4];
  6988. if (type$3 == ",") { types[i$4] = "N"; }
  6989. else if (type$3 == "%") {
  6990. var end = (void 0);
  6991. for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
  6992. var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
  6993. for (var j = i$4; j < end; ++j) { types[j] = replace; }
  6994. i$4 = end - 1;
  6995. }
  6996. }
  6997. // W7. Search backwards from each instance of a European number
  6998. // until the first strong type (R, L, or sor) is found. If an L is
  6999. // found, then change the type of the European number to L.
  7000. for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
  7001. var type$4 = types[i$5];
  7002. if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
  7003. else if (isStrong.test(type$4)) { cur$1 = type$4; }
  7004. }
  7005. // N1. A sequence of neutrals takes the direction of the
  7006. // surrounding strong text if the text on both sides has the same
  7007. // direction. European and Arabic numbers act as if they were R in
  7008. // terms of their influence on neutrals. Start-of-level-run (sor)
  7009. // and end-of-level-run (eor) are used at level run boundaries.
  7010. // N2. Any remaining neutrals take the embedding direction.
  7011. for (var i$6 = 0; i$6 < len; ++i$6) {
  7012. if (isNeutral.test(types[i$6])) {
  7013. var end$1 = (void 0);
  7014. for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
  7015. var before = (i$6 ? types[i$6-1] : outerType) == "L";
  7016. var after = (end$1 < len ? types[end$1] : outerType) == "L";
  7017. var replace$1 = before == after ? (before ? "L" : "R") : outerType;
  7018. for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
  7019. i$6 = end$1 - 1;
  7020. }
  7021. }
  7022. // Here we depart from the documented algorithm, in order to avoid
  7023. // building up an actual levels array. Since there are only three
  7024. // levels (0, 1, 2) in an implementation that doesn't take
  7025. // explicit embedding into account, we can build up the order on
  7026. // the fly, without following the level-based algorithm.
  7027. var order = [], m;
  7028. for (var i$7 = 0; i$7 < len;) {
  7029. if (countsAsLeft.test(types[i$7])) {
  7030. var start = i$7;
  7031. for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
  7032. order.push(new BidiSpan(0, start, i$7));
  7033. } else {
  7034. var pos = i$7, at = order.length;
  7035. for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
  7036. for (var j$2 = pos; j$2 < i$7;) {
  7037. if (countsAsNum.test(types[j$2])) {
  7038. if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
  7039. var nstart = j$2;
  7040. for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
  7041. order.splice(at, 0, new BidiSpan(2, nstart, j$2));
  7042. pos = j$2;
  7043. } else { ++j$2; }
  7044. }
  7045. if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
  7046. }
  7047. }
  7048. if (order[0].level == 1 && (m = str.match(/^\s+/))) {
  7049. order[0].from = m[0].length;
  7050. order.unshift(new BidiSpan(0, 0, m[0].length));
  7051. }
  7052. if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
  7053. lst(order).to -= m[0].length;
  7054. order.push(new BidiSpan(0, len - m[0].length, len));
  7055. }
  7056. return direction == "rtl" ? order.reverse() : order
  7057. }
  7058. })();
  7059. // Get the bidi ordering for the given line (and cache it). Returns
  7060. // false for lines that are fully left-to-right, and an array of
  7061. // BidiSpan objects otherwise.
  7062. function getOrder(line, direction) {
  7063. var order = line.order;
  7064. if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
  7065. return order
  7066. }
  7067. function moveCharLogically(line, ch, dir) {
  7068. var target = skipExtendingChars(line.text, ch + dir, dir);
  7069. return target < 0 || target > line.text.length ? null : target
  7070. }
  7071. function moveLogically(line, start, dir) {
  7072. var ch = moveCharLogically(line, start.ch, dir);
  7073. return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
  7074. }
  7075. function endOfLine(visually, cm, lineObj, lineNo, dir) {
  7076. if (visually) {
  7077. var order = getOrder(lineObj, cm.doc.direction);
  7078. if (order) {
  7079. var part = dir < 0 ? lst(order) : order[0];
  7080. var moveInStorageOrder = (dir < 0) == (part.level == 1);
  7081. var sticky = moveInStorageOrder ? "after" : "before";
  7082. var ch;
  7083. // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
  7084. // it could be that the last bidi part is not on the last visual line,
  7085. // since visual lines contain content order-consecutive chunks.
  7086. // Thus, in rtl, we are looking for the first (content-order) character
  7087. // in the rtl chunk that is on the last line (that is, the same line
  7088. // as the last (content-order) character).
  7089. if (part.level > 0) {
  7090. var prep = prepareMeasureForLine(cm, lineObj);
  7091. ch = dir < 0 ? lineObj.text.length - 1 : 0;
  7092. var targetTop = measureCharPrepared(cm, prep, ch).top;
  7093. ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
  7094. if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true); }
  7095. } else { ch = dir < 0 ? part.to : part.from; }
  7096. return new Pos(lineNo, ch, sticky)
  7097. }
  7098. }
  7099. return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
  7100. }
  7101. function moveVisually(cm, line, start, dir) {
  7102. var bidi = getOrder(line, cm.doc.direction);
  7103. if (!bidi) { return moveLogically(line, start, dir) }
  7104. if (start.ch >= line.text.length) {
  7105. start.ch = line.text.length;
  7106. start.sticky = "before";
  7107. } else if (start.ch <= 0) {
  7108. start.ch = 0;
  7109. start.sticky = "after";
  7110. }
  7111. var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
  7112. if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
  7113. // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
  7114. // nothing interesting happens.
  7115. return moveLogically(line, start, dir)
  7116. }
  7117. var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
  7118. var prep;
  7119. var getWrappedLineExtent = function (ch) {
  7120. if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
  7121. prep = prep || prepareMeasureForLine(cm, line);
  7122. return wrappedLineExtentChar(cm, line, prep, ch)
  7123. };
  7124. var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
  7125. if (cm.doc.direction == "rtl" || part.level == 1) {
  7126. var moveInStorageOrder = (part.level == 1) == (dir < 0);
  7127. var ch = mv(start, moveInStorageOrder ? 1 : -1);
  7128. if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
  7129. // Case 2: We move within an rtl part or in an rtl editor on the same visual line
  7130. var sticky = moveInStorageOrder ? "before" : "after";
  7131. return new Pos(start.line, ch, sticky)
  7132. }
  7133. }
  7134. // Case 3: Could not move within this bidi part in this visual line, so leave
  7135. // the current bidi part
  7136. var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
  7137. var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
  7138. ? new Pos(start.line, mv(ch, 1), "before")
  7139. : new Pos(start.line, ch, "after"); };
  7140. for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
  7141. var part = bidi[partPos];
  7142. var moveInStorageOrder = (dir > 0) == (part.level != 1);
  7143. var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
  7144. if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
  7145. ch = moveInStorageOrder ? part.from : mv(part.to, -1);
  7146. if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
  7147. }
  7148. };
  7149. // Case 3a: Look for other bidi parts on the same visual line
  7150. var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
  7151. if (res) { return res }
  7152. // Case 3b: Look for other bidi parts on the next visual line
  7153. var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
  7154. if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
  7155. res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
  7156. if (res) { return res }
  7157. }
  7158. // Case 4: Nowhere to move
  7159. return null
  7160. }
  7161. // EVENT HANDLING
  7162. // Lightweight event framework. on/off also work on DOM nodes,
  7163. // registering native DOM handlers.
  7164. var noHandlers = [];
  7165. var on = function(emitter, type, f) {
  7166. if (emitter.addEventListener) {
  7167. emitter.addEventListener(type, f, false);
  7168. } else if (emitter.attachEvent) {
  7169. emitter.attachEvent("on" + type, f);
  7170. } else {
  7171. var map$$1 = emitter._handlers || (emitter._handlers = {});
  7172. map$$1[type] = (map$$1[type] || noHandlers).concat(f);
  7173. }
  7174. };
  7175. function getHandlers(emitter, type) {
  7176. return emitter._handlers && emitter._handlers[type] || noHandlers
  7177. }
  7178. function off(emitter, type, f) {
  7179. if (emitter.removeEventListener) {
  7180. emitter.removeEventListener(type, f, false);
  7181. } else if (emitter.detachEvent) {
  7182. emitter.detachEvent("on" + type, f);
  7183. } else {
  7184. var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
  7185. if (arr) {
  7186. var index = indexOf(arr, f);
  7187. if (index > -1)
  7188. { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
  7189. }
  7190. }
  7191. }
  7192. function signal(emitter, type /*, values...*/) {
  7193. var handlers = getHandlers(emitter, type);
  7194. if (!handlers.length) { return }
  7195. var args = Array.prototype.slice.call(arguments, 2);
  7196. for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
  7197. }
  7198. // The DOM events that CodeMirror handles can be overridden by
  7199. // registering a (non-DOM) handler on the editor for the event name,
  7200. // and preventDefault-ing the event in that handler.
  7201. function signalDOMEvent(cm, e, override) {
  7202. if (typeof e == "string")
  7203. { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
  7204. signal(cm, override || e.type, cm, e);
  7205. return e_defaultPrevented(e) || e.codemirrorIgnore
  7206. }
  7207. function signalCursorActivity(cm) {
  7208. var arr = cm._handlers && cm._handlers.cursorActivity;
  7209. if (!arr) { return }
  7210. var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
  7211. for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
  7212. { set.push(arr[i]); } }
  7213. }
  7214. function hasHandler(emitter, type) {
  7215. return getHandlers(emitter, type).length > 0
  7216. }
  7217. // Add on and off methods to a constructor's prototype, to make
  7218. // registering events on such objects more convenient.
  7219. function eventMixin(ctor) {
  7220. ctor.prototype.on = function(type, f) {on(this, type, f);};
  7221. ctor.prototype.off = function(type, f) {off(this, type, f);};
  7222. }
  7223. // Due to the fact that we still support jurassic IE versions, some
  7224. // compatibility wrappers are needed.
  7225. function e_preventDefault(e) {
  7226. if (e.preventDefault) { e.preventDefault(); }
  7227. else { e.returnValue = false; }
  7228. }
  7229. function e_stopPropagation(e) {
  7230. if (e.stopPropagation) { e.stopPropagation(); }
  7231. else { e.cancelBubble = true; }
  7232. }
  7233. function e_defaultPrevented(e) {
  7234. return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
  7235. }
  7236. function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
  7237. function e_target(e) {return e.target || e.srcElement}
  7238. function e_button(e) {
  7239. var b = e.which;
  7240. if (b == null) {
  7241. if (e.button & 1) { b = 1; }
  7242. else if (e.button & 2) { b = 3; }
  7243. else if (e.button & 4) { b = 2; }
  7244. }
  7245. if (mac && e.ctrlKey && b == 1) { b = 3; }
  7246. return b
  7247. }
  7248. // Detect drag-and-drop
  7249. var dragAndDrop = function() {
  7250. // There is *some* kind of drag-and-drop support in IE6-8, but I
  7251. // couldn't get it to work yet.
  7252. if (ie && ie_version < 9) { return false }
  7253. var div = elt('div');
  7254. return "draggable" in div || "dragDrop" in div
  7255. }();
  7256. var zwspSupported;
  7257. function zeroWidthElement(measure) {
  7258. if (zwspSupported == null) {
  7259. var test = elt("span", "\u200b");
  7260. removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
  7261. if (measure.firstChild.offsetHeight != 0)
  7262. { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
  7263. }
  7264. var node = zwspSupported ? elt("span", "\u200b") :
  7265. elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
  7266. node.setAttribute("cm-text", "");
  7267. return node
  7268. }
  7269. // Feature-detect IE's crummy client rect reporting for bidi text
  7270. var badBidiRects;
  7271. function hasBadBidiRects(measure) {
  7272. if (badBidiRects != null) { return badBidiRects }
  7273. var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
  7274. var r0 = range(txt, 0, 1).getBoundingClientRect();
  7275. var r1 = range(txt, 1, 2).getBoundingClientRect();
  7276. removeChildren(measure);
  7277. if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
  7278. return badBidiRects = (r1.right - r0.right < 3)
  7279. }
  7280. // See if "".split is the broken IE version, if so, provide an
  7281. // alternative way to split lines.
  7282. var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
  7283. var pos = 0, result = [], l = string.length;
  7284. while (pos <= l) {
  7285. var nl = string.indexOf("\n", pos);
  7286. if (nl == -1) { nl = string.length; }
  7287. var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
  7288. var rt = line.indexOf("\r");
  7289. if (rt != -1) {
  7290. result.push(line.slice(0, rt));
  7291. pos += rt + 1;
  7292. } else {
  7293. result.push(line);
  7294. pos = nl + 1;
  7295. }
  7296. }
  7297. return result
  7298. } : function (string) { return string.split(/\r\n?|\n/); };
  7299. var hasSelection = window.getSelection ? function (te) {
  7300. try { return te.selectionStart != te.selectionEnd }
  7301. catch(e) { return false }
  7302. } : function (te) {
  7303. var range$$1;
  7304. try {range$$1 = te.ownerDocument.selection.createRange();}
  7305. catch(e) {}
  7306. if (!range$$1 || range$$1.parentElement() != te) { return false }
  7307. return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
  7308. };
  7309. var hasCopyEvent = (function () {
  7310. var e = elt("div");
  7311. if ("oncopy" in e) { return true }
  7312. e.setAttribute("oncopy", "return;");
  7313. return typeof e.oncopy == "function"
  7314. })();
  7315. var badZoomedRects = null;
  7316. function hasBadZoomedRects(measure) {
  7317. if (badZoomedRects != null) { return badZoomedRects }
  7318. var node = removeChildrenAndAdd(measure, elt("span", "x"));
  7319. var normal = node.getBoundingClientRect();
  7320. var fromRange = range(node, 0, 1).getBoundingClientRect();
  7321. return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
  7322. }
  7323. // Known modes, by name and by MIME
  7324. var modes = {};
  7325. var mimeModes = {};
  7326. // Extra arguments are stored as the mode's dependencies, which is
  7327. // used by (legacy) mechanisms like loadmode.js to automatically
  7328. // load a mode. (Preferred mechanism is the require/define calls.)
  7329. function defineMode(name, mode) {
  7330. if (arguments.length > 2)
  7331. { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
  7332. modes[name] = mode;
  7333. }
  7334. function defineMIME(mime, spec) {
  7335. mimeModes[mime] = spec;
  7336. }
  7337. // Given a MIME type, a {name, ...options} config object, or a name
  7338. // string, return a mode config object.
  7339. function resolveMode(spec) {
  7340. if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
  7341. spec = mimeModes[spec];
  7342. } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
  7343. var found = mimeModes[spec.name];
  7344. if (typeof found == "string") { found = {name: found}; }
  7345. spec = createObj(found, spec);
  7346. spec.name = found.name;
  7347. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
  7348. return resolveMode("application/xml")
  7349. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
  7350. return resolveMode("application/json")
  7351. }
  7352. if (typeof spec == "string") { return {name: spec} }
  7353. else { return spec || {name: "null"} }
  7354. }
  7355. // Given a mode spec (anything that resolveMode accepts), find and
  7356. // initialize an actual mode object.
  7357. function getMode(options, spec) {
  7358. spec = resolveMode(spec);
  7359. var mfactory = modes[spec.name];
  7360. if (!mfactory) { return getMode(options, "text/plain") }
  7361. var modeObj = mfactory(options, spec);
  7362. if (modeExtensions.hasOwnProperty(spec.name)) {
  7363. var exts = modeExtensions[spec.name];
  7364. for (var prop in exts) {
  7365. if (!exts.hasOwnProperty(prop)) { continue }
  7366. if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
  7367. modeObj[prop] = exts[prop];
  7368. }
  7369. }
  7370. modeObj.name = spec.name;
  7371. if (spec.helperType) { modeObj.helperType = spec.helperType; }
  7372. if (spec.modeProps) { for (var prop$1 in spec.modeProps)
  7373. { modeObj[prop$1] = spec.modeProps[prop$1]; } }
  7374. return modeObj
  7375. }
  7376. // This can be used to attach properties to mode objects from
  7377. // outside the actual mode definition.
  7378. var modeExtensions = {};
  7379. function extendMode(mode, properties) {
  7380. var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
  7381. copyObj(properties, exts);
  7382. }
  7383. function copyState(mode, state) {
  7384. if (state === true) { return state }
  7385. if (mode.copyState) { return mode.copyState(state) }
  7386. var nstate = {};
  7387. for (var n in state) {
  7388. var val = state[n];
  7389. if (val instanceof Array) { val = val.concat([]); }
  7390. nstate[n] = val;
  7391. }
  7392. return nstate
  7393. }
  7394. // Given a mode and a state (for that mode), find the inner mode and
  7395. // state at the position that the state refers to.
  7396. function innerMode(mode, state) {
  7397. var info;
  7398. while (mode.innerMode) {
  7399. info = mode.innerMode(state);
  7400. if (!info || info.mode == mode) { break }
  7401. state = info.state;
  7402. mode = info.mode;
  7403. }
  7404. return info || {mode: mode, state: state}
  7405. }
  7406. function startState(mode, a1, a2) {
  7407. return mode.startState ? mode.startState(a1, a2) : true
  7408. }
  7409. // STRING STREAM
  7410. // Fed to the mode parsers, provides helper functions to make
  7411. // parsers more succinct.
  7412. var StringStream = function(string, tabSize) {
  7413. this.pos = this.start = 0;
  7414. this.string = string;
  7415. this.tabSize = tabSize || 8;
  7416. this.lastColumnPos = this.lastColumnValue = 0;
  7417. this.lineStart = 0;
  7418. };
  7419. StringStream.prototype.eol = function () {return this.pos >= this.string.length};
  7420. StringStream.prototype.sol = function () {return this.pos == this.lineStart};
  7421. StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
  7422. StringStream.prototype.next = function () {
  7423. if (this.pos < this.string.length)
  7424. { return this.string.charAt(this.pos++) }
  7425. };
  7426. StringStream.prototype.eat = function (match) {
  7427. var ch = this.string.charAt(this.pos);
  7428. var ok;
  7429. if (typeof match == "string") { ok = ch == match; }
  7430. else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
  7431. if (ok) {++this.pos; return ch}
  7432. };
  7433. StringStream.prototype.eatWhile = function (match) {
  7434. var start = this.pos;
  7435. while (this.eat(match)){}
  7436. return this.pos > start
  7437. };
  7438. StringStream.prototype.eatSpace = function () {
  7439. var this$1 = this;
  7440. var start = this.pos;
  7441. while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
  7442. return this.pos > start
  7443. };
  7444. StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
  7445. StringStream.prototype.skipTo = function (ch) {
  7446. var found = this.string.indexOf(ch, this.pos);
  7447. if (found > -1) {this.pos = found; return true}
  7448. };
  7449. StringStream.prototype.backUp = function (n) {this.pos -= n;};
  7450. StringStream.prototype.column = function () {
  7451. if (this.lastColumnPos < this.start) {
  7452. this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
  7453. this.lastColumnPos = this.start;
  7454. }
  7455. return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  7456. };
  7457. StringStream.prototype.indentation = function () {
  7458. return countColumn(this.string, null, this.tabSize) -
  7459. (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  7460. };
  7461. StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
  7462. if (typeof pattern == "string") {
  7463. var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
  7464. var substr = this.string.substr(this.pos, pattern.length);
  7465. if (cased(substr) == cased(pattern)) {
  7466. if (consume !== false) { this.pos += pattern.length; }
  7467. return true
  7468. }
  7469. } else {
  7470. var match = this.string.slice(this.pos).match(pattern);
  7471. if (match && match.index > 0) { return null }
  7472. if (match && consume !== false) { this.pos += match[0].length; }
  7473. return match
  7474. }
  7475. };
  7476. StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
  7477. StringStream.prototype.hideFirstChars = function (n, inner) {
  7478. this.lineStart += n;
  7479. try { return inner() }
  7480. finally { this.lineStart -= n; }
  7481. };
  7482. // Compute a style array (an array starting with a mode generation
  7483. // -- for invalidation -- followed by pairs of end positions and
  7484. // style strings), which is used to highlight the tokens on the
  7485. // line.
  7486. function highlightLine(cm, line, state, forceToEnd) {
  7487. // A styles array always starts with a number identifying the
  7488. // mode/overlays that it is based on (for easy invalidation).
  7489. var st = [cm.state.modeGen], lineClasses = {};
  7490. // Compute the base array of styles
  7491. runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
  7492. lineClasses, forceToEnd);
  7493. // Run overlays, adjust style array.
  7494. var loop = function ( o ) {
  7495. var overlay = cm.state.overlays[o], i = 1, at = 0;
  7496. runMode(cm, line.text, overlay.mode, true, function (end, style) {
  7497. var start = i;
  7498. // Ensure there's a token end at the current position, and that i points at it
  7499. while (at < end) {
  7500. var i_end = st[i];
  7501. if (i_end > end)
  7502. { st.splice(i, 1, end, st[i+1], i_end); }
  7503. i += 2;
  7504. at = Math.min(end, i_end);
  7505. }
  7506. if (!style) { return }
  7507. if (overlay.opaque) {
  7508. st.splice(start, i - start, end, "overlay " + style);
  7509. i = start + 2;
  7510. } else {
  7511. for (; start < i; start += 2) {
  7512. var cur = st[start+1];
  7513. st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
  7514. }
  7515. }
  7516. }, lineClasses);
  7517. };
  7518. for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
  7519. return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
  7520. }
  7521. function getLineStyles(cm, line, updateFrontier) {
  7522. if (!line.styles || line.styles[0] != cm.state.modeGen) {
  7523. var state = getStateBefore(cm, lineNo(line));
  7524. var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);
  7525. line.stateAfter = state;
  7526. line.styles = result.styles;
  7527. if (result.classes) { line.styleClasses = result.classes; }
  7528. else if (line.styleClasses) { line.styleClasses = null; }
  7529. if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++; }
  7530. }
  7531. return line.styles
  7532. }
  7533. function getStateBefore(cm, n, precise) {
  7534. var doc = cm.doc, display = cm.display;
  7535. if (!doc.mode.startState) { return true }
  7536. var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
  7537. if (!state) { state = startState(doc.mode); }
  7538. else { state = copyState(doc.mode, state); }
  7539. doc.iter(pos, n, function (line) {
  7540. processLine(cm, line.text, state);
  7541. var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
  7542. line.stateAfter = save ? copyState(doc.mode, state) : null;
  7543. ++pos;
  7544. });
  7545. if (precise) { doc.frontier = pos; }
  7546. return state
  7547. }
  7548. // Lightweight form of highlight -- proceed over this line and
  7549. // update state, but don't save a style array. Used for lines that
  7550. // aren't currently visible.
  7551. function processLine(cm, text, state, startAt) {
  7552. var mode = cm.doc.mode;
  7553. var stream = new StringStream(text, cm.options.tabSize);
  7554. stream.start = stream.pos = startAt || 0;
  7555. if (text == "") { callBlankLine(mode, state); }
  7556. while (!stream.eol()) {
  7557. readToken(mode, stream, state);
  7558. stream.start = stream.pos;
  7559. }
  7560. }
  7561. function callBlankLine(mode, state) {
  7562. if (mode.blankLine) { return mode.blankLine(state) }
  7563. if (!mode.innerMode) { return }
  7564. var inner = innerMode(mode, state);
  7565. if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
  7566. }
  7567. function readToken(mode, stream, state, inner) {
  7568. for (var i = 0; i < 10; i++) {
  7569. if (inner) { inner[0] = innerMode(mode, state).mode; }
  7570. var style = mode.token(stream, state);
  7571. if (stream.pos > stream.start) { return style }
  7572. }
  7573. throw new Error("Mode " + mode.name + " failed to advance stream.")
  7574. }
  7575. // Utility for getTokenAt and getLineTokens
  7576. function takeToken(cm, pos, precise, asArray) {
  7577. var getObj = function (copy) { return ({
  7578. start: stream.start, end: stream.pos,
  7579. string: stream.current(),
  7580. type: style || null,
  7581. state: copy ? copyState(doc.mode, state) : state
  7582. }); };
  7583. var doc = cm.doc, mode = doc.mode, style;
  7584. pos = clipPos(doc, pos);
  7585. var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);
  7586. var stream = new StringStream(line.text, cm.options.tabSize), tokens;
  7587. if (asArray) { tokens = []; }
  7588. while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
  7589. stream.start = stream.pos;
  7590. style = readToken(mode, stream, state);
  7591. if (asArray) { tokens.push(getObj(true)); }
  7592. }
  7593. return asArray ? tokens : getObj()
  7594. }
  7595. function extractLineClasses(type, output) {
  7596. if (type) { for (;;) {
  7597. var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
  7598. if (!lineClass) { break }
  7599. type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
  7600. var prop = lineClass[1] ? "bgClass" : "textClass";
  7601. if (output[prop] == null)
  7602. { output[prop] = lineClass[2]; }
  7603. else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
  7604. { output[prop] += " " + lineClass[2]; }
  7605. } }
  7606. return type
  7607. }
  7608. // Run the given mode's parser over a line, calling f for each token.
  7609. function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
  7610. var flattenSpans = mode.flattenSpans;
  7611. if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
  7612. var curStart = 0, curStyle = null;
  7613. var stream = new StringStream(text, cm.options.tabSize), style;
  7614. var inner = cm.options.addModeClass && [null];
  7615. if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses); }
  7616. while (!stream.eol()) {
  7617. if (stream.pos > cm.options.maxHighlightLength) {
  7618. flattenSpans = false;
  7619. if (forceToEnd) { processLine(cm, text, state, stream.pos); }
  7620. stream.pos = text.length;
  7621. style = null;
  7622. } else {
  7623. style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);
  7624. }
  7625. if (inner) {
  7626. var mName = inner[0].name;
  7627. if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
  7628. }
  7629. if (!flattenSpans || curStyle != style) {
  7630. while (curStart < stream.start) {
  7631. curStart = Math.min(stream.start, curStart + 5000);
  7632. f(curStart, curStyle);
  7633. }
  7634. curStyle = style;
  7635. }
  7636. stream.start = stream.pos;
  7637. }
  7638. while (curStart < stream.pos) {
  7639. // Webkit seems to refuse to render text nodes longer than 57444
  7640. // characters, and returns inaccurate measurements in nodes
  7641. // starting around 5000 chars.
  7642. var pos = Math.min(stream.pos, curStart + 5000);
  7643. f(pos, curStyle);
  7644. curStart = pos;
  7645. }
  7646. }
  7647. // Finds the line to start with when starting a parse. Tries to
  7648. // find a line with a stateAfter, so that it can start with a
  7649. // valid state. If that fails, it returns the line with the
  7650. // smallest indentation, which tends to need the least context to
  7651. // parse correctly.
  7652. function findStartLine(cm, n, precise) {
  7653. var minindent, minline, doc = cm.doc;
  7654. var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
  7655. for (var search = n; search > lim; --search) {
  7656. if (search <= doc.first) { return doc.first }
  7657. var line = getLine(doc, search - 1);
  7658. if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
  7659. var indented = countColumn(line.text, null, cm.options.tabSize);
  7660. if (minline == null || minindent > indented) {
  7661. minline = search - 1;
  7662. minindent = indented;
  7663. }
  7664. }
  7665. return minline
  7666. }
  7667. // LINE DATA STRUCTURE
  7668. // Line objects. These hold state related to a line, including
  7669. // highlighting info (the styles array).
  7670. var Line = function(text, markedSpans, estimateHeight) {
  7671. this.text = text;
  7672. attachMarkedSpans(this, markedSpans);
  7673. this.height = estimateHeight ? estimateHeight(this) : 1;
  7674. };
  7675. Line.prototype.lineNo = function () { return lineNo(this) };
  7676. eventMixin(Line);
  7677. // Change the content (text, markers) of a line. Automatically
  7678. // invalidates cached information and tries to re-estimate the
  7679. // line's height.
  7680. function updateLine(line, text, markedSpans, estimateHeight) {
  7681. line.text = text;
  7682. if (line.stateAfter) { line.stateAfter = null; }
  7683. if (line.styles) { line.styles = null; }
  7684. if (line.order != null) { line.order = null; }
  7685. detachMarkedSpans(line);
  7686. attachMarkedSpans(line, markedSpans);
  7687. var estHeight = estimateHeight ? estimateHeight(line) : 1;
  7688. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  7689. }
  7690. // Detach a line from the document tree and its markers.
  7691. function cleanUpLine(line) {
  7692. line.parent = null;
  7693. detachMarkedSpans(line);
  7694. }
  7695. // Convert a style as returned by a mode (either null, or a string
  7696. // containing one or more styles) to a CSS style. This is cached,
  7697. // and also looks for line-wide styles.
  7698. var styleToClassCache = {};
  7699. var styleToClassCacheWithMode = {};
  7700. function interpretTokenStyle(style, options) {
  7701. if (!style || /^\s*$/.test(style)) { return null }
  7702. var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
  7703. return cache[style] ||
  7704. (cache[style] = style.replace(/\S+/g, "cm-$&"))
  7705. }
  7706. // Render the DOM representation of the text of a line. Also builds
  7707. // up a 'line map', which points at the DOM nodes that represent
  7708. // specific stretches of text, and is used by the measuring code.
  7709. // The returned object contains the DOM node, this map, and
  7710. // information about line-wide styles that were set by the mode.
  7711. function buildLineContent(cm, lineView) {
  7712. // The padding-right forces the element to have a 'border', which
  7713. // is needed on Webkit to be able to get line-level bounding
  7714. // rectangles for it (in measureChar).
  7715. var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
  7716. var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
  7717. col: 0, pos: 0, cm: cm,
  7718. trailingSpace: false,
  7719. splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")};
  7720. lineView.measure = {};
  7721. // Iterate over the logical lines that make up this visual line.
  7722. for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
  7723. var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
  7724. builder.pos = 0;
  7725. builder.addToken = buildToken;
  7726. // Optionally wire in some hacks into the token-rendering
  7727. // algorithm, to deal with browser quirks.
  7728. if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
  7729. { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
  7730. builder.map = [];
  7731. var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
  7732. insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
  7733. if (line.styleClasses) {
  7734. if (line.styleClasses.bgClass)
  7735. { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
  7736. if (line.styleClasses.textClass)
  7737. { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
  7738. }
  7739. // Ensure at least a single node is present, for measuring.
  7740. if (builder.map.length == 0)
  7741. { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
  7742. // Store the map and a cache object for the current logical line
  7743. if (i == 0) {
  7744. lineView.measure.map = builder.map;
  7745. lineView.measure.cache = {};
  7746. } else {
  7747. (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
  7748. ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
  7749. }
  7750. }
  7751. // See issue #2901
  7752. if (webkit) {
  7753. var last = builder.content.lastChild;
  7754. if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
  7755. { builder.content.className = "cm-tab-wrap-hack"; }
  7756. }
  7757. signal(cm, "renderLine", cm, lineView.line, builder.pre);
  7758. if (builder.pre.className)
  7759. { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
  7760. return builder
  7761. }
  7762. function defaultSpecialCharPlaceholder(ch) {
  7763. var token = elt("span", "\u2022", "cm-invalidchar");
  7764. token.title = "\\u" + ch.charCodeAt(0).toString(16);
  7765. token.setAttribute("aria-label", token.title);
  7766. return token
  7767. }
  7768. // Build up the DOM representation for a single token, and add it to
  7769. // the line map. Takes care to render special characters separately.
  7770. function buildToken(builder, text, style, startStyle, endStyle, title, css) {
  7771. if (!text) { return }
  7772. var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
  7773. var special = builder.cm.state.specialChars, mustWrap = false;
  7774. var content;
  7775. if (!special.test(text)) {
  7776. builder.col += text.length;
  7777. content = document.createTextNode(displayText);
  7778. builder.map.push(builder.pos, builder.pos + text.length, content);
  7779. if (ie && ie_version < 9) { mustWrap = true; }
  7780. builder.pos += text.length;
  7781. } else {
  7782. content = document.createDocumentFragment();
  7783. var pos = 0;
  7784. while (true) {
  7785. special.lastIndex = pos;
  7786. var m = special.exec(text);
  7787. var skipped = m ? m.index - pos : text.length - pos;
  7788. if (skipped) {
  7789. var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
  7790. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
  7791. else { content.appendChild(txt); }
  7792. builder.map.push(builder.pos, builder.pos + skipped, txt);
  7793. builder.col += skipped;
  7794. builder.pos += skipped;
  7795. }
  7796. if (!m) { break }
  7797. pos += skipped + 1;
  7798. var txt$1 = (void 0);
  7799. if (m[0] == "\t") {
  7800. var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
  7801. txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
  7802. txt$1.setAttribute("role", "presentation");
  7803. txt$1.setAttribute("cm-text", "\t");
  7804. builder.col += tabWidth;
  7805. } else if (m[0] == "\r" || m[0] == "\n") {
  7806. txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
  7807. txt$1.setAttribute("cm-text", m[0]);
  7808. builder.col += 1;
  7809. } else {
  7810. txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
  7811. txt$1.setAttribute("cm-text", m[0]);
  7812. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
  7813. else { content.appendChild(txt$1); }
  7814. builder.col += 1;
  7815. }
  7816. builder.map.push(builder.pos, builder.pos + 1, txt$1);
  7817. builder.pos++;
  7818. }
  7819. }
  7820. builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
  7821. if (style || startStyle || endStyle || mustWrap || css) {
  7822. var fullStyle = style || "";
  7823. if (startStyle) { fullStyle += startStyle; }
  7824. if (endStyle) { fullStyle += endStyle; }
  7825. var token = elt("span", [content], fullStyle, css);
  7826. if (title) { token.title = title; }
  7827. return builder.content.appendChild(token)
  7828. }
  7829. builder.content.appendChild(content);
  7830. }
  7831. function splitSpaces(text, trailingBefore) {
  7832. if (text.length > 1 && !/ /.test(text)) { return text }
  7833. var spaceBefore = trailingBefore, result = "";
  7834. for (var i = 0; i < text.length; i++) {
  7835. var ch = text.charAt(i);
  7836. if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
  7837. { ch = "\u00a0"; }
  7838. result += ch;
  7839. spaceBefore = ch == " ";
  7840. }
  7841. return result
  7842. }
  7843. // Work around nonsense dimensions being reported for stretches of
  7844. // right-to-left text.
  7845. function buildTokenBadBidi(inner, order) {
  7846. return function (builder, text, style, startStyle, endStyle, title, css) {
  7847. style = style ? style + " cm-force-border" : "cm-force-border";
  7848. var start = builder.pos, end = start + text.length;
  7849. for (;;) {
  7850. // Find the part that overlaps with the start of this text
  7851. var part = (void 0);
  7852. for (var i = 0; i < order.length; i++) {
  7853. part = order[i];
  7854. if (part.to > start && part.from <= start) { break }
  7855. }
  7856. if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
  7857. inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);
  7858. startStyle = null;
  7859. text = text.slice(part.to - start);
  7860. start = part.to;
  7861. }
  7862. }
  7863. }
  7864. function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
  7865. var widget = !ignoreWidget && marker.widgetNode;
  7866. if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
  7867. if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
  7868. if (!widget)
  7869. { widget = builder.content.appendChild(document.createElement("span")); }
  7870. widget.setAttribute("cm-marker", marker.id);
  7871. }
  7872. if (widget) {
  7873. builder.cm.display.input.setUneditable(widget);
  7874. builder.content.appendChild(widget);
  7875. }
  7876. builder.pos += size;
  7877. builder.trailingSpace = false;
  7878. }
  7879. // Outputs a number of spans to make up a line, taking highlighting
  7880. // and marked text into account.
  7881. function insertLineContent(line, builder, styles) {
  7882. var spans = line.markedSpans, allText = line.text, at = 0;
  7883. if (!spans) {
  7884. for (var i$1 = 1; i$1 < styles.length; i$1+=2)
  7885. { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
  7886. return
  7887. }
  7888. var len = allText.length, pos = 0, i = 1, text = "", style, css;
  7889. var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
  7890. for (;;) {
  7891. if (nextChange == pos) { // Update current marker set
  7892. spanStyle = spanEndStyle = spanStartStyle = title = css = "";
  7893. collapsed = null; nextChange = Infinity;
  7894. var foundBookmarks = [], endStyles = (void 0);
  7895. for (var j = 0; j < spans.length; ++j) {
  7896. var sp = spans[j], m = sp.marker;
  7897. if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
  7898. foundBookmarks.push(m);
  7899. } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
  7900. if (sp.to != null && sp.to != pos && nextChange > sp.to) {
  7901. nextChange = sp.to;
  7902. spanEndStyle = "";
  7903. }
  7904. if (m.className) { spanStyle += " " + m.className; }
  7905. if (m.css) { css = (css ? css + ";" : "") + m.css; }
  7906. if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
  7907. if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
  7908. if (m.title && !title) { title = m.title; }
  7909. if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
  7910. { collapsed = sp; }
  7911. } else if (sp.from > pos && nextChange > sp.from) {
  7912. nextChange = sp.from;
  7913. }
  7914. }
  7915. if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
  7916. { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
  7917. if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
  7918. { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
  7919. if (collapsed && (collapsed.from || 0) == pos) {
  7920. buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
  7921. collapsed.marker, collapsed.from == null);
  7922. if (collapsed.to == null) { return }
  7923. if (collapsed.to == pos) { collapsed = false; }
  7924. }
  7925. }
  7926. if (pos >= len) { break }
  7927. var upto = Math.min(len, nextChange);
  7928. while (true) {
  7929. if (text) {
  7930. var end = pos + text.length;
  7931. if (!collapsed) {
  7932. var tokenText = end > upto ? text.slice(0, upto - pos) : text;
  7933. builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
  7934. spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css);
  7935. }
  7936. if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
  7937. pos = end;
  7938. spanStartStyle = "";
  7939. }
  7940. text = allText.slice(at, at = styles[i++]);
  7941. style = interpretTokenStyle(styles[i++], builder.cm.options);
  7942. }
  7943. }
  7944. }
  7945. // These objects are used to represent the visible (currently drawn)
  7946. // part of the document. A LineView may correspond to multiple
  7947. // logical lines, if those are connected by collapsed ranges.
  7948. function LineView(doc, line, lineN) {
  7949. // The starting line
  7950. this.line = line;
  7951. // Continuing lines, if any
  7952. this.rest = visualLineContinued(line);
  7953. // Number of logical lines in this visual line
  7954. this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
  7955. this.node = this.text = null;
  7956. this.hidden = lineIsHidden(doc, line);
  7957. }
  7958. // Create a range of LineView objects for the given lines.
  7959. function buildViewArray(cm, from, to) {
  7960. var array = [], nextPos;
  7961. for (var pos = from; pos < to; pos = nextPos) {
  7962. var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
  7963. nextPos = pos + view.size;
  7964. array.push(view);
  7965. }
  7966. return array
  7967. }
  7968. var operationGroup = null;
  7969. function pushOperation(op) {
  7970. if (operationGroup) {
  7971. operationGroup.ops.push(op);
  7972. } else {
  7973. op.ownsGroup = operationGroup = {
  7974. ops: [op],
  7975. delayedCallbacks: []
  7976. };
  7977. }
  7978. }
  7979. function fireCallbacksForOps(group) {
  7980. // Calls delayed callbacks and cursorActivity handlers until no
  7981. // new ones appear
  7982. var callbacks = group.delayedCallbacks, i = 0;
  7983. do {
  7984. for (; i < callbacks.length; i++)
  7985. { callbacks[i].call(null); }
  7986. for (var j = 0; j < group.ops.length; j++) {
  7987. var op = group.ops[j];
  7988. if (op.cursorActivityHandlers)
  7989. { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
  7990. { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
  7991. }
  7992. } while (i < callbacks.length)
  7993. }
  7994. function finishOperation(op, endCb) {
  7995. var group = op.ownsGroup;
  7996. if (!group) { return }
  7997. try { fireCallbacksForOps(group); }
  7998. finally {
  7999. operationGroup = null;
  8000. endCb(group);
  8001. }
  8002. }
  8003. var orphanDelayedCallbacks = null;
  8004. // Often, we want to signal events at a point where we are in the
  8005. // middle of some work, but don't want the handler to start calling
  8006. // other methods on the editor, which might be in an inconsistent
  8007. // state or simply not expect any other events to happen.
  8008. // signalLater looks whether there are any handlers, and schedules
  8009. // them to be executed when the last operation ends, or, if no
  8010. // operation is active, when a timeout fires.
  8011. function signalLater(emitter, type /*, values...*/) {
  8012. var arr = getHandlers(emitter, type);
  8013. if (!arr.length) { return }
  8014. var args = Array.prototype.slice.call(arguments, 2), list;
  8015. if (operationGroup) {
  8016. list = operationGroup.delayedCallbacks;
  8017. } else if (orphanDelayedCallbacks) {
  8018. list = orphanDelayedCallbacks;
  8019. } else {
  8020. list = orphanDelayedCallbacks = [];
  8021. setTimeout(fireOrphanDelayed, 0);
  8022. }
  8023. var loop = function ( i ) {
  8024. list.push(function () { return arr[i].apply(null, args); });
  8025. };
  8026. for (var i = 0; i < arr.length; ++i)
  8027. loop( i );
  8028. }
  8029. function fireOrphanDelayed() {
  8030. var delayed = orphanDelayedCallbacks;
  8031. orphanDelayedCallbacks = null;
  8032. for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
  8033. }
  8034. // When an aspect of a line changes, a string is added to
  8035. // lineView.changes. This updates the relevant part of the line's
  8036. // DOM structure.
  8037. function updateLineForChanges(cm, lineView, lineN, dims) {
  8038. for (var j = 0; j < lineView.changes.length; j++) {
  8039. var type = lineView.changes[j];
  8040. if (type == "text") { updateLineText(cm, lineView); }
  8041. else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
  8042. else if (type == "class") { updateLineClasses(cm, lineView); }
  8043. else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
  8044. }
  8045. lineView.changes = null;
  8046. }
  8047. // Lines with gutter elements, widgets or a background class need to
  8048. // be wrapped, and have the extra elements added to the wrapper div
  8049. function ensureLineWrapped(lineView) {
  8050. if (lineView.node == lineView.text) {
  8051. lineView.node = elt("div", null, null, "position: relative");
  8052. if (lineView.text.parentNode)
  8053. { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
  8054. lineView.node.appendChild(lineView.text);
  8055. if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
  8056. }
  8057. return lineView.node
  8058. }
  8059. function updateLineBackground(cm, lineView) {
  8060. var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
  8061. if (cls) { cls += " CodeMirror-linebackground"; }
  8062. if (lineView.background) {
  8063. if (cls) { lineView.background.className = cls; }
  8064. else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
  8065. } else if (cls) {
  8066. var wrap = ensureLineWrapped(lineView);
  8067. lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
  8068. cm.display.input.setUneditable(lineView.background);
  8069. }
  8070. }
  8071. // Wrapper around buildLineContent which will reuse the structure
  8072. // in display.externalMeasured when possible.
  8073. function getLineContent(cm, lineView) {
  8074. var ext = cm.display.externalMeasured;
  8075. if (ext && ext.line == lineView.line) {
  8076. cm.display.externalMeasured = null;
  8077. lineView.measure = ext.measure;
  8078. return ext.built
  8079. }
  8080. return buildLineContent(cm, lineView)
  8081. }
  8082. // Redraw the line's text. Interacts with the background and text
  8083. // classes because the mode may output tokens that influence these
  8084. // classes.
  8085. function updateLineText(cm, lineView) {
  8086. var cls = lineView.text.className;
  8087. var built = getLineContent(cm, lineView);
  8088. if (lineView.text == lineView.node) { lineView.node = built.pre; }
  8089. lineView.text.parentNode.replaceChild(built.pre, lineView.text);
  8090. lineView.text = built.pre;
  8091. if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
  8092. lineView.bgClass = built.bgClass;
  8093. lineView.textClass = built.textClass;
  8094. updateLineClasses(cm, lineView);
  8095. } else if (cls) {
  8096. lineView.text.className = cls;
  8097. }
  8098. }
  8099. function updateLineClasses(cm, lineView) {
  8100. updateLineBackground(cm, lineView);
  8101. if (lineView.line.wrapClass)
  8102. { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
  8103. else if (lineView.node != lineView.text)
  8104. { lineView.node.className = ""; }
  8105. var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
  8106. lineView.text.className = textClass || "";
  8107. }
  8108. function updateLineGutter(cm, lineView, lineN, dims) {
  8109. if (lineView.gutter) {
  8110. lineView.node.removeChild(lineView.gutter);
  8111. lineView.gutter = null;
  8112. }
  8113. if (lineView.gutterBackground) {
  8114. lineView.node.removeChild(lineView.gutterBackground);
  8115. lineView.gutterBackground = null;
  8116. }
  8117. if (lineView.line.gutterClass) {
  8118. var wrap = ensureLineWrapped(lineView);
  8119. lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
  8120. ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
  8121. cm.display.input.setUneditable(lineView.gutterBackground);
  8122. wrap.insertBefore(lineView.gutterBackground, lineView.text);
  8123. }
  8124. var markers = lineView.line.gutterMarkers;
  8125. if (cm.options.lineNumbers || markers) {
  8126. var wrap$1 = ensureLineWrapped(lineView);
  8127. var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
  8128. cm.display.input.setUneditable(gutterWrap);
  8129. wrap$1.insertBefore(gutterWrap, lineView.text);
  8130. if (lineView.line.gutterClass)
  8131. { gutterWrap.className += " " + lineView.line.gutterClass; }
  8132. if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
  8133. { lineView.lineNumber = gutterWrap.appendChild(
  8134. elt("div", lineNumberFor(cm.options, lineN),
  8135. "CodeMirror-linenumber CodeMirror-gutter-elt",
  8136. ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
  8137. if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
  8138. var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
  8139. if (found)
  8140. { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
  8141. ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
  8142. } }
  8143. }
  8144. }
  8145. function updateLineWidgets(cm, lineView, dims) {
  8146. if (lineView.alignable) { lineView.alignable = null; }
  8147. for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
  8148. next = node.nextSibling;
  8149. if (node.className == "CodeMirror-linewidget")
  8150. { lineView.node.removeChild(node); }
  8151. }
  8152. insertLineWidgets(cm, lineView, dims);
  8153. }
  8154. // Build a line's DOM representation from scratch
  8155. function buildLineElement(cm, lineView, lineN, dims) {
  8156. var built = getLineContent(cm, lineView);
  8157. lineView.text = lineView.node = built.pre;
  8158. if (built.bgClass) { lineView.bgClass = built.bgClass; }
  8159. if (built.textClass) { lineView.textClass = built.textClass; }
  8160. updateLineClasses(cm, lineView);
  8161. updateLineGutter(cm, lineView, lineN, dims);
  8162. insertLineWidgets(cm, lineView, dims);
  8163. return lineView.node
  8164. }
  8165. // A lineView may contain multiple logical lines (when merged by
  8166. // collapsed spans). The widgets for all of them need to be drawn.
  8167. function insertLineWidgets(cm, lineView, dims) {
  8168. insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
  8169. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  8170. { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
  8171. }
  8172. function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
  8173. if (!line.widgets) { return }
  8174. var wrap = ensureLineWrapped(lineView);
  8175. for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
  8176. var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
  8177. if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
  8178. positionLineWidget(widget, node, lineView, dims);
  8179. cm.display.input.setUneditable(node);
  8180. if (allowAbove && widget.above)
  8181. { wrap.insertBefore(node, lineView.gutter || lineView.text); }
  8182. else
  8183. { wrap.appendChild(node); }
  8184. signalLater(widget, "redraw");
  8185. }
  8186. }
  8187. function positionLineWidget(widget, node, lineView, dims) {
  8188. if (widget.noHScroll) {
  8189. (lineView.alignable || (lineView.alignable = [])).push(node);
  8190. var width = dims.wrapperWidth;
  8191. node.style.left = dims.fixedPos + "px";
  8192. if (!widget.coverGutter) {
  8193. width -= dims.gutterTotalWidth;
  8194. node.style.paddingLeft = dims.gutterTotalWidth + "px";
  8195. }
  8196. node.style.width = width + "px";
  8197. }
  8198. if (widget.coverGutter) {
  8199. node.style.zIndex = 5;
  8200. node.style.position = "relative";
  8201. if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
  8202. }
  8203. }
  8204. function widgetHeight(widget) {
  8205. if (widget.height != null) { return widget.height }
  8206. var cm = widget.doc.cm;
  8207. if (!cm) { return 0 }
  8208. if (!contains(document.body, widget.node)) {
  8209. var parentStyle = "position: relative;";
  8210. if (widget.coverGutter)
  8211. { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
  8212. if (widget.noHScroll)
  8213. { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
  8214. removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
  8215. }
  8216. return widget.height = widget.node.parentNode.offsetHeight
  8217. }
  8218. // Return true when the given mouse event happened in a widget
  8219. function eventInWidget(display, e) {
  8220. for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
  8221. if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
  8222. (n.parentNode == display.sizer && n != display.mover))
  8223. { return true }
  8224. }
  8225. }
  8226. // POSITION MEASUREMENT
  8227. function paddingTop(display) {return display.lineSpace.offsetTop}
  8228. function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
  8229. function paddingH(display) {
  8230. if (display.cachedPaddingH) { return display.cachedPaddingH }
  8231. var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
  8232. var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
  8233. var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
  8234. if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
  8235. return data
  8236. }
  8237. function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
  8238. function displayWidth(cm) {
  8239. return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
  8240. }
  8241. function displayHeight(cm) {
  8242. return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
  8243. }
  8244. // Ensure the lineView.wrapping.heights array is populated. This is
  8245. // an array of bottom offsets for the lines that make up a drawn
  8246. // line. When lineWrapping is on, there might be more than one
  8247. // height.
  8248. function ensureLineHeights(cm, lineView, rect) {
  8249. var wrapping = cm.options.lineWrapping;
  8250. var curWidth = wrapping && displayWidth(cm);
  8251. if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
  8252. var heights = lineView.measure.heights = [];
  8253. if (wrapping) {
  8254. lineView.measure.width = curWidth;
  8255. var rects = lineView.text.firstChild.getClientRects();
  8256. for (var i = 0; i < rects.length - 1; i++) {
  8257. var cur = rects[i], next = rects[i + 1];
  8258. if (Math.abs(cur.bottom - next.bottom) > 2)
  8259. { heights.push((cur.bottom + next.top) / 2 - rect.top); }
  8260. }
  8261. }
  8262. heights.push(rect.bottom - rect.top);
  8263. }
  8264. }
  8265. // Find a line map (mapping character offsets to text nodes) and a
  8266. // measurement cache for the given line number. (A line view might
  8267. // contain multiple lines when collapsed ranges are present.)
  8268. function mapFromLineView(lineView, line, lineN) {
  8269. if (lineView.line == line)
  8270. { return {map: lineView.measure.map, cache: lineView.measure.cache} }
  8271. for (var i = 0; i < lineView.rest.length; i++)
  8272. { if (lineView.rest[i] == line)
  8273. { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
  8274. for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
  8275. { if (lineNo(lineView.rest[i$1]) > lineN)
  8276. { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
  8277. }
  8278. // Render a line into the hidden node display.externalMeasured. Used
  8279. // when measurement is needed for a line that's not in the viewport.
  8280. function updateExternalMeasurement(cm, line) {
  8281. line = visualLine(line);
  8282. var lineN = lineNo(line);
  8283. var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
  8284. view.lineN = lineN;
  8285. var built = view.built = buildLineContent(cm, view);
  8286. view.text = built.pre;
  8287. removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
  8288. return view
  8289. }
  8290. // Get a {top, bottom, left, right} box (in line-local coordinates)
  8291. // for a given character.
  8292. function measureChar(cm, line, ch, bias) {
  8293. return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
  8294. }
  8295. // Find a line view that corresponds to the given line number.
  8296. function findViewForLine(cm, lineN) {
  8297. if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
  8298. { return cm.display.view[findViewIndex(cm, lineN)] }
  8299. var ext = cm.display.externalMeasured;
  8300. if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
  8301. { return ext }
  8302. }
  8303. // Measurement can be split in two steps, the set-up work that
  8304. // applies to the whole line, and the measurement of the actual
  8305. // character. Functions like coordsChar, that need to do a lot of
  8306. // measurements in a row, can thus ensure that the set-up work is
  8307. // only done once.
  8308. function prepareMeasureForLine(cm, line) {
  8309. var lineN = lineNo(line);
  8310. var view = findViewForLine(cm, lineN);
  8311. if (view && !view.text) {
  8312. view = null;
  8313. } else if (view && view.changes) {
  8314. updateLineForChanges(cm, view, lineN, getDimensions(cm));
  8315. cm.curOp.forceUpdate = true;
  8316. }
  8317. if (!view)
  8318. { view = updateExternalMeasurement(cm, line); }
  8319. var info = mapFromLineView(view, line, lineN);
  8320. return {
  8321. line: line, view: view, rect: null,
  8322. map: info.map, cache: info.cache, before: info.before,
  8323. hasHeights: false
  8324. }
  8325. }
  8326. // Given a prepared measurement object, measures the position of an
  8327. // actual character (or fetches it from the cache).
  8328. function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
  8329. if (prepared.before) { ch = -1; }
  8330. var key = ch + (bias || ""), found;
  8331. if (prepared.cache.hasOwnProperty(key)) {
  8332. found = prepared.cache[key];
  8333. } else {
  8334. if (!prepared.rect)
  8335. { prepared.rect = prepared.view.text.getBoundingClientRect(); }
  8336. if (!prepared.hasHeights) {
  8337. ensureLineHeights(cm, prepared.view, prepared.rect);
  8338. prepared.hasHeights = true;
  8339. }
  8340. found = measureCharInner(cm, prepared, ch, bias);
  8341. if (!found.bogus) { prepared.cache[key] = found; }
  8342. }
  8343. return {left: found.left, right: found.right,
  8344. top: varHeight ? found.rtop : found.top,
  8345. bottom: varHeight ? found.rbottom : found.bottom}
  8346. }
  8347. var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
  8348. function nodeAndOffsetInLineMap(map$$1, ch, bias) {
  8349. var node, start, end, collapse, mStart, mEnd;
  8350. // First, search the line map for the text node corresponding to,
  8351. // or closest to, the target character.
  8352. for (var i = 0; i < map$$1.length; i += 3) {
  8353. mStart = map$$1[i];
  8354. mEnd = map$$1[i + 1];
  8355. if (ch < mStart) {
  8356. start = 0; end = 1;
  8357. collapse = "left";
  8358. } else if (ch < mEnd) {
  8359. start = ch - mStart;
  8360. end = start + 1;
  8361. } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
  8362. end = mEnd - mStart;
  8363. start = end - 1;
  8364. if (ch >= mEnd) { collapse = "right"; }
  8365. }
  8366. if (start != null) {
  8367. node = map$$1[i + 2];
  8368. if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
  8369. { collapse = bias; }
  8370. if (bias == "left" && start == 0)
  8371. { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
  8372. node = map$$1[(i -= 3) + 2];
  8373. collapse = "left";
  8374. } }
  8375. if (bias == "right" && start == mEnd - mStart)
  8376. { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
  8377. node = map$$1[(i += 3) + 2];
  8378. collapse = "right";
  8379. } }
  8380. break
  8381. }
  8382. }
  8383. return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
  8384. }
  8385. function getUsefulRect(rects, bias) {
  8386. var rect = nullRect;
  8387. if (bias == "left") { for (var i = 0; i < rects.length; i++) {
  8388. if ((rect = rects[i]).left != rect.right) { break }
  8389. } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
  8390. if ((rect = rects[i$1]).left != rect.right) { break }
  8391. } }
  8392. return rect
  8393. }
  8394. function measureCharInner(cm, prepared, ch, bias) {
  8395. var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
  8396. var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
  8397. var rect;
  8398. if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
  8399. for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
  8400. while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
  8401. while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
  8402. if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
  8403. { rect = node.parentNode.getBoundingClientRect(); }
  8404. else
  8405. { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
  8406. if (rect.left || rect.right || start == 0) { break }
  8407. end = start;
  8408. start = start - 1;
  8409. collapse = "right";
  8410. }
  8411. if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
  8412. } else { // If it is a widget, simply get the box for the whole widget.
  8413. if (start > 0) { collapse = bias = "right"; }
  8414. var rects;
  8415. if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
  8416. { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
  8417. else
  8418. { rect = node.getBoundingClientRect(); }
  8419. }
  8420. if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
  8421. var rSpan = node.parentNode.getClientRects()[0];
  8422. if (rSpan)
  8423. { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
  8424. else
  8425. { rect = nullRect; }
  8426. }
  8427. var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
  8428. var mid = (rtop + rbot) / 2;
  8429. var heights = prepared.view.measure.heights;
  8430. var i = 0;
  8431. for (; i < heights.length - 1; i++)
  8432. { if (mid < heights[i]) { break } }
  8433. var top = i ? heights[i - 1] : 0, bot = heights[i];
  8434. var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
  8435. right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
  8436. top: top, bottom: bot};
  8437. if (!rect.left && !rect.right) { result.bogus = true; }
  8438. if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
  8439. return result
  8440. }
  8441. // Work around problem with bounding client rects on ranges being
  8442. // returned incorrectly when zoomed on IE10 and below.
  8443. function maybeUpdateRectForZooming(measure, rect) {
  8444. if (!window.screen || screen.logicalXDPI == null ||
  8445. screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
  8446. { return rect }
  8447. var scaleX = screen.logicalXDPI / screen.deviceXDPI;
  8448. var scaleY = screen.logicalYDPI / screen.deviceYDPI;
  8449. return {left: rect.left * scaleX, right: rect.right * scaleX,
  8450. top: rect.top * scaleY, bottom: rect.bottom * scaleY}
  8451. }
  8452. function clearLineMeasurementCacheFor(lineView) {
  8453. if (lineView.measure) {
  8454. lineView.measure.cache = {};
  8455. lineView.measure.heights = null;
  8456. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  8457. { lineView.measure.caches[i] = {}; } }
  8458. }
  8459. }
  8460. function clearLineMeasurementCache(cm) {
  8461. cm.display.externalMeasure = null;
  8462. removeChildren(cm.display.lineMeasure);
  8463. for (var i = 0; i < cm.display.view.length; i++)
  8464. { clearLineMeasurementCacheFor(cm.display.view[i]); }
  8465. }
  8466. function clearCaches(cm) {
  8467. clearLineMeasurementCache(cm);
  8468. cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
  8469. if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
  8470. cm.display.lineNumChars = null;
  8471. }
  8472. function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft }
  8473. function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop }
  8474. // Converts a {top, bottom, left, right} box from line-local
  8475. // coordinates into another coordinate system. Context may be one of
  8476. // "line", "div" (display.lineDiv), "local"./null (editor), "window",
  8477. // or "page".
  8478. function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
  8479. if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
  8480. var size = widgetHeight(lineObj.widgets[i]);
  8481. rect.top += size; rect.bottom += size;
  8482. } } }
  8483. if (context == "line") { return rect }
  8484. if (!context) { context = "local"; }
  8485. var yOff = heightAtLine(lineObj);
  8486. if (context == "local") { yOff += paddingTop(cm.display); }
  8487. else { yOff -= cm.display.viewOffset; }
  8488. if (context == "page" || context == "window") {
  8489. var lOff = cm.display.lineSpace.getBoundingClientRect();
  8490. yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
  8491. var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
  8492. rect.left += xOff; rect.right += xOff;
  8493. }
  8494. rect.top += yOff; rect.bottom += yOff;
  8495. return rect
  8496. }
  8497. // Coverts a box from "div" coords to another coordinate system.
  8498. // Context may be "window", "page", "div", or "local"./null.
  8499. function fromCoordSystem(cm, coords, context) {
  8500. if (context == "div") { return coords }
  8501. var left = coords.left, top = coords.top;
  8502. // First move into "page" coordinate system
  8503. if (context == "page") {
  8504. left -= pageScrollX();
  8505. top -= pageScrollY();
  8506. } else if (context == "local" || !context) {
  8507. var localBox = cm.display.sizer.getBoundingClientRect();
  8508. left += localBox.left;
  8509. top += localBox.top;
  8510. }
  8511. var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
  8512. return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
  8513. }
  8514. function charCoords(cm, pos, context, lineObj, bias) {
  8515. if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
  8516. return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
  8517. }
  8518. // Returns a box for a given cursor position, which may have an
  8519. // 'other' property containing the position of the secondary cursor
  8520. // on a bidi boundary.
  8521. // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
  8522. // and after `char - 1` in writing order of `char - 1`
  8523. // A cursor Pos(line, char, "after") is on the same visual line as `char`
  8524. // and before `char` in writing order of `char`
  8525. // Examples (upper-case letters are RTL, lower-case are LTR):
  8526. // Pos(0, 1, ...)
  8527. // before after
  8528. // ab a|b a|b
  8529. // aB a|B aB|
  8530. // Ab |Ab A|b
  8531. // AB B|A B|A
  8532. // Every position after the last character on a line is considered to stick
  8533. // to the last character on the line.
  8534. function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
  8535. lineObj = lineObj || getLine(cm.doc, pos.line);
  8536. if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
  8537. function get(ch, right) {
  8538. var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
  8539. if (right) { m.left = m.right; } else { m.right = m.left; }
  8540. return intoCoordSystem(cm, lineObj, m, context)
  8541. }
  8542. var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
  8543. if (ch >= lineObj.text.length) {
  8544. ch = lineObj.text.length;
  8545. sticky = "before";
  8546. } else if (ch <= 0) {
  8547. ch = 0;
  8548. sticky = "after";
  8549. }
  8550. if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
  8551. function getBidi(ch, partPos, invert) {
  8552. var part = order[partPos], right = (part.level % 2) != 0;
  8553. return get(invert ? ch - 1 : ch, right != invert)
  8554. }
  8555. var partPos = getBidiPartAt(order, ch, sticky);
  8556. var other = bidiOther;
  8557. var val = getBidi(ch, partPos, sticky == "before");
  8558. if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
  8559. return val
  8560. }
  8561. // Used to cheaply estimate the coordinates for a position. Used for
  8562. // intermediate scroll updates.
  8563. function estimateCoords(cm, pos) {
  8564. var left = 0;
  8565. pos = clipPos(cm.doc, pos);
  8566. if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
  8567. var lineObj = getLine(cm.doc, pos.line);
  8568. var top = heightAtLine(lineObj) + paddingTop(cm.display);
  8569. return {left: left, right: left, top: top, bottom: top + lineObj.height}
  8570. }
  8571. // Positions returned by coordsChar contain some extra information.
  8572. // xRel is the relative x position of the input coordinates compared
  8573. // to the found position (so xRel > 0 means the coordinates are to
  8574. // the right of the character position, for example). When outside
  8575. // is true, that means the coordinates lie outside the line's
  8576. // vertical range.
  8577. function PosWithInfo(line, ch, sticky, outside, xRel) {
  8578. var pos = Pos(line, ch, sticky);
  8579. pos.xRel = xRel;
  8580. if (outside) { pos.outside = true; }
  8581. return pos
  8582. }
  8583. // Compute the character position closest to the given coordinates.
  8584. // Input must be lineSpace-local ("div" coordinate system).
  8585. function coordsChar(cm, x, y) {
  8586. var doc = cm.doc;
  8587. y += cm.display.viewOffset;
  8588. if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
  8589. var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
  8590. if (lineN > last)
  8591. { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
  8592. if (x < 0) { x = 0; }
  8593. var lineObj = getLine(doc, lineN);
  8594. for (;;) {
  8595. var found = coordsCharInner(cm, lineObj, lineN, x, y);
  8596. var merged = collapsedSpanAtEnd(lineObj);
  8597. var mergedPos = merged && merged.find(0, true);
  8598. if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
  8599. { lineN = lineNo(lineObj = mergedPos.to.line); }
  8600. else
  8601. { return found }
  8602. }
  8603. }
  8604. function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
  8605. var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); };
  8606. var end = lineObj.text.length;
  8607. var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0);
  8608. end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end);
  8609. return {begin: begin, end: end}
  8610. }
  8611. function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
  8612. var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
  8613. return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
  8614. }
  8615. function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
  8616. y -= heightAtLine(lineObj);
  8617. var begin = 0, end = lineObj.text.length;
  8618. var preparedMeasure = prepareMeasureForLine(cm, lineObj);
  8619. var pos;
  8620. var order = getOrder(lineObj, cm.doc.direction);
  8621. if (order) {
  8622. if (cm.options.lineWrapping) {
  8623. var assign;
  8624. ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign));
  8625. }
  8626. pos = new Pos(lineNo$$1, begin);
  8627. var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left;
  8628. var dir = beginLeft < x ? 1 : -1;
  8629. var prevDiff, diff = beginLeft - x, prevPos;
  8630. do {
  8631. prevDiff = diff;
  8632. prevPos = pos;
  8633. pos = moveVisually(cm, lineObj, pos, dir);
  8634. if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
  8635. pos = prevPos;
  8636. break
  8637. }
  8638. diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x;
  8639. } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
  8640. if (Math.abs(diff) > Math.abs(prevDiff)) {
  8641. if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
  8642. pos = prevPos;
  8643. }
  8644. } else {
  8645. var ch = findFirst(function (ch) {
  8646. var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line");
  8647. if (box.top > y) {
  8648. // For the cursor stickiness
  8649. end = Math.min(ch, end);
  8650. return true
  8651. }
  8652. else if (box.bottom <= y) { return false }
  8653. else if (box.left > x) { return true }
  8654. else if (box.right < x) { return false }
  8655. else { return (x - box.left < box.right - x) }
  8656. }, begin, end);
  8657. ch = skipExtendingChars(lineObj.text, ch, 1);
  8658. pos = new Pos(lineNo$$1, ch, ch == end ? "before" : "after");
  8659. }
  8660. var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure);
  8661. if (y < coords.top || coords.bottom < y) { pos.outside = true; }
  8662. pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0);
  8663. return pos
  8664. }
  8665. var measureText;
  8666. // Compute the default text height.
  8667. function textHeight(display) {
  8668. if (display.cachedTextHeight != null) { return display.cachedTextHeight }
  8669. if (measureText == null) {
  8670. measureText = elt("pre");
  8671. // Measure a bunch of lines, for browsers that compute
  8672. // fractional heights.
  8673. for (var i = 0; i < 49; ++i) {
  8674. measureText.appendChild(document.createTextNode("x"));
  8675. measureText.appendChild(elt("br"));
  8676. }
  8677. measureText.appendChild(document.createTextNode("x"));
  8678. }
  8679. removeChildrenAndAdd(display.measure, measureText);
  8680. var height = measureText.offsetHeight / 50;
  8681. if (height > 3) { display.cachedTextHeight = height; }
  8682. removeChildren(display.measure);
  8683. return height || 1
  8684. }
  8685. // Compute the default character width.
  8686. function charWidth(display) {
  8687. if (display.cachedCharWidth != null) { return display.cachedCharWidth }
  8688. var anchor = elt("span", "xxxxxxxxxx");
  8689. var pre = elt("pre", [anchor]);
  8690. removeChildrenAndAdd(display.measure, pre);
  8691. var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
  8692. if (width > 2) { display.cachedCharWidth = width; }
  8693. return width || 10
  8694. }
  8695. // Do a bulk-read of the DOM positions and sizes needed to draw the
  8696. // view, so that we don't interleave reading and writing to the DOM.
  8697. function getDimensions(cm) {
  8698. var d = cm.display, left = {}, width = {};
  8699. var gutterLeft = d.gutters.clientLeft;
  8700. for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
  8701. left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
  8702. width[cm.options.gutters[i]] = n.clientWidth;
  8703. }
  8704. return {fixedPos: compensateForHScroll(d),
  8705. gutterTotalWidth: d.gutters.offsetWidth,
  8706. gutterLeft: left,
  8707. gutterWidth: width,
  8708. wrapperWidth: d.wrapper.clientWidth}
  8709. }
  8710. // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
  8711. // but using getBoundingClientRect to get a sub-pixel-accurate
  8712. // result.
  8713. function compensateForHScroll(display) {
  8714. return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
  8715. }
  8716. // Returns a function that estimates the height of a line, to use as
  8717. // first approximation until the line becomes visible (and is thus
  8718. // properly measurable).
  8719. function estimateHeight(cm) {
  8720. var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
  8721. var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
  8722. return function (line) {
  8723. if (lineIsHidden(cm.doc, line)) { return 0 }
  8724. var widgetsHeight = 0;
  8725. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
  8726. if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
  8727. } }
  8728. if (wrapping)
  8729. { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
  8730. else
  8731. { return widgetsHeight + th }
  8732. }
  8733. }
  8734. function estimateLineHeights(cm) {
  8735. var doc = cm.doc, est = estimateHeight(cm);
  8736. doc.iter(function (line) {
  8737. var estHeight = est(line);
  8738. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  8739. });
  8740. }
  8741. // Given a mouse event, find the corresponding position. If liberal
  8742. // is false, it checks whether a gutter or scrollbar was clicked,
  8743. // and returns null if it was. forRect is used by rectangular
  8744. // selections, and tries to estimate a character position even for
  8745. // coordinates beyond the right of the text.
  8746. function posFromMouse(cm, e, liberal, forRect) {
  8747. var display = cm.display;
  8748. if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
  8749. var x, y, space = display.lineSpace.getBoundingClientRect();
  8750. // Fails unpredictably on IE[67] when mouse is dragged around quickly.
  8751. try { x = e.clientX - space.left; y = e.clientY - space.top; }
  8752. catch (e) { return null }
  8753. var coords = coordsChar(cm, x, y), line;
  8754. if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
  8755. var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
  8756. coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
  8757. }
  8758. return coords
  8759. }
  8760. // Find the view element corresponding to a given line. Return null
  8761. // when the line isn't visible.
  8762. function findViewIndex(cm, n) {
  8763. if (n >= cm.display.viewTo) { return null }
  8764. n -= cm.display.viewFrom;
  8765. if (n < 0) { return null }
  8766. var view = cm.display.view;
  8767. for (var i = 0; i < view.length; i++) {
  8768. n -= view[i].size;
  8769. if (n < 0) { return i }
  8770. }
  8771. }
  8772. function updateSelection(cm) {
  8773. cm.display.input.showSelection(cm.display.input.prepareSelection());
  8774. }
  8775. function prepareSelection(cm, primary) {
  8776. var doc = cm.doc, result = {};
  8777. var curFragment = result.cursors = document.createDocumentFragment();
  8778. var selFragment = result.selection = document.createDocumentFragment();
  8779. for (var i = 0; i < doc.sel.ranges.length; i++) {
  8780. if (primary === false && i == doc.sel.primIndex) { continue }
  8781. var range$$1 = doc.sel.ranges[i];
  8782. if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
  8783. var collapsed = range$$1.empty();
  8784. if (collapsed || cm.options.showCursorWhenSelecting)
  8785. { drawSelectionCursor(cm, range$$1.head, curFragment); }
  8786. if (!collapsed)
  8787. { drawSelectionRange(cm, range$$1, selFragment); }
  8788. }
  8789. return result
  8790. }
  8791. // Draws a cursor for the given range
  8792. function drawSelectionCursor(cm, head, output) {
  8793. var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
  8794. var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
  8795. cursor.style.left = pos.left + "px";
  8796. cursor.style.top = pos.top + "px";
  8797. cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
  8798. if (pos.other) {
  8799. // Secondary cursor, shown when on a 'jump' in bi-directional text
  8800. var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
  8801. otherCursor.style.display = "";
  8802. otherCursor.style.left = pos.other.left + "px";
  8803. otherCursor.style.top = pos.other.top + "px";
  8804. otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
  8805. }
  8806. }
  8807. // Draws the given range as a highlighted selection
  8808. function drawSelectionRange(cm, range$$1, output) {
  8809. var display = cm.display, doc = cm.doc;
  8810. var fragment = document.createDocumentFragment();
  8811. var padding = paddingH(cm.display), leftSide = padding.left;
  8812. var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
  8813. function add(left, top, width, bottom) {
  8814. if (top < 0) { top = 0; }
  8815. top = Math.round(top);
  8816. bottom = Math.round(bottom);
  8817. 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")));
  8818. }
  8819. function drawForLine(line, fromArg, toArg) {
  8820. var lineObj = getLine(doc, line);
  8821. var lineLen = lineObj.text.length;
  8822. var start, end;
  8823. function coords(ch, bias) {
  8824. return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
  8825. }
  8826. iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
  8827. var leftPos = coords(from, "left"), rightPos, left, right;
  8828. if (from == to) {
  8829. rightPos = leftPos;
  8830. left = right = leftPos.left;
  8831. } else {
  8832. rightPos = coords(to - 1, "right");
  8833. if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
  8834. left = leftPos.left;
  8835. right = rightPos.right;
  8836. }
  8837. if (fromArg == null && from == 0) { left = leftSide; }
  8838. if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
  8839. add(left, leftPos.top, null, leftPos.bottom);
  8840. left = leftSide;
  8841. if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top); }
  8842. }
  8843. if (toArg == null && to == lineLen) { right = rightSide; }
  8844. if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
  8845. { start = leftPos; }
  8846. if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
  8847. { end = rightPos; }
  8848. if (left < leftSide + 1) { left = leftSide; }
  8849. add(left, rightPos.top, right - left, rightPos.bottom);
  8850. });
  8851. return {start: start, end: end}
  8852. }
  8853. var sFrom = range$$1.from(), sTo = range$$1.to();
  8854. if (sFrom.line == sTo.line) {
  8855. drawForLine(sFrom.line, sFrom.ch, sTo.ch);
  8856. } else {
  8857. var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
  8858. var singleVLine = visualLine(fromLine) == visualLine(toLine);
  8859. var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
  8860. var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
  8861. if (singleVLine) {
  8862. if (leftEnd.top < rightStart.top - 2) {
  8863. add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
  8864. add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
  8865. } else {
  8866. add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
  8867. }
  8868. }
  8869. if (leftEnd.bottom < rightStart.top)
  8870. { add(leftSide, leftEnd.bottom, null, rightStart.top); }
  8871. }
  8872. output.appendChild(fragment);
  8873. }
  8874. // Cursor-blinking
  8875. function restartBlink(cm) {
  8876. if (!cm.state.focused) { return }
  8877. var display = cm.display;
  8878. clearInterval(display.blinker);
  8879. var on = true;
  8880. display.cursorDiv.style.visibility = "";
  8881. if (cm.options.cursorBlinkRate > 0)
  8882. { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
  8883. cm.options.cursorBlinkRate); }
  8884. else if (cm.options.cursorBlinkRate < 0)
  8885. { display.cursorDiv.style.visibility = "hidden"; }
  8886. }
  8887. function ensureFocus(cm) {
  8888. if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
  8889. }
  8890. function delayBlurEvent(cm) {
  8891. cm.state.delayingBlurEvent = true;
  8892. setTimeout(function () { if (cm.state.delayingBlurEvent) {
  8893. cm.state.delayingBlurEvent = false;
  8894. onBlur(cm);
  8895. } }, 100);
  8896. }
  8897. function onFocus(cm, e) {
  8898. if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
  8899. if (cm.options.readOnly == "nocursor") { return }
  8900. if (!cm.state.focused) {
  8901. signal(cm, "focus", cm, e);
  8902. cm.state.focused = true;
  8903. addClass(cm.display.wrapper, "CodeMirror-focused");
  8904. // This test prevents this from firing when a context
  8905. // menu is closed (since the input reset would kill the
  8906. // select-all detection hack)
  8907. if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
  8908. cm.display.input.reset();
  8909. if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
  8910. }
  8911. cm.display.input.receivedFocus();
  8912. }
  8913. restartBlink(cm);
  8914. }
  8915. function onBlur(cm, e) {
  8916. if (cm.state.delayingBlurEvent) { return }
  8917. if (cm.state.focused) {
  8918. signal(cm, "blur", cm, e);
  8919. cm.state.focused = false;
  8920. rmClass(cm.display.wrapper, "CodeMirror-focused");
  8921. }
  8922. clearInterval(cm.display.blinker);
  8923. setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
  8924. }
  8925. // Re-align line numbers and gutter marks to compensate for
  8926. // horizontal scrolling.
  8927. function alignHorizontally(cm) {
  8928. var display = cm.display, view = display.view;
  8929. if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
  8930. var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
  8931. var gutterW = display.gutters.offsetWidth, left = comp + "px";
  8932. for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
  8933. if (cm.options.fixedGutter) {
  8934. if (view[i].gutter)
  8935. { view[i].gutter.style.left = left; }
  8936. if (view[i].gutterBackground)
  8937. { view[i].gutterBackground.style.left = left; }
  8938. }
  8939. var align = view[i].alignable;
  8940. if (align) { for (var j = 0; j < align.length; j++)
  8941. { align[j].style.left = left; } }
  8942. } }
  8943. if (cm.options.fixedGutter)
  8944. { display.gutters.style.left = (comp + gutterW) + "px"; }
  8945. }
  8946. // Used to ensure that the line number gutter is still the right
  8947. // size for the current document size. Returns true when an update
  8948. // is needed.
  8949. function maybeUpdateLineNumberWidth(cm) {
  8950. if (!cm.options.lineNumbers) { return false }
  8951. var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
  8952. if (last.length != display.lineNumChars) {
  8953. var test = display.measure.appendChild(elt("div", [elt("div", last)],
  8954. "CodeMirror-linenumber CodeMirror-gutter-elt"));
  8955. var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
  8956. display.lineGutter.style.width = "";
  8957. display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
  8958. display.lineNumWidth = display.lineNumInnerWidth + padding;
  8959. display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
  8960. display.lineGutter.style.width = display.lineNumWidth + "px";
  8961. updateGutterSpace(cm);
  8962. return true
  8963. }
  8964. return false
  8965. }
  8966. // Read the actual heights of the rendered lines, and update their
  8967. // stored heights to match.
  8968. function updateHeightsInViewport(cm) {
  8969. var display = cm.display;
  8970. var prevBottom = display.lineDiv.offsetTop;
  8971. for (var i = 0; i < display.view.length; i++) {
  8972. var cur = display.view[i], height = (void 0);
  8973. if (cur.hidden) { continue }
  8974. if (ie && ie_version < 8) {
  8975. var bot = cur.node.offsetTop + cur.node.offsetHeight;
  8976. height = bot - prevBottom;
  8977. prevBottom = bot;
  8978. } else {
  8979. var box = cur.node.getBoundingClientRect();
  8980. height = box.bottom - box.top;
  8981. }
  8982. var diff = cur.line.height - height;
  8983. if (height < 2) { height = textHeight(display); }
  8984. if (diff > .001 || diff < -.001) {
  8985. updateLineHeight(cur.line, height);
  8986. updateWidgetHeight(cur.line);
  8987. if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
  8988. { updateWidgetHeight(cur.rest[j]); } }
  8989. }
  8990. }
  8991. }
  8992. // Read and store the height of line widgets associated with the
  8993. // given line.
  8994. function updateWidgetHeight(line) {
  8995. if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
  8996. { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }
  8997. }
  8998. // Compute the lines that are visible in a given viewport (defaults
  8999. // the the current scroll position). viewport may contain top,
  9000. // height, and ensure (see op.scrollToPos) properties.
  9001. function visibleLines(display, doc, viewport) {
  9002. var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
  9003. top = Math.floor(top - paddingTop(display));
  9004. var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
  9005. var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
  9006. // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
  9007. // forces those lines into the viewport (if possible).
  9008. if (viewport && viewport.ensure) {
  9009. var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
  9010. if (ensureFrom < from) {
  9011. from = ensureFrom;
  9012. to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
  9013. } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
  9014. from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
  9015. to = ensureTo;
  9016. }
  9017. }
  9018. return {from: from, to: Math.max(to, from + 1)}
  9019. }
  9020. // Sync the scrollable area and scrollbars, ensure the viewport
  9021. // covers the visible area.
  9022. function setScrollTop(cm, val) {
  9023. if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
  9024. cm.doc.scrollTop = val;
  9025. if (!gecko) { updateDisplaySimple(cm, {top: val}); }
  9026. if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
  9027. cm.display.scrollbars.setScrollTop(val);
  9028. if (gecko) { updateDisplaySimple(cm); }
  9029. startWorker(cm, 100);
  9030. }
  9031. // Sync scroller and scrollbar, ensure the gutter elements are
  9032. // aligned.
  9033. function setScrollLeft(cm, val, isScroller) {
  9034. if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return }
  9035. val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
  9036. cm.doc.scrollLeft = val;
  9037. alignHorizontally(cm);
  9038. if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
  9039. cm.display.scrollbars.setScrollLeft(val);
  9040. }
  9041. // Since the delta values reported on mouse wheel events are
  9042. // unstandardized between browsers and even browser versions, and
  9043. // generally horribly unpredictable, this code starts by measuring
  9044. // the scroll effect that the first few mouse wheel events have,
  9045. // and, from that, detects the way it can convert deltas to pixel
  9046. // offsets afterwards.
  9047. //
  9048. // The reason we want to know the amount a wheel event will scroll
  9049. // is that it gives us a chance to update the display before the
  9050. // actual scrolling happens, reducing flickering.
  9051. var wheelSamples = 0;
  9052. var wheelPixelsPerUnit = null;
  9053. // Fill in a browser-detected starting value on browsers where we
  9054. // know one. These don't have to be accurate -- the result of them
  9055. // being wrong would just be a slight flicker on the first wheel
  9056. // scroll (if it is large enough).
  9057. if (ie) { wheelPixelsPerUnit = -.53; }
  9058. else if (gecko) { wheelPixelsPerUnit = 15; }
  9059. else if (chrome) { wheelPixelsPerUnit = -.7; }
  9060. else if (safari) { wheelPixelsPerUnit = -1/3; }
  9061. function wheelEventDelta(e) {
  9062. var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
  9063. if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
  9064. if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
  9065. else if (dy == null) { dy = e.wheelDelta; }
  9066. return {x: dx, y: dy}
  9067. }
  9068. function wheelEventPixels(e) {
  9069. var delta = wheelEventDelta(e);
  9070. delta.x *= wheelPixelsPerUnit;
  9071. delta.y *= wheelPixelsPerUnit;
  9072. return delta
  9073. }
  9074. function onScrollWheel(cm, e) {
  9075. var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
  9076. var display = cm.display, scroll = display.scroller;
  9077. // Quit if there's nothing to scroll here
  9078. var canScrollX = scroll.scrollWidth > scroll.clientWidth;
  9079. var canScrollY = scroll.scrollHeight > scroll.clientHeight;
  9080. if (!(dx && canScrollX || dy && canScrollY)) { return }
  9081. // Webkit browsers on OS X abort momentum scrolls when the target
  9082. // of the scroll event is removed from the scrollable element.
  9083. // This hack (see related code in patchDisplay) makes sure the
  9084. // element is kept around.
  9085. if (dy && mac && webkit) {
  9086. outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
  9087. for (var i = 0; i < view.length; i++) {
  9088. if (view[i].node == cur) {
  9089. cm.display.currentWheelTarget = cur;
  9090. break outer
  9091. }
  9092. }
  9093. }
  9094. }
  9095. // On some browsers, horizontal scrolling will cause redraws to
  9096. // happen before the gutter has been realigned, causing it to
  9097. // wriggle around in a most unseemly way. When we have an
  9098. // estimated pixels/delta value, we just handle horizontal
  9099. // scrolling entirely here. It'll be slightly off from native, but
  9100. // better than glitching out.
  9101. if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
  9102. if (dy && canScrollY)
  9103. { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); }
  9104. setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
  9105. // Only prevent default scrolling if vertical scrolling is
  9106. // actually possible. Otherwise, it causes vertical scroll
  9107. // jitter on OSX trackpads when deltaX is small and deltaY
  9108. // is large (issue #3579)
  9109. if (!dy || (dy && canScrollY))
  9110. { e_preventDefault(e); }
  9111. display.wheelStartX = null; // Abort measurement, if in progress
  9112. return
  9113. }
  9114. // 'Project' the visible viewport to cover the area that is being
  9115. // scrolled into view (if we know enough to estimate it).
  9116. if (dy && wheelPixelsPerUnit != null) {
  9117. var pixels = dy * wheelPixelsPerUnit;
  9118. var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
  9119. if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
  9120. else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
  9121. updateDisplaySimple(cm, {top: top, bottom: bot});
  9122. }
  9123. if (wheelSamples < 20) {
  9124. if (display.wheelStartX == null) {
  9125. display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
  9126. display.wheelDX = dx; display.wheelDY = dy;
  9127. setTimeout(function () {
  9128. if (display.wheelStartX == null) { return }
  9129. var movedX = scroll.scrollLeft - display.wheelStartX;
  9130. var movedY = scroll.scrollTop - display.wheelStartY;
  9131. var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
  9132. (movedX && display.wheelDX && movedX / display.wheelDX);
  9133. display.wheelStartX = display.wheelStartY = null;
  9134. if (!sample) { return }
  9135. wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
  9136. ++wheelSamples;
  9137. }, 200);
  9138. } else {
  9139. display.wheelDX += dx; display.wheelDY += dy;
  9140. }
  9141. }
  9142. }
  9143. // SCROLLBARS
  9144. // Prepare DOM reads needed to update the scrollbars. Done in one
  9145. // shot to minimize update/measure roundtrips.
  9146. function measureForScrollbars(cm) {
  9147. var d = cm.display, gutterW = d.gutters.offsetWidth;
  9148. var docH = Math.round(cm.doc.height + paddingVert(cm.display));
  9149. return {
  9150. clientHeight: d.scroller.clientHeight,
  9151. viewHeight: d.wrapper.clientHeight,
  9152. scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
  9153. viewWidth: d.wrapper.clientWidth,
  9154. barLeft: cm.options.fixedGutter ? gutterW : 0,
  9155. docHeight: docH,
  9156. scrollHeight: docH + scrollGap(cm) + d.barHeight,
  9157. nativeBarWidth: d.nativeBarWidth,
  9158. gutterWidth: gutterW
  9159. }
  9160. }
  9161. var NativeScrollbars = function(place, scroll, cm) {
  9162. this.cm = cm;
  9163. var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
  9164. var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
  9165. place(vert); place(horiz);
  9166. on(vert, "scroll", function () {
  9167. if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
  9168. });
  9169. on(horiz, "scroll", function () {
  9170. if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
  9171. });
  9172. this.checkedZeroWidth = false;
  9173. // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
  9174. if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
  9175. };
  9176. NativeScrollbars.prototype.update = function (measure) {
  9177. var needsH = measure.scrollWidth > measure.clientWidth + 1;
  9178. var needsV = measure.scrollHeight > measure.clientHeight + 1;
  9179. var sWidth = measure.nativeBarWidth;
  9180. if (needsV) {
  9181. this.vert.style.display = "block";
  9182. this.vert.style.bottom = needsH ? sWidth + "px" : "0";
  9183. var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
  9184. // A bug in IE8 can cause this value to be negative, so guard it.
  9185. this.vert.firstChild.style.height =
  9186. Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
  9187. } else {
  9188. this.vert.style.display = "";
  9189. this.vert.firstChild.style.height = "0";
  9190. }
  9191. if (needsH) {
  9192. this.horiz.style.display = "block";
  9193. this.horiz.style.right = needsV ? sWidth + "px" : "0";
  9194. this.horiz.style.left = measure.barLeft + "px";
  9195. var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
  9196. this.horiz.firstChild.style.width =
  9197. Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
  9198. } else {
  9199. this.horiz.style.display = "";
  9200. this.horiz.firstChild.style.width = "0";
  9201. }
  9202. if (!this.checkedZeroWidth && measure.clientHeight > 0) {
  9203. if (sWidth == 0) { this.zeroWidthHack(); }
  9204. this.checkedZeroWidth = true;
  9205. }
  9206. return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
  9207. };
  9208. NativeScrollbars.prototype.setScrollLeft = function (pos) {
  9209. if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
  9210. if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz); }
  9211. };
  9212. NativeScrollbars.prototype.setScrollTop = function (pos) {
  9213. if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
  9214. if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert); }
  9215. };
  9216. NativeScrollbars.prototype.zeroWidthHack = function () {
  9217. var w = mac && !mac_geMountainLion ? "12px" : "18px";
  9218. this.horiz.style.height = this.vert.style.width = w;
  9219. this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
  9220. this.disableHoriz = new Delayed;
  9221. this.disableVert = new Delayed;
  9222. };
  9223. NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay) {
  9224. bar.style.pointerEvents = "auto";
  9225. function maybeDisable() {
  9226. // To find out whether the scrollbar is still visible, we
  9227. // check whether the element under the pixel in the bottom
  9228. // left corner of the scrollbar box is the scrollbar box
  9229. // itself (when the bar is still visible) or its filler child
  9230. // (when the bar is hidden). If it is still visible, we keep
  9231. // it enabled, if it's hidden, we disable pointer events.
  9232. var box = bar.getBoundingClientRect();
  9233. var elt$$1 = document.elementFromPoint(box.left + 1, box.bottom - 1);
  9234. if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
  9235. else { delay.set(1000, maybeDisable); }
  9236. }
  9237. delay.set(1000, maybeDisable);
  9238. };
  9239. NativeScrollbars.prototype.clear = function () {
  9240. var parent = this.horiz.parentNode;
  9241. parent.removeChild(this.horiz);
  9242. parent.removeChild(this.vert);
  9243. };
  9244. var NullScrollbars = function () {};
  9245. NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
  9246. NullScrollbars.prototype.setScrollLeft = function () {};
  9247. NullScrollbars.prototype.setScrollTop = function () {};
  9248. NullScrollbars.prototype.clear = function () {};
  9249. function updateScrollbars(cm, measure) {
  9250. if (!measure) { measure = measureForScrollbars(cm); }
  9251. var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
  9252. updateScrollbarsInner(cm, measure);
  9253. for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
  9254. if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
  9255. { updateHeightsInViewport(cm); }
  9256. updateScrollbarsInner(cm, measureForScrollbars(cm));
  9257. startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
  9258. }
  9259. }
  9260. // Re-synchronize the fake scrollbars with the actual size of the
  9261. // content.
  9262. function updateScrollbarsInner(cm, measure) {
  9263. var d = cm.display;
  9264. var sizes = d.scrollbars.update(measure);
  9265. d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
  9266. d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
  9267. d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
  9268. if (sizes.right && sizes.bottom) {
  9269. d.scrollbarFiller.style.display = "block";
  9270. d.scrollbarFiller.style.height = sizes.bottom + "px";
  9271. d.scrollbarFiller.style.width = sizes.right + "px";
  9272. } else { d.scrollbarFiller.style.display = ""; }
  9273. if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
  9274. d.gutterFiller.style.display = "block";
  9275. d.gutterFiller.style.height = sizes.bottom + "px";
  9276. d.gutterFiller.style.width = measure.gutterWidth + "px";
  9277. } else { d.gutterFiller.style.display = ""; }
  9278. }
  9279. var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
  9280. function initScrollbars(cm) {
  9281. if (cm.display.scrollbars) {
  9282. cm.display.scrollbars.clear();
  9283. if (cm.display.scrollbars.addClass)
  9284. { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  9285. }
  9286. cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
  9287. cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
  9288. // Prevent clicks in the scrollbars from killing focus
  9289. on(node, "mousedown", function () {
  9290. if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
  9291. });
  9292. node.setAttribute("cm-not-content", "true");
  9293. }, function (pos, axis) {
  9294. if (axis == "horizontal") { setScrollLeft(cm, pos); }
  9295. else { setScrollTop(cm, pos); }
  9296. }, cm);
  9297. if (cm.display.scrollbars.addClass)
  9298. { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  9299. }
  9300. // SCROLLING THINGS INTO VIEW
  9301. // If an editor sits on the top or bottom of the window, partially
  9302. // scrolled out of view, this ensures that the cursor is visible.
  9303. function maybeScrollWindow(cm, rect) {
  9304. if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
  9305. var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
  9306. if (rect.top + box.top < 0) { doScroll = true; }
  9307. else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
  9308. if (doScroll != null && !phantom) {
  9309. 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;"));
  9310. cm.display.lineSpace.appendChild(scrollNode);
  9311. scrollNode.scrollIntoView(doScroll);
  9312. cm.display.lineSpace.removeChild(scrollNode);
  9313. }
  9314. }
  9315. // Scroll a given position into view (immediately), verifying that
  9316. // it actually became visible (as line heights are accurately
  9317. // measured, the position of something may 'drift' during drawing).
  9318. function scrollPosIntoView(cm, pos, end, margin) {
  9319. if (margin == null) { margin = 0; }
  9320. var rect;
  9321. for (var limit = 0; limit < 5; limit++) {
  9322. var changed = false;
  9323. var coords = cursorCoords(cm, pos);
  9324. var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
  9325. rect = {left: Math.min(coords.left, endCoords.left),
  9326. top: Math.min(coords.top, endCoords.top) - margin,
  9327. right: Math.max(coords.left, endCoords.left),
  9328. bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
  9329. var scrollPos = calculateScrollPos(cm, rect);
  9330. var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
  9331. if (scrollPos.scrollTop != null) {
  9332. setScrollTop(cm, scrollPos.scrollTop);
  9333. if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
  9334. }
  9335. if (scrollPos.scrollLeft != null) {
  9336. setScrollLeft(cm, scrollPos.scrollLeft);
  9337. if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
  9338. }
  9339. if (!changed) { break }
  9340. }
  9341. return rect
  9342. }
  9343. // Scroll a given set of coordinates into view (immediately).
  9344. function scrollIntoView(cm, rect) {
  9345. var scrollPos = calculateScrollPos(cm, rect);
  9346. if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop); }
  9347. if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
  9348. }
  9349. // Calculate a new scroll position needed to scroll the given
  9350. // rectangle into view. Returns an object with scrollTop and
  9351. // scrollLeft properties. When these are undefined, the
  9352. // vertical/horizontal position does not need to be adjusted.
  9353. function calculateScrollPos(cm, rect) {
  9354. var display = cm.display, snapMargin = textHeight(cm.display);
  9355. if (rect.top < 0) { rect.top = 0; }
  9356. var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
  9357. var screen = displayHeight(cm), result = {};
  9358. if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
  9359. var docBottom = cm.doc.height + paddingVert(display);
  9360. var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
  9361. if (rect.top < screentop) {
  9362. result.scrollTop = atTop ? 0 : rect.top;
  9363. } else if (rect.bottom > screentop + screen) {
  9364. var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
  9365. if (newTop != screentop) { result.scrollTop = newTop; }
  9366. }
  9367. var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
  9368. var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
  9369. var tooWide = rect.right - rect.left > screenw;
  9370. if (tooWide) { rect.right = rect.left + screenw; }
  9371. if (rect.left < 10)
  9372. { result.scrollLeft = 0; }
  9373. else if (rect.left < screenleft)
  9374. { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
  9375. else if (rect.right > screenw + screenleft - 3)
  9376. { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
  9377. return result
  9378. }
  9379. // Store a relative adjustment to the scroll position in the current
  9380. // operation (to be applied when the operation finishes).
  9381. function addToScrollPos(cm, left, top) {
  9382. if (left != null || top != null) { resolveScrollToPos(cm); }
  9383. if (left != null)
  9384. { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; }
  9385. if (top != null)
  9386. { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; }
  9387. }
  9388. // Make sure that at the end of the operation the current cursor is
  9389. // shown.
  9390. function ensureCursorVisible(cm) {
  9391. resolveScrollToPos(cm);
  9392. var cur = cm.getCursor(), from = cur, to = cur;
  9393. if (!cm.options.lineWrapping) {
  9394. from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
  9395. to = Pos(cur.line, cur.ch + 1);
  9396. }
  9397. cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin};
  9398. }
  9399. // When an operation has its scrollToPos property set, and another
  9400. // scroll action is applied before the end of the operation, this
  9401. // 'simulates' scrolling that position into view in a cheap way, so
  9402. // that the effect of intermediate scroll commands is not ignored.
  9403. function resolveScrollToPos(cm) {
  9404. var range$$1 = cm.curOp.scrollToPos;
  9405. if (range$$1) {
  9406. cm.curOp.scrollToPos = null;
  9407. var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
  9408. var sPos = calculateScrollPos(cm, {
  9409. left: Math.min(from.left, to.left),
  9410. top: Math.min(from.top, to.top) - range$$1.margin,
  9411. right: Math.max(from.right, to.right),
  9412. bottom: Math.max(from.bottom, to.bottom) + range$$1.margin
  9413. });
  9414. cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  9415. }
  9416. }
  9417. // Operations are used to wrap a series of changes to the editor
  9418. // state in such a way that each change won't have to update the
  9419. // cursor and display (which would be awkward, slow, and
  9420. // error-prone). Instead, display updates are batched and then all
  9421. // combined and executed at once.
  9422. var nextOpId = 0;
  9423. // Start a new operation.
  9424. function startOperation(cm) {
  9425. cm.curOp = {
  9426. cm: cm,
  9427. viewChanged: false, // Flag that indicates that lines might need to be redrawn
  9428. startHeight: cm.doc.height, // Used to detect need to update scrollbar
  9429. forceUpdate: false, // Used to force a redraw
  9430. updateInput: null, // Whether to reset the input textarea
  9431. typing: false, // Whether this reset should be careful to leave existing text (for compositing)
  9432. changeObjs: null, // Accumulated changes, for firing change events
  9433. cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
  9434. cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
  9435. selectionChanged: false, // Whether the selection needs to be redrawn
  9436. updateMaxLine: false, // Set when the widest line needs to be determined anew
  9437. scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
  9438. scrollToPos: null, // Used to scroll to a specific position
  9439. focus: false,
  9440. id: ++nextOpId // Unique ID
  9441. };
  9442. pushOperation(cm.curOp);
  9443. }
  9444. // Finish an operation, updating the display and signalling delayed events
  9445. function endOperation(cm) {
  9446. var op = cm.curOp;
  9447. finishOperation(op, function (group) {
  9448. for (var i = 0; i < group.ops.length; i++)
  9449. { group.ops[i].cm.curOp = null; }
  9450. endOperations(group);
  9451. });
  9452. }
  9453. // The DOM updates done when an operation finishes are batched so
  9454. // that the minimum number of relayouts are required.
  9455. function endOperations(group) {
  9456. var ops = group.ops;
  9457. for (var i = 0; i < ops.length; i++) // Read DOM
  9458. { endOperation_R1(ops[i]); }
  9459. for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
  9460. { endOperation_W1(ops[i$1]); }
  9461. for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
  9462. { endOperation_R2(ops[i$2]); }
  9463. for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
  9464. { endOperation_W2(ops[i$3]); }
  9465. for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
  9466. { endOperation_finish(ops[i$4]); }
  9467. }
  9468. function endOperation_R1(op) {
  9469. var cm = op.cm, display = cm.display;
  9470. maybeClipScrollbars(cm);
  9471. if (op.updateMaxLine) { findMaxLine(cm); }
  9472. op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
  9473. op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
  9474. op.scrollToPos.to.line >= display.viewTo) ||
  9475. display.maxLineChanged && cm.options.lineWrapping;
  9476. op.update = op.mustUpdate &&
  9477. new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
  9478. }
  9479. function endOperation_W1(op) {
  9480. op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
  9481. }
  9482. function endOperation_R2(op) {
  9483. var cm = op.cm, display = cm.display;
  9484. if (op.updatedDisplay) { updateHeightsInViewport(cm); }
  9485. op.barMeasure = measureForScrollbars(cm);
  9486. // If the max line changed since it was last measured, measure it,
  9487. // and ensure the document's width matches it.
  9488. // updateDisplay_W2 will use these properties to do the actual resizing
  9489. if (display.maxLineChanged && !cm.options.lineWrapping) {
  9490. op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
  9491. cm.display.sizerWidth = op.adjustWidthTo;
  9492. op.barMeasure.scrollWidth =
  9493. Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
  9494. op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
  9495. }
  9496. if (op.updatedDisplay || op.selectionChanged)
  9497. { op.preparedSelection = display.input.prepareSelection(op.focus); }
  9498. }
  9499. function endOperation_W2(op) {
  9500. var cm = op.cm;
  9501. if (op.adjustWidthTo != null) {
  9502. cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
  9503. if (op.maxScrollLeft < cm.doc.scrollLeft)
  9504. { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
  9505. cm.display.maxLineChanged = false;
  9506. }
  9507. var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus());
  9508. if (op.preparedSelection)
  9509. { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
  9510. if (op.updatedDisplay || op.startHeight != cm.doc.height)
  9511. { updateScrollbars(cm, op.barMeasure); }
  9512. if (op.updatedDisplay)
  9513. { setDocumentHeight(cm, op.barMeasure); }
  9514. if (op.selectionChanged) { restartBlink(cm); }
  9515. if (cm.state.focused && op.updateInput)
  9516. { cm.display.input.reset(op.typing); }
  9517. if (takeFocus) { ensureFocus(op.cm); }
  9518. }
  9519. function endOperation_finish(op) {
  9520. var cm = op.cm, display = cm.display, doc = cm.doc;
  9521. if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
  9522. // Abort mouse wheel delta measurement, when scrolling explicitly
  9523. if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
  9524. { display.wheelStartX = display.wheelStartY = null; }
  9525. // Propagate the scroll position to the actual DOM scroller
  9526. if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
  9527. doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
  9528. display.scrollbars.setScrollTop(doc.scrollTop);
  9529. display.scroller.scrollTop = doc.scrollTop;
  9530. }
  9531. if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
  9532. doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
  9533. display.scrollbars.setScrollLeft(doc.scrollLeft);
  9534. display.scroller.scrollLeft = doc.scrollLeft;
  9535. alignHorizontally(cm);
  9536. }
  9537. // If we need to scroll a specific position into view, do so.
  9538. if (op.scrollToPos) {
  9539. var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
  9540. clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
  9541. maybeScrollWindow(cm, rect);
  9542. }
  9543. // Fire events for markers that are hidden/unidden by editing or
  9544. // undoing
  9545. var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
  9546. if (hidden) { for (var i = 0; i < hidden.length; ++i)
  9547. { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
  9548. if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
  9549. { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
  9550. if (display.wrapper.offsetHeight)
  9551. { doc.scrollTop = cm.display.scroller.scrollTop; }
  9552. // Fire change events, and delayed event handlers
  9553. if (op.changeObjs)
  9554. { signal(cm, "changes", cm, op.changeObjs); }
  9555. if (op.update)
  9556. { op.update.finish(); }
  9557. }
  9558. // Run the given function in an operation
  9559. function runInOp(cm, f) {
  9560. if (cm.curOp) { return f() }
  9561. startOperation(cm);
  9562. try { return f() }
  9563. finally { endOperation(cm); }
  9564. }
  9565. // Wraps a function in an operation. Returns the wrapped function.
  9566. function operation(cm, f) {
  9567. return function() {
  9568. if (cm.curOp) { return f.apply(cm, arguments) }
  9569. startOperation(cm);
  9570. try { return f.apply(cm, arguments) }
  9571. finally { endOperation(cm); }
  9572. }
  9573. }
  9574. // Used to add methods to editor and doc instances, wrapping them in
  9575. // operations.
  9576. function methodOp(f) {
  9577. return function() {
  9578. if (this.curOp) { return f.apply(this, arguments) }
  9579. startOperation(this);
  9580. try { return f.apply(this, arguments) }
  9581. finally { endOperation(this); }
  9582. }
  9583. }
  9584. function docMethodOp(f) {
  9585. return function() {
  9586. var cm = this.cm;
  9587. if (!cm || cm.curOp) { return f.apply(this, arguments) }
  9588. startOperation(cm);
  9589. try { return f.apply(this, arguments) }
  9590. finally { endOperation(cm); }
  9591. }
  9592. }
  9593. // Updates the display.view data structure for a given change to the
  9594. // document. From and to are in pre-change coordinates. Lendiff is
  9595. // the amount of lines added or subtracted by the change. This is
  9596. // used for changes that span multiple lines, or change the way
  9597. // lines are divided into visual lines. regLineChange (below)
  9598. // registers single-line changes.
  9599. function regChange(cm, from, to, lendiff) {
  9600. if (from == null) { from = cm.doc.first; }
  9601. if (to == null) { to = cm.doc.first + cm.doc.size; }
  9602. if (!lendiff) { lendiff = 0; }
  9603. var display = cm.display;
  9604. if (lendiff && to < display.viewTo &&
  9605. (display.updateLineNumbers == null || display.updateLineNumbers > from))
  9606. { display.updateLineNumbers = from; }
  9607. cm.curOp.viewChanged = true;
  9608. if (from >= display.viewTo) { // Change after
  9609. if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
  9610. { resetView(cm); }
  9611. } else if (to <= display.viewFrom) { // Change before
  9612. if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
  9613. resetView(cm);
  9614. } else {
  9615. display.viewFrom += lendiff;
  9616. display.viewTo += lendiff;
  9617. }
  9618. } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
  9619. resetView(cm);
  9620. } else if (from <= display.viewFrom) { // Top overlap
  9621. var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
  9622. if (cut) {
  9623. display.view = display.view.slice(cut.index);
  9624. display.viewFrom = cut.lineN;
  9625. display.viewTo += lendiff;
  9626. } else {
  9627. resetView(cm);
  9628. }
  9629. } else if (to >= display.viewTo) { // Bottom overlap
  9630. var cut$1 = viewCuttingPoint(cm, from, from, -1);
  9631. if (cut$1) {
  9632. display.view = display.view.slice(0, cut$1.index);
  9633. display.viewTo = cut$1.lineN;
  9634. } else {
  9635. resetView(cm);
  9636. }
  9637. } else { // Gap in the middle
  9638. var cutTop = viewCuttingPoint(cm, from, from, -1);
  9639. var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
  9640. if (cutTop && cutBot) {
  9641. display.view = display.view.slice(0, cutTop.index)
  9642. .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
  9643. .concat(display.view.slice(cutBot.index));
  9644. display.viewTo += lendiff;
  9645. } else {
  9646. resetView(cm);
  9647. }
  9648. }
  9649. var ext = display.externalMeasured;
  9650. if (ext) {
  9651. if (to < ext.lineN)
  9652. { ext.lineN += lendiff; }
  9653. else if (from < ext.lineN + ext.size)
  9654. { display.externalMeasured = null; }
  9655. }
  9656. }
  9657. // Register a change to a single line. Type must be one of "text",
  9658. // "gutter", "class", "widget"
  9659. function regLineChange(cm, line, type) {
  9660. cm.curOp.viewChanged = true;
  9661. var display = cm.display, ext = cm.display.externalMeasured;
  9662. if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
  9663. { display.externalMeasured = null; }
  9664. if (line < display.viewFrom || line >= display.viewTo) { return }
  9665. var lineView = display.view[findViewIndex(cm, line)];
  9666. if (lineView.node == null) { return }
  9667. var arr = lineView.changes || (lineView.changes = []);
  9668. if (indexOf(arr, type) == -1) { arr.push(type); }
  9669. }
  9670. // Clear the view.
  9671. function resetView(cm) {
  9672. cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
  9673. cm.display.view = [];
  9674. cm.display.viewOffset = 0;
  9675. }
  9676. function viewCuttingPoint(cm, oldN, newN, dir) {
  9677. var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
  9678. if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
  9679. { return {index: index, lineN: newN} }
  9680. var n = cm.display.viewFrom;
  9681. for (var i = 0; i < index; i++)
  9682. { n += view[i].size; }
  9683. if (n != oldN) {
  9684. if (dir > 0) {
  9685. if (index == view.length - 1) { return null }
  9686. diff = (n + view[index].size) - oldN;
  9687. index++;
  9688. } else {
  9689. diff = n - oldN;
  9690. }
  9691. oldN += diff; newN += diff;
  9692. }
  9693. while (visualLineNo(cm.doc, newN) != newN) {
  9694. if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
  9695. newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
  9696. index += dir;
  9697. }
  9698. return {index: index, lineN: newN}
  9699. }
  9700. // Force the view to cover a given range, adding empty view element
  9701. // or clipping off existing ones as needed.
  9702. function adjustView(cm, from, to) {
  9703. var display = cm.display, view = display.view;
  9704. if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
  9705. display.view = buildViewArray(cm, from, to);
  9706. display.viewFrom = from;
  9707. } else {
  9708. if (display.viewFrom > from)
  9709. { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
  9710. else if (display.viewFrom < from)
  9711. { display.view = display.view.slice(findViewIndex(cm, from)); }
  9712. display.viewFrom = from;
  9713. if (display.viewTo < to)
  9714. { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
  9715. else if (display.viewTo > to)
  9716. { display.view = display.view.slice(0, findViewIndex(cm, to)); }
  9717. }
  9718. display.viewTo = to;
  9719. }
  9720. // Count the number of lines in the view whose DOM representation is
  9721. // out of date (or nonexistent).
  9722. function countDirtyView(cm) {
  9723. var view = cm.display.view, dirty = 0;
  9724. for (var i = 0; i < view.length; i++) {
  9725. var lineView = view[i];
  9726. if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
  9727. }
  9728. return dirty
  9729. }
  9730. // HIGHLIGHT WORKER
  9731. function startWorker(cm, time) {
  9732. if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
  9733. { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
  9734. }
  9735. function highlightWorker(cm) {
  9736. var doc = cm.doc;
  9737. if (doc.frontier < doc.first) { doc.frontier = doc.first; }
  9738. if (doc.frontier >= cm.display.viewTo) { return }
  9739. var end = +new Date + cm.options.workTime;
  9740. var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
  9741. var changedLines = [];
  9742. doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
  9743. if (doc.frontier >= cm.display.viewFrom) { // Visible
  9744. var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
  9745. var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
  9746. line.styles = highlighted.styles;
  9747. var oldCls = line.styleClasses, newCls = highlighted.classes;
  9748. if (newCls) { line.styleClasses = newCls; }
  9749. else if (oldCls) { line.styleClasses = null; }
  9750. var ischange = !oldStyles || oldStyles.length != line.styles.length ||
  9751. oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
  9752. for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
  9753. if (ischange) { changedLines.push(doc.frontier); }
  9754. line.stateAfter = tooLong ? state : copyState(doc.mode, state);
  9755. } else {
  9756. if (line.text.length <= cm.options.maxHighlightLength)
  9757. { processLine(cm, line.text, state); }
  9758. line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
  9759. }
  9760. ++doc.frontier;
  9761. if (+new Date > end) {
  9762. startWorker(cm, cm.options.workDelay);
  9763. return true
  9764. }
  9765. });
  9766. if (changedLines.length) { runInOp(cm, function () {
  9767. for (var i = 0; i < changedLines.length; i++)
  9768. { regLineChange(cm, changedLines[i], "text"); }
  9769. }); }
  9770. }
  9771. // DISPLAY DRAWING
  9772. var DisplayUpdate = function(cm, viewport, force) {
  9773. var display = cm.display;
  9774. this.viewport = viewport;
  9775. // Store some values that we'll need later (but don't want to force a relayout for)
  9776. this.visible = visibleLines(display, cm.doc, viewport);
  9777. this.editorIsHidden = !display.wrapper.offsetWidth;
  9778. this.wrapperHeight = display.wrapper.clientHeight;
  9779. this.wrapperWidth = display.wrapper.clientWidth;
  9780. this.oldDisplayWidth = displayWidth(cm);
  9781. this.force = force;
  9782. this.dims = getDimensions(cm);
  9783. this.events = [];
  9784. };
  9785. DisplayUpdate.prototype.signal = function (emitter, type) {
  9786. if (hasHandler(emitter, type))
  9787. { this.events.push(arguments); }
  9788. };
  9789. DisplayUpdate.prototype.finish = function () {
  9790. var this$1 = this;
  9791. for (var i = 0; i < this.events.length; i++)
  9792. { signal.apply(null, this$1.events[i]); }
  9793. };
  9794. function maybeClipScrollbars(cm) {
  9795. var display = cm.display;
  9796. if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
  9797. display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
  9798. display.heightForcer.style.height = scrollGap(cm) + "px";
  9799. display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
  9800. display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
  9801. display.scrollbarsClipped = true;
  9802. }
  9803. }
  9804. // Does the actual updating of the line display. Bails out
  9805. // (returning false) when there is nothing to be done and forced is
  9806. // false.
  9807. function updateDisplayIfNeeded(cm, update) {
  9808. var display = cm.display, doc = cm.doc;
  9809. if (update.editorIsHidden) {
  9810. resetView(cm);
  9811. return false
  9812. }
  9813. // Bail out if the visible area is already rendered and nothing changed.
  9814. if (!update.force &&
  9815. update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
  9816. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
  9817. display.renderedView == display.view && countDirtyView(cm) == 0)
  9818. { return false }
  9819. if (maybeUpdateLineNumberWidth(cm)) {
  9820. resetView(cm);
  9821. update.dims = getDimensions(cm);
  9822. }
  9823. // Compute a suitable new viewport (from & to)
  9824. var end = doc.first + doc.size;
  9825. var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
  9826. var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
  9827. if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
  9828. if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
  9829. if (sawCollapsedSpans) {
  9830. from = visualLineNo(cm.doc, from);
  9831. to = visualLineEndNo(cm.doc, to);
  9832. }
  9833. var different = from != display.viewFrom || to != display.viewTo ||
  9834. display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
  9835. adjustView(cm, from, to);
  9836. display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
  9837. // Position the mover div to align with the current scroll position
  9838. cm.display.mover.style.top = display.viewOffset + "px";
  9839. var toUpdate = countDirtyView(cm);
  9840. if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
  9841. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
  9842. { return false }
  9843. // For big changes, we hide the enclosing element during the
  9844. // update, since that speeds up the operations on most browsers.
  9845. var focused = activeElt();
  9846. if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
  9847. patchDisplay(cm, display.updateLineNumbers, update.dims);
  9848. if (toUpdate > 4) { display.lineDiv.style.display = ""; }
  9849. display.renderedView = display.view;
  9850. // There might have been a widget with a focused element that got
  9851. // hidden or updated, if so re-focus it.
  9852. if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus(); }
  9853. // Prevent selection and cursors from interfering with the scroll
  9854. // width and height.
  9855. removeChildren(display.cursorDiv);
  9856. removeChildren(display.selectionDiv);
  9857. display.gutters.style.height = display.sizer.style.minHeight = 0;
  9858. if (different) {
  9859. display.lastWrapHeight = update.wrapperHeight;
  9860. display.lastWrapWidth = update.wrapperWidth;
  9861. startWorker(cm, 400);
  9862. }
  9863. display.updateLineNumbers = null;
  9864. return true
  9865. }
  9866. function postUpdateDisplay(cm, update) {
  9867. var viewport = update.viewport;
  9868. for (var first = true;; first = false) {
  9869. if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
  9870. // Clip forced viewport to actual scrollable area.
  9871. if (viewport && viewport.top != null)
  9872. { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
  9873. // Updated line heights might result in the drawn area not
  9874. // actually covering the viewport. Keep looping until it does.
  9875. update.visible = visibleLines(cm.display, cm.doc, viewport);
  9876. if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
  9877. { break }
  9878. }
  9879. if (!updateDisplayIfNeeded(cm, update)) { break }
  9880. updateHeightsInViewport(cm);
  9881. var barMeasure = measureForScrollbars(cm);
  9882. updateSelection(cm);
  9883. updateScrollbars(cm, barMeasure);
  9884. setDocumentHeight(cm, barMeasure);
  9885. }
  9886. update.signal(cm, "update", cm);
  9887. if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
  9888. update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
  9889. cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
  9890. }
  9891. }
  9892. function updateDisplaySimple(cm, viewport) {
  9893. var update = new DisplayUpdate(cm, viewport);
  9894. if (updateDisplayIfNeeded(cm, update)) {
  9895. updateHeightsInViewport(cm);
  9896. postUpdateDisplay(cm, update);
  9897. var barMeasure = measureForScrollbars(cm);
  9898. updateSelection(cm);
  9899. updateScrollbars(cm, barMeasure);
  9900. setDocumentHeight(cm, barMeasure);
  9901. update.finish();
  9902. }
  9903. }
  9904. // Sync the actual display DOM structure with display.view, removing
  9905. // nodes for lines that are no longer in view, and creating the ones
  9906. // that are not there yet, and updating the ones that are out of
  9907. // date.
  9908. function patchDisplay(cm, updateNumbersFrom, dims) {
  9909. var display = cm.display, lineNumbers = cm.options.lineNumbers;
  9910. var container = display.lineDiv, cur = container.firstChild;
  9911. function rm(node) {
  9912. var next = node.nextSibling;
  9913. // Works around a throw-scroll bug in OS X Webkit
  9914. if (webkit && mac && cm.display.currentWheelTarget == node)
  9915. { node.style.display = "none"; }
  9916. else
  9917. { node.parentNode.removeChild(node); }
  9918. return next
  9919. }
  9920. var view = display.view, lineN = display.viewFrom;
  9921. // Loop over the elements in the view, syncing cur (the DOM nodes
  9922. // in display.lineDiv) with the view as we go.
  9923. for (var i = 0; i < view.length; i++) {
  9924. var lineView = view[i];
  9925. if (lineView.hidden) {
  9926. } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
  9927. var node = buildLineElement(cm, lineView, lineN, dims);
  9928. container.insertBefore(node, cur);
  9929. } else { // Already drawn
  9930. while (cur != lineView.node) { cur = rm(cur); }
  9931. var updateNumber = lineNumbers && updateNumbersFrom != null &&
  9932. updateNumbersFrom <= lineN && lineView.lineNumber;
  9933. if (lineView.changes) {
  9934. if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
  9935. updateLineForChanges(cm, lineView, lineN, dims);
  9936. }
  9937. if (updateNumber) {
  9938. removeChildren(lineView.lineNumber);
  9939. lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
  9940. }
  9941. cur = lineView.node.nextSibling;
  9942. }
  9943. lineN += lineView.size;
  9944. }
  9945. while (cur) { cur = rm(cur); }
  9946. }
  9947. function updateGutterSpace(cm) {
  9948. var width = cm.display.gutters.offsetWidth;
  9949. cm.display.sizer.style.marginLeft = width + "px";
  9950. }
  9951. function setDocumentHeight(cm, measure) {
  9952. cm.display.sizer.style.minHeight = measure.docHeight + "px";
  9953. cm.display.heightForcer.style.top = measure.docHeight + "px";
  9954. cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
  9955. }
  9956. // Rebuild the gutter elements, ensure the margin to the left of the
  9957. // code matches their width.
  9958. function updateGutters(cm) {
  9959. var gutters = cm.display.gutters, specs = cm.options.gutters;
  9960. removeChildren(gutters);
  9961. var i = 0;
  9962. for (; i < specs.length; ++i) {
  9963. var gutterClass = specs[i];
  9964. var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
  9965. if (gutterClass == "CodeMirror-linenumbers") {
  9966. cm.display.lineGutter = gElt;
  9967. gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
  9968. }
  9969. }
  9970. gutters.style.display = i ? "" : "none";
  9971. updateGutterSpace(cm);
  9972. }
  9973. // Make sure the gutters options contains the element
  9974. // "CodeMirror-linenumbers" when the lineNumbers option is true.
  9975. function setGuttersForLineNumbers(options) {
  9976. var found = indexOf(options.gutters, "CodeMirror-linenumbers");
  9977. if (found == -1 && options.lineNumbers) {
  9978. options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
  9979. } else if (found > -1 && !options.lineNumbers) {
  9980. options.gutters = options.gutters.slice(0);
  9981. options.gutters.splice(found, 1);
  9982. }
  9983. }
  9984. // Selection objects are immutable. A new one is created every time
  9985. // the selection changes. A selection is one or more non-overlapping
  9986. // (and non-touching) ranges, sorted, and an integer that indicates
  9987. // which one is the primary selection (the one that's scrolled into
  9988. // view, that getCursor returns, etc).
  9989. var Selection = function(ranges, primIndex) {
  9990. this.ranges = ranges;
  9991. this.primIndex = primIndex;
  9992. };
  9993. Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
  9994. Selection.prototype.equals = function (other) {
  9995. var this$1 = this;
  9996. if (other == this) { return true }
  9997. if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
  9998. for (var i = 0; i < this.ranges.length; i++) {
  9999. var here = this$1.ranges[i], there = other.ranges[i];
  10000. if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
  10001. }
  10002. return true
  10003. };
  10004. Selection.prototype.deepCopy = function () {
  10005. var this$1 = this;
  10006. var out = [];
  10007. for (var i = 0; i < this.ranges.length; i++)
  10008. { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
  10009. return new Selection(out, this.primIndex)
  10010. };
  10011. Selection.prototype.somethingSelected = function () {
  10012. var this$1 = this;
  10013. for (var i = 0; i < this.ranges.length; i++)
  10014. { if (!this$1.ranges[i].empty()) { return true } }
  10015. return false
  10016. };
  10017. Selection.prototype.contains = function (pos, end) {
  10018. var this$1 = this;
  10019. if (!end) { end = pos; }
  10020. for (var i = 0; i < this.ranges.length; i++) {
  10021. var range = this$1.ranges[i];
  10022. if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
  10023. { return i }
  10024. }
  10025. return -1
  10026. };
  10027. var Range = function(anchor, head) {
  10028. this.anchor = anchor; this.head = head;
  10029. };
  10030. Range.prototype.from = function () { return minPos(this.anchor, this.head) };
  10031. Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
  10032. Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
  10033. // Take an unsorted, potentially overlapping set of ranges, and
  10034. // build a selection out of it. 'Consumes' ranges array (modifying
  10035. // it).
  10036. function normalizeSelection(ranges, primIndex) {
  10037. var prim = ranges[primIndex];
  10038. ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
  10039. primIndex = indexOf(ranges, prim);
  10040. for (var i = 1; i < ranges.length; i++) {
  10041. var cur = ranges[i], prev = ranges[i - 1];
  10042. if (cmp(prev.to(), cur.from()) >= 0) {
  10043. var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
  10044. var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
  10045. if (i <= primIndex) { --primIndex; }
  10046. ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
  10047. }
  10048. }
  10049. return new Selection(ranges, primIndex)
  10050. }
  10051. function simpleSelection(anchor, head) {
  10052. return new Selection([new Range(anchor, head || anchor)], 0)
  10053. }
  10054. // Compute the position of the end of a change (its 'to' property
  10055. // refers to the pre-change end).
  10056. function changeEnd(change) {
  10057. if (!change.text) { return change.to }
  10058. return Pos(change.from.line + change.text.length - 1,
  10059. lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
  10060. }
  10061. // Adjust a position to refer to the post-change position of the
  10062. // same text, or the end of the change if the change covers it.
  10063. function adjustForChange(pos, change) {
  10064. if (cmp(pos, change.from) < 0) { return pos }
  10065. if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
  10066. var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
  10067. if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
  10068. return Pos(line, ch)
  10069. }
  10070. function computeSelAfterChange(doc, change) {
  10071. var out = [];
  10072. for (var i = 0; i < doc.sel.ranges.length; i++) {
  10073. var range = doc.sel.ranges[i];
  10074. out.push(new Range(adjustForChange(range.anchor, change),
  10075. adjustForChange(range.head, change)));
  10076. }
  10077. return normalizeSelection(out, doc.sel.primIndex)
  10078. }
  10079. function offsetPos(pos, old, nw) {
  10080. if (pos.line == old.line)
  10081. { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
  10082. else
  10083. { return Pos(nw.line + (pos.line - old.line), pos.ch) }
  10084. }
  10085. // Used by replaceSelections to allow moving the selection to the
  10086. // start or around the replaced test. Hint may be "start" or "around".
  10087. function computeReplacedSel(doc, changes, hint) {
  10088. var out = [];
  10089. var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
  10090. for (var i = 0; i < changes.length; i++) {
  10091. var change = changes[i];
  10092. var from = offsetPos(change.from, oldPrev, newPrev);
  10093. var to = offsetPos(changeEnd(change), oldPrev, newPrev);
  10094. oldPrev = change.to;
  10095. newPrev = to;
  10096. if (hint == "around") {
  10097. var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
  10098. out[i] = new Range(inv ? to : from, inv ? from : to);
  10099. } else {
  10100. out[i] = new Range(from, from);
  10101. }
  10102. }
  10103. return new Selection(out, doc.sel.primIndex)
  10104. }
  10105. // Used to get the editor into a consistent state again when options change.
  10106. function loadMode(cm) {
  10107. cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
  10108. resetModeState(cm);
  10109. }
  10110. function resetModeState(cm) {
  10111. cm.doc.iter(function (line) {
  10112. if (line.stateAfter) { line.stateAfter = null; }
  10113. if (line.styles) { line.styles = null; }
  10114. });
  10115. cm.doc.frontier = cm.doc.first;
  10116. startWorker(cm, 100);
  10117. cm.state.modeGen++;
  10118. if (cm.curOp) { regChange(cm); }
  10119. }
  10120. // DOCUMENT DATA STRUCTURE
  10121. // By default, updates that start and end at the beginning of a line
  10122. // are treated specially, in order to make the association of line
  10123. // widgets and marker elements with the text behave more intuitive.
  10124. function isWholeLineUpdate(doc, change) {
  10125. return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
  10126. (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
  10127. }
  10128. // Perform a change on the document data structure.
  10129. function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
  10130. function spansFor(n) {return markedSpans ? markedSpans[n] : null}
  10131. function update(line, text, spans) {
  10132. updateLine(line, text, spans, estimateHeight$$1);
  10133. signalLater(line, "change", line, change);
  10134. }
  10135. function linesFor(start, end) {
  10136. var result = [];
  10137. for (var i = start; i < end; ++i)
  10138. { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
  10139. return result
  10140. }
  10141. var from = change.from, to = change.to, text = change.text;
  10142. var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
  10143. var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
  10144. // Adjust the line structure
  10145. if (change.full) {
  10146. doc.insert(0, linesFor(0, text.length));
  10147. doc.remove(text.length, doc.size - text.length);
  10148. } else if (isWholeLineUpdate(doc, change)) {
  10149. // This is a whole-line replace. Treated specially to make
  10150. // sure line objects move the way they are supposed to.
  10151. var added = linesFor(0, text.length - 1);
  10152. update(lastLine, lastLine.text, lastSpans);
  10153. if (nlines) { doc.remove(from.line, nlines); }
  10154. if (added.length) { doc.insert(from.line, added); }
  10155. } else if (firstLine == lastLine) {
  10156. if (text.length == 1) {
  10157. update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
  10158. } else {
  10159. var added$1 = linesFor(1, text.length - 1);
  10160. added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
  10161. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  10162. doc.insert(from.line + 1, added$1);
  10163. }
  10164. } else if (text.length == 1) {
  10165. update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
  10166. doc.remove(from.line + 1, nlines);
  10167. } else {
  10168. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  10169. update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
  10170. var added$2 = linesFor(1, text.length - 1);
  10171. if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
  10172. doc.insert(from.line + 1, added$2);
  10173. }
  10174. signalLater(doc, "change", doc, change);
  10175. }
  10176. // Call f for all linked documents.
  10177. function linkedDocs(doc, f, sharedHistOnly) {
  10178. function propagate(doc, skip, sharedHist) {
  10179. if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
  10180. var rel = doc.linked[i];
  10181. if (rel.doc == skip) { continue }
  10182. var shared = sharedHist && rel.sharedHist;
  10183. if (sharedHistOnly && !shared) { continue }
  10184. f(rel.doc, shared);
  10185. propagate(rel.doc, doc, shared);
  10186. } }
  10187. }
  10188. propagate(doc, null, true);
  10189. }
  10190. // Attach a document to an editor.
  10191. function attachDoc(cm, doc) {
  10192. if (doc.cm) { throw new Error("This document is already in use.") }
  10193. cm.doc = doc;
  10194. doc.cm = cm;
  10195. estimateLineHeights(cm);
  10196. loadMode(cm);
  10197. setDirectionClass(cm);
  10198. if (!cm.options.lineWrapping) { findMaxLine(cm); }
  10199. cm.options.mode = doc.modeOption;
  10200. regChange(cm);
  10201. }
  10202. function setDirectionClass(cm) {
  10203. (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
  10204. }
  10205. function directionChanged(cm) {
  10206. runInOp(cm, function () {
  10207. setDirectionClass(cm);
  10208. regChange(cm);
  10209. });
  10210. }
  10211. function History(startGen) {
  10212. // Arrays of change events and selections. Doing something adds an
  10213. // event to done and clears undo. Undoing moves events from done
  10214. // to undone, redoing moves them in the other direction.
  10215. this.done = []; this.undone = [];
  10216. this.undoDepth = Infinity;
  10217. // Used to track when changes can be merged into a single undo
  10218. // event
  10219. this.lastModTime = this.lastSelTime = 0;
  10220. this.lastOp = this.lastSelOp = null;
  10221. this.lastOrigin = this.lastSelOrigin = null;
  10222. // Used by the isClean() method
  10223. this.generation = this.maxGeneration = startGen || 1;
  10224. }
  10225. // Create a history change event from an updateDoc-style change
  10226. // object.
  10227. function historyChangeFromChange(doc, change) {
  10228. var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
  10229. attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
  10230. linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
  10231. return histChange
  10232. }
  10233. // Pop all selection events off the end of a history array. Stop at
  10234. // a change event.
  10235. function clearSelectionEvents(array) {
  10236. while (array.length) {
  10237. var last = lst(array);
  10238. if (last.ranges) { array.pop(); }
  10239. else { break }
  10240. }
  10241. }
  10242. // Find the top change event in the history. Pop off selection
  10243. // events that are in the way.
  10244. function lastChangeEvent(hist, force) {
  10245. if (force) {
  10246. clearSelectionEvents(hist.done);
  10247. return lst(hist.done)
  10248. } else if (hist.done.length && !lst(hist.done).ranges) {
  10249. return lst(hist.done)
  10250. } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
  10251. hist.done.pop();
  10252. return lst(hist.done)
  10253. }
  10254. }
  10255. // Register a change in the history. Merges changes that are within
  10256. // a single operation, or are close together with an origin that
  10257. // allows merging (starting with "+") into a single event.
  10258. function addChangeToHistory(doc, change, selAfter, opId) {
  10259. var hist = doc.history;
  10260. hist.undone.length = 0;
  10261. var time = +new Date, cur;
  10262. var last;
  10263. if ((hist.lastOp == opId ||
  10264. hist.lastOrigin == change.origin && change.origin &&
  10265. ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
  10266. change.origin.charAt(0) == "*")) &&
  10267. (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
  10268. // Merge this change into the last event
  10269. last = lst(cur.changes);
  10270. if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
  10271. // Optimized case for simple insertion -- don't want to add
  10272. // new changesets for every character typed
  10273. last.to = changeEnd(change);
  10274. } else {
  10275. // Add new sub-event
  10276. cur.changes.push(historyChangeFromChange(doc, change));
  10277. }
  10278. } else {
  10279. // Can not be merged, start a new event.
  10280. var before = lst(hist.done);
  10281. if (!before || !before.ranges)
  10282. { pushSelectionToHistory(doc.sel, hist.done); }
  10283. cur = {changes: [historyChangeFromChange(doc, change)],
  10284. generation: hist.generation};
  10285. hist.done.push(cur);
  10286. while (hist.done.length > hist.undoDepth) {
  10287. hist.done.shift();
  10288. if (!hist.done[0].ranges) { hist.done.shift(); }
  10289. }
  10290. }
  10291. hist.done.push(selAfter);
  10292. hist.generation = ++hist.maxGeneration;
  10293. hist.lastModTime = hist.lastSelTime = time;
  10294. hist.lastOp = hist.lastSelOp = opId;
  10295. hist.lastOrigin = hist.lastSelOrigin = change.origin;
  10296. if (!last) { signal(doc, "historyAdded"); }
  10297. }
  10298. function selectionEventCanBeMerged(doc, origin, prev, sel) {
  10299. var ch = origin.charAt(0);
  10300. return ch == "*" ||
  10301. ch == "+" &&
  10302. prev.ranges.length == sel.ranges.length &&
  10303. prev.somethingSelected() == sel.somethingSelected() &&
  10304. new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
  10305. }
  10306. // Called whenever the selection changes, sets the new selection as
  10307. // the pending selection in the history, and pushes the old pending
  10308. // selection into the 'done' array when it was significantly
  10309. // different (in number of selected ranges, emptiness, or time).
  10310. function addSelectionToHistory(doc, sel, opId, options) {
  10311. var hist = doc.history, origin = options && options.origin;
  10312. // A new event is started when the previous origin does not match
  10313. // the current, or the origins don't allow matching. Origins
  10314. // starting with * are always merged, those starting with + are
  10315. // merged when similar and close together in time.
  10316. if (opId == hist.lastSelOp ||
  10317. (origin && hist.lastSelOrigin == origin &&
  10318. (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
  10319. selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
  10320. { hist.done[hist.done.length - 1] = sel; }
  10321. else
  10322. { pushSelectionToHistory(sel, hist.done); }
  10323. hist.lastSelTime = +new Date;
  10324. hist.lastSelOrigin = origin;
  10325. hist.lastSelOp = opId;
  10326. if (options && options.clearRedo !== false)
  10327. { clearSelectionEvents(hist.undone); }
  10328. }
  10329. function pushSelectionToHistory(sel, dest) {
  10330. var top = lst(dest);
  10331. if (!(top && top.ranges && top.equals(sel)))
  10332. { dest.push(sel); }
  10333. }
  10334. // Used to store marked span information in the history.
  10335. function attachLocalSpans(doc, change, from, to) {
  10336. var existing = change["spans_" + doc.id], n = 0;
  10337. doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
  10338. if (line.markedSpans)
  10339. { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
  10340. ++n;
  10341. });
  10342. }
  10343. // When un/re-doing restores text containing marked spans, those
  10344. // that have been explicitly cleared should not be restored.
  10345. function removeClearedSpans(spans) {
  10346. if (!spans) { return null }
  10347. var out;
  10348. for (var i = 0; i < spans.length; ++i) {
  10349. if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
  10350. else if (out) { out.push(spans[i]); }
  10351. }
  10352. return !out ? spans : out.length ? out : null
  10353. }
  10354. // Retrieve and filter the old marked spans stored in a change event.
  10355. function getOldSpans(doc, change) {
  10356. var found = change["spans_" + doc.id];
  10357. if (!found) { return null }
  10358. var nw = [];
  10359. for (var i = 0; i < change.text.length; ++i)
  10360. { nw.push(removeClearedSpans(found[i])); }
  10361. return nw
  10362. }
  10363. // Used for un/re-doing changes from the history. Combines the
  10364. // result of computing the existing spans with the set of spans that
  10365. // existed in the history (so that deleting around a span and then
  10366. // undoing brings back the span).
  10367. function mergeOldSpans(doc, change) {
  10368. var old = getOldSpans(doc, change);
  10369. var stretched = stretchSpansOverChange(doc, change);
  10370. if (!old) { return stretched }
  10371. if (!stretched) { return old }
  10372. for (var i = 0; i < old.length; ++i) {
  10373. var oldCur = old[i], stretchCur = stretched[i];
  10374. if (oldCur && stretchCur) {
  10375. spans: for (var j = 0; j < stretchCur.length; ++j) {
  10376. var span = stretchCur[j];
  10377. for (var k = 0; k < oldCur.length; ++k)
  10378. { if (oldCur[k].marker == span.marker) { continue spans } }
  10379. oldCur.push(span);
  10380. }
  10381. } else if (stretchCur) {
  10382. old[i] = stretchCur;
  10383. }
  10384. }
  10385. return old
  10386. }
  10387. // Used both to provide a JSON-safe object in .getHistory, and, when
  10388. // detaching a document, to split the history in two
  10389. function copyHistoryArray(events, newGroup, instantiateSel) {
  10390. var copy = [];
  10391. for (var i = 0; i < events.length; ++i) {
  10392. var event = events[i];
  10393. if (event.ranges) {
  10394. copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
  10395. continue
  10396. }
  10397. var changes = event.changes, newChanges = [];
  10398. copy.push({changes: newChanges});
  10399. for (var j = 0; j < changes.length; ++j) {
  10400. var change = changes[j], m = (void 0);
  10401. newChanges.push({from: change.from, to: change.to, text: change.text});
  10402. if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
  10403. if (indexOf(newGroup, Number(m[1])) > -1) {
  10404. lst(newChanges)[prop] = change[prop];
  10405. delete change[prop];
  10406. }
  10407. } } }
  10408. }
  10409. }
  10410. return copy
  10411. }
  10412. // The 'scroll' parameter given to many of these indicated whether
  10413. // the new cursor position should be scrolled into view after
  10414. // modifying the selection.
  10415. // If shift is held or the extend flag is set, extends a range to
  10416. // include a given position (and optionally a second position).
  10417. // Otherwise, simply returns the range between the given positions.
  10418. // Used for cursor motion and such.
  10419. function extendRange(doc, range, head, other) {
  10420. if (doc.cm && doc.cm.display.shift || doc.extend) {
  10421. var anchor = range.anchor;
  10422. if (other) {
  10423. var posBefore = cmp(head, anchor) < 0;
  10424. if (posBefore != (cmp(other, anchor) < 0)) {
  10425. anchor = head;
  10426. head = other;
  10427. } else if (posBefore != (cmp(head, other) < 0)) {
  10428. head = other;
  10429. }
  10430. }
  10431. return new Range(anchor, head)
  10432. } else {
  10433. return new Range(other || head, head)
  10434. }
  10435. }
  10436. // Extend the primary selection range, discard the rest.
  10437. function extendSelection(doc, head, other, options) {
  10438. setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
  10439. }
  10440. // Extend all selections (pos is an array of selections with length
  10441. // equal the number of selections)
  10442. function extendSelections(doc, heads, options) {
  10443. var out = [];
  10444. for (var i = 0; i < doc.sel.ranges.length; i++)
  10445. { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); }
  10446. var newSel = normalizeSelection(out, doc.sel.primIndex);
  10447. setSelection(doc, newSel, options);
  10448. }
  10449. // Updates a single range in the selection.
  10450. function replaceOneSelection(doc, i, range, options) {
  10451. var ranges = doc.sel.ranges.slice(0);
  10452. ranges[i] = range;
  10453. setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
  10454. }
  10455. // Reset the selection to a single range.
  10456. function setSimpleSelection(doc, anchor, head, options) {
  10457. setSelection(doc, simpleSelection(anchor, head), options);
  10458. }
  10459. // Give beforeSelectionChange handlers a change to influence a
  10460. // selection update.
  10461. function filterSelectionChange(doc, sel, options) {
  10462. var obj = {
  10463. ranges: sel.ranges,
  10464. update: function(ranges) {
  10465. var this$1 = this;
  10466. this.ranges = [];
  10467. for (var i = 0; i < ranges.length; i++)
  10468. { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
  10469. clipPos(doc, ranges[i].head)); }
  10470. },
  10471. origin: options && options.origin
  10472. };
  10473. signal(doc, "beforeSelectionChange", doc, obj);
  10474. if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
  10475. if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
  10476. else { return sel }
  10477. }
  10478. function setSelectionReplaceHistory(doc, sel, options) {
  10479. var done = doc.history.done, last = lst(done);
  10480. if (last && last.ranges) {
  10481. done[done.length - 1] = sel;
  10482. setSelectionNoUndo(doc, sel, options);
  10483. } else {
  10484. setSelection(doc, sel, options);
  10485. }
  10486. }
  10487. // Set a new selection.
  10488. function setSelection(doc, sel, options) {
  10489. setSelectionNoUndo(doc, sel, options);
  10490. addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
  10491. }
  10492. function setSelectionNoUndo(doc, sel, options) {
  10493. if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
  10494. { sel = filterSelectionChange(doc, sel, options); }
  10495. var bias = options && options.bias ||
  10496. (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
  10497. setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
  10498. if (!(options && options.scroll === false) && doc.cm)
  10499. { ensureCursorVisible(doc.cm); }
  10500. }
  10501. function setSelectionInner(doc, sel) {
  10502. if (sel.equals(doc.sel)) { return }
  10503. doc.sel = sel;
  10504. if (doc.cm) {
  10505. doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
  10506. signalCursorActivity(doc.cm);
  10507. }
  10508. signalLater(doc, "cursorActivity", doc);
  10509. }
  10510. // Verify that the selection does not partially select any atomic
  10511. // marked ranges.
  10512. function reCheckSelection(doc) {
  10513. setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
  10514. }
  10515. // Return a selection that does not partially select any atomic
  10516. // ranges.
  10517. function skipAtomicInSelection(doc, sel, bias, mayClear) {
  10518. var out;
  10519. for (var i = 0; i < sel.ranges.length; i++) {
  10520. var range = sel.ranges[i];
  10521. var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
  10522. var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
  10523. var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
  10524. if (out || newAnchor != range.anchor || newHead != range.head) {
  10525. if (!out) { out = sel.ranges.slice(0, i); }
  10526. out[i] = new Range(newAnchor, newHead);
  10527. }
  10528. }
  10529. return out ? normalizeSelection(out, sel.primIndex) : sel
  10530. }
  10531. function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
  10532. var line = getLine(doc, pos.line);
  10533. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  10534. var sp = line.markedSpans[i], m = sp.marker;
  10535. if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
  10536. (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
  10537. if (mayClear) {
  10538. signal(m, "beforeCursorEnter");
  10539. if (m.explicitlyCleared) {
  10540. if (!line.markedSpans) { break }
  10541. else {--i; continue}
  10542. }
  10543. }
  10544. if (!m.atomic) { continue }
  10545. if (oldPos) {
  10546. var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
  10547. if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
  10548. { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
  10549. if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
  10550. { return skipAtomicInner(doc, near, pos, dir, mayClear) }
  10551. }
  10552. var far = m.find(dir < 0 ? -1 : 1);
  10553. if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
  10554. { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
  10555. return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
  10556. }
  10557. } }
  10558. return pos
  10559. }
  10560. // Ensure a given position is not inside an atomic range.
  10561. function skipAtomic(doc, pos, oldPos, bias, mayClear) {
  10562. var dir = bias || 1;
  10563. var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
  10564. (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
  10565. skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
  10566. (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
  10567. if (!found) {
  10568. doc.cantEdit = true;
  10569. return Pos(doc.first, 0)
  10570. }
  10571. return found
  10572. }
  10573. function movePos(doc, pos, dir, line) {
  10574. if (dir < 0 && pos.ch == 0) {
  10575. if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
  10576. else { return null }
  10577. } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
  10578. if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
  10579. else { return null }
  10580. } else {
  10581. return new Pos(pos.line, pos.ch + dir)
  10582. }
  10583. }
  10584. function selectAll(cm) {
  10585. cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
  10586. }
  10587. // UPDATING
  10588. // Allow "beforeChange" event handlers to influence a change
  10589. function filterChange(doc, change, update) {
  10590. var obj = {
  10591. canceled: false,
  10592. from: change.from,
  10593. to: change.to,
  10594. text: change.text,
  10595. origin: change.origin,
  10596. cancel: function () { return obj.canceled = true; }
  10597. };
  10598. if (update) { obj.update = function (from, to, text, origin) {
  10599. if (from) { obj.from = clipPos(doc, from); }
  10600. if (to) { obj.to = clipPos(doc, to); }
  10601. if (text) { obj.text = text; }
  10602. if (origin !== undefined) { obj.origin = origin; }
  10603. }; }
  10604. signal(doc, "beforeChange", doc, obj);
  10605. if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
  10606. if (obj.canceled) { return null }
  10607. return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
  10608. }
  10609. // Apply a change to a document, and add it to the document's
  10610. // history, and propagating it to all linked documents.
  10611. function makeChange(doc, change, ignoreReadOnly) {
  10612. if (doc.cm) {
  10613. if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
  10614. if (doc.cm.state.suppressEdits) { return }
  10615. }
  10616. if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
  10617. change = filterChange(doc, change, true);
  10618. if (!change) { return }
  10619. }
  10620. // Possibly split or suppress the update based on the presence
  10621. // of read-only spans in its range.
  10622. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
  10623. if (split) {
  10624. for (var i = split.length - 1; i >= 0; --i)
  10625. { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); }
  10626. } else {
  10627. makeChangeInner(doc, change);
  10628. }
  10629. }
  10630. function makeChangeInner(doc, change) {
  10631. if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
  10632. var selAfter = computeSelAfterChange(doc, change);
  10633. addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
  10634. makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
  10635. var rebased = [];
  10636. linkedDocs(doc, function (doc, sharedHist) {
  10637. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  10638. rebaseHist(doc.history, change);
  10639. rebased.push(doc.history);
  10640. }
  10641. makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
  10642. });
  10643. }
  10644. // Revert a change stored in a document's history.
  10645. function makeChangeFromHistory(doc, type, allowSelectionOnly) {
  10646. if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
  10647. var hist = doc.history, event, selAfter = doc.sel;
  10648. var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
  10649. // Verify that there is a useable event (so that ctrl-z won't
  10650. // needlessly clear selection events)
  10651. var i = 0;
  10652. for (; i < source.length; i++) {
  10653. event = source[i];
  10654. if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
  10655. { break }
  10656. }
  10657. if (i == source.length) { return }
  10658. hist.lastOrigin = hist.lastSelOrigin = null;
  10659. for (;;) {
  10660. event = source.pop();
  10661. if (event.ranges) {
  10662. pushSelectionToHistory(event, dest);
  10663. if (allowSelectionOnly && !event.equals(doc.sel)) {
  10664. setSelection(doc, event, {clearRedo: false});
  10665. return
  10666. }
  10667. selAfter = event;
  10668. }
  10669. else { break }
  10670. }
  10671. // Build up a reverse change object to add to the opposite history
  10672. // stack (redo when undoing, and vice versa).
  10673. var antiChanges = [];
  10674. pushSelectionToHistory(selAfter, dest);
  10675. dest.push({changes: antiChanges, generation: hist.generation});
  10676. hist.generation = event.generation || ++hist.maxGeneration;
  10677. var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
  10678. var loop = function ( i ) {
  10679. var change = event.changes[i];
  10680. change.origin = type;
  10681. if (filter && !filterChange(doc, change, false)) {
  10682. source.length = 0;
  10683. return {}
  10684. }
  10685. antiChanges.push(historyChangeFromChange(doc, change));
  10686. var after = i ? computeSelAfterChange(doc, change) : lst(source);
  10687. makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
  10688. if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
  10689. var rebased = [];
  10690. // Propagate to the linked documents
  10691. linkedDocs(doc, function (doc, sharedHist) {
  10692. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  10693. rebaseHist(doc.history, change);
  10694. rebased.push(doc.history);
  10695. }
  10696. makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
  10697. });
  10698. };
  10699. for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
  10700. var returned = loop( i$1 );
  10701. if ( returned ) return returned.v;
  10702. }
  10703. }
  10704. // Sub-views need their line numbers shifted when text is added
  10705. // above or below them in the parent document.
  10706. function shiftDoc(doc, distance) {
  10707. if (distance == 0) { return }
  10708. doc.first += distance;
  10709. doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
  10710. Pos(range.anchor.line + distance, range.anchor.ch),
  10711. Pos(range.head.line + distance, range.head.ch)
  10712. ); }), doc.sel.primIndex);
  10713. if (doc.cm) {
  10714. regChange(doc.cm, doc.first, doc.first - distance, distance);
  10715. for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
  10716. { regLineChange(doc.cm, l, "gutter"); }
  10717. }
  10718. }
  10719. // More lower-level change function, handling only a single document
  10720. // (not linked ones).
  10721. function makeChangeSingleDoc(doc, change, selAfter, spans) {
  10722. if (doc.cm && !doc.cm.curOp)
  10723. { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
  10724. if (change.to.line < doc.first) {
  10725. shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
  10726. return
  10727. }
  10728. if (change.from.line > doc.lastLine()) { return }
  10729. // Clip the change to the size of this doc
  10730. if (change.from.line < doc.first) {
  10731. var shift = change.text.length - 1 - (doc.first - change.from.line);
  10732. shiftDoc(doc, shift);
  10733. change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
  10734. text: [lst(change.text)], origin: change.origin};
  10735. }
  10736. var last = doc.lastLine();
  10737. if (change.to.line > last) {
  10738. change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
  10739. text: [change.text[0]], origin: change.origin};
  10740. }
  10741. change.removed = getBetween(doc, change.from, change.to);
  10742. if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
  10743. if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
  10744. else { updateDoc(doc, change, spans); }
  10745. setSelectionNoUndo(doc, selAfter, sel_dontScroll);
  10746. }
  10747. // Handle the interaction of a change to a document with the editor
  10748. // that this document is part of.
  10749. function makeChangeSingleDocInEditor(cm, change, spans) {
  10750. var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
  10751. var recomputeMaxLength = false, checkWidthStart = from.line;
  10752. if (!cm.options.lineWrapping) {
  10753. checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
  10754. doc.iter(checkWidthStart, to.line + 1, function (line) {
  10755. if (line == display.maxLine) {
  10756. recomputeMaxLength = true;
  10757. return true
  10758. }
  10759. });
  10760. }
  10761. if (doc.sel.contains(change.from, change.to) > -1)
  10762. { signalCursorActivity(cm); }
  10763. updateDoc(doc, change, spans, estimateHeight(cm));
  10764. if (!cm.options.lineWrapping) {
  10765. doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
  10766. var len = lineLength(line);
  10767. if (len > display.maxLineLength) {
  10768. display.maxLine = line;
  10769. display.maxLineLength = len;
  10770. display.maxLineChanged = true;
  10771. recomputeMaxLength = false;
  10772. }
  10773. });
  10774. if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
  10775. }
  10776. // Adjust frontier, schedule worker
  10777. doc.frontier = Math.min(doc.frontier, from.line);
  10778. startWorker(cm, 400);
  10779. var lendiff = change.text.length - (to.line - from.line) - 1;
  10780. // Remember that these lines changed, for updating the display
  10781. if (change.full)
  10782. { regChange(cm); }
  10783. else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
  10784. { regLineChange(cm, from.line, "text"); }
  10785. else
  10786. { regChange(cm, from.line, to.line + 1, lendiff); }
  10787. var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
  10788. if (changeHandler || changesHandler) {
  10789. var obj = {
  10790. from: from, to: to,
  10791. text: change.text,
  10792. removed: change.removed,
  10793. origin: change.origin
  10794. };
  10795. if (changeHandler) { signalLater(cm, "change", cm, obj); }
  10796. if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
  10797. }
  10798. cm.display.selForContextMenu = null;
  10799. }
  10800. function replaceRange(doc, code, from, to, origin) {
  10801. if (!to) { to = from; }
  10802. if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
  10803. if (typeof code == "string") { code = doc.splitLines(code); }
  10804. makeChange(doc, {from: from, to: to, text: code, origin: origin});
  10805. }
  10806. // Rebasing/resetting history to deal with externally-sourced changes
  10807. function rebaseHistSelSingle(pos, from, to, diff) {
  10808. if (to < pos.line) {
  10809. pos.line += diff;
  10810. } else if (from < pos.line) {
  10811. pos.line = from;
  10812. pos.ch = 0;
  10813. }
  10814. }
  10815. // Tries to rebase an array of history events given a change in the
  10816. // document. If the change touches the same lines as the event, the
  10817. // event, and everything 'behind' it, is discarded. If the change is
  10818. // before the event, the event's positions are updated. Uses a
  10819. // copy-on-write scheme for the positions, to avoid having to
  10820. // reallocate them all on every rebase, but also avoid problems with
  10821. // shared position objects being unsafely updated.
  10822. function rebaseHistArray(array, from, to, diff) {
  10823. for (var i = 0; i < array.length; ++i) {
  10824. var sub = array[i], ok = true;
  10825. if (sub.ranges) {
  10826. if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
  10827. for (var j = 0; j < sub.ranges.length; j++) {
  10828. rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
  10829. rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
  10830. }
  10831. continue
  10832. }
  10833. for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
  10834. var cur = sub.changes[j$1];
  10835. if (to < cur.from.line) {
  10836. cur.from = Pos(cur.from.line + diff, cur.from.ch);
  10837. cur.to = Pos(cur.to.line + diff, cur.to.ch);
  10838. } else if (from <= cur.to.line) {
  10839. ok = false;
  10840. break
  10841. }
  10842. }
  10843. if (!ok) {
  10844. array.splice(0, i + 1);
  10845. i = 0;
  10846. }
  10847. }
  10848. }
  10849. function rebaseHist(hist, change) {
  10850. var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
  10851. rebaseHistArray(hist.done, from, to, diff);
  10852. rebaseHistArray(hist.undone, from, to, diff);
  10853. }
  10854. // Utility for applying a change to a line by handle or number,
  10855. // returning the number and optionally registering the line as
  10856. // changed.
  10857. function changeLine(doc, handle, changeType, op) {
  10858. var no = handle, line = handle;
  10859. if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
  10860. else { no = lineNo(handle); }
  10861. if (no == null) { return null }
  10862. if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
  10863. return line
  10864. }
  10865. // The document is represented as a BTree consisting of leaves, with
  10866. // chunk of lines in them, and branches, with up to ten leaves or
  10867. // other branch nodes below them. The top node is always a branch
  10868. // node, and is the document object itself (meaning it has
  10869. // additional methods and properties).
  10870. //
  10871. // All nodes have parent links. The tree is used both to go from
  10872. // line numbers to line objects, and to go from objects to numbers.
  10873. // It also indexes by height, and is used to convert between height
  10874. // and line object, and to find the total height of the document.
  10875. //
  10876. // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
  10877. var LeafChunk = function(lines) {
  10878. var this$1 = this;
  10879. this.lines = lines;
  10880. this.parent = null;
  10881. var height = 0;
  10882. for (var i = 0; i < lines.length; ++i) {
  10883. lines[i].parent = this$1;
  10884. height += lines[i].height;
  10885. }
  10886. this.height = height;
  10887. };
  10888. LeafChunk.prototype.chunkSize = function () { return this.lines.length };
  10889. // Remove the n lines at offset 'at'.
  10890. LeafChunk.prototype.removeInner = function (at, n) {
  10891. var this$1 = this;
  10892. for (var i = at, e = at + n; i < e; ++i) {
  10893. var line = this$1.lines[i];
  10894. this$1.height -= line.height;
  10895. cleanUpLine(line);
  10896. signalLater(line, "delete");
  10897. }
  10898. this.lines.splice(at, n);
  10899. };
  10900. // Helper used to collapse a small branch into a single leaf.
  10901. LeafChunk.prototype.collapse = function (lines) {
  10902. lines.push.apply(lines, this.lines);
  10903. };
  10904. // Insert the given array of lines at offset 'at', count them as
  10905. // having the given height.
  10906. LeafChunk.prototype.insertInner = function (at, lines, height) {
  10907. var this$1 = this;
  10908. this.height += height;
  10909. this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
  10910. for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
  10911. };
  10912. // Used to iterate over a part of the tree.
  10913. LeafChunk.prototype.iterN = function (at, n, op) {
  10914. var this$1 = this;
  10915. for (var e = at + n; at < e; ++at)
  10916. { if (op(this$1.lines[at])) { return true } }
  10917. };
  10918. var BranchChunk = function(children) {
  10919. var this$1 = this;
  10920. this.children = children;
  10921. var size = 0, height = 0;
  10922. for (var i = 0; i < children.length; ++i) {
  10923. var ch = children[i];
  10924. size += ch.chunkSize(); height += ch.height;
  10925. ch.parent = this$1;
  10926. }
  10927. this.size = size;
  10928. this.height = height;
  10929. this.parent = null;
  10930. };
  10931. BranchChunk.prototype.chunkSize = function () { return this.size };
  10932. BranchChunk.prototype.removeInner = function (at, n) {
  10933. var this$1 = this;
  10934. this.size -= n;
  10935. for (var i = 0; i < this.children.length; ++i) {
  10936. var child = this$1.children[i], sz = child.chunkSize();
  10937. if (at < sz) {
  10938. var rm = Math.min(n, sz - at), oldHeight = child.height;
  10939. child.removeInner(at, rm);
  10940. this$1.height -= oldHeight - child.height;
  10941. if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
  10942. if ((n -= rm) == 0) { break }
  10943. at = 0;
  10944. } else { at -= sz; }
  10945. }
  10946. // If the result is smaller than 25 lines, ensure that it is a
  10947. // single leaf node.
  10948. if (this.size - n < 25 &&
  10949. (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
  10950. var lines = [];
  10951. this.collapse(lines);
  10952. this.children = [new LeafChunk(lines)];
  10953. this.children[0].parent = this;
  10954. }
  10955. };
  10956. BranchChunk.prototype.collapse = function (lines) {
  10957. var this$1 = this;
  10958. for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
  10959. };
  10960. BranchChunk.prototype.insertInner = function (at, lines, height) {
  10961. var this$1 = this;
  10962. this.size += lines.length;
  10963. this.height += height;
  10964. for (var i = 0; i < this.children.length; ++i) {
  10965. var child = this$1.children[i], sz = child.chunkSize();
  10966. if (at <= sz) {
  10967. child.insertInner(at, lines, height);
  10968. if (child.lines && child.lines.length > 50) {
  10969. // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
  10970. // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
  10971. var remaining = child.lines.length % 25 + 25;
  10972. for (var pos = remaining; pos < child.lines.length;) {
  10973. var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
  10974. child.height -= leaf.height;
  10975. this$1.children.splice(++i, 0, leaf);
  10976. leaf.parent = this$1;
  10977. }
  10978. child.lines = child.lines.slice(0, remaining);
  10979. this$1.maybeSpill();
  10980. }
  10981. break
  10982. }
  10983. at -= sz;
  10984. }
  10985. };
  10986. // When a node has grown, check whether it should be split.
  10987. BranchChunk.prototype.maybeSpill = function () {
  10988. if (this.children.length <= 10) { return }
  10989. var me = this;
  10990. do {
  10991. var spilled = me.children.splice(me.children.length - 5, 5);
  10992. var sibling = new BranchChunk(spilled);
  10993. if (!me.parent) { // Become the parent node
  10994. var copy = new BranchChunk(me.children);
  10995. copy.parent = me;
  10996. me.children = [copy, sibling];
  10997. me = copy;
  10998. } else {
  10999. me.size -= sibling.size;
  11000. me.height -= sibling.height;
  11001. var myIndex = indexOf(me.parent.children, me);
  11002. me.parent.children.splice(myIndex + 1, 0, sibling);
  11003. }
  11004. sibling.parent = me.parent;
  11005. } while (me.children.length > 10)
  11006. me.parent.maybeSpill();
  11007. };
  11008. BranchChunk.prototype.iterN = function (at, n, op) {
  11009. var this$1 = this;
  11010. for (var i = 0; i < this.children.length; ++i) {
  11011. var child = this$1.children[i], sz = child.chunkSize();
  11012. if (at < sz) {
  11013. var used = Math.min(n, sz - at);
  11014. if (child.iterN(at, used, op)) { return true }
  11015. if ((n -= used) == 0) { break }
  11016. at = 0;
  11017. } else { at -= sz; }
  11018. }
  11019. };
  11020. // Line widgets are block elements displayed above or below a line.
  11021. var LineWidget = function(doc, node, options) {
  11022. var this$1 = this;
  11023. if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
  11024. { this$1[opt] = options[opt]; } } }
  11025. this.doc = doc;
  11026. this.node = node;
  11027. };
  11028. LineWidget.prototype.clear = function () {
  11029. var this$1 = this;
  11030. var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
  11031. if (no == null || !ws) { return }
  11032. for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
  11033. if (!ws.length) { line.widgets = null; }
  11034. var height = widgetHeight(this);
  11035. updateLineHeight(line, Math.max(0, line.height - height));
  11036. if (cm) {
  11037. runInOp(cm, function () {
  11038. adjustScrollWhenAboveVisible(cm, line, -height);
  11039. regLineChange(cm, no, "widget");
  11040. });
  11041. signalLater(cm, "lineWidgetCleared", cm, this, no);
  11042. }
  11043. };
  11044. LineWidget.prototype.changed = function () {
  11045. var this$1 = this;
  11046. var oldH = this.height, cm = this.doc.cm, line = this.line;
  11047. this.height = null;
  11048. var diff = widgetHeight(this) - oldH;
  11049. if (!diff) { return }
  11050. updateLineHeight(line, line.height + diff);
  11051. if (cm) {
  11052. runInOp(cm, function () {
  11053. cm.curOp.forceUpdate = true;
  11054. adjustScrollWhenAboveVisible(cm, line, diff);
  11055. signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
  11056. });
  11057. }
  11058. };
  11059. eventMixin(LineWidget);
  11060. function adjustScrollWhenAboveVisible(cm, line, diff) {
  11061. if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
  11062. { addToScrollPos(cm, null, diff); }
  11063. }
  11064. function addLineWidget(doc, handle, node, options) {
  11065. var widget = new LineWidget(doc, node, options);
  11066. var cm = doc.cm;
  11067. if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
  11068. changeLine(doc, handle, "widget", function (line) {
  11069. var widgets = line.widgets || (line.widgets = []);
  11070. if (widget.insertAt == null) { widgets.push(widget); }
  11071. else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
  11072. widget.line = line;
  11073. if (cm && !lineIsHidden(doc, line)) {
  11074. var aboveVisible = heightAtLine(line) < doc.scrollTop;
  11075. updateLineHeight(line, line.height + widgetHeight(widget));
  11076. if (aboveVisible) { addToScrollPos(cm, null, widget.height); }
  11077. cm.curOp.forceUpdate = true;
  11078. }
  11079. return true
  11080. });
  11081. signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle));
  11082. return widget
  11083. }
  11084. // TEXTMARKERS
  11085. // Created with markText and setBookmark methods. A TextMarker is a
  11086. // handle that can be used to clear or find a marked position in the
  11087. // document. Line objects hold arrays (markedSpans) containing
  11088. // {from, to, marker} object pointing to such marker objects, and
  11089. // indicating that such a marker is present on that line. Multiple
  11090. // lines may point to the same marker when it spans across lines.
  11091. // The spans will have null for their from/to properties when the
  11092. // marker continues beyond the start/end of the line. Markers have
  11093. // links back to the lines they currently touch.
  11094. // Collapsed markers have unique ids, in order to be able to order
  11095. // them, which is needed for uniquely determining an outer marker
  11096. // when they overlap (they may nest, but not partially overlap).
  11097. var nextMarkerId = 0;
  11098. var TextMarker = function(doc, type) {
  11099. this.lines = [];
  11100. this.type = type;
  11101. this.doc = doc;
  11102. this.id = ++nextMarkerId;
  11103. };
  11104. // Clear the marker.
  11105. TextMarker.prototype.clear = function () {
  11106. var this$1 = this;
  11107. if (this.explicitlyCleared) { return }
  11108. var cm = this.doc.cm, withOp = cm && !cm.curOp;
  11109. if (withOp) { startOperation(cm); }
  11110. if (hasHandler(this, "clear")) {
  11111. var found = this.find();
  11112. if (found) { signalLater(this, "clear", found.from, found.to); }
  11113. }
  11114. var min = null, max = null;
  11115. for (var i = 0; i < this.lines.length; ++i) {
  11116. var line = this$1.lines[i];
  11117. var span = getMarkedSpanFor(line.markedSpans, this$1);
  11118. if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
  11119. else if (cm) {
  11120. if (span.to != null) { max = lineNo(line); }
  11121. if (span.from != null) { min = lineNo(line); }
  11122. }
  11123. line.markedSpans = removeMarkedSpan(line.markedSpans, span);
  11124. if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
  11125. { updateLineHeight(line, textHeight(cm.display)); }
  11126. }
  11127. if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
  11128. var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
  11129. if (len > cm.display.maxLineLength) {
  11130. cm.display.maxLine = visual;
  11131. cm.display.maxLineLength = len;
  11132. cm.display.maxLineChanged = true;
  11133. }
  11134. } }
  11135. if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
  11136. this.lines.length = 0;
  11137. this.explicitlyCleared = true;
  11138. if (this.atomic && this.doc.cantEdit) {
  11139. this.doc.cantEdit = false;
  11140. if (cm) { reCheckSelection(cm.doc); }
  11141. }
  11142. if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
  11143. if (withOp) { endOperation(cm); }
  11144. if (this.parent) { this.parent.clear(); }
  11145. };
  11146. // Find the position of the marker in the document. Returns a {from,
  11147. // to} object by default. Side can be passed to get a specific side
  11148. // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
  11149. // Pos objects returned contain a line object, rather than a line
  11150. // number (used to prevent looking up the same line twice).
  11151. TextMarker.prototype.find = function (side, lineObj) {
  11152. var this$1 = this;
  11153. if (side == null && this.type == "bookmark") { side = 1; }
  11154. var from, to;
  11155. for (var i = 0; i < this.lines.length; ++i) {
  11156. var line = this$1.lines[i];
  11157. var span = getMarkedSpanFor(line.markedSpans, this$1);
  11158. if (span.from != null) {
  11159. from = Pos(lineObj ? line : lineNo(line), span.from);
  11160. if (side == -1) { return from }
  11161. }
  11162. if (span.to != null) {
  11163. to = Pos(lineObj ? line : lineNo(line), span.to);
  11164. if (side == 1) { return to }
  11165. }
  11166. }
  11167. return from && {from: from, to: to}
  11168. };
  11169. // Signals that the marker's widget changed, and surrounding layout
  11170. // should be recomputed.
  11171. TextMarker.prototype.changed = function () {
  11172. var this$1 = this;
  11173. var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
  11174. if (!pos || !cm) { return }
  11175. runInOp(cm, function () {
  11176. var line = pos.line, lineN = lineNo(pos.line);
  11177. var view = findViewForLine(cm, lineN);
  11178. if (view) {
  11179. clearLineMeasurementCacheFor(view);
  11180. cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
  11181. }
  11182. cm.curOp.updateMaxLine = true;
  11183. if (!lineIsHidden(widget.doc, line) && widget.height != null) {
  11184. var oldHeight = widget.height;
  11185. widget.height = null;
  11186. var dHeight = widgetHeight(widget) - oldHeight;
  11187. if (dHeight)
  11188. { updateLineHeight(line, line.height + dHeight); }
  11189. }
  11190. signalLater(cm, "markerChanged", cm, this$1);
  11191. });
  11192. };
  11193. TextMarker.prototype.attachLine = function (line) {
  11194. if (!this.lines.length && this.doc.cm) {
  11195. var op = this.doc.cm.curOp;
  11196. if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
  11197. { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
  11198. }
  11199. this.lines.push(line);
  11200. };
  11201. TextMarker.prototype.detachLine = function (line) {
  11202. this.lines.splice(indexOf(this.lines, line), 1);
  11203. if (!this.lines.length && this.doc.cm) {
  11204. var op = this.doc.cm.curOp;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
  11205. }
  11206. };
  11207. eventMixin(TextMarker);
  11208. // Create a marker, wire it up to the right lines, and
  11209. function markText(doc, from, to, options, type) {
  11210. // Shared markers (across linked documents) are handled separately
  11211. // (markTextShared will call out to this again, once per
  11212. // document).
  11213. if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
  11214. // Ensure we are in an operation.
  11215. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
  11216. var marker = new TextMarker(doc, type), diff = cmp(from, to);
  11217. if (options) { copyObj(options, marker, false); }
  11218. // Don't connect empty markers unless clearWhenEmpty is false
  11219. if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
  11220. { return marker }
  11221. if (marker.replacedWith) {
  11222. // Showing up as a widget implies collapsed (widget replaces text)
  11223. marker.collapsed = true;
  11224. marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
  11225. if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
  11226. if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
  11227. }
  11228. if (marker.collapsed) {
  11229. if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
  11230. from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
  11231. { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
  11232. seeCollapsedSpans();
  11233. }
  11234. if (marker.addToHistory)
  11235. { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
  11236. var curLine = from.line, cm = doc.cm, updateMaxLine;
  11237. doc.iter(curLine, to.line + 1, function (line) {
  11238. if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
  11239. { updateMaxLine = true; }
  11240. if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
  11241. addMarkedSpan(line, new MarkedSpan(marker,
  11242. curLine == from.line ? from.ch : null,
  11243. curLine == to.line ? to.ch : null));
  11244. ++curLine;
  11245. });
  11246. // lineIsHidden depends on the presence of the spans, so needs a second pass
  11247. if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
  11248. if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
  11249. }); }
  11250. if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
  11251. if (marker.readOnly) {
  11252. seeReadOnlySpans();
  11253. if (doc.history.done.length || doc.history.undone.length)
  11254. { doc.clearHistory(); }
  11255. }
  11256. if (marker.collapsed) {
  11257. marker.id = ++nextMarkerId;
  11258. marker.atomic = true;
  11259. }
  11260. if (cm) {
  11261. // Sync editor state
  11262. if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
  11263. if (marker.collapsed)
  11264. { regChange(cm, from.line, to.line + 1); }
  11265. else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
  11266. { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
  11267. if (marker.atomic) { reCheckSelection(cm.doc); }
  11268. signalLater(cm, "markerAdded", cm, marker);
  11269. }
  11270. return marker
  11271. }
  11272. // SHARED TEXTMARKERS
  11273. // A shared marker spans multiple linked documents. It is
  11274. // implemented as a meta-marker-object controlling multiple normal
  11275. // markers.
  11276. var SharedTextMarker = function(markers, primary) {
  11277. var this$1 = this;
  11278. this.markers = markers;
  11279. this.primary = primary;
  11280. for (var i = 0; i < markers.length; ++i)
  11281. { markers[i].parent = this$1; }
  11282. };
  11283. SharedTextMarker.prototype.clear = function () {
  11284. var this$1 = this;
  11285. if (this.explicitlyCleared) { return }
  11286. this.explicitlyCleared = true;
  11287. for (var i = 0; i < this.markers.length; ++i)
  11288. { this$1.markers[i].clear(); }
  11289. signalLater(this, "clear");
  11290. };
  11291. SharedTextMarker.prototype.find = function (side, lineObj) {
  11292. return this.primary.find(side, lineObj)
  11293. };
  11294. eventMixin(SharedTextMarker);
  11295. function markTextShared(doc, from, to, options, type) {
  11296. options = copyObj(options);
  11297. options.shared = false;
  11298. var markers = [markText(doc, from, to, options, type)], primary = markers[0];
  11299. var widget = options.widgetNode;
  11300. linkedDocs(doc, function (doc) {
  11301. if (widget) { options.widgetNode = widget.cloneNode(true); }
  11302. markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
  11303. for (var i = 0; i < doc.linked.length; ++i)
  11304. { if (doc.linked[i].isParent) { return } }
  11305. primary = lst(markers);
  11306. });
  11307. return new SharedTextMarker(markers, primary)
  11308. }
  11309. function findSharedMarkers(doc) {
  11310. return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
  11311. }
  11312. function copySharedMarkers(doc, markers) {
  11313. for (var i = 0; i < markers.length; i++) {
  11314. var marker = markers[i], pos = marker.find();
  11315. var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
  11316. if (cmp(mFrom, mTo)) {
  11317. var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
  11318. marker.markers.push(subMark);
  11319. subMark.parent = marker;
  11320. }
  11321. }
  11322. }
  11323. function detachSharedMarkers(markers) {
  11324. var loop = function ( i ) {
  11325. var marker = markers[i], linked = [marker.primary.doc];
  11326. linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
  11327. for (var j = 0; j < marker.markers.length; j++) {
  11328. var subMarker = marker.markers[j];
  11329. if (indexOf(linked, subMarker.doc) == -1) {
  11330. subMarker.parent = null;
  11331. marker.markers.splice(j--, 1);
  11332. }
  11333. }
  11334. };
  11335. for (var i = 0; i < markers.length; i++) loop( i );
  11336. }
  11337. var nextDocId = 0;
  11338. var Doc = function(text, mode, firstLine, lineSep, direction) {
  11339. if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
  11340. if (firstLine == null) { firstLine = 0; }
  11341. BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
  11342. this.first = firstLine;
  11343. this.scrollTop = this.scrollLeft = 0;
  11344. this.cantEdit = false;
  11345. this.cleanGeneration = 1;
  11346. this.frontier = firstLine;
  11347. var start = Pos(firstLine, 0);
  11348. this.sel = simpleSelection(start);
  11349. this.history = new History(null);
  11350. this.id = ++nextDocId;
  11351. this.modeOption = mode;
  11352. this.lineSep = lineSep;
  11353. this.direction = (direction == "rtl") ? "rtl" : "ltr";
  11354. this.extend = false;
  11355. if (typeof text == "string") { text = this.splitLines(text); }
  11356. updateDoc(this, {from: start, to: start, text: text});
  11357. setSelection(this, simpleSelection(start), sel_dontScroll);
  11358. };
  11359. Doc.prototype = createObj(BranchChunk.prototype, {
  11360. constructor: Doc,
  11361. // Iterate over the document. Supports two forms -- with only one
  11362. // argument, it calls that for each line in the document. With
  11363. // three, it iterates over the range given by the first two (with
  11364. // the second being non-inclusive).
  11365. iter: function(from, to, op) {
  11366. if (op) { this.iterN(from - this.first, to - from, op); }
  11367. else { this.iterN(this.first, this.first + this.size, from); }
  11368. },
  11369. // Non-public interface for adding and removing lines.
  11370. insert: function(at, lines) {
  11371. var height = 0;
  11372. for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
  11373. this.insertInner(at - this.first, lines, height);
  11374. },
  11375. remove: function(at, n) { this.removeInner(at - this.first, n); },
  11376. // From here, the methods are part of the public interface. Most
  11377. // are also available from CodeMirror (editor) instances.
  11378. getValue: function(lineSep) {
  11379. var lines = getLines(this, this.first, this.first + this.size);
  11380. if (lineSep === false) { return lines }
  11381. return lines.join(lineSep || this.lineSeparator())
  11382. },
  11383. setValue: docMethodOp(function(code) {
  11384. var top = Pos(this.first, 0), last = this.first + this.size - 1;
  11385. makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
  11386. text: this.splitLines(code), origin: "setValue", full: true}, true);
  11387. setSelection(this, simpleSelection(top));
  11388. }),
  11389. replaceRange: function(code, from, to, origin) {
  11390. from = clipPos(this, from);
  11391. to = to ? clipPos(this, to) : from;
  11392. replaceRange(this, code, from, to, origin);
  11393. },
  11394. getRange: function(from, to, lineSep) {
  11395. var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
  11396. if (lineSep === false) { return lines }
  11397. return lines.join(lineSep || this.lineSeparator())
  11398. },
  11399. getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
  11400. getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
  11401. getLineNumber: function(line) {return lineNo(line)},
  11402. getLineHandleVisualStart: function(line) {
  11403. if (typeof line == "number") { line = getLine(this, line); }
  11404. return visualLine(line)
  11405. },
  11406. lineCount: function() {return this.size},
  11407. firstLine: function() {return this.first},
  11408. lastLine: function() {return this.first + this.size - 1},
  11409. clipPos: function(pos) {return clipPos(this, pos)},
  11410. getCursor: function(start) {
  11411. var range$$1 = this.sel.primary(), pos;
  11412. if (start == null || start == "head") { pos = range$$1.head; }
  11413. else if (start == "anchor") { pos = range$$1.anchor; }
  11414. else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
  11415. else { pos = range$$1.from(); }
  11416. return pos
  11417. },
  11418. listSelections: function() { return this.sel.ranges },
  11419. somethingSelected: function() {return this.sel.somethingSelected()},
  11420. setCursor: docMethodOp(function(line, ch, options) {
  11421. setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
  11422. }),
  11423. setSelection: docMethodOp(function(anchor, head, options) {
  11424. setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
  11425. }),
  11426. extendSelection: docMethodOp(function(head, other, options) {
  11427. extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
  11428. }),
  11429. extendSelections: docMethodOp(function(heads, options) {
  11430. extendSelections(this, clipPosArray(this, heads), options);
  11431. }),
  11432. extendSelectionsBy: docMethodOp(function(f, options) {
  11433. var heads = map(this.sel.ranges, f);
  11434. extendSelections(this, clipPosArray(this, heads), options);
  11435. }),
  11436. setSelections: docMethodOp(function(ranges, primary, options) {
  11437. var this$1 = this;
  11438. if (!ranges.length) { return }
  11439. var out = [];
  11440. for (var i = 0; i < ranges.length; i++)
  11441. { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
  11442. clipPos(this$1, ranges[i].head)); }
  11443. if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
  11444. setSelection(this, normalizeSelection(out, primary), options);
  11445. }),
  11446. addSelection: docMethodOp(function(anchor, head, options) {
  11447. var ranges = this.sel.ranges.slice(0);
  11448. ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
  11449. setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);
  11450. }),
  11451. getSelection: function(lineSep) {
  11452. var this$1 = this;
  11453. var ranges = this.sel.ranges, lines;
  11454. for (var i = 0; i < ranges.length; i++) {
  11455. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  11456. lines = lines ? lines.concat(sel) : sel;
  11457. }
  11458. if (lineSep === false) { return lines }
  11459. else { return lines.join(lineSep || this.lineSeparator()) }
  11460. },
  11461. getSelections: function(lineSep) {
  11462. var this$1 = this;
  11463. var parts = [], ranges = this.sel.ranges;
  11464. for (var i = 0; i < ranges.length; i++) {
  11465. var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
  11466. if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
  11467. parts[i] = sel;
  11468. }
  11469. return parts
  11470. },
  11471. replaceSelection: function(code, collapse, origin) {
  11472. var dup = [];
  11473. for (var i = 0; i < this.sel.ranges.length; i++)
  11474. { dup[i] = code; }
  11475. this.replaceSelections(dup, collapse, origin || "+input");
  11476. },
  11477. replaceSelections: docMethodOp(function(code, collapse, origin) {
  11478. var this$1 = this;
  11479. var changes = [], sel = this.sel;
  11480. for (var i = 0; i < sel.ranges.length; i++) {
  11481. var range$$1 = sel.ranges[i];
  11482. changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
  11483. }
  11484. var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
  11485. for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
  11486. { makeChange(this$1, changes[i$1]); }
  11487. if (newSel) { setSelectionReplaceHistory(this, newSel); }
  11488. else if (this.cm) { ensureCursorVisible(this.cm); }
  11489. }),
  11490. undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
  11491. redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
  11492. undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
  11493. redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
  11494. setExtending: function(val) {this.extend = val;},
  11495. getExtending: function() {return this.extend},
  11496. historySize: function() {
  11497. var hist = this.history, done = 0, undone = 0;
  11498. for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
  11499. for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
  11500. return {undo: done, redo: undone}
  11501. },
  11502. clearHistory: function() {this.history = new History(this.history.maxGeneration);},
  11503. markClean: function() {
  11504. this.cleanGeneration = this.changeGeneration(true);
  11505. },
  11506. changeGeneration: function(forceSplit) {
  11507. if (forceSplit)
  11508. { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
  11509. return this.history.generation
  11510. },
  11511. isClean: function (gen) {
  11512. return this.history.generation == (gen || this.cleanGeneration)
  11513. },
  11514. getHistory: function() {
  11515. return {done: copyHistoryArray(this.history.done),
  11516. undone: copyHistoryArray(this.history.undone)}
  11517. },
  11518. setHistory: function(histData) {
  11519. var hist = this.history = new History(this.history.maxGeneration);
  11520. hist.done = copyHistoryArray(histData.done.slice(0), null, true);
  11521. hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
  11522. },
  11523. setGutterMarker: docMethodOp(function(line, gutterID, value) {
  11524. return changeLine(this, line, "gutter", function (line) {
  11525. var markers = line.gutterMarkers || (line.gutterMarkers = {});
  11526. markers[gutterID] = value;
  11527. if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
  11528. return true
  11529. })
  11530. }),
  11531. clearGutter: docMethodOp(function(gutterID) {
  11532. var this$1 = this;
  11533. this.iter(function (line) {
  11534. if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
  11535. changeLine(this$1, line, "gutter", function () {
  11536. line.gutterMarkers[gutterID] = null;
  11537. if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
  11538. return true
  11539. });
  11540. }
  11541. });
  11542. }),
  11543. lineInfo: function(line) {
  11544. var n;
  11545. if (typeof line == "number") {
  11546. if (!isLine(this, line)) { return null }
  11547. n = line;
  11548. line = getLine(this, line);
  11549. if (!line) { return null }
  11550. } else {
  11551. n = lineNo(line);
  11552. if (n == null) { return null }
  11553. }
  11554. return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
  11555. textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
  11556. widgets: line.widgets}
  11557. },
  11558. addLineClass: docMethodOp(function(handle, where, cls) {
  11559. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  11560. var prop = where == "text" ? "textClass"
  11561. : where == "background" ? "bgClass"
  11562. : where == "gutter" ? "gutterClass" : "wrapClass";
  11563. if (!line[prop]) { line[prop] = cls; }
  11564. else if (classTest(cls).test(line[prop])) { return false }
  11565. else { line[prop] += " " + cls; }
  11566. return true
  11567. })
  11568. }),
  11569. removeLineClass: docMethodOp(function(handle, where, cls) {
  11570. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  11571. var prop = where == "text" ? "textClass"
  11572. : where == "background" ? "bgClass"
  11573. : where == "gutter" ? "gutterClass" : "wrapClass";
  11574. var cur = line[prop];
  11575. if (!cur) { return false }
  11576. else if (cls == null) { line[prop] = null; }
  11577. else {
  11578. var found = cur.match(classTest(cls));
  11579. if (!found) { return false }
  11580. var end = found.index + found[0].length;
  11581. line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
  11582. }
  11583. return true
  11584. })
  11585. }),
  11586. addLineWidget: docMethodOp(function(handle, node, options) {
  11587. return addLineWidget(this, handle, node, options)
  11588. }),
  11589. removeLineWidget: function(widget) { widget.clear(); },
  11590. markText: function(from, to, options) {
  11591. return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
  11592. },
  11593. setBookmark: function(pos, options) {
  11594. var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
  11595. insertLeft: options && options.insertLeft,
  11596. clearWhenEmpty: false, shared: options && options.shared,
  11597. handleMouseEvents: options && options.handleMouseEvents};
  11598. pos = clipPos(this, pos);
  11599. return markText(this, pos, pos, realOpts, "bookmark")
  11600. },
  11601. findMarksAt: function(pos) {
  11602. pos = clipPos(this, pos);
  11603. var markers = [], spans = getLine(this, pos.line).markedSpans;
  11604. if (spans) { for (var i = 0; i < spans.length; ++i) {
  11605. var span = spans[i];
  11606. if ((span.from == null || span.from <= pos.ch) &&
  11607. (span.to == null || span.to >= pos.ch))
  11608. { markers.push(span.marker.parent || span.marker); }
  11609. } }
  11610. return markers
  11611. },
  11612. findMarks: function(from, to, filter) {
  11613. from = clipPos(this, from); to = clipPos(this, to);
  11614. var found = [], lineNo$$1 = from.line;
  11615. this.iter(from.line, to.line + 1, function (line) {
  11616. var spans = line.markedSpans;
  11617. if (spans) { for (var i = 0; i < spans.length; i++) {
  11618. var span = spans[i];
  11619. if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
  11620. span.from == null && lineNo$$1 != from.line ||
  11621. span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
  11622. (!filter || filter(span.marker)))
  11623. { found.push(span.marker.parent || span.marker); }
  11624. } }
  11625. ++lineNo$$1;
  11626. });
  11627. return found
  11628. },
  11629. getAllMarks: function() {
  11630. var markers = [];
  11631. this.iter(function (line) {
  11632. var sps = line.markedSpans;
  11633. if (sps) { for (var i = 0; i < sps.length; ++i)
  11634. { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
  11635. });
  11636. return markers
  11637. },
  11638. posFromIndex: function(off) {
  11639. var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
  11640. this.iter(function (line) {
  11641. var sz = line.text.length + sepSize;
  11642. if (sz > off) { ch = off; return true }
  11643. off -= sz;
  11644. ++lineNo$$1;
  11645. });
  11646. return clipPos(this, Pos(lineNo$$1, ch))
  11647. },
  11648. indexFromPos: function (coords) {
  11649. coords = clipPos(this, coords);
  11650. var index = coords.ch;
  11651. if (coords.line < this.first || coords.ch < 0) { return 0 }
  11652. var sepSize = this.lineSeparator().length;
  11653. this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
  11654. index += line.text.length + sepSize;
  11655. });
  11656. return index
  11657. },
  11658. copy: function(copyHistory) {
  11659. var doc = new Doc(getLines(this, this.first, this.first + this.size),
  11660. this.modeOption, this.first, this.lineSep, this.direction);
  11661. doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
  11662. doc.sel = this.sel;
  11663. doc.extend = false;
  11664. if (copyHistory) {
  11665. doc.history.undoDepth = this.history.undoDepth;
  11666. doc.setHistory(this.getHistory());
  11667. }
  11668. return doc
  11669. },
  11670. linkedDoc: function(options) {
  11671. if (!options) { options = {}; }
  11672. var from = this.first, to = this.first + this.size;
  11673. if (options.from != null && options.from > from) { from = options.from; }
  11674. if (options.to != null && options.to < to) { to = options.to; }
  11675. var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
  11676. if (options.sharedHist) { copy.history = this.history
  11677. ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
  11678. copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
  11679. copySharedMarkers(copy, findSharedMarkers(this));
  11680. return copy
  11681. },
  11682. unlinkDoc: function(other) {
  11683. var this$1 = this;
  11684. if (other instanceof CodeMirror$1) { other = other.doc; }
  11685. if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
  11686. var link = this$1.linked[i];
  11687. if (link.doc != other) { continue }
  11688. this$1.linked.splice(i, 1);
  11689. other.unlinkDoc(this$1);
  11690. detachSharedMarkers(findSharedMarkers(this$1));
  11691. break
  11692. } }
  11693. // If the histories were shared, split them again
  11694. if (other.history == this.history) {
  11695. var splitIds = [other.id];
  11696. linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
  11697. other.history = new History(null);
  11698. other.history.done = copyHistoryArray(this.history.done, splitIds);
  11699. other.history.undone = copyHistoryArray(this.history.undone, splitIds);
  11700. }
  11701. },
  11702. iterLinkedDocs: function(f) {linkedDocs(this, f);},
  11703. getMode: function() {return this.mode},
  11704. getEditor: function() {return this.cm},
  11705. splitLines: function(str) {
  11706. if (this.lineSep) { return str.split(this.lineSep) }
  11707. return splitLinesAuto(str)
  11708. },
  11709. lineSeparator: function() { return this.lineSep || "\n" },
  11710. setDirection: docMethodOp(function (dir) {
  11711. if (dir != "rtl") { dir = "ltr"; }
  11712. if (dir == this.direction) { return }
  11713. this.direction = dir;
  11714. this.iter(function (line) { return line.order = null; });
  11715. if (this.cm) { directionChanged(this.cm); }
  11716. })
  11717. });
  11718. // Public alias.
  11719. Doc.prototype.eachLine = Doc.prototype.iter;
  11720. // Kludge to work around strange IE behavior where it'll sometimes
  11721. // re-fire a series of drag-related events right after the drop (#1551)
  11722. var lastDrop = 0;
  11723. function onDrop(e) {
  11724. var cm = this;
  11725. clearDragCursor(cm);
  11726. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
  11727. { return }
  11728. e_preventDefault(e);
  11729. if (ie) { lastDrop = +new Date; }
  11730. var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
  11731. if (!pos || cm.isReadOnly()) { return }
  11732. // Might be a file drop, in which case we simply extract the text
  11733. // and insert it.
  11734. if (files && files.length && window.FileReader && window.File) {
  11735. var n = files.length, text = Array(n), read = 0;
  11736. var loadFile = function (file, i) {
  11737. if (cm.options.allowDropFileTypes &&
  11738. indexOf(cm.options.allowDropFileTypes, file.type) == -1)
  11739. { return }
  11740. var reader = new FileReader;
  11741. reader.onload = operation(cm, function () {
  11742. var content = reader.result;
  11743. if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
  11744. text[i] = content;
  11745. if (++read == n) {
  11746. pos = clipPos(cm.doc, pos);
  11747. var change = {from: pos, to: pos,
  11748. text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
  11749. origin: "paste"};
  11750. makeChange(cm.doc, change);
  11751. setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
  11752. }
  11753. });
  11754. reader.readAsText(file);
  11755. };
  11756. for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
  11757. } else { // Normal drop
  11758. // Don't do a replace if the drop happened inside of the selected text.
  11759. if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
  11760. cm.state.draggingText(e);
  11761. // Ensure the editor is re-focused
  11762. setTimeout(function () { return cm.display.input.focus(); }, 20);
  11763. return
  11764. }
  11765. try {
  11766. var text$1 = e.dataTransfer.getData("Text");
  11767. if (text$1) {
  11768. var selected;
  11769. if (cm.state.draggingText && !cm.state.draggingText.copy)
  11770. { selected = cm.listSelections(); }
  11771. setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
  11772. if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
  11773. { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
  11774. cm.replaceSelection(text$1, "around", "paste");
  11775. cm.display.input.focus();
  11776. }
  11777. }
  11778. catch(e){}
  11779. }
  11780. }
  11781. function onDragStart(cm, e) {
  11782. if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
  11783. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
  11784. e.dataTransfer.setData("Text", cm.getSelection());
  11785. e.dataTransfer.effectAllowed = "copyMove";
  11786. // Use dummy image instead of default browsers image.
  11787. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
  11788. if (e.dataTransfer.setDragImage && !safari) {
  11789. var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
  11790. img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
  11791. if (presto) {
  11792. img.width = img.height = 1;
  11793. cm.display.wrapper.appendChild(img);
  11794. // Force a relayout, or Opera won't use our image for some obscure reason
  11795. img._top = img.offsetTop;
  11796. }
  11797. e.dataTransfer.setDragImage(img, 0, 0);
  11798. if (presto) { img.parentNode.removeChild(img); }
  11799. }
  11800. }
  11801. function onDragOver(cm, e) {
  11802. var pos = posFromMouse(cm, e);
  11803. if (!pos) { return }
  11804. var frag = document.createDocumentFragment();
  11805. drawSelectionCursor(cm, pos, frag);
  11806. if (!cm.display.dragCursor) {
  11807. cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
  11808. cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
  11809. }
  11810. removeChildrenAndAdd(cm.display.dragCursor, frag);
  11811. }
  11812. function clearDragCursor(cm) {
  11813. if (cm.display.dragCursor) {
  11814. cm.display.lineSpace.removeChild(cm.display.dragCursor);
  11815. cm.display.dragCursor = null;
  11816. }
  11817. }
  11818. // These must be handled carefully, because naively registering a
  11819. // handler for each editor will cause the editors to never be
  11820. // garbage collected.
  11821. function forEachCodeMirror(f) {
  11822. if (!document.body.getElementsByClassName) { return }
  11823. var byClass = document.body.getElementsByClassName("CodeMirror");
  11824. for (var i = 0; i < byClass.length; i++) {
  11825. var cm = byClass[i].CodeMirror;
  11826. if (cm) { f(cm); }
  11827. }
  11828. }
  11829. var globalsRegistered = false;
  11830. function ensureGlobalHandlers() {
  11831. if (globalsRegistered) { return }
  11832. registerGlobalHandlers();
  11833. globalsRegistered = true;
  11834. }
  11835. function registerGlobalHandlers() {
  11836. // When the window resizes, we need to refresh active editors.
  11837. var resizeTimer;
  11838. on(window, "resize", function () {
  11839. if (resizeTimer == null) { resizeTimer = setTimeout(function () {
  11840. resizeTimer = null;
  11841. forEachCodeMirror(onResize);
  11842. }, 100); }
  11843. });
  11844. // When the window loses focus, we want to show the editor as blurred
  11845. on(window, "blur", function () { return forEachCodeMirror(onBlur); });
  11846. }
  11847. // Called when the window resizes
  11848. function onResize(cm) {
  11849. var d = cm.display;
  11850. if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
  11851. { return }
  11852. // Might be a text scaling operation, clear size caches.
  11853. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  11854. d.scrollbarsClipped = false;
  11855. cm.setSize();
  11856. }
  11857. var keyNames = {
  11858. 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
  11859. 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
  11860. 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
  11861. 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
  11862. 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
  11863. 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
  11864. 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
  11865. 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
  11866. };
  11867. // Number keys
  11868. for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
  11869. // Alphabetic keys
  11870. for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
  11871. // Function keys
  11872. for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
  11873. var keyMap = {};
  11874. keyMap.basic = {
  11875. "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
  11876. "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
  11877. "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
  11878. "Tab": "defaultTab", "Shift-Tab": "indentAuto",
  11879. "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
  11880. "Esc": "singleSelection"
  11881. };
  11882. // Note that the save and find-related commands aren't defined by
  11883. // default. User code or addons can define them. Unknown commands
  11884. // are simply ignored.
  11885. keyMap.pcDefault = {
  11886. "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
  11887. "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
  11888. "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
  11889. "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
  11890. "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
  11891. "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
  11892. "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
  11893. fallthrough: "basic"
  11894. };
  11895. // Very basic readline/emacs-style bindings, which are standard on Mac.
  11896. keyMap.emacsy = {
  11897. "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
  11898. "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
  11899. "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
  11900. "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
  11901. "Ctrl-O": "openLine"
  11902. };
  11903. keyMap.macDefault = {
  11904. "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
  11905. "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
  11906. "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
  11907. "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
  11908. "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
  11909. "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
  11910. "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
  11911. fallthrough: ["basic", "emacsy"]
  11912. };
  11913. keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
  11914. // KEYMAP DISPATCH
  11915. function normalizeKeyName(name) {
  11916. var parts = name.split(/-(?!$)/);
  11917. name = parts[parts.length - 1];
  11918. var alt, ctrl, shift, cmd;
  11919. for (var i = 0; i < parts.length - 1; i++) {
  11920. var mod = parts[i];
  11921. if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
  11922. else if (/^a(lt)?$/i.test(mod)) { alt = true; }
  11923. else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
  11924. else if (/^s(hift)?$/i.test(mod)) { shift = true; }
  11925. else { throw new Error("Unrecognized modifier name: " + mod) }
  11926. }
  11927. if (alt) { name = "Alt-" + name; }
  11928. if (ctrl) { name = "Ctrl-" + name; }
  11929. if (cmd) { name = "Cmd-" + name; }
  11930. if (shift) { name = "Shift-" + name; }
  11931. return name
  11932. }
  11933. // This is a kludge to keep keymaps mostly working as raw objects
  11934. // (backwards compatibility) while at the same time support features
  11935. // like normalization and multi-stroke key bindings. It compiles a
  11936. // new normalized keymap, and then updates the old object to reflect
  11937. // this.
  11938. function normalizeKeyMap(keymap) {
  11939. var copy = {};
  11940. for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
  11941. var value = keymap[keyname];
  11942. if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
  11943. if (value == "...") { delete keymap[keyname]; continue }
  11944. var keys = map(keyname.split(" "), normalizeKeyName);
  11945. for (var i = 0; i < keys.length; i++) {
  11946. var val = (void 0), name = (void 0);
  11947. if (i == keys.length - 1) {
  11948. name = keys.join(" ");
  11949. val = value;
  11950. } else {
  11951. name = keys.slice(0, i + 1).join(" ");
  11952. val = "...";
  11953. }
  11954. var prev = copy[name];
  11955. if (!prev) { copy[name] = val; }
  11956. else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
  11957. }
  11958. delete keymap[keyname];
  11959. } }
  11960. for (var prop in copy) { keymap[prop] = copy[prop]; }
  11961. return keymap
  11962. }
  11963. function lookupKey(key, map$$1, handle, context) {
  11964. map$$1 = getKeyMap(map$$1);
  11965. var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
  11966. if (found === false) { return "nothing" }
  11967. if (found === "...") { return "multi" }
  11968. if (found != null && handle(found)) { return "handled" }
  11969. if (map$$1.fallthrough) {
  11970. if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
  11971. { return lookupKey(key, map$$1.fallthrough, handle, context) }
  11972. for (var i = 0; i < map$$1.fallthrough.length; i++) {
  11973. var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
  11974. if (result) { return result }
  11975. }
  11976. }
  11977. }
  11978. // Modifier key presses don't count as 'real' key presses for the
  11979. // purpose of keymap fallthrough.
  11980. function isModifierKey(value) {
  11981. var name = typeof value == "string" ? value : keyNames[value.keyCode];
  11982. return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
  11983. }
  11984. // Look up the name of a key as indicated by an event object.
  11985. function keyName(event, noShift) {
  11986. if (presto && event.keyCode == 34 && event["char"]) { return false }
  11987. var base = keyNames[event.keyCode], name = base;
  11988. if (name == null || event.altGraphKey) { return false }
  11989. if (event.altKey && base != "Alt") { name = "Alt-" + name; }
  11990. if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
  11991. if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
  11992. if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
  11993. return name
  11994. }
  11995. function getKeyMap(val) {
  11996. return typeof val == "string" ? keyMap[val] : val
  11997. }
  11998. // Helper for deleting text near the selection(s), used to implement
  11999. // backspace, delete, and similar functionality.
  12000. function deleteNearSelection(cm, compute) {
  12001. var ranges = cm.doc.sel.ranges, kill = [];
  12002. // Build up a set of ranges to kill first, merging overlapping
  12003. // ranges.
  12004. for (var i = 0; i < ranges.length; i++) {
  12005. var toKill = compute(ranges[i]);
  12006. while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
  12007. var replaced = kill.pop();
  12008. if (cmp(replaced.from, toKill.from) < 0) {
  12009. toKill.from = replaced.from;
  12010. break
  12011. }
  12012. }
  12013. kill.push(toKill);
  12014. }
  12015. // Next, remove those actual ranges.
  12016. runInOp(cm, function () {
  12017. for (var i = kill.length - 1; i >= 0; i--)
  12018. { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
  12019. ensureCursorVisible(cm);
  12020. });
  12021. }
  12022. // Commands are parameter-less actions that can be performed on an
  12023. // editor, mostly used for keybindings.
  12024. var commands = {
  12025. selectAll: selectAll,
  12026. singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
  12027. killLine: function (cm) { return deleteNearSelection(cm, function (range) {
  12028. if (range.empty()) {
  12029. var len = getLine(cm.doc, range.head.line).text.length;
  12030. if (range.head.ch == len && range.head.line < cm.lastLine())
  12031. { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
  12032. else
  12033. { return {from: range.head, to: Pos(range.head.line, len)} }
  12034. } else {
  12035. return {from: range.from(), to: range.to()}
  12036. }
  12037. }); },
  12038. deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  12039. from: Pos(range.from().line, 0),
  12040. to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
  12041. }); }); },
  12042. delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  12043. from: Pos(range.from().line, 0), to: range.from()
  12044. }); }); },
  12045. delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
  12046. var top = cm.charCoords(range.head, "div").top + 5;
  12047. var leftPos = cm.coordsChar({left: 0, top: top}, "div");
  12048. return {from: leftPos, to: range.from()}
  12049. }); },
  12050. delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
  12051. var top = cm.charCoords(range.head, "div").top + 5;
  12052. var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
  12053. return {from: range.from(), to: rightPos }
  12054. }); },
  12055. undo: function (cm) { return cm.undo(); },
  12056. redo: function (cm) { return cm.redo(); },
  12057. undoSelection: function (cm) { return cm.undoSelection(); },
  12058. redoSelection: function (cm) { return cm.redoSelection(); },
  12059. goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
  12060. goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
  12061. goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
  12062. {origin: "+move", bias: 1}
  12063. ); },
  12064. goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
  12065. {origin: "+move", bias: 1}
  12066. ); },
  12067. goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
  12068. {origin: "+move", bias: -1}
  12069. ); },
  12070. goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
  12071. var top = cm.charCoords(range.head, "div").top + 5;
  12072. return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
  12073. }, sel_move); },
  12074. goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
  12075. var top = cm.charCoords(range.head, "div").top + 5;
  12076. return cm.coordsChar({left: 0, top: top}, "div")
  12077. }, sel_move); },
  12078. goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
  12079. var top = cm.charCoords(range.head, "div").top + 5;
  12080. var pos = cm.coordsChar({left: 0, top: top}, "div");
  12081. if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
  12082. return pos
  12083. }, sel_move); },
  12084. goLineUp: function (cm) { return cm.moveV(-1, "line"); },
  12085. goLineDown: function (cm) { return cm.moveV(1, "line"); },
  12086. goPageUp: function (cm) { return cm.moveV(-1, "page"); },
  12087. goPageDown: function (cm) { return cm.moveV(1, "page"); },
  12088. goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
  12089. goCharRight: function (cm) { return cm.moveH(1, "char"); },
  12090. goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
  12091. goColumnRight: function (cm) { return cm.moveH(1, "column"); },
  12092. goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
  12093. goGroupRight: function (cm) { return cm.moveH(1, "group"); },
  12094. goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
  12095. goWordRight: function (cm) { return cm.moveH(1, "word"); },
  12096. delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
  12097. delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
  12098. delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
  12099. delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
  12100. delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
  12101. delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
  12102. indentAuto: function (cm) { return cm.indentSelection("smart"); },
  12103. indentMore: function (cm) { return cm.indentSelection("add"); },
  12104. indentLess: function (cm) { return cm.indentSelection("subtract"); },
  12105. insertTab: function (cm) { return cm.replaceSelection("\t"); },
  12106. insertSoftTab: function (cm) {
  12107. var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
  12108. for (var i = 0; i < ranges.length; i++) {
  12109. var pos = ranges[i].from();
  12110. var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
  12111. spaces.push(spaceStr(tabSize - col % tabSize));
  12112. }
  12113. cm.replaceSelections(spaces);
  12114. },
  12115. defaultTab: function (cm) {
  12116. if (cm.somethingSelected()) { cm.indentSelection("add"); }
  12117. else { cm.execCommand("insertTab"); }
  12118. },
  12119. // Swap the two chars left and right of each selection's head.
  12120. // Move cursor behind the two swapped characters afterwards.
  12121. //
  12122. // Doesn't consider line feeds a character.
  12123. // Doesn't scan more than one line above to find a character.
  12124. // Doesn't do anything on an empty line.
  12125. // Doesn't do anything with non-empty selections.
  12126. transposeChars: function (cm) { return runInOp(cm, function () {
  12127. var ranges = cm.listSelections(), newSel = [];
  12128. for (var i = 0; i < ranges.length; i++) {
  12129. if (!ranges[i].empty()) { continue }
  12130. var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
  12131. if (line) {
  12132. if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
  12133. if (cur.ch > 0) {
  12134. cur = new Pos(cur.line, cur.ch + 1);
  12135. cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
  12136. Pos(cur.line, cur.ch - 2), cur, "+transpose");
  12137. } else if (cur.line > cm.doc.first) {
  12138. var prev = getLine(cm.doc, cur.line - 1).text;
  12139. if (prev) {
  12140. cur = new Pos(cur.line, 1);
  12141. cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
  12142. prev.charAt(prev.length - 1),
  12143. Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
  12144. }
  12145. }
  12146. }
  12147. newSel.push(new Range(cur, cur));
  12148. }
  12149. cm.setSelections(newSel);
  12150. }); },
  12151. newlineAndIndent: function (cm) { return runInOp(cm, function () {
  12152. var sels = cm.listSelections();
  12153. for (var i = sels.length - 1; i >= 0; i--)
  12154. { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
  12155. sels = cm.listSelections();
  12156. for (var i$1 = 0; i$1 < sels.length; i$1++)
  12157. { cm.indentLine(sels[i$1].from().line, null, true); }
  12158. ensureCursorVisible(cm);
  12159. }); },
  12160. openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
  12161. toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
  12162. };
  12163. function lineStart(cm, lineN) {
  12164. var line = getLine(cm.doc, lineN);
  12165. var visual = visualLine(line);
  12166. if (visual != line) { lineN = lineNo(visual); }
  12167. return endOfLine(true, cm, visual, lineN, 1)
  12168. }
  12169. function lineEnd(cm, lineN) {
  12170. var line = getLine(cm.doc, lineN);
  12171. var visual = visualLineEnd(line);
  12172. if (visual != line) { lineN = lineNo(visual); }
  12173. return endOfLine(true, cm, line, lineN, -1)
  12174. }
  12175. function lineStartSmart(cm, pos) {
  12176. var start = lineStart(cm, pos.line);
  12177. var line = getLine(cm.doc, start.line);
  12178. var order = getOrder(line, cm.doc.direction);
  12179. if (!order || order[0].level == 0) {
  12180. var firstNonWS = Math.max(0, line.text.search(/\S/));
  12181. var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
  12182. return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
  12183. }
  12184. return start
  12185. }
  12186. // Run a handler that was bound to a key.
  12187. function doHandleBinding(cm, bound, dropShift) {
  12188. if (typeof bound == "string") {
  12189. bound = commands[bound];
  12190. if (!bound) { return false }
  12191. }
  12192. // Ensure previous input has been read, so that the handler sees a
  12193. // consistent view of the document
  12194. cm.display.input.ensurePolled();
  12195. var prevShift = cm.display.shift, done = false;
  12196. try {
  12197. if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
  12198. if (dropShift) { cm.display.shift = false; }
  12199. done = bound(cm) != Pass;
  12200. } finally {
  12201. cm.display.shift = prevShift;
  12202. cm.state.suppressEdits = false;
  12203. }
  12204. return done
  12205. }
  12206. function lookupKeyForEditor(cm, name, handle) {
  12207. for (var i = 0; i < cm.state.keyMaps.length; i++) {
  12208. var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
  12209. if (result) { return result }
  12210. }
  12211. return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
  12212. || lookupKey(name, cm.options.keyMap, handle, cm)
  12213. }
  12214. var stopSeq = new Delayed;
  12215. function dispatchKey(cm, name, e, handle) {
  12216. var seq = cm.state.keySeq;
  12217. if (seq) {
  12218. if (isModifierKey(name)) { return "handled" }
  12219. stopSeq.set(50, function () {
  12220. if (cm.state.keySeq == seq) {
  12221. cm.state.keySeq = null;
  12222. cm.display.input.reset();
  12223. }
  12224. });
  12225. name = seq + " " + name;
  12226. }
  12227. var result = lookupKeyForEditor(cm, name, handle);
  12228. if (result == "multi")
  12229. { cm.state.keySeq = name; }
  12230. if (result == "handled")
  12231. { signalLater(cm, "keyHandled", cm, name, e); }
  12232. if (result == "handled" || result == "multi") {
  12233. e_preventDefault(e);
  12234. restartBlink(cm);
  12235. }
  12236. if (seq && !result && /\'$/.test(name)) {
  12237. e_preventDefault(e);
  12238. return true
  12239. }
  12240. return !!result
  12241. }
  12242. // Handle a key from the keydown event.
  12243. function handleKeyBinding(cm, e) {
  12244. var name = keyName(e, true);
  12245. if (!name) { return false }
  12246. if (e.shiftKey && !cm.state.keySeq) {
  12247. // First try to resolve full name (including 'Shift-'). Failing
  12248. // that, see if there is a cursor-motion command (starting with
  12249. // 'go') bound to the keyname without 'Shift-'.
  12250. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
  12251. || dispatchKey(cm, name, e, function (b) {
  12252. if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
  12253. { return doHandleBinding(cm, b) }
  12254. })
  12255. } else {
  12256. return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
  12257. }
  12258. }
  12259. // Handle a key from the keypress event
  12260. function handleCharBinding(cm, e, ch) {
  12261. return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
  12262. }
  12263. var lastStoppedKey = null;
  12264. function onKeyDown(e) {
  12265. var cm = this;
  12266. cm.curOp.focus = activeElt();
  12267. if (signalDOMEvent(cm, e)) { return }
  12268. // IE does strange things with escape.
  12269. if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
  12270. var code = e.keyCode;
  12271. cm.display.shift = code == 16 || e.shiftKey;
  12272. var handled = handleKeyBinding(cm, e);
  12273. if (presto) {
  12274. lastStoppedKey = handled ? code : null;
  12275. // Opera has no cut event... we try to at least catch the key combo
  12276. if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
  12277. { cm.replaceSelection("", null, "cut"); }
  12278. }
  12279. // Turn mouse into crosshair when Alt is held on Mac.
  12280. if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
  12281. { showCrossHair(cm); }
  12282. }
  12283. function showCrossHair(cm) {
  12284. var lineDiv = cm.display.lineDiv;
  12285. addClass(lineDiv, "CodeMirror-crosshair");
  12286. function up(e) {
  12287. if (e.keyCode == 18 || !e.altKey) {
  12288. rmClass(lineDiv, "CodeMirror-crosshair");
  12289. off(document, "keyup", up);
  12290. off(document, "mouseover", up);
  12291. }
  12292. }
  12293. on(document, "keyup", up);
  12294. on(document, "mouseover", up);
  12295. }
  12296. function onKeyUp(e) {
  12297. if (e.keyCode == 16) { this.doc.sel.shift = false; }
  12298. signalDOMEvent(this, e);
  12299. }
  12300. function onKeyPress(e) {
  12301. var cm = this;
  12302. if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
  12303. var keyCode = e.keyCode, charCode = e.charCode;
  12304. if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
  12305. if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
  12306. var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
  12307. // Some browsers fire keypress events for backspace
  12308. if (ch == "\x08") { return }
  12309. if (handleCharBinding(cm, e, ch)) { return }
  12310. cm.display.input.onKeyPress(e);
  12311. }
  12312. // A mouse down can be a single click, double click, triple click,
  12313. // start of selection drag, start of text drag, new cursor
  12314. // (ctrl-click), rectangle drag (alt-drag), or xwin
  12315. // middle-click-paste. Or it might be a click on something we should
  12316. // not interfere with, such as a scrollbar or widget.
  12317. function onMouseDown(e) {
  12318. var cm = this, display = cm.display;
  12319. if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
  12320. display.input.ensurePolled();
  12321. display.shift = e.shiftKey;
  12322. if (eventInWidget(display, e)) {
  12323. if (!webkit) {
  12324. // Briefly turn off draggability, to allow widgets to do
  12325. // normal dragging things.
  12326. display.scroller.draggable = false;
  12327. setTimeout(function () { return display.scroller.draggable = true; }, 100);
  12328. }
  12329. return
  12330. }
  12331. if (clickInGutter(cm, e)) { return }
  12332. var start = posFromMouse(cm, e);
  12333. window.focus();
  12334. switch (e_button(e)) {
  12335. case 1:
  12336. // #3261: make sure, that we're not starting a second selection
  12337. if (cm.state.selectingText)
  12338. { cm.state.selectingText(e); }
  12339. else if (start)
  12340. { leftButtonDown(cm, e, start); }
  12341. else if (e_target(e) == display.scroller)
  12342. { e_preventDefault(e); }
  12343. break
  12344. case 2:
  12345. if (webkit) { cm.state.lastMiddleDown = +new Date; }
  12346. if (start) { extendSelection(cm.doc, start); }
  12347. setTimeout(function () { return display.input.focus(); }, 20);
  12348. e_preventDefault(e);
  12349. break
  12350. case 3:
  12351. if (captureRightClick) { onContextMenu(cm, e); }
  12352. else { delayBlurEvent(cm); }
  12353. break
  12354. }
  12355. }
  12356. var lastClick;
  12357. var lastDoubleClick;
  12358. function leftButtonDown(cm, e, start) {
  12359. if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
  12360. else { cm.curOp.focus = activeElt(); }
  12361. var now = +new Date, type;
  12362. if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
  12363. type = "triple";
  12364. } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
  12365. type = "double";
  12366. lastDoubleClick = {time: now, pos: start};
  12367. } else {
  12368. type = "single";
  12369. lastClick = {time: now, pos: start};
  12370. }
  12371. var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
  12372. if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
  12373. type == "single" && (contained = sel.contains(start)) > -1 &&
  12374. (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
  12375. (cmp(contained.to(), start) > 0 || start.xRel < 0))
  12376. { leftButtonStartDrag(cm, e, start, modifier); }
  12377. else
  12378. { leftButtonSelect(cm, e, start, type, modifier); }
  12379. }
  12380. // Start a text drag. When it ends, see if any dragging actually
  12381. // happen, and treat as a click if it didn't.
  12382. function leftButtonStartDrag(cm, e, start, modifier) {
  12383. var display = cm.display, startTime = +new Date;
  12384. var dragEnd = operation(cm, function (e2) {
  12385. if (webkit) { display.scroller.draggable = false; }
  12386. cm.state.draggingText = false;
  12387. off(document, "mouseup", dragEnd);
  12388. off(display.scroller, "drop", dragEnd);
  12389. if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
  12390. e_preventDefault(e2);
  12391. if (!modifier && +new Date - 200 < startTime)
  12392. { extendSelection(cm.doc, start); }
  12393. // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
  12394. if (webkit || ie && ie_version == 9)
  12395. { setTimeout(function () {document.body.focus(); display.input.focus();}, 20); }
  12396. else
  12397. { display.input.focus(); }
  12398. }
  12399. });
  12400. // Let the drag handler handle this.
  12401. if (webkit) { display.scroller.draggable = true; }
  12402. cm.state.draggingText = dragEnd;
  12403. dragEnd.copy = mac ? e.altKey : e.ctrlKey;
  12404. // IE's approach to draggable
  12405. if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
  12406. on(document, "mouseup", dragEnd);
  12407. on(display.scroller, "drop", dragEnd);
  12408. }
  12409. // Normal selection, as opposed to text dragging.
  12410. function leftButtonSelect(cm, e, start, type, addNew) {
  12411. var display = cm.display, doc = cm.doc;
  12412. e_preventDefault(e);
  12413. var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
  12414. if (addNew && !e.shiftKey) {
  12415. ourIndex = doc.sel.contains(start);
  12416. if (ourIndex > -1)
  12417. { ourRange = ranges[ourIndex]; }
  12418. else
  12419. { ourRange = new Range(start, start); }
  12420. } else {
  12421. ourRange = doc.sel.primary();
  12422. ourIndex = doc.sel.primIndex;
  12423. }
  12424. if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
  12425. type = "rect";
  12426. if (!addNew) { ourRange = new Range(start, start); }
  12427. start = posFromMouse(cm, e, true, true);
  12428. ourIndex = -1;
  12429. } else if (type == "double") {
  12430. var word = cm.findWordAt(start);
  12431. if (cm.display.shift || doc.extend)
  12432. { ourRange = extendRange(doc, ourRange, word.anchor, word.head); }
  12433. else
  12434. { ourRange = word; }
  12435. } else if (type == "triple") {
  12436. var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
  12437. if (cm.display.shift || doc.extend)
  12438. { ourRange = extendRange(doc, ourRange, line.anchor, line.head); }
  12439. else
  12440. { ourRange = line; }
  12441. } else {
  12442. ourRange = extendRange(doc, ourRange, start);
  12443. }
  12444. if (!addNew) {
  12445. ourIndex = 0;
  12446. setSelection(doc, new Selection([ourRange], 0), sel_mouse);
  12447. startSel = doc.sel;
  12448. } else if (ourIndex == -1) {
  12449. ourIndex = ranges.length;
  12450. setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
  12451. {scroll: false, origin: "*mouse"});
  12452. } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
  12453. setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
  12454. {scroll: false, origin: "*mouse"});
  12455. startSel = doc.sel;
  12456. } else {
  12457. replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
  12458. }
  12459. var lastPos = start;
  12460. function extendTo(pos) {
  12461. if (cmp(lastPos, pos) == 0) { return }
  12462. lastPos = pos;
  12463. if (type == "rect") {
  12464. var ranges = [], tabSize = cm.options.tabSize;
  12465. var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
  12466. var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
  12467. var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
  12468. for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
  12469. line <= end; line++) {
  12470. var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
  12471. if (left == right)
  12472. { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
  12473. else if (text.length > leftPos)
  12474. { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
  12475. }
  12476. if (!ranges.length) { ranges.push(new Range(start, start)); }
  12477. setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
  12478. {origin: "*mouse", scroll: false});
  12479. cm.scrollIntoView(pos);
  12480. } else {
  12481. var oldRange = ourRange;
  12482. var anchor = oldRange.anchor, head = pos;
  12483. if (type != "single") {
  12484. var range$$1;
  12485. if (type == "double")
  12486. { range$$1 = cm.findWordAt(pos); }
  12487. else
  12488. { range$$1 = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); }
  12489. if (cmp(range$$1.anchor, anchor) > 0) {
  12490. head = range$$1.head;
  12491. anchor = minPos(oldRange.from(), range$$1.anchor);
  12492. } else {
  12493. head = range$$1.anchor;
  12494. anchor = maxPos(oldRange.to(), range$$1.head);
  12495. }
  12496. }
  12497. var ranges$1 = startSel.ranges.slice(0);
  12498. ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head);
  12499. setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);
  12500. }
  12501. }
  12502. var editorSize = display.wrapper.getBoundingClientRect();
  12503. // Used to ensure timeout re-tries don't fire when another extend
  12504. // happened in the meantime (clearTimeout isn't reliable -- at
  12505. // least on Chrome, the timeouts still happen even when cleared,
  12506. // if the clear happens after their scheduled firing time).
  12507. var counter = 0;
  12508. function extend(e) {
  12509. var curCount = ++counter;
  12510. var cur = posFromMouse(cm, e, true, type == "rect");
  12511. if (!cur) { return }
  12512. if (cmp(cur, lastPos) != 0) {
  12513. cm.curOp.focus = activeElt();
  12514. extendTo(cur);
  12515. var visible = visibleLines(display, doc);
  12516. if (cur.line >= visible.to || cur.line < visible.from)
  12517. { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
  12518. } else {
  12519. var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
  12520. if (outside) { setTimeout(operation(cm, function () {
  12521. if (counter != curCount) { return }
  12522. display.scroller.scrollTop += outside;
  12523. extend(e);
  12524. }), 50); }
  12525. }
  12526. }
  12527. function done(e) {
  12528. cm.state.selectingText = false;
  12529. counter = Infinity;
  12530. e_preventDefault(e);
  12531. display.input.focus();
  12532. off(document, "mousemove", move);
  12533. off(document, "mouseup", up);
  12534. doc.history.lastSelOrigin = null;
  12535. }
  12536. var move = operation(cm, function (e) {
  12537. if (!e_button(e)) { done(e); }
  12538. else { extend(e); }
  12539. });
  12540. var up = operation(cm, done);
  12541. cm.state.selectingText = up;
  12542. on(document, "mousemove", move);
  12543. on(document, "mouseup", up);
  12544. }
  12545. // Determines whether an event happened in the gutter, and fires the
  12546. // handlers for the corresponding event.
  12547. function gutterEvent(cm, e, type, prevent) {
  12548. var mX, mY;
  12549. try { mX = e.clientX; mY = e.clientY; }
  12550. catch(e) { return false }
  12551. if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
  12552. if (prevent) { e_preventDefault(e); }
  12553. var display = cm.display;
  12554. var lineBox = display.lineDiv.getBoundingClientRect();
  12555. if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
  12556. mY -= lineBox.top - display.viewOffset;
  12557. for (var i = 0; i < cm.options.gutters.length; ++i) {
  12558. var g = display.gutters.childNodes[i];
  12559. if (g && g.getBoundingClientRect().right >= mX) {
  12560. var line = lineAtHeight(cm.doc, mY);
  12561. var gutter = cm.options.gutters[i];
  12562. signal(cm, type, cm, line, gutter, e);
  12563. return e_defaultPrevented(e)
  12564. }
  12565. }
  12566. }
  12567. function clickInGutter(cm, e) {
  12568. return gutterEvent(cm, e, "gutterClick", true)
  12569. }
  12570. // CONTEXT MENU HANDLING
  12571. // To make the context menu work, we need to briefly unhide the
  12572. // textarea (making it as unobtrusive as possible) to let the
  12573. // right-click take effect on it.
  12574. function onContextMenu(cm, e) {
  12575. if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
  12576. if (signalDOMEvent(cm, e, "contextmenu")) { return }
  12577. cm.display.input.onContextMenu(e);
  12578. }
  12579. function contextMenuInGutter(cm, e) {
  12580. if (!hasHandler(cm, "gutterContextMenu")) { return false }
  12581. return gutterEvent(cm, e, "gutterContextMenu", false)
  12582. }
  12583. function themeChanged(cm) {
  12584. cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
  12585. cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
  12586. clearCaches(cm);
  12587. }
  12588. var Init = {toString: function(){return "CodeMirror.Init"}};
  12589. var defaults = {};
  12590. var optionHandlers = {};
  12591. function defineOptions(CodeMirror) {
  12592. var optionHandlers = CodeMirror.optionHandlers;
  12593. function option(name, deflt, handle, notOnInit) {
  12594. CodeMirror.defaults[name] = deflt;
  12595. if (handle) { optionHandlers[name] =
  12596. notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
  12597. }
  12598. CodeMirror.defineOption = option;
  12599. // Passed to option handlers when there is no old value.
  12600. CodeMirror.Init = Init;
  12601. // These two are, on init, called from the constructor because they
  12602. // have to be initialized before the editor can start at all.
  12603. option("value", "", function (cm, val) { return cm.setValue(val); }, true);
  12604. option("mode", null, function (cm, val) {
  12605. cm.doc.modeOption = val;
  12606. loadMode(cm);
  12607. }, true);
  12608. option("indentUnit", 2, loadMode, true);
  12609. option("indentWithTabs", false);
  12610. option("smartIndent", true);
  12611. option("tabSize", 4, function (cm) {
  12612. resetModeState(cm);
  12613. clearCaches(cm);
  12614. regChange(cm);
  12615. }, true);
  12616. option("lineSeparator", null, function (cm, val) {
  12617. cm.doc.lineSep = val;
  12618. if (!val) { return }
  12619. var newBreaks = [], lineNo = cm.doc.first;
  12620. cm.doc.iter(function (line) {
  12621. for (var pos = 0;;) {
  12622. var found = line.text.indexOf(val, pos);
  12623. if (found == -1) { break }
  12624. pos = found + val.length;
  12625. newBreaks.push(Pos(lineNo, found));
  12626. }
  12627. lineNo++;
  12628. });
  12629. for (var i = newBreaks.length - 1; i >= 0; i--)
  12630. { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
  12631. });
  12632. option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
  12633. cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
  12634. if (old != Init) { cm.refresh(); }
  12635. });
  12636. option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
  12637. option("electricChars", true);
  12638. option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
  12639. throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
  12640. }, true);
  12641. option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
  12642. option("rtlMoveVisually", !windows);
  12643. option("wholeLineUpdateBefore", true);
  12644. option("theme", "default", function (cm) {
  12645. themeChanged(cm);
  12646. guttersChanged(cm);
  12647. }, true);
  12648. option("keyMap", "default", function (cm, val, old) {
  12649. var next = getKeyMap(val);
  12650. var prev = old != Init && getKeyMap(old);
  12651. if (prev && prev.detach) { prev.detach(cm, next); }
  12652. if (next.attach) { next.attach(cm, prev || null); }
  12653. });
  12654. option("extraKeys", null);
  12655. option("lineWrapping", false, wrappingChanged, true);
  12656. option("gutters", [], function (cm) {
  12657. setGuttersForLineNumbers(cm.options);
  12658. guttersChanged(cm);
  12659. }, true);
  12660. option("fixedGutter", true, function (cm, val) {
  12661. cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
  12662. cm.refresh();
  12663. }, true);
  12664. option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
  12665. option("scrollbarStyle", "native", function (cm) {
  12666. initScrollbars(cm);
  12667. updateScrollbars(cm);
  12668. cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
  12669. cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
  12670. }, true);
  12671. option("lineNumbers", false, function (cm) {
  12672. setGuttersForLineNumbers(cm.options);
  12673. guttersChanged(cm);
  12674. }, true);
  12675. option("firstLineNumber", 1, guttersChanged, true);
  12676. option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true);
  12677. option("showCursorWhenSelecting", false, updateSelection, true);
  12678. option("resetSelectionOnContextMenu", true);
  12679. option("lineWiseCopyCut", true);
  12680. option("readOnly", false, function (cm, val) {
  12681. if (val == "nocursor") {
  12682. onBlur(cm);
  12683. cm.display.input.blur();
  12684. cm.display.disabled = true;
  12685. } else {
  12686. cm.display.disabled = false;
  12687. }
  12688. cm.display.input.readOnlyChanged(val);
  12689. });
  12690. option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
  12691. option("dragDrop", true, dragDropChanged);
  12692. option("allowDropFileTypes", null);
  12693. option("cursorBlinkRate", 530);
  12694. option("cursorScrollMargin", 0);
  12695. option("cursorHeight", 1, updateSelection, true);
  12696. option("singleCursorHeightPerLine", true, updateSelection, true);
  12697. option("workTime", 100);
  12698. option("workDelay", 100);
  12699. option("flattenSpans", true, resetModeState, true);
  12700. option("addModeClass", false, resetModeState, true);
  12701. option("pollInterval", 100);
  12702. option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
  12703. option("historyEventDelay", 1250);
  12704. option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
  12705. option("maxHighlightLength", 10000, resetModeState, true);
  12706. option("moveInputWithCursor", true, function (cm, val) {
  12707. if (!val) { cm.display.input.resetPosition(); }
  12708. });
  12709. option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
  12710. option("autofocus", null);
  12711. option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
  12712. }
  12713. function guttersChanged(cm) {
  12714. updateGutters(cm);
  12715. regChange(cm);
  12716. alignHorizontally(cm);
  12717. }
  12718. function dragDropChanged(cm, value, old) {
  12719. var wasOn = old && old != Init;
  12720. if (!value != !wasOn) {
  12721. var funcs = cm.display.dragFunctions;
  12722. var toggle = value ? on : off;
  12723. toggle(cm.display.scroller, "dragstart", funcs.start);
  12724. toggle(cm.display.scroller, "dragenter", funcs.enter);
  12725. toggle(cm.display.scroller, "dragover", funcs.over);
  12726. toggle(cm.display.scroller, "dragleave", funcs.leave);
  12727. toggle(cm.display.scroller, "drop", funcs.drop);
  12728. }
  12729. }
  12730. function wrappingChanged(cm) {
  12731. if (cm.options.lineWrapping) {
  12732. addClass(cm.display.wrapper, "CodeMirror-wrap");
  12733. cm.display.sizer.style.minWidth = "";
  12734. cm.display.sizerWidth = null;
  12735. } else {
  12736. rmClass(cm.display.wrapper, "CodeMirror-wrap");
  12737. findMaxLine(cm);
  12738. }
  12739. estimateLineHeights(cm);
  12740. regChange(cm);
  12741. clearCaches(cm);
  12742. setTimeout(function () { return updateScrollbars(cm); }, 100);
  12743. }
  12744. // A CodeMirror instance represents an editor. This is the object
  12745. // that user code is usually dealing with.
  12746. function CodeMirror$1(place, options) {
  12747. var this$1 = this;
  12748. if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }
  12749. this.options = options = options ? copyObj(options) : {};
  12750. // Determine effective options based on given values and defaults.
  12751. copyObj(defaults, options, false);
  12752. setGuttersForLineNumbers(options);
  12753. var doc = options.value;
  12754. if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
  12755. this.doc = doc;
  12756. var input = new CodeMirror$1.inputStyles[options.inputStyle](this);
  12757. var display = this.display = new Display(place, doc, input);
  12758. display.wrapper.CodeMirror = this;
  12759. updateGutters(this);
  12760. themeChanged(this);
  12761. if (options.lineWrapping)
  12762. { this.display.wrapper.className += " CodeMirror-wrap"; }
  12763. initScrollbars(this);
  12764. this.state = {
  12765. keyMaps: [], // stores maps added by addKeyMap
  12766. overlays: [], // highlighting overlays, as added by addOverlay
  12767. modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
  12768. overwrite: false,
  12769. delayingBlurEvent: false,
  12770. focused: false,
  12771. suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
  12772. pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
  12773. selectingText: false,
  12774. draggingText: false,
  12775. highlight: new Delayed(), // stores highlight worker timeout
  12776. keySeq: null, // Unfinished key sequence
  12777. specialChars: null
  12778. };
  12779. if (options.autofocus && !mobile) { display.input.focus(); }
  12780. // Override magic textarea content restore that IE sometimes does
  12781. // on our hidden textarea on reload
  12782. if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
  12783. registerEventHandlers(this);
  12784. ensureGlobalHandlers();
  12785. startOperation(this);
  12786. this.curOp.forceUpdate = true;
  12787. attachDoc(this, doc);
  12788. if ((options.autofocus && !mobile) || this.hasFocus())
  12789. { setTimeout(bind(onFocus, this), 20); }
  12790. else
  12791. { onBlur(this); }
  12792. for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
  12793. { optionHandlers[opt](this$1, options[opt], Init); } }
  12794. maybeUpdateLineNumberWidth(this);
  12795. if (options.finishInit) { options.finishInit(this); }
  12796. for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
  12797. endOperation(this);
  12798. // Suppress optimizelegibility in Webkit, since it breaks text
  12799. // measuring on line wrapping boundaries.
  12800. if (webkit && options.lineWrapping &&
  12801. getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
  12802. { display.lineDiv.style.textRendering = "auto"; }
  12803. }
  12804. // The default configuration options.
  12805. CodeMirror$1.defaults = defaults;
  12806. // Functions to run when options are changed.
  12807. CodeMirror$1.optionHandlers = optionHandlers;
  12808. // Attach the necessary event handlers when initializing the editor
  12809. function registerEventHandlers(cm) {
  12810. var d = cm.display;
  12811. on(d.scroller, "mousedown", operation(cm, onMouseDown));
  12812. // Older IE's will not fire a second mousedown for a double click
  12813. if (ie && ie_version < 11)
  12814. { on(d.scroller, "dblclick", operation(cm, function (e) {
  12815. if (signalDOMEvent(cm, e)) { return }
  12816. var pos = posFromMouse(cm, e);
  12817. if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
  12818. e_preventDefault(e);
  12819. var word = cm.findWordAt(pos);
  12820. extendSelection(cm.doc, word.anchor, word.head);
  12821. })); }
  12822. else
  12823. { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
  12824. // Some browsers fire contextmenu *after* opening the menu, at
  12825. // which point we can't mess with it anymore. Context menu is
  12826. // handled in onMouseDown for these browsers.
  12827. if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }); }
  12828. // Used to suppress mouse event handling when a touch happens
  12829. var touchFinished, prevTouch = {end: 0};
  12830. function finishTouch() {
  12831. if (d.activeTouch) {
  12832. touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
  12833. prevTouch = d.activeTouch;
  12834. prevTouch.end = +new Date;
  12835. }
  12836. }
  12837. function isMouseLikeTouchEvent(e) {
  12838. if (e.touches.length != 1) { return false }
  12839. var touch = e.touches[0];
  12840. return touch.radiusX <= 1 && touch.radiusY <= 1
  12841. }
  12842. function farAway(touch, other) {
  12843. if (other.left == null) { return true }
  12844. var dx = other.left - touch.left, dy = other.top - touch.top;
  12845. return dx * dx + dy * dy > 20 * 20
  12846. }
  12847. on(d.scroller, "touchstart", function (e) {
  12848. if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
  12849. d.input.ensurePolled();
  12850. clearTimeout(touchFinished);
  12851. var now = +new Date;
  12852. d.activeTouch = {start: now, moved: false,
  12853. prev: now - prevTouch.end <= 300 ? prevTouch : null};
  12854. if (e.touches.length == 1) {
  12855. d.activeTouch.left = e.touches[0].pageX;
  12856. d.activeTouch.top = e.touches[0].pageY;
  12857. }
  12858. }
  12859. });
  12860. on(d.scroller, "touchmove", function () {
  12861. if (d.activeTouch) { d.activeTouch.moved = true; }
  12862. });
  12863. on(d.scroller, "touchend", function (e) {
  12864. var touch = d.activeTouch;
  12865. if (touch && !eventInWidget(d, e) && touch.left != null &&
  12866. !touch.moved && new Date - touch.start < 300) {
  12867. var pos = cm.coordsChar(d.activeTouch, "page"), range;
  12868. if (!touch.prev || farAway(touch, touch.prev)) // Single tap
  12869. { range = new Range(pos, pos); }
  12870. else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
  12871. { range = cm.findWordAt(pos); }
  12872. else // Triple tap
  12873. { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
  12874. cm.setSelection(range.anchor, range.head);
  12875. cm.focus();
  12876. e_preventDefault(e);
  12877. }
  12878. finishTouch();
  12879. });
  12880. on(d.scroller, "touchcancel", finishTouch);
  12881. // Sync scrolling between fake scrollbars and real scrollable
  12882. // area, ensure viewport is updated when scrolling.
  12883. on(d.scroller, "scroll", function () {
  12884. if (d.scroller.clientHeight) {
  12885. setScrollTop(cm, d.scroller.scrollTop);
  12886. setScrollLeft(cm, d.scroller.scrollLeft, true);
  12887. signal(cm, "scroll", cm);
  12888. }
  12889. });
  12890. // Listen to wheel events in order to try and update the viewport on time.
  12891. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
  12892. on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
  12893. // Prevent wrapper from ever scrolling
  12894. on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
  12895. d.dragFunctions = {
  12896. enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
  12897. over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
  12898. start: function (e) { return onDragStart(cm, e); },
  12899. drop: operation(cm, onDrop),
  12900. leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
  12901. };
  12902. var inp = d.input.getField();
  12903. on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
  12904. on(inp, "keydown", operation(cm, onKeyDown));
  12905. on(inp, "keypress", operation(cm, onKeyPress));
  12906. on(inp, "focus", function (e) { return onFocus(cm, e); });
  12907. on(inp, "blur", function (e) { return onBlur(cm, e); });
  12908. }
  12909. var initHooks = [];
  12910. CodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); };
  12911. // Indent the given line. The how parameter can be "smart",
  12912. // "add"/null, "subtract", or "prev". When aggressive is false
  12913. // (typically set to true for forced single-line indents), empty
  12914. // lines are not indented, and places where the mode returns Pass
  12915. // are left alone.
  12916. function indentLine(cm, n, how, aggressive) {
  12917. var doc = cm.doc, state;
  12918. if (how == null) { how = "add"; }
  12919. if (how == "smart") {
  12920. // Fall back to "prev" when the mode doesn't have an indentation
  12921. // method.
  12922. if (!doc.mode.indent) { how = "prev"; }
  12923. else { state = getStateBefore(cm, n); }
  12924. }
  12925. var tabSize = cm.options.tabSize;
  12926. var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
  12927. if (line.stateAfter) { line.stateAfter = null; }
  12928. var curSpaceString = line.text.match(/^\s*/)[0], indentation;
  12929. if (!aggressive && !/\S/.test(line.text)) {
  12930. indentation = 0;
  12931. how = "not";
  12932. } else if (how == "smart") {
  12933. indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
  12934. if (indentation == Pass || indentation > 150) {
  12935. if (!aggressive) { return }
  12936. how = "prev";
  12937. }
  12938. }
  12939. if (how == "prev") {
  12940. if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
  12941. else { indentation = 0; }
  12942. } else if (how == "add") {
  12943. indentation = curSpace + cm.options.indentUnit;
  12944. } else if (how == "subtract") {
  12945. indentation = curSpace - cm.options.indentUnit;
  12946. } else if (typeof how == "number") {
  12947. indentation = curSpace + how;
  12948. }
  12949. indentation = Math.max(0, indentation);
  12950. var indentString = "", pos = 0;
  12951. if (cm.options.indentWithTabs)
  12952. { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
  12953. if (pos < indentation) { indentString += spaceStr(indentation - pos); }
  12954. if (indentString != curSpaceString) {
  12955. replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
  12956. line.stateAfter = null;
  12957. return true
  12958. } else {
  12959. // Ensure that, if the cursor was in the whitespace at the start
  12960. // of the line, it is moved to the end of that space.
  12961. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
  12962. var range = doc.sel.ranges[i$1];
  12963. if (range.head.line == n && range.head.ch < curSpaceString.length) {
  12964. var pos$1 = Pos(n, curSpaceString.length);
  12965. replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
  12966. break
  12967. }
  12968. }
  12969. }
  12970. }
  12971. // This will be set to a {lineWise: bool, text: [string]} object, so
  12972. // that, when pasting, we know what kind of selections the copied
  12973. // text was made out of.
  12974. var lastCopied = null;
  12975. function setLastCopied(newLastCopied) {
  12976. lastCopied = newLastCopied;
  12977. }
  12978. function applyTextInput(cm, inserted, deleted, sel, origin) {
  12979. var doc = cm.doc;
  12980. cm.display.shift = false;
  12981. if (!sel) { sel = doc.sel; }
  12982. var paste = cm.state.pasteIncoming || origin == "paste";
  12983. var textLines = splitLinesAuto(inserted), multiPaste = null;
  12984. // When pasing N lines into N selections, insert one line per selection
  12985. if (paste && sel.ranges.length > 1) {
  12986. if (lastCopied && lastCopied.text.join("\n") == inserted) {
  12987. if (sel.ranges.length % lastCopied.text.length == 0) {
  12988. multiPaste = [];
  12989. for (var i = 0; i < lastCopied.text.length; i++)
  12990. { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
  12991. }
  12992. } else if (textLines.length == sel.ranges.length) {
  12993. multiPaste = map(textLines, function (l) { return [l]; });
  12994. }
  12995. }
  12996. var updateInput;
  12997. // Normal behavior is to insert the new text into every selection
  12998. for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
  12999. var range$$1 = sel.ranges[i$1];
  13000. var from = range$$1.from(), to = range$$1.to();
  13001. if (range$$1.empty()) {
  13002. if (deleted && deleted > 0) // Handle deletion
  13003. { from = Pos(from.line, from.ch - deleted); }
  13004. else if (cm.state.overwrite && !paste) // Handle overwrite
  13005. { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
  13006. else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
  13007. { from = to = Pos(from.line, 0); }
  13008. }
  13009. updateInput = cm.curOp.updateInput;
  13010. var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
  13011. origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
  13012. makeChange(cm.doc, changeEvent);
  13013. signalLater(cm, "inputRead", cm, changeEvent);
  13014. }
  13015. if (inserted && !paste)
  13016. { triggerElectric(cm, inserted); }
  13017. ensureCursorVisible(cm);
  13018. cm.curOp.updateInput = updateInput;
  13019. cm.curOp.typing = true;
  13020. cm.state.pasteIncoming = cm.state.cutIncoming = false;
  13021. }
  13022. function handlePaste(e, cm) {
  13023. var pasted = e.clipboardData && e.clipboardData.getData("Text");
  13024. if (pasted) {
  13025. e.preventDefault();
  13026. if (!cm.isReadOnly() && !cm.options.disableInput)
  13027. { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
  13028. return true
  13029. }
  13030. }
  13031. function triggerElectric(cm, inserted) {
  13032. // When an 'electric' character is inserted, immediately trigger a reindent
  13033. if (!cm.options.electricChars || !cm.options.smartIndent) { return }
  13034. var sel = cm.doc.sel;
  13035. for (var i = sel.ranges.length - 1; i >= 0; i--) {
  13036. var range$$1 = sel.ranges[i];
  13037. if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
  13038. var mode = cm.getModeAt(range$$1.head);
  13039. var indented = false;
  13040. if (mode.electricChars) {
  13041. for (var j = 0; j < mode.electricChars.length; j++)
  13042. { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
  13043. indented = indentLine(cm, range$$1.head.line, "smart");
  13044. break
  13045. } }
  13046. } else if (mode.electricInput) {
  13047. if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
  13048. { indented = indentLine(cm, range$$1.head.line, "smart"); }
  13049. }
  13050. if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
  13051. }
  13052. }
  13053. function copyableRanges(cm) {
  13054. var text = [], ranges = [];
  13055. for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
  13056. var line = cm.doc.sel.ranges[i].head.line;
  13057. var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
  13058. ranges.push(lineRange);
  13059. text.push(cm.getRange(lineRange.anchor, lineRange.head));
  13060. }
  13061. return {text: text, ranges: ranges}
  13062. }
  13063. function disableBrowserMagic(field, spellcheck) {
  13064. field.setAttribute("autocorrect", "off");
  13065. field.setAttribute("autocapitalize", "off");
  13066. field.setAttribute("spellcheck", !!spellcheck);
  13067. }
  13068. function hiddenTextarea() {
  13069. var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
  13070. var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
  13071. // The textarea is kept positioned near the cursor to prevent the
  13072. // fact that it'll be scrolled into view on input from scrolling
  13073. // our fake cursor out of view. On webkit, when wrap=off, paste is
  13074. // very slow. So make the area wide instead.
  13075. if (webkit) { te.style.width = "1000px"; }
  13076. else { te.setAttribute("wrap", "off"); }
  13077. // If border: 0; -- iOS fails to open keyboard (issue #1287)
  13078. if (ios) { te.style.border = "1px solid black"; }
  13079. disableBrowserMagic(te);
  13080. return div
  13081. }
  13082. // The publicly visible API. Note that methodOp(f) means
  13083. // 'wrap f in an operation, performed on its `this` parameter'.
  13084. // This is not the complete set of editor methods. Most of the
  13085. // methods defined on the Doc type are also injected into
  13086. // CodeMirror.prototype, for backwards compatibility and
  13087. // convenience.
  13088. var addEditorMethods = function(CodeMirror) {
  13089. var optionHandlers = CodeMirror.optionHandlers;
  13090. var helpers = CodeMirror.helpers = {};
  13091. CodeMirror.prototype = {
  13092. constructor: CodeMirror,
  13093. focus: function(){window.focus(); this.display.input.focus();},
  13094. setOption: function(option, value) {
  13095. var options = this.options, old = options[option];
  13096. if (options[option] == value && option != "mode") { return }
  13097. options[option] = value;
  13098. if (optionHandlers.hasOwnProperty(option))
  13099. { operation(this, optionHandlers[option])(this, value, old); }
  13100. signal(this, "optionChange", this, option);
  13101. },
  13102. getOption: function(option) {return this.options[option]},
  13103. getDoc: function() {return this.doc},
  13104. addKeyMap: function(map$$1, bottom) {
  13105. this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
  13106. },
  13107. removeKeyMap: function(map$$1) {
  13108. var maps = this.state.keyMaps;
  13109. for (var i = 0; i < maps.length; ++i)
  13110. { if (maps[i] == map$$1 || maps[i].name == map$$1) {
  13111. maps.splice(i, 1);
  13112. return true
  13113. } }
  13114. },
  13115. addOverlay: methodOp(function(spec, options) {
  13116. var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
  13117. if (mode.startState) { throw new Error("Overlays may not be stateful.") }
  13118. insertSorted(this.state.overlays,
  13119. {mode: mode, modeSpec: spec, opaque: options && options.opaque,
  13120. priority: (options && options.priority) || 0},
  13121. function (overlay) { return overlay.priority; });
  13122. this.state.modeGen++;
  13123. regChange(this);
  13124. }),
  13125. removeOverlay: methodOp(function(spec) {
  13126. var this$1 = this;
  13127. var overlays = this.state.overlays;
  13128. for (var i = 0; i < overlays.length; ++i) {
  13129. var cur = overlays[i].modeSpec;
  13130. if (cur == spec || typeof spec == "string" && cur.name == spec) {
  13131. overlays.splice(i, 1);
  13132. this$1.state.modeGen++;
  13133. regChange(this$1);
  13134. return
  13135. }
  13136. }
  13137. }),
  13138. indentLine: methodOp(function(n, dir, aggressive) {
  13139. if (typeof dir != "string" && typeof dir != "number") {
  13140. if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
  13141. else { dir = dir ? "add" : "subtract"; }
  13142. }
  13143. if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
  13144. }),
  13145. indentSelection: methodOp(function(how) {
  13146. var this$1 = this;
  13147. var ranges = this.doc.sel.ranges, end = -1;
  13148. for (var i = 0; i < ranges.length; i++) {
  13149. var range$$1 = ranges[i];
  13150. if (!range$$1.empty()) {
  13151. var from = range$$1.from(), to = range$$1.to();
  13152. var start = Math.max(end, from.line);
  13153. end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
  13154. for (var j = start; j < end; ++j)
  13155. { indentLine(this$1, j, how); }
  13156. var newRanges = this$1.doc.sel.ranges;
  13157. if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
  13158. { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
  13159. } else if (range$$1.head.line > end) {
  13160. indentLine(this$1, range$$1.head.line, how, true);
  13161. end = range$$1.head.line;
  13162. if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
  13163. }
  13164. }
  13165. }),
  13166. // Fetch the parser token for a given character. Useful for hacks
  13167. // that want to inspect the mode state (say, for completion).
  13168. getTokenAt: function(pos, precise) {
  13169. return takeToken(this, pos, precise)
  13170. },
  13171. getLineTokens: function(line, precise) {
  13172. return takeToken(this, Pos(line), precise, true)
  13173. },
  13174. getTokenTypeAt: function(pos) {
  13175. pos = clipPos(this.doc, pos);
  13176. var styles = getLineStyles(this, getLine(this.doc, pos.line));
  13177. var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
  13178. var type;
  13179. if (ch == 0) { type = styles[2]; }
  13180. else { for (;;) {
  13181. var mid = (before + after) >> 1;
  13182. if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
  13183. else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
  13184. else { type = styles[mid * 2 + 2]; break }
  13185. } }
  13186. var cut = type ? type.indexOf("overlay ") : -1;
  13187. return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
  13188. },
  13189. getModeAt: function(pos) {
  13190. var mode = this.doc.mode;
  13191. if (!mode.innerMode) { return mode }
  13192. return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
  13193. },
  13194. getHelper: function(pos, type) {
  13195. return this.getHelpers(pos, type)[0]
  13196. },
  13197. getHelpers: function(pos, type) {
  13198. var this$1 = this;
  13199. var found = [];
  13200. if (!helpers.hasOwnProperty(type)) { return found }
  13201. var help = helpers[type], mode = this.getModeAt(pos);
  13202. if (typeof mode[type] == "string") {
  13203. if (help[mode[type]]) { found.push(help[mode[type]]); }
  13204. } else if (mode[type]) {
  13205. for (var i = 0; i < mode[type].length; i++) {
  13206. var val = help[mode[type][i]];
  13207. if (val) { found.push(val); }
  13208. }
  13209. } else if (mode.helperType && help[mode.helperType]) {
  13210. found.push(help[mode.helperType]);
  13211. } else if (help[mode.name]) {
  13212. found.push(help[mode.name]);
  13213. }
  13214. for (var i$1 = 0; i$1 < help._global.length; i$1++) {
  13215. var cur = help._global[i$1];
  13216. if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
  13217. { found.push(cur.val); }
  13218. }
  13219. return found
  13220. },
  13221. getStateAfter: function(line, precise) {
  13222. var doc = this.doc;
  13223. line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
  13224. return getStateBefore(this, line + 1, precise)
  13225. },
  13226. cursorCoords: function(start, mode) {
  13227. var pos, range$$1 = this.doc.sel.primary();
  13228. if (start == null) { pos = range$$1.head; }
  13229. else if (typeof start == "object") { pos = clipPos(this.doc, start); }
  13230. else { pos = start ? range$$1.from() : range$$1.to(); }
  13231. return cursorCoords(this, pos, mode || "page")
  13232. },
  13233. charCoords: function(pos, mode) {
  13234. return charCoords(this, clipPos(this.doc, pos), mode || "page")
  13235. },
  13236. coordsChar: function(coords, mode) {
  13237. coords = fromCoordSystem(this, coords, mode || "page");
  13238. return coordsChar(this, coords.left, coords.top)
  13239. },
  13240. lineAtHeight: function(height, mode) {
  13241. height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
  13242. return lineAtHeight(this.doc, height + this.display.viewOffset)
  13243. },
  13244. heightAtLine: function(line, mode, includeWidgets) {
  13245. var end = false, lineObj;
  13246. if (typeof line == "number") {
  13247. var last = this.doc.first + this.doc.size - 1;
  13248. if (line < this.doc.first) { line = this.doc.first; }
  13249. else if (line > last) { line = last; end = true; }
  13250. lineObj = getLine(this.doc, line);
  13251. } else {
  13252. lineObj = line;
  13253. }
  13254. return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
  13255. (end ? this.doc.height - heightAtLine(lineObj) : 0)
  13256. },
  13257. defaultTextHeight: function() { return textHeight(this.display) },
  13258. defaultCharWidth: function() { return charWidth(this.display) },
  13259. getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
  13260. addWidget: function(pos, node, scroll, vert, horiz) {
  13261. var display = this.display;
  13262. pos = cursorCoords(this, clipPos(this.doc, pos));
  13263. var top = pos.bottom, left = pos.left;
  13264. node.style.position = "absolute";
  13265. node.setAttribute("cm-ignore-events", "true");
  13266. this.display.input.setUneditable(node);
  13267. display.sizer.appendChild(node);
  13268. if (vert == "over") {
  13269. top = pos.top;
  13270. } else if (vert == "above" || vert == "near") {
  13271. var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
  13272. hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
  13273. // Default to positioning above (if specified and possible); otherwise default to positioning below
  13274. if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
  13275. { top = pos.top - node.offsetHeight; }
  13276. else if (pos.bottom + node.offsetHeight <= vspace)
  13277. { top = pos.bottom; }
  13278. if (left + node.offsetWidth > hspace)
  13279. { left = hspace - node.offsetWidth; }
  13280. }
  13281. node.style.top = top + "px";
  13282. node.style.left = node.style.right = "";
  13283. if (horiz == "right") {
  13284. left = display.sizer.clientWidth - node.offsetWidth;
  13285. node.style.right = "0px";
  13286. } else {
  13287. if (horiz == "left") { left = 0; }
  13288. else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
  13289. node.style.left = left + "px";
  13290. }
  13291. if (scroll)
  13292. { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
  13293. },
  13294. triggerOnKeyDown: methodOp(onKeyDown),
  13295. triggerOnKeyPress: methodOp(onKeyPress),
  13296. triggerOnKeyUp: onKeyUp,
  13297. execCommand: function(cmd) {
  13298. if (commands.hasOwnProperty(cmd))
  13299. { return commands[cmd].call(null, this) }
  13300. },
  13301. triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
  13302. findPosH: function(from, amount, unit, visually) {
  13303. var this$1 = this;
  13304. var dir = 1;
  13305. if (amount < 0) { dir = -1; amount = -amount; }
  13306. var cur = clipPos(this.doc, from);
  13307. for (var i = 0; i < amount; ++i) {
  13308. cur = findPosH(this$1.doc, cur, dir, unit, visually);
  13309. if (cur.hitSide) { break }
  13310. }
  13311. return cur
  13312. },
  13313. moveH: methodOp(function(dir, unit) {
  13314. var this$1 = this;
  13315. this.extendSelectionsBy(function (range$$1) {
  13316. if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
  13317. { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
  13318. else
  13319. { return dir < 0 ? range$$1.from() : range$$1.to() }
  13320. }, sel_move);
  13321. }),
  13322. deleteH: methodOp(function(dir, unit) {
  13323. var sel = this.doc.sel, doc = this.doc;
  13324. if (sel.somethingSelected())
  13325. { doc.replaceSelection("", null, "+delete"); }
  13326. else
  13327. { deleteNearSelection(this, function (range$$1) {
  13328. var other = findPosH(doc, range$$1.head, dir, unit, false);
  13329. return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
  13330. }); }
  13331. }),
  13332. findPosV: function(from, amount, unit, goalColumn) {
  13333. var this$1 = this;
  13334. var dir = 1, x = goalColumn;
  13335. if (amount < 0) { dir = -1; amount = -amount; }
  13336. var cur = clipPos(this.doc, from);
  13337. for (var i = 0; i < amount; ++i) {
  13338. var coords = cursorCoords(this$1, cur, "div");
  13339. if (x == null) { x = coords.left; }
  13340. else { coords.left = x; }
  13341. cur = findPosV(this$1, coords, dir, unit);
  13342. if (cur.hitSide) { break }
  13343. }
  13344. return cur
  13345. },
  13346. moveV: methodOp(function(dir, unit) {
  13347. var this$1 = this;
  13348. var doc = this.doc, goals = [];
  13349. var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
  13350. doc.extendSelectionsBy(function (range$$1) {
  13351. if (collapse)
  13352. { return dir < 0 ? range$$1.from() : range$$1.to() }
  13353. var headPos = cursorCoords(this$1, range$$1.head, "div");
  13354. if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
  13355. goals.push(headPos.left);
  13356. var pos = findPosV(this$1, headPos, dir, unit);
  13357. if (unit == "page" && range$$1 == doc.sel.primary())
  13358. { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top); }
  13359. return pos
  13360. }, sel_move);
  13361. if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
  13362. { doc.sel.ranges[i].goalColumn = goals[i]; } }
  13363. }),
  13364. // Find the word at the given position (as returned by coordsChar).
  13365. findWordAt: function(pos) {
  13366. var doc = this.doc, line = getLine(doc, pos.line).text;
  13367. var start = pos.ch, end = pos.ch;
  13368. if (line) {
  13369. var helper = this.getHelper(pos, "wordChars");
  13370. if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
  13371. var startChar = line.charAt(start);
  13372. var check = isWordChar(startChar, helper)
  13373. ? function (ch) { return isWordChar(ch, helper); }
  13374. : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
  13375. : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
  13376. while (start > 0 && check(line.charAt(start - 1))) { --start; }
  13377. while (end < line.length && check(line.charAt(end))) { ++end; }
  13378. }
  13379. return new Range(Pos(pos.line, start), Pos(pos.line, end))
  13380. },
  13381. toggleOverwrite: function(value) {
  13382. if (value != null && value == this.state.overwrite) { return }
  13383. if (this.state.overwrite = !this.state.overwrite)
  13384. { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  13385. else
  13386. { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  13387. signal(this, "overwriteToggle", this, this.state.overwrite);
  13388. },
  13389. hasFocus: function() { return this.display.input.getField() == activeElt() },
  13390. isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
  13391. scrollTo: methodOp(function(x, y) {
  13392. if (x != null || y != null) { resolveScrollToPos(this); }
  13393. if (x != null) { this.curOp.scrollLeft = x; }
  13394. if (y != null) { this.curOp.scrollTop = y; }
  13395. }),
  13396. getScrollInfo: function() {
  13397. var scroller = this.display.scroller;
  13398. return {left: scroller.scrollLeft, top: scroller.scrollTop,
  13399. height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
  13400. width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
  13401. clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
  13402. },
  13403. scrollIntoView: methodOp(function(range$$1, margin) {
  13404. if (range$$1 == null) {
  13405. range$$1 = {from: this.doc.sel.primary().head, to: null};
  13406. if (margin == null) { margin = this.options.cursorScrollMargin; }
  13407. } else if (typeof range$$1 == "number") {
  13408. range$$1 = {from: Pos(range$$1, 0), to: null};
  13409. } else if (range$$1.from == null) {
  13410. range$$1 = {from: range$$1, to: null};
  13411. }
  13412. if (!range$$1.to) { range$$1.to = range$$1.from; }
  13413. range$$1.margin = margin || 0;
  13414. if (range$$1.from.line != null) {
  13415. resolveScrollToPos(this);
  13416. this.curOp.scrollToPos = range$$1;
  13417. } else {
  13418. var sPos = calculateScrollPos(this, {
  13419. left: Math.min(range$$1.from.left, range$$1.to.left),
  13420. top: Math.min(range$$1.from.top, range$$1.to.top) - range$$1.margin,
  13421. right: Math.max(range$$1.from.right, range$$1.to.right),
  13422. bottom: Math.max(range$$1.from.bottom, range$$1.to.bottom) + range$$1.margin
  13423. });
  13424. this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
  13425. }
  13426. }),
  13427. setSize: methodOp(function(width, height) {
  13428. var this$1 = this;
  13429. var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
  13430. if (width != null) { this.display.wrapper.style.width = interpret(width); }
  13431. if (height != null) { this.display.wrapper.style.height = interpret(height); }
  13432. if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
  13433. var lineNo$$1 = this.display.viewFrom;
  13434. this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
  13435. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
  13436. { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
  13437. ++lineNo$$1;
  13438. });
  13439. this.curOp.forceUpdate = true;
  13440. signal(this, "refresh", this);
  13441. }),
  13442. operation: function(f){return runInOp(this, f)},
  13443. refresh: methodOp(function() {
  13444. var oldHeight = this.display.cachedTextHeight;
  13445. regChange(this);
  13446. this.curOp.forceUpdate = true;
  13447. clearCaches(this);
  13448. this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
  13449. updateGutterSpace(this);
  13450. if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
  13451. { estimateLineHeights(this); }
  13452. signal(this, "refresh", this);
  13453. }),
  13454. swapDoc: methodOp(function(doc) {
  13455. var old = this.doc;
  13456. old.cm = null;
  13457. attachDoc(this, doc);
  13458. clearCaches(this);
  13459. this.display.input.reset();
  13460. this.scrollTo(doc.scrollLeft, doc.scrollTop);
  13461. this.curOp.forceScroll = true;
  13462. signalLater(this, "swapDoc", this, old);
  13463. return old
  13464. }),
  13465. getInputField: function(){return this.display.input.getField()},
  13466. getWrapperElement: function(){return this.display.wrapper},
  13467. getScrollerElement: function(){return this.display.scroller},
  13468. getGutterElement: function(){return this.display.gutters}
  13469. };
  13470. eventMixin(CodeMirror);
  13471. CodeMirror.registerHelper = function(type, name, value) {
  13472. if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
  13473. helpers[type][name] = value;
  13474. };
  13475. CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
  13476. CodeMirror.registerHelper(type, name, value);
  13477. helpers[type]._global.push({pred: predicate, val: value});
  13478. };
  13479. };
  13480. // Used for horizontal relative motion. Dir is -1 or 1 (left or
  13481. // right), unit can be "char", "column" (like char, but doesn't
  13482. // cross line boundaries), "word" (across next word), or "group" (to
  13483. // the start of next group of word or non-word-non-whitespace
  13484. // chars). The visually param controls whether, in right-to-left
  13485. // text, direction 1 means to move towards the next index in the
  13486. // string, or towards the character to the right of the current
  13487. // position. The resulting position will have a hitSide=true
  13488. // property if it reached the end of the document.
  13489. function findPosH(doc, pos, dir, unit, visually) {
  13490. var oldPos = pos;
  13491. var origDir = dir;
  13492. var lineObj = getLine(doc, pos.line);
  13493. function findNextLine() {
  13494. var l = pos.line + dir;
  13495. if (l < doc.first || l >= doc.first + doc.size) { return false }
  13496. pos = new Pos(l, pos.ch, pos.sticky);
  13497. return lineObj = getLine(doc, l)
  13498. }
  13499. function moveOnce(boundToLine) {
  13500. var next;
  13501. if (visually) {
  13502. next = moveVisually(doc.cm, lineObj, pos, dir);
  13503. } else {
  13504. next = moveLogically(lineObj, pos, dir);
  13505. }
  13506. if (next == null) {
  13507. if (!boundToLine && findNextLine())
  13508. { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
  13509. else
  13510. { return false }
  13511. } else {
  13512. pos = next;
  13513. }
  13514. return true
  13515. }
  13516. if (unit == "char") {
  13517. moveOnce();
  13518. } else if (unit == "column") {
  13519. moveOnce(true);
  13520. } else if (unit == "word" || unit == "group") {
  13521. var sawType = null, group = unit == "group";
  13522. var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
  13523. for (var first = true;; first = false) {
  13524. if (dir < 0 && !moveOnce(!first)) { break }
  13525. var cur = lineObj.text.charAt(pos.ch) || "\n";
  13526. var type = isWordChar(cur, helper) ? "w"
  13527. : group && cur == "\n" ? "n"
  13528. : !group || /\s/.test(cur) ? null
  13529. : "p";
  13530. if (group && !first && !type) { type = "s"; }
  13531. if (sawType && sawType != type) {
  13532. if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
  13533. break
  13534. }
  13535. if (type) { sawType = type; }
  13536. if (dir > 0 && !moveOnce(!first)) { break }
  13537. }
  13538. }
  13539. var result = skipAtomic(doc, pos, oldPos, origDir, true);
  13540. if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
  13541. return result
  13542. }
  13543. // For relative vertical movement. Dir may be -1 or 1. Unit can be
  13544. // "page" or "line". The resulting position will have a hitSide=true
  13545. // property if it reached the end of the document.
  13546. function findPosV(cm, pos, dir, unit) {
  13547. var doc = cm.doc, x = pos.left, y;
  13548. if (unit == "page") {
  13549. var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
  13550. var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
  13551. y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
  13552. } else if (unit == "line") {
  13553. y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
  13554. }
  13555. var target;
  13556. for (;;) {
  13557. target = coordsChar(cm, x, y);
  13558. if (!target.outside) { break }
  13559. if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
  13560. y += dir * 5;
  13561. }
  13562. return target
  13563. }
  13564. // CONTENTEDITABLE INPUT STYLE
  13565. var ContentEditableInput = function(cm) {
  13566. this.cm = cm;
  13567. this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
  13568. this.polling = new Delayed();
  13569. this.composing = null;
  13570. this.gracePeriod = false;
  13571. this.readDOMTimeout = null;
  13572. };
  13573. ContentEditableInput.prototype.init = function (display) {
  13574. var this$1 = this;
  13575. var input = this, cm = input.cm;
  13576. var div = input.div = display.lineDiv;
  13577. disableBrowserMagic(div, cm.options.spellcheck);
  13578. on(div, "paste", function (e) {
  13579. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  13580. // IE doesn't fire input events, so we schedule a read for the pasted content in this way
  13581. if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
  13582. });
  13583. on(div, "compositionstart", function (e) {
  13584. this$1.composing = {data: e.data, done: false};
  13585. });
  13586. on(div, "compositionupdate", function (e) {
  13587. if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
  13588. });
  13589. on(div, "compositionend", function (e) {
  13590. if (this$1.composing) {
  13591. if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
  13592. this$1.composing.done = true;
  13593. }
  13594. });
  13595. on(div, "touchstart", function () { return input.forceCompositionEnd(); });
  13596. on(div, "input", function () {
  13597. if (!this$1.composing) { this$1.readFromDOMSoon(); }
  13598. });
  13599. function onCopyCut(e) {
  13600. if (signalDOMEvent(cm, e)) { return }
  13601. if (cm.somethingSelected()) {
  13602. setLastCopied({lineWise: false, text: cm.getSelections()});
  13603. if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
  13604. } else if (!cm.options.lineWiseCopyCut) {
  13605. return
  13606. } else {
  13607. var ranges = copyableRanges(cm);
  13608. setLastCopied({lineWise: true, text: ranges.text});
  13609. if (e.type == "cut") {
  13610. cm.operation(function () {
  13611. cm.setSelections(ranges.ranges, 0, sel_dontScroll);
  13612. cm.replaceSelection("", null, "cut");
  13613. });
  13614. }
  13615. }
  13616. if (e.clipboardData) {
  13617. e.clipboardData.clearData();
  13618. var content = lastCopied.text.join("\n");
  13619. // iOS exposes the clipboard API, but seems to discard content inserted into it
  13620. e.clipboardData.setData("Text", content);
  13621. if (e.clipboardData.getData("Text") == content) {
  13622. e.preventDefault();
  13623. return
  13624. }
  13625. }
  13626. // Old-fashioned briefly-focus-a-textarea hack
  13627. var kludge = hiddenTextarea(), te = kludge.firstChild;
  13628. cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
  13629. te.value = lastCopied.text.join("\n");
  13630. var hadFocus = document.activeElement;
  13631. selectInput(te);
  13632. setTimeout(function () {
  13633. cm.display.lineSpace.removeChild(kludge);
  13634. hadFocus.focus();
  13635. if (hadFocus == div) { input.showPrimarySelection(); }
  13636. }, 50);
  13637. }
  13638. on(div, "copy", onCopyCut);
  13639. on(div, "cut", onCopyCut);
  13640. };
  13641. ContentEditableInput.prototype.prepareSelection = function () {
  13642. var result = prepareSelection(this.cm, false);
  13643. result.focus = this.cm.state.focused;
  13644. return result
  13645. };
  13646. ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
  13647. if (!info || !this.cm.display.view.length) { return }
  13648. if (info.focus || takeFocus) { this.showPrimarySelection(); }
  13649. this.showMultipleSelections(info);
  13650. };
  13651. ContentEditableInput.prototype.showPrimarySelection = function () {
  13652. var sel = window.getSelection(), prim = this.cm.doc.sel.primary();
  13653. var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);
  13654. var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);
  13655. if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
  13656. cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&
  13657. cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)
  13658. { return }
  13659. var start = posToDOM(this.cm, prim.from());
  13660. var end = posToDOM(this.cm, prim.to());
  13661. if (!start && !end) {
  13662. sel.removeAllRanges();
  13663. return
  13664. }
  13665. var view = this.cm.display.view;
  13666. var old = sel.rangeCount && sel.getRangeAt(0);
  13667. if (!start) {
  13668. start = {node: view[0].measure.map[2], offset: 0};
  13669. } else if (!end) { // FIXME dangerously hacky
  13670. var measure = view[view.length - 1].measure;
  13671. var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
  13672. end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};
  13673. }
  13674. var rng;
  13675. try { rng = range(start.node, start.offset, end.offset, end.node); }
  13676. catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
  13677. if (rng) {
  13678. if (!gecko && this.cm.state.focused) {
  13679. sel.collapse(start.node, start.offset);
  13680. if (!rng.collapsed) {
  13681. sel.removeAllRanges();
  13682. sel.addRange(rng);
  13683. }
  13684. } else {
  13685. sel.removeAllRanges();
  13686. sel.addRange(rng);
  13687. }
  13688. if (old && sel.anchorNode == null) { sel.addRange(old); }
  13689. else if (gecko) { this.startGracePeriod(); }
  13690. }
  13691. this.rememberSelection();
  13692. };
  13693. ContentEditableInput.prototype.startGracePeriod = function () {
  13694. var this$1 = this;
  13695. clearTimeout(this.gracePeriod);
  13696. this.gracePeriod = setTimeout(function () {
  13697. this$1.gracePeriod = false;
  13698. if (this$1.selectionChanged())
  13699. { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
  13700. }, 20);
  13701. };
  13702. ContentEditableInput.prototype.showMultipleSelections = function (info) {
  13703. removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
  13704. removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
  13705. };
  13706. ContentEditableInput.prototype.rememberSelection = function () {
  13707. var sel = window.getSelection();
  13708. this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
  13709. this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
  13710. };
  13711. ContentEditableInput.prototype.selectionInEditor = function () {
  13712. var sel = window.getSelection();
  13713. if (!sel.rangeCount) { return false }
  13714. var node = sel.getRangeAt(0).commonAncestorContainer;
  13715. return contains(this.div, node)
  13716. };
  13717. ContentEditableInput.prototype.focus = function () {
  13718. if (this.cm.options.readOnly != "nocursor") {
  13719. if (!this.selectionInEditor())
  13720. { this.showSelection(this.prepareSelection(), true); }
  13721. this.div.focus();
  13722. }
  13723. };
  13724. ContentEditableInput.prototype.blur = function () { this.div.blur(); };
  13725. ContentEditableInput.prototype.getField = function () { return this.div };
  13726. ContentEditableInput.prototype.supportsTouch = function () { return true };
  13727. ContentEditableInput.prototype.receivedFocus = function () {
  13728. var input = this;
  13729. if (this.selectionInEditor())
  13730. { this.pollSelection(); }
  13731. else
  13732. { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
  13733. function poll() {
  13734. if (input.cm.state.focused) {
  13735. input.pollSelection();
  13736. input.polling.set(input.cm.options.pollInterval, poll);
  13737. }
  13738. }
  13739. this.polling.set(this.cm.options.pollInterval, poll);
  13740. };
  13741. ContentEditableInput.prototype.selectionChanged = function () {
  13742. var sel = window.getSelection();
  13743. return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
  13744. sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
  13745. };
  13746. ContentEditableInput.prototype.pollSelection = function () {
  13747. if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
  13748. var sel = window.getSelection(), cm = this.cm;
  13749. // On Android Chrome (version 56, at least), backspacing into an
  13750. // uneditable block element will put the cursor in that element,
  13751. // and then, because it's not editable, hide the virtual keyboard.
  13752. // Because Android doesn't allow us to actually detect backspace
  13753. // presses in a sane way, this code checks for when that happens
  13754. // and simulates a backspace press in this case.
  13755. if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
  13756. this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
  13757. this.blur();
  13758. this.focus();
  13759. return
  13760. }
  13761. if (this.composing) { return }
  13762. this.rememberSelection();
  13763. var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
  13764. var head = domToPos(cm, sel.focusNode, sel.focusOffset);
  13765. if (anchor && head) { runInOp(cm, function () {
  13766. setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
  13767. if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
  13768. }); }
  13769. };
  13770. ContentEditableInput.prototype.pollContent = function () {
  13771. if (this.readDOMTimeout != null) {
  13772. clearTimeout(this.readDOMTimeout);
  13773. this.readDOMTimeout = null;
  13774. }
  13775. var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
  13776. var from = sel.from(), to = sel.to();
  13777. if (from.ch == 0 && from.line > cm.firstLine())
  13778. { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
  13779. if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
  13780. { to = Pos(to.line + 1, 0); }
  13781. if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
  13782. var fromIndex, fromLine, fromNode;
  13783. if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
  13784. fromLine = lineNo(display.view[0].line);
  13785. fromNode = display.view[0].node;
  13786. } else {
  13787. fromLine = lineNo(display.view[fromIndex].line);
  13788. fromNode = display.view[fromIndex - 1].node.nextSibling;
  13789. }
  13790. var toIndex = findViewIndex(cm, to.line);
  13791. var toLine, toNode;
  13792. if (toIndex == display.view.length - 1) {
  13793. toLine = display.viewTo - 1;
  13794. toNode = display.lineDiv.lastChild;
  13795. } else {
  13796. toLine = lineNo(display.view[toIndex + 1].line) - 1;
  13797. toNode = display.view[toIndex + 1].node.previousSibling;
  13798. }
  13799. if (!fromNode) { return false }
  13800. var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
  13801. var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
  13802. while (newText.length > 1 && oldText.length > 1) {
  13803. if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
  13804. else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
  13805. else { break }
  13806. }
  13807. var cutFront = 0, cutEnd = 0;
  13808. var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
  13809. while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
  13810. { ++cutFront; }
  13811. var newBot = lst(newText), oldBot = lst(oldText);
  13812. var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
  13813. oldBot.length - (oldText.length == 1 ? cutFront : 0));
  13814. while (cutEnd < maxCutEnd &&
  13815. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
  13816. { ++cutEnd; }
  13817. // Try to move start of change to start of selection if ambiguous
  13818. if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
  13819. while (cutFront && cutFront > from.ch &&
  13820. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
  13821. cutFront--;
  13822. cutEnd++;
  13823. }
  13824. }
  13825. newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
  13826. newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
  13827. var chFrom = Pos(fromLine, cutFront);
  13828. var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
  13829. if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
  13830. replaceRange(cm.doc, newText, chFrom, chTo, "+input");
  13831. return true
  13832. }
  13833. };
  13834. ContentEditableInput.prototype.ensurePolled = function () {
  13835. this.forceCompositionEnd();
  13836. };
  13837. ContentEditableInput.prototype.reset = function () {
  13838. this.forceCompositionEnd();
  13839. };
  13840. ContentEditableInput.prototype.forceCompositionEnd = function () {
  13841. if (!this.composing) { return }
  13842. clearTimeout(this.readDOMTimeout);
  13843. this.composing = null;
  13844. this.updateFromDOM();
  13845. this.div.blur();
  13846. this.div.focus();
  13847. };
  13848. ContentEditableInput.prototype.readFromDOMSoon = function () {
  13849. var this$1 = this;
  13850. if (this.readDOMTimeout != null) { return }
  13851. this.readDOMTimeout = setTimeout(function () {
  13852. this$1.readDOMTimeout = null;
  13853. if (this$1.composing) {
  13854. if (this$1.composing.done) { this$1.composing = null; }
  13855. else { return }
  13856. }
  13857. this$1.updateFromDOM();
  13858. }, 80);
  13859. };
  13860. ContentEditableInput.prototype.updateFromDOM = function () {
  13861. var this$1 = this;
  13862. if (this.cm.isReadOnly() || !this.pollContent())
  13863. { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
  13864. };
  13865. ContentEditableInput.prototype.setUneditable = function (node) {
  13866. node.contentEditable = "false";
  13867. };
  13868. ContentEditableInput.prototype.onKeyPress = function (e) {
  13869. if (e.charCode == 0) { return }
  13870. e.preventDefault();
  13871. if (!this.cm.isReadOnly())
  13872. { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
  13873. };
  13874. ContentEditableInput.prototype.readOnlyChanged = function (val) {
  13875. this.div.contentEditable = String(val != "nocursor");
  13876. };
  13877. ContentEditableInput.prototype.onContextMenu = function () {};
  13878. ContentEditableInput.prototype.resetPosition = function () {};
  13879. ContentEditableInput.prototype.needsContentAttribute = true;
  13880. function posToDOM(cm, pos) {
  13881. var view = findViewForLine(cm, pos.line);
  13882. if (!view || view.hidden) { return null }
  13883. var line = getLine(cm.doc, pos.line);
  13884. var info = mapFromLineView(view, line, pos.line);
  13885. var order = getOrder(line, cm.doc.direction), side = "left";
  13886. if (order) {
  13887. var partPos = getBidiPartAt(order, pos.ch);
  13888. side = partPos % 2 ? "right" : "left";
  13889. }
  13890. var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
  13891. result.offset = result.collapse == "right" ? result.end : result.start;
  13892. return result
  13893. }
  13894. function isInGutter(node) {
  13895. for (var scan = node; scan; scan = scan.parentNode)
  13896. { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
  13897. return false
  13898. }
  13899. function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
  13900. function domTextBetween(cm, from, to, fromLine, toLine) {
  13901. var text = "", closing = false, lineSep = cm.doc.lineSeparator();
  13902. function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
  13903. function close() {
  13904. if (closing) {
  13905. text += lineSep;
  13906. closing = false;
  13907. }
  13908. }
  13909. function addText(str) {
  13910. if (str) {
  13911. close();
  13912. text += str;
  13913. }
  13914. }
  13915. function walk(node) {
  13916. if (node.nodeType == 1) {
  13917. var cmText = node.getAttribute("cm-text");
  13918. if (cmText != null) {
  13919. addText(cmText || node.textContent.replace(/\u200b/g, ""));
  13920. return
  13921. }
  13922. var markerID = node.getAttribute("cm-marker"), range$$1;
  13923. if (markerID) {
  13924. var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
  13925. if (found.length && (range$$1 = found[0].find()))
  13926. { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
  13927. return
  13928. }
  13929. if (node.getAttribute("contenteditable") == "false") { return }
  13930. var isBlock = /^(pre|div|p)$/i.test(node.nodeName);
  13931. if (isBlock) { close(); }
  13932. for (var i = 0; i < node.childNodes.length; i++)
  13933. { walk(node.childNodes[i]); }
  13934. if (isBlock) { closing = true; }
  13935. } else if (node.nodeType == 3) {
  13936. addText(node.nodeValue);
  13937. }
  13938. }
  13939. for (;;) {
  13940. walk(from);
  13941. if (from == to) { break }
  13942. from = from.nextSibling;
  13943. }
  13944. return text
  13945. }
  13946. function domToPos(cm, node, offset) {
  13947. var lineNode;
  13948. if (node == cm.display.lineDiv) {
  13949. lineNode = cm.display.lineDiv.childNodes[offset];
  13950. if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
  13951. node = null; offset = 0;
  13952. } else {
  13953. for (lineNode = node;; lineNode = lineNode.parentNode) {
  13954. if (!lineNode || lineNode == cm.display.lineDiv) { return null }
  13955. if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
  13956. }
  13957. }
  13958. for (var i = 0; i < cm.display.view.length; i++) {
  13959. var lineView = cm.display.view[i];
  13960. if (lineView.node == lineNode)
  13961. { return locateNodeInLineView(lineView, node, offset) }
  13962. }
  13963. }
  13964. function locateNodeInLineView(lineView, node, offset) {
  13965. var wrapper = lineView.text.firstChild, bad = false;
  13966. if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
  13967. if (node == wrapper) {
  13968. bad = true;
  13969. node = wrapper.childNodes[offset];
  13970. offset = 0;
  13971. if (!node) {
  13972. var line = lineView.rest ? lst(lineView.rest) : lineView.line;
  13973. return badPos(Pos(lineNo(line), line.text.length), bad)
  13974. }
  13975. }
  13976. var textNode = node.nodeType == 3 ? node : null, topNode = node;
  13977. if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
  13978. textNode = node.firstChild;
  13979. if (offset) { offset = textNode.nodeValue.length; }
  13980. }
  13981. while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
  13982. var measure = lineView.measure, maps = measure.maps;
  13983. function find(textNode, topNode, offset) {
  13984. for (var i = -1; i < (maps ? maps.length : 0); i++) {
  13985. var map$$1 = i < 0 ? measure.map : maps[i];
  13986. for (var j = 0; j < map$$1.length; j += 3) {
  13987. var curNode = map$$1[j + 2];
  13988. if (curNode == textNode || curNode == topNode) {
  13989. var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
  13990. var ch = map$$1[j] + offset;
  13991. if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
  13992. return Pos(line, ch)
  13993. }
  13994. }
  13995. }
  13996. }
  13997. var found = find(textNode, topNode, offset);
  13998. if (found) { return badPos(found, bad) }
  13999. // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
  14000. for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
  14001. found = find(after, after.firstChild, 0);
  14002. if (found)
  14003. { return badPos(Pos(found.line, found.ch - dist), bad) }
  14004. else
  14005. { dist += after.textContent.length; }
  14006. }
  14007. for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
  14008. found = find(before, before.firstChild, -1);
  14009. if (found)
  14010. { return badPos(Pos(found.line, found.ch + dist$1), bad) }
  14011. else
  14012. { dist$1 += before.textContent.length; }
  14013. }
  14014. }
  14015. // TEXTAREA INPUT STYLE
  14016. var TextareaInput = function(cm) {
  14017. this.cm = cm;
  14018. // See input.poll and input.reset
  14019. this.prevInput = "";
  14020. // Flag that indicates whether we expect input to appear real soon
  14021. // now (after some event like 'keypress' or 'input') and are
  14022. // polling intensively.
  14023. this.pollingFast = false;
  14024. // Self-resetting timeout for the poller
  14025. this.polling = new Delayed();
  14026. // Tracks when input.reset has punted to just putting a short
  14027. // string into the textarea instead of the full selection.
  14028. this.inaccurateSelection = false;
  14029. // Used to work around IE issue with selection being forgotten when focus moves away from textarea
  14030. this.hasSelection = false;
  14031. this.composing = null;
  14032. };
  14033. TextareaInput.prototype.init = function (display) {
  14034. var this$1 = this;
  14035. var input = this, cm = this.cm;
  14036. // Wraps and hides input textarea
  14037. var div = this.wrapper = hiddenTextarea();
  14038. // The semihidden textarea that is focused when the editor is
  14039. // focused, and receives input.
  14040. var te = this.textarea = div.firstChild;
  14041. display.wrapper.insertBefore(div, display.wrapper.firstChild);
  14042. // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
  14043. if (ios) { te.style.width = "0px"; }
  14044. on(te, "input", function () {
  14045. if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
  14046. input.poll();
  14047. });
  14048. on(te, "paste", function (e) {
  14049. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  14050. cm.state.pasteIncoming = true;
  14051. input.fastPoll();
  14052. });
  14053. function prepareCopyCut(e) {
  14054. if (signalDOMEvent(cm, e)) { return }
  14055. if (cm.somethingSelected()) {
  14056. setLastCopied({lineWise: false, text: cm.getSelections()});
  14057. if (input.inaccurateSelection) {
  14058. input.prevInput = "";
  14059. input.inaccurateSelection = false;
  14060. te.value = lastCopied.text.join("\n");
  14061. selectInput(te);
  14062. }
  14063. } else if (!cm.options.lineWiseCopyCut) {
  14064. return
  14065. } else {
  14066. var ranges = copyableRanges(cm);
  14067. setLastCopied({lineWise: true, text: ranges.text});
  14068. if (e.type == "cut") {
  14069. cm.setSelections(ranges.ranges, null, sel_dontScroll);
  14070. } else {
  14071. input.prevInput = "";
  14072. te.value = ranges.text.join("\n");
  14073. selectInput(te);
  14074. }
  14075. }
  14076. if (e.type == "cut") { cm.state.cutIncoming = true; }
  14077. }
  14078. on(te, "cut", prepareCopyCut);
  14079. on(te, "copy", prepareCopyCut);
  14080. on(display.scroller, "paste", function (e) {
  14081. if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
  14082. cm.state.pasteIncoming = true;
  14083. input.focus();
  14084. });
  14085. // Prevent normal selection in the editor (we handle our own)
  14086. on(display.lineSpace, "selectstart", function (e) {
  14087. if (!eventInWidget(display, e)) { e_preventDefault(e); }
  14088. });
  14089. on(te, "compositionstart", function () {
  14090. var start = cm.getCursor("from");
  14091. if (input.composing) { input.composing.range.clear(); }
  14092. input.composing = {
  14093. start: start,
  14094. range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
  14095. };
  14096. });
  14097. on(te, "compositionend", function () {
  14098. if (input.composing) {
  14099. input.poll();
  14100. input.composing.range.clear();
  14101. input.composing = null;
  14102. }
  14103. });
  14104. };
  14105. TextareaInput.prototype.prepareSelection = function () {
  14106. // Redraw the selection and/or cursor
  14107. var cm = this.cm, display = cm.display, doc = cm.doc;
  14108. var result = prepareSelection(cm);
  14109. // Move the hidden textarea near the cursor to prevent scrolling artifacts
  14110. if (cm.options.moveInputWithCursor) {
  14111. var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
  14112. var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
  14113. result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
  14114. headPos.top + lineOff.top - wrapOff.top));
  14115. result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
  14116. headPos.left + lineOff.left - wrapOff.left));
  14117. }
  14118. return result
  14119. };
  14120. TextareaInput.prototype.showSelection = function (drawn) {
  14121. var cm = this.cm, display = cm.display;
  14122. removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
  14123. removeChildrenAndAdd(display.selectionDiv, drawn.selection);
  14124. if (drawn.teTop != null) {
  14125. this.wrapper.style.top = drawn.teTop + "px";
  14126. this.wrapper.style.left = drawn.teLeft + "px";
  14127. }
  14128. };
  14129. // Reset the input to correspond to the selection (or to be empty,
  14130. // when not typing and nothing is selected)
  14131. TextareaInput.prototype.reset = function (typing) {
  14132. if (this.contextMenuPending) { return }
  14133. var minimal, selected, cm = this.cm, doc = cm.doc;
  14134. if (cm.somethingSelected()) {
  14135. this.prevInput = "";
  14136. var range$$1 = doc.sel.primary();
  14137. minimal = hasCopyEvent &&
  14138. (range$$1.to().line - range$$1.from().line > 100 || (selected = cm.getSelection()).length > 1000);
  14139. var content = minimal ? "-" : selected || cm.getSelection();
  14140. this.textarea.value = content;
  14141. if (cm.state.focused) { selectInput(this.textarea); }
  14142. if (ie && ie_version >= 9) { this.hasSelection = content; }
  14143. } else if (!typing) {
  14144. this.prevInput = this.textarea.value = "";
  14145. if (ie && ie_version >= 9) { this.hasSelection = null; }
  14146. }
  14147. this.inaccurateSelection = minimal;
  14148. };
  14149. TextareaInput.prototype.getField = function () { return this.textarea };
  14150. TextareaInput.prototype.supportsTouch = function () { return false };
  14151. TextareaInput.prototype.focus = function () {
  14152. if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
  14153. try { this.textarea.focus(); }
  14154. catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
  14155. }
  14156. };
  14157. TextareaInput.prototype.blur = function () { this.textarea.blur(); };
  14158. TextareaInput.prototype.resetPosition = function () {
  14159. this.wrapper.style.top = this.wrapper.style.left = 0;
  14160. };
  14161. TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
  14162. // Poll for input changes, using the normal rate of polling. This
  14163. // runs as long as the editor is focused.
  14164. TextareaInput.prototype.slowPoll = function () {
  14165. var this$1 = this;
  14166. if (this.pollingFast) { return }
  14167. this.polling.set(this.cm.options.pollInterval, function () {
  14168. this$1.poll();
  14169. if (this$1.cm.state.focused) { this$1.slowPoll(); }
  14170. });
  14171. };
  14172. // When an event has just come in that is likely to add or change
  14173. // something in the input textarea, we poll faster, to ensure that
  14174. // the change appears on the screen quickly.
  14175. TextareaInput.prototype.fastPoll = function () {
  14176. var missed = false, input = this;
  14177. input.pollingFast = true;
  14178. function p() {
  14179. var changed = input.poll();
  14180. if (!changed && !missed) {missed = true; input.polling.set(60, p);}
  14181. else {input.pollingFast = false; input.slowPoll();}
  14182. }
  14183. input.polling.set(20, p);
  14184. };
  14185. // Read input from the textarea, and update the document to match.
  14186. // When something is selected, it is present in the textarea, and
  14187. // selected (unless it is huge, in which case a placeholder is
  14188. // used). When nothing is selected, the cursor sits after previously
  14189. // seen text (can be empty), which is stored in prevInput (we must
  14190. // not reset the textarea when typing, because that breaks IME).
  14191. TextareaInput.prototype.poll = function () {
  14192. var this$1 = this;
  14193. var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
  14194. // Since this is called a *lot*, try to bail out as cheaply as
  14195. // possible when it is clear that nothing happened. hasSelection
  14196. // will be the case when there is a lot of text in the textarea,
  14197. // in which case reading its value would be expensive.
  14198. if (this.contextMenuPending || !cm.state.focused ||
  14199. (hasSelection(input) && !prevInput && !this.composing) ||
  14200. cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
  14201. { return false }
  14202. var text = input.value;
  14203. // If nothing changed, bail.
  14204. if (text == prevInput && !cm.somethingSelected()) { return false }
  14205. // Work around nonsensical selection resetting in IE9/10, and
  14206. // inexplicable appearance of private area unicode characters on
  14207. // some key combos in Mac (#2689).
  14208. if (ie && ie_version >= 9 && this.hasSelection === text ||
  14209. mac && /[\uf700-\uf7ff]/.test(text)) {
  14210. cm.display.input.reset();
  14211. return false
  14212. }
  14213. if (cm.doc.sel == cm.display.selForContextMenu) {
  14214. var first = text.charCodeAt(0);
  14215. if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
  14216. if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
  14217. }
  14218. // Find the part of the input that is actually new
  14219. var same = 0, l = Math.min(prevInput.length, text.length);
  14220. while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
  14221. runInOp(cm, function () {
  14222. applyTextInput(cm, text.slice(same), prevInput.length - same,
  14223. null, this$1.composing ? "*compose" : null);
  14224. // Don't leave long text in the textarea, since it makes further polling slow
  14225. if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
  14226. else { this$1.prevInput = text; }
  14227. if (this$1.composing) {
  14228. this$1.composing.range.clear();
  14229. this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
  14230. {className: "CodeMirror-composing"});
  14231. }
  14232. });
  14233. return true
  14234. };
  14235. TextareaInput.prototype.ensurePolled = function () {
  14236. if (this.pollingFast && this.poll()) { this.pollingFast = false; }
  14237. };
  14238. TextareaInput.prototype.onKeyPress = function () {
  14239. if (ie && ie_version >= 9) { this.hasSelection = null; }
  14240. this.fastPoll();
  14241. };
  14242. TextareaInput.prototype.onContextMenu = function (e) {
  14243. var input = this, cm = input.cm, display = cm.display, te = input.textarea;
  14244. var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
  14245. if (!pos || presto) { return } // Opera is difficult.
  14246. // Reset the current text selection only if the click is done outside of the selection
  14247. // and 'resetSelectionOnContextMenu' option is true.
  14248. var reset = cm.options.resetSelectionOnContextMenu;
  14249. if (reset && cm.doc.sel.contains(pos) == -1)
  14250. { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
  14251. var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
  14252. input.wrapper.style.cssText = "position: absolute";
  14253. var wrapperBox = input.wrapper.getBoundingClientRect();
  14254. 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);";
  14255. var oldScrollY;
  14256. if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
  14257. display.input.focus();
  14258. if (webkit) { window.scrollTo(null, oldScrollY); }
  14259. display.input.reset();
  14260. // Adds "Select all" to context menu in FF
  14261. if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
  14262. input.contextMenuPending = true;
  14263. display.selForContextMenu = cm.doc.sel;
  14264. clearTimeout(display.detectingSelectAll);
  14265. // Select-all will be greyed out if there's nothing to select, so
  14266. // this adds a zero-width space so that we can later check whether
  14267. // it got selected.
  14268. function prepareSelectAllHack() {
  14269. if (te.selectionStart != null) {
  14270. var selected = cm.somethingSelected();
  14271. var extval = "\u200b" + (selected ? te.value : "");
  14272. te.value = "\u21da"; // Used to catch context-menu undo
  14273. te.value = extval;
  14274. input.prevInput = selected ? "" : "\u200b";
  14275. te.selectionStart = 1; te.selectionEnd = extval.length;
  14276. // Re-set this, in case some other handler touched the
  14277. // selection in the meantime.
  14278. display.selForContextMenu = cm.doc.sel;
  14279. }
  14280. }
  14281. function rehide() {
  14282. input.contextMenuPending = false;
  14283. input.wrapper.style.cssText = oldWrapperCSS;
  14284. te.style.cssText = oldCSS;
  14285. if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
  14286. // Try to detect the user choosing select-all
  14287. if (te.selectionStart != null) {
  14288. if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
  14289. var i = 0, poll = function () {
  14290. if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
  14291. te.selectionEnd > 0 && input.prevInput == "\u200b") {
  14292. operation(cm, selectAll)(cm);
  14293. } else if (i++ < 10) {
  14294. display.detectingSelectAll = setTimeout(poll, 500);
  14295. } else {
  14296. display.selForContextMenu = null;
  14297. display.input.reset();
  14298. }
  14299. };
  14300. display.detectingSelectAll = setTimeout(poll, 200);
  14301. }
  14302. }
  14303. if (ie && ie_version >= 9) { prepareSelectAllHack(); }
  14304. if (captureRightClick) {
  14305. e_stop(e);
  14306. var mouseup = function () {
  14307. off(window, "mouseup", mouseup);
  14308. setTimeout(rehide, 20);
  14309. };
  14310. on(window, "mouseup", mouseup);
  14311. } else {
  14312. setTimeout(rehide, 50);
  14313. }
  14314. };
  14315. TextareaInput.prototype.readOnlyChanged = function (val) {
  14316. if (!val) { this.reset(); }
  14317. };
  14318. TextareaInput.prototype.setUneditable = function () {};
  14319. TextareaInput.prototype.needsContentAttribute = false;
  14320. function fromTextArea(textarea, options) {
  14321. options = options ? copyObj(options) : {};
  14322. options.value = textarea.value;
  14323. if (!options.tabindex && textarea.tabIndex)
  14324. { options.tabindex = textarea.tabIndex; }
  14325. if (!options.placeholder && textarea.placeholder)
  14326. { options.placeholder = textarea.placeholder; }
  14327. // Set autofocus to true if this textarea is focused, or if it has
  14328. // autofocus and no other element is focused.
  14329. if (options.autofocus == null) {
  14330. var hasFocus = activeElt();
  14331. options.autofocus = hasFocus == textarea ||
  14332. textarea.getAttribute("autofocus") != null && hasFocus == document.body;
  14333. }
  14334. function save() {textarea.value = cm.getValue();}
  14335. var realSubmit;
  14336. if (textarea.form) {
  14337. on(textarea.form, "submit", save);
  14338. // Deplorable hack to make the submit method do the right thing.
  14339. if (!options.leaveSubmitMethodAlone) {
  14340. var form = textarea.form;
  14341. realSubmit = form.submit;
  14342. try {
  14343. var wrappedSubmit = form.submit = function () {
  14344. save();
  14345. form.submit = realSubmit;
  14346. form.submit();
  14347. form.submit = wrappedSubmit;
  14348. };
  14349. } catch(e) {}
  14350. }
  14351. }
  14352. options.finishInit = function (cm) {
  14353. cm.save = save;
  14354. cm.getTextArea = function () { return textarea; };
  14355. cm.toTextArea = function () {
  14356. cm.toTextArea = isNaN; // Prevent this from being ran twice
  14357. save();
  14358. textarea.parentNode.removeChild(cm.getWrapperElement());
  14359. textarea.style.display = "";
  14360. if (textarea.form) {
  14361. off(textarea.form, "submit", save);
  14362. if (typeof textarea.form.submit == "function")
  14363. { textarea.form.submit = realSubmit; }
  14364. }
  14365. };
  14366. };
  14367. textarea.style.display = "none";
  14368. var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
  14369. options);
  14370. return cm
  14371. }
  14372. function addLegacyProps(CodeMirror) {
  14373. CodeMirror.off = off;
  14374. CodeMirror.on = on;
  14375. CodeMirror.wheelEventPixels = wheelEventPixels;
  14376. CodeMirror.Doc = Doc;
  14377. CodeMirror.splitLines = splitLinesAuto;
  14378. CodeMirror.countColumn = countColumn;
  14379. CodeMirror.findColumn = findColumn;
  14380. CodeMirror.isWordChar = isWordCharBasic;
  14381. CodeMirror.Pass = Pass;
  14382. CodeMirror.signal = signal;
  14383. CodeMirror.Line = Line;
  14384. CodeMirror.changeEnd = changeEnd;
  14385. CodeMirror.scrollbarModel = scrollbarModel;
  14386. CodeMirror.Pos = Pos;
  14387. CodeMirror.cmpPos = cmp;
  14388. CodeMirror.modes = modes;
  14389. CodeMirror.mimeModes = mimeModes;
  14390. CodeMirror.resolveMode = resolveMode;
  14391. CodeMirror.getMode = getMode;
  14392. CodeMirror.modeExtensions = modeExtensions;
  14393. CodeMirror.extendMode = extendMode;
  14394. CodeMirror.copyState = copyState;
  14395. CodeMirror.startState = startState;
  14396. CodeMirror.innerMode = innerMode;
  14397. CodeMirror.commands = commands;
  14398. CodeMirror.keyMap = keyMap;
  14399. CodeMirror.keyName = keyName;
  14400. CodeMirror.isModifierKey = isModifierKey;
  14401. CodeMirror.lookupKey = lookupKey;
  14402. CodeMirror.normalizeKeyMap = normalizeKeyMap;
  14403. CodeMirror.StringStream = StringStream;
  14404. CodeMirror.SharedTextMarker = SharedTextMarker;
  14405. CodeMirror.TextMarker = TextMarker;
  14406. CodeMirror.LineWidget = LineWidget;
  14407. CodeMirror.e_preventDefault = e_preventDefault;
  14408. CodeMirror.e_stopPropagation = e_stopPropagation;
  14409. CodeMirror.e_stop = e_stop;
  14410. CodeMirror.addClass = addClass;
  14411. CodeMirror.contains = contains;
  14412. CodeMirror.rmClass = rmClass;
  14413. CodeMirror.keyNames = keyNames;
  14414. }
  14415. // EDITOR CONSTRUCTOR
  14416. defineOptions(CodeMirror$1);
  14417. addEditorMethods(CodeMirror$1);
  14418. // Set up methods on CodeMirror's prototype to redirect to the editor's document.
  14419. var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
  14420. for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
  14421. { CodeMirror$1.prototype[prop] = (function(method) {
  14422. return function() {return method.apply(this.doc, arguments)}
  14423. })(Doc.prototype[prop]); } }
  14424. eventMixin(Doc);
  14425. // INPUT HANDLING
  14426. CodeMirror$1.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
  14427. // MODE DEFINITION AND QUERYING
  14428. // Extra arguments are stored as the mode's dependencies, which is
  14429. // used by (legacy) mechanisms like loadmode.js to automatically
  14430. // load a mode. (Preferred mechanism is the require/define calls.)
  14431. CodeMirror$1.defineMode = function(name/*, mode, …*/) {
  14432. if (!CodeMirror$1.defaults.mode && name != "null") { CodeMirror$1.defaults.mode = name; }
  14433. defineMode.apply(this, arguments);
  14434. };
  14435. CodeMirror$1.defineMIME = defineMIME;
  14436. // Minimal default mode.
  14437. CodeMirror$1.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
  14438. CodeMirror$1.defineMIME("text/plain", "null");
  14439. // EXTENSIONS
  14440. CodeMirror$1.defineExtension = function (name, func) {
  14441. CodeMirror$1.prototype[name] = func;
  14442. };
  14443. CodeMirror$1.defineDocExtension = function (name, func) {
  14444. Doc.prototype[name] = func;
  14445. };
  14446. CodeMirror$1.fromTextArea = fromTextArea;
  14447. addLegacyProps(CodeMirror$1);
  14448. CodeMirror$1.version = "5.25.0";
  14449. return CodeMirror$1;
  14450. })));
  14451. /***/ }),
  14452. /* 69 */
  14453. /***/ (function(module, exports) {
  14454. // shim for using process in browser
  14455. var process = module.exports = {};
  14456. // cached from whatever global is present so that test runners that stub it
  14457. // don't break things. But we need to wrap it in a try catch in case it is
  14458. // wrapped in strict mode code which doesn't define any globals. It's inside a
  14459. // function because try/catches deoptimize in certain engines.
  14460. var cachedSetTimeout;
  14461. var cachedClearTimeout;
  14462. function defaultSetTimout() {
  14463. throw new Error('setTimeout has not been defined');
  14464. }
  14465. function defaultClearTimeout () {
  14466. throw new Error('clearTimeout has not been defined');
  14467. }
  14468. (function () {
  14469. try {
  14470. if (typeof setTimeout === 'function') {
  14471. cachedSetTimeout = setTimeout;
  14472. } else {
  14473. cachedSetTimeout = defaultSetTimout;
  14474. }
  14475. } catch (e) {
  14476. cachedSetTimeout = defaultSetTimout;
  14477. }
  14478. try {
  14479. if (typeof clearTimeout === 'function') {
  14480. cachedClearTimeout = clearTimeout;
  14481. } else {
  14482. cachedClearTimeout = defaultClearTimeout;
  14483. }
  14484. } catch (e) {
  14485. cachedClearTimeout = defaultClearTimeout;
  14486. }
  14487. } ())
  14488. function runTimeout(fun) {
  14489. if (cachedSetTimeout === setTimeout) {
  14490. //normal enviroments in sane situations
  14491. return setTimeout(fun, 0);
  14492. }
  14493. // if setTimeout wasn't available but was latter defined
  14494. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  14495. cachedSetTimeout = setTimeout;
  14496. return setTimeout(fun, 0);
  14497. }
  14498. try {
  14499. // when when somebody has screwed with setTimeout but no I.E. maddness
  14500. return cachedSetTimeout(fun, 0);
  14501. } catch(e){
  14502. try {
  14503. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14504. return cachedSetTimeout.call(null, fun, 0);
  14505. } catch(e){
  14506. // 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
  14507. return cachedSetTimeout.call(this, fun, 0);
  14508. }
  14509. }
  14510. }
  14511. function runClearTimeout(marker) {
  14512. if (cachedClearTimeout === clearTimeout) {
  14513. //normal enviroments in sane situations
  14514. return clearTimeout(marker);
  14515. }
  14516. // if clearTimeout wasn't available but was latter defined
  14517. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  14518. cachedClearTimeout = clearTimeout;
  14519. return clearTimeout(marker);
  14520. }
  14521. try {
  14522. // when when somebody has screwed with setTimeout but no I.E. maddness
  14523. return cachedClearTimeout(marker);
  14524. } catch (e){
  14525. try {
  14526. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  14527. return cachedClearTimeout.call(null, marker);
  14528. } catch (e){
  14529. // 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.
  14530. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  14531. return cachedClearTimeout.call(this, marker);
  14532. }
  14533. }
  14534. }
  14535. var queue = [];
  14536. var draining = false;
  14537. var currentQueue;
  14538. var queueIndex = -1;
  14539. function cleanUpNextTick() {
  14540. if (!draining || !currentQueue) {
  14541. return;
  14542. }
  14543. draining = false;
  14544. if (currentQueue.length) {
  14545. queue = currentQueue.concat(queue);
  14546. } else {
  14547. queueIndex = -1;
  14548. }
  14549. if (queue.length) {
  14550. drainQueue();
  14551. }
  14552. }
  14553. function drainQueue() {
  14554. if (draining) {
  14555. return;
  14556. }
  14557. var timeout = runTimeout(cleanUpNextTick);
  14558. draining = true;
  14559. var len = queue.length;
  14560. while(len) {
  14561. currentQueue = queue;
  14562. queue = [];
  14563. while (++queueIndex < len) {
  14564. if (currentQueue) {
  14565. currentQueue[queueIndex].run();
  14566. }
  14567. }
  14568. queueIndex = -1;
  14569. len = queue.length;
  14570. }
  14571. currentQueue = null;
  14572. draining = false;
  14573. runClearTimeout(timeout);
  14574. }
  14575. process.nextTick = function (fun) {
  14576. var args = new Array(arguments.length - 1);
  14577. if (arguments.length > 1) {
  14578. for (var i = 1; i < arguments.length; i++) {
  14579. args[i - 1] = arguments[i];
  14580. }
  14581. }
  14582. queue.push(new Item(fun, args));
  14583. if (queue.length === 1 && !draining) {
  14584. runTimeout(drainQueue);
  14585. }
  14586. };
  14587. // v8 likes predictible objects
  14588. function Item(fun, array) {
  14589. this.fun = fun;
  14590. this.array = array;
  14591. }
  14592. Item.prototype.run = function () {
  14593. this.fun.apply(null, this.array);
  14594. };
  14595. process.title = 'browser';
  14596. process.browser = true;
  14597. process.env = {};
  14598. process.argv = [];
  14599. process.version = ''; // empty string to avoid regexp issues
  14600. process.versions = {};
  14601. function noop() {}
  14602. process.on = noop;
  14603. process.addListener = noop;
  14604. process.once = noop;
  14605. process.off = noop;
  14606. process.removeListener = noop;
  14607. process.removeAllListeners = noop;
  14608. process.emit = noop;
  14609. process.binding = function (name) {
  14610. throw new Error('process.binding is not supported');
  14611. };
  14612. process.cwd = function () { return '/' };
  14613. process.chdir = function (dir) {
  14614. throw new Error('process.chdir is not supported');
  14615. };
  14616. process.umask = function() { return 0; };
  14617. /***/ }),
  14618. /* 70 */
  14619. /***/ (function(module, exports) {
  14620. 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=="
  14621. /***/ }),
  14622. /* 71 */
  14623. /***/ (function(module, exports, __webpack_require__) {
  14624. "use strict";
  14625. exports.version = [3, 3, 0, 5073];
  14626. /***/ }),
  14627. /* 72 */
  14628. /***/ (function(module, exports, __webpack_require__) {
  14629. "use strict";
  14630. /**
  14631. * kw
  14632. * @author oldj
  14633. * @blog http://oldj.net
  14634. */
  14635. function kw2re(kw) {
  14636. // 模糊搜索
  14637. var r = void 0;
  14638. var m = void 0;
  14639. var flag = [];
  14640. if (kw === '/') {
  14641. return;
  14642. } else if (m = kw.match(/^\/([^\/]+)\/?(\w*)$/)) {
  14643. if (m[2].indexOf('i') > -1) {
  14644. flag.push('i');
  14645. }
  14646. // if (m[2].indexOf('g') > -1) {
  14647. flag.push('g');
  14648. // }
  14649. try {
  14650. r = new RegExp(m[1], flag.join(''));
  14651. } catch (e) {}
  14652. } else if (kw.indexOf('*') > -1) {
  14653. try {
  14654. r = new RegExp(kw.replace(/\*/g, '.*'), 'ig');
  14655. } catch (e) {}
  14656. }
  14657. return r;
  14658. }
  14659. exports.findPositions = function (kw, code) {
  14660. if (!kw || kw === '/') return [];
  14661. var r = kw2re(kw);
  14662. if (!r) {
  14663. try {
  14664. r = new RegExp(kw.replace(/([\.\?\*\+\^\$\(\)\-\[\]\{\}])/g, '\\$1'), 'ig');
  14665. } catch (e) {
  14666. console.log(e);
  14667. return [];
  14668. }
  14669. }
  14670. var indexes = [];
  14671. var lines = code.split('\n');
  14672. lines.map(function (ln, idx) {
  14673. var match = void 0;
  14674. var max_loop = 30;
  14675. while (match = r.exec(ln)) {
  14676. indexes.push([{ line: idx, ch: match.index }, { line: idx, ch: match.index + match[0].length }]);
  14677. max_loop--;
  14678. if (max_loop < 0) break;
  14679. }
  14680. });
  14681. return indexes;
  14682. };
  14683. exports.kw2re = kw2re;
  14684. /***/ }),
  14685. /* 73 */
  14686. /***/ (function(module, exports, __webpack_require__) {
  14687. "use strict";
  14688. /**
  14689. * @author oldj
  14690. * @blog https://oldj.net
  14691. */
  14692. /**
  14693. * 将一个 node list 转为数组
  14694. * @param list {NodeList}
  14695. * 参见:http://www.planabc.net/2010/01/06/arguments_to_array/
  14696. */
  14697. module.exports = (list) => {
  14698. let arr
  14699. let length
  14700. try {
  14701. // works in every browser except IE
  14702. arr = [].slice.call(list);
  14703. return arr;
  14704. } catch(err) {
  14705. // slower, but works in IE
  14706. arr = [];
  14707. length = list.length;
  14708. for (let i = 0; i < length; i++) {
  14709. arr.push(list[i]);
  14710. }
  14711. return arr;
  14712. }
  14713. }
  14714. /***/ }),
  14715. /* 74 */
  14716. /***/ (function(module, exports, __webpack_require__) {
  14717. "use strict";
  14718. /**
  14719. * Copyright (c) 2013-present, Facebook, Inc.
  14720. *
  14721. * Licensed under the Apache License, Version 2.0 (the "License");
  14722. * you may not use this file except in compliance with the License.
  14723. * You may obtain a copy of the License at
  14724. *
  14725. * http://www.apache.org/licenses/LICENSE-2.0
  14726. *
  14727. * Unless required by applicable law or agreed to in writing, software
  14728. * distributed under the License is distributed on an "AS IS" BASIS,
  14729. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14730. * See the License for the specific language governing permissions and
  14731. * limitations under the License.
  14732. *
  14733. * @typechecks
  14734. */
  14735. var emptyFunction = __webpack_require__(10);
  14736. /**
  14737. * Upstream version of event listener. Does not take into account specific
  14738. * nature of platform.
  14739. */
  14740. var EventListener = {
  14741. /**
  14742. * Listen to DOM events during the bubble phase.
  14743. *
  14744. * @param {DOMEventTarget} target DOM element to register listener on.
  14745. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14746. * @param {function} callback Callback function.
  14747. * @return {object} Object with a `remove` method.
  14748. */
  14749. listen: function listen(target, eventType, callback) {
  14750. if (target.addEventListener) {
  14751. target.addEventListener(eventType, callback, false);
  14752. return {
  14753. remove: function remove() {
  14754. target.removeEventListener(eventType, callback, false);
  14755. }
  14756. };
  14757. } else if (target.attachEvent) {
  14758. target.attachEvent('on' + eventType, callback);
  14759. return {
  14760. remove: function remove() {
  14761. target.detachEvent('on' + eventType, callback);
  14762. }
  14763. };
  14764. }
  14765. },
  14766. /**
  14767. * Listen to DOM events during the capture phase.
  14768. *
  14769. * @param {DOMEventTarget} target DOM element to register listener on.
  14770. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  14771. * @param {function} callback Callback function.
  14772. * @return {object} Object with a `remove` method.
  14773. */
  14774. capture: function capture(target, eventType, callback) {
  14775. if (target.addEventListener) {
  14776. target.addEventListener(eventType, callback, true);
  14777. return {
  14778. remove: function remove() {
  14779. target.removeEventListener(eventType, callback, true);
  14780. }
  14781. };
  14782. } else {
  14783. if (false) {
  14784. 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.');
  14785. }
  14786. return {
  14787. remove: emptyFunction
  14788. };
  14789. }
  14790. },
  14791. registerDefault: function registerDefault() {}
  14792. };
  14793. module.exports = EventListener;
  14794. /***/ }),
  14795. /* 75 */
  14796. /***/ (function(module, exports, __webpack_require__) {
  14797. "use strict";
  14798. /**
  14799. * Copyright (c) 2013-present, Facebook, Inc.
  14800. * All rights reserved.
  14801. *
  14802. * This source code is licensed under the BSD-style license found in the
  14803. * LICENSE file in the root directory of this source tree. An additional grant
  14804. * of patent rights can be found in the PATENTS file in the same directory.
  14805. *
  14806. */
  14807. /**
  14808. * @param {DOMElement} node input/textarea to focus
  14809. */
  14810. function focusNode(node) {
  14811. // IE8 can throw "Can't move focus to the control because it is invisible,
  14812. // not enabled, or of a type that does not accept the focus." for all kinds of
  14813. // reasons that are too expensive and fragile to test.
  14814. try {
  14815. node.focus();
  14816. } catch (e) {}
  14817. }
  14818. module.exports = focusNode;
  14819. /***/ }),
  14820. /* 76 */
  14821. /***/ (function(module, exports, __webpack_require__) {
  14822. "use strict";
  14823. /**
  14824. * Copyright (c) 2013-present, Facebook, Inc.
  14825. * All rights reserved.
  14826. *
  14827. * This source code is licensed under the BSD-style license found in the
  14828. * LICENSE file in the root directory of this source tree. An additional grant
  14829. * of patent rights can be found in the PATENTS file in the same directory.
  14830. *
  14831. * @typechecks
  14832. */
  14833. /* eslint-disable fb-www/typeof-undefined */
  14834. /**
  14835. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  14836. * not safe to call document.activeElement if there is nothing focused.
  14837. *
  14838. * The activeElement will be null only if the document or document body is not
  14839. * yet defined.
  14840. *
  14841. * @param {?DOMDocument} doc Defaults to current document.
  14842. * @return {?DOMElement}
  14843. */
  14844. function getActiveElement(doc) /*?DOMElement*/{
  14845. doc = doc || (typeof document !== 'undefined' ? document : undefined);
  14846. if (typeof doc === 'undefined') {
  14847. return null;
  14848. }
  14849. try {
  14850. return doc.activeElement || doc.body;
  14851. } catch (e) {
  14852. return doc.body;
  14853. }
  14854. }
  14855. module.exports = getActiveElement;
  14856. /***/ }),
  14857. /* 77 */
  14858. /***/ (function(module, exports, __webpack_require__) {
  14859. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**!
  14860. * Sortable
  14861. * @author RubaXa <[email protected]>
  14862. * @license MIT
  14863. */
  14864. (function sortableModule(factory) {
  14865. "use strict";
  14866. if (true) {
  14867. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14868. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14869. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14870. __WEBPACK_AMD_DEFINE_FACTORY__),
  14871. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  14872. }
  14873. else if (typeof module != "undefined" && typeof module.exports != "undefined") {
  14874. module.exports = factory();
  14875. }
  14876. else {
  14877. /* jshint sub:true */
  14878. window["Sortable"] = factory();
  14879. }
  14880. })(function sortableFactory() {
  14881. "use strict";
  14882. if (typeof window == "undefined" || !window.document) {
  14883. return function sortableError() {
  14884. throw new Error("Sortable.js requires a window with a document");
  14885. };
  14886. }
  14887. var dragEl,
  14888. parentEl,
  14889. ghostEl,
  14890. cloneEl,
  14891. rootEl,
  14892. nextEl,
  14893. lastDownEl,
  14894. scrollEl,
  14895. scrollParentEl,
  14896. scrollCustomFn,
  14897. lastEl,
  14898. lastCSS,
  14899. lastParentCSS,
  14900. oldIndex,
  14901. newIndex,
  14902. activeGroup,
  14903. putSortable,
  14904. autoScroll = {},
  14905. tapEvt,
  14906. touchEvt,
  14907. moved,
  14908. /** @const */
  14909. R_SPACE = /\s+/g,
  14910. R_FLOAT = /left|right|inline/,
  14911. expando = 'Sortable' + (new Date).getTime(),
  14912. win = window,
  14913. document = win.document,
  14914. parseInt = win.parseInt,
  14915. $ = win.jQuery || win.Zepto,
  14916. Polymer = win.Polymer,
  14917. captureMode = false,
  14918. supportDraggable = !!('draggable' in document.createElement('div')),
  14919. supportCssPointerEvents = (function (el) {
  14920. // false when IE11
  14921. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  14922. return false;
  14923. }
  14924. el = document.createElement('x');
  14925. el.style.cssText = 'pointer-events:auto';
  14926. return el.style.pointerEvents === 'auto';
  14927. })(),
  14928. _silent = false,
  14929. abs = Math.abs,
  14930. min = Math.min,
  14931. savedInputChecked = [],
  14932. touchDragOverListeners = [],
  14933. _autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  14934. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  14935. if (rootEl && options.scroll) {
  14936. var _this = rootEl[expando],
  14937. el,
  14938. rect,
  14939. sens = options.scrollSensitivity,
  14940. speed = options.scrollSpeed,
  14941. x = evt.clientX,
  14942. y = evt.clientY,
  14943. winWidth = window.innerWidth,
  14944. winHeight = window.innerHeight,
  14945. vx,
  14946. vy,
  14947. scrollOffsetX,
  14948. scrollOffsetY
  14949. ;
  14950. // Delect scrollEl
  14951. if (scrollParentEl !== rootEl) {
  14952. scrollEl = options.scroll;
  14953. scrollParentEl = rootEl;
  14954. scrollCustomFn = options.scrollFn;
  14955. if (scrollEl === true) {
  14956. scrollEl = rootEl;
  14957. do {
  14958. if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
  14959. (scrollEl.offsetHeight < scrollEl.scrollHeight)
  14960. ) {
  14961. break;
  14962. }
  14963. /* jshint boss:true */
  14964. } while (scrollEl = scrollEl.parentNode);
  14965. }
  14966. }
  14967. if (scrollEl) {
  14968. el = scrollEl;
  14969. rect = scrollEl.getBoundingClientRect();
  14970. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  14971. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  14972. }
  14973. if (!(vx || vy)) {
  14974. vx = (winWidth - x <= sens) - (x <= sens);
  14975. vy = (winHeight - y <= sens) - (y <= sens);
  14976. /* jshint expr:true */
  14977. (vx || vy) && (el = win);
  14978. }
  14979. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  14980. autoScroll.el = el;
  14981. autoScroll.vx = vx;
  14982. autoScroll.vy = vy;
  14983. clearInterval(autoScroll.pid);
  14984. if (el) {
  14985. autoScroll.pid = setInterval(function () {
  14986. scrollOffsetY = vy ? vy * speed : 0;
  14987. scrollOffsetX = vx ? vx * speed : 0;
  14988. if ('function' === typeof(scrollCustomFn)) {
  14989. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  14990. }
  14991. if (el === win) {
  14992. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  14993. } else {
  14994. el.scrollTop += scrollOffsetY;
  14995. el.scrollLeft += scrollOffsetX;
  14996. }
  14997. }, 24);
  14998. }
  14999. }
  15000. }
  15001. }, 30),
  15002. _prepareGroup = function (options) {
  15003. function toFn(value, pull) {
  15004. if (value === void 0 || value === true) {
  15005. value = group.name;
  15006. }
  15007. if (typeof value === 'function') {
  15008. return value;
  15009. } else {
  15010. return function (to, from) {
  15011. var fromGroup = from.options.group.name;
  15012. return pull
  15013. ? value
  15014. : value && (value.join
  15015. ? value.indexOf(fromGroup) > -1
  15016. : (fromGroup == value)
  15017. );
  15018. };
  15019. }
  15020. }
  15021. var group = {};
  15022. var originalGroup = options.group;
  15023. if (!originalGroup || typeof originalGroup != 'object') {
  15024. originalGroup = {name: originalGroup};
  15025. }
  15026. group.name = originalGroup.name;
  15027. group.checkPull = toFn(originalGroup.pull, true);
  15028. group.checkPut = toFn(originalGroup.put);
  15029. group.revertClone = originalGroup.revertClone;
  15030. options.group = group;
  15031. }
  15032. ;
  15033. /**
  15034. * @class Sortable
  15035. * @param {HTMLElement} el
  15036. * @param {Object} [options]
  15037. */
  15038. function Sortable(el, options) {
  15039. if (!(el && el.nodeType && el.nodeType === 1)) {
  15040. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  15041. }
  15042. this.el = el; // root element
  15043. this.options = options = _extend({}, options);
  15044. // Export instance
  15045. el[expando] = this;
  15046. // Default options
  15047. var defaults = {
  15048. group: Math.random(),
  15049. sort: true,
  15050. disabled: false,
  15051. store: null,
  15052. handle: null,
  15053. scroll: true,
  15054. scrollSensitivity: 30,
  15055. scrollSpeed: 10,
  15056. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  15057. ghostClass: 'sortable-ghost',
  15058. chosenClass: 'sortable-chosen',
  15059. dragClass: 'sortable-drag',
  15060. ignore: 'a, img',
  15061. filter: null,
  15062. preventOnFilter: true,
  15063. animation: 0,
  15064. setData: function (dataTransfer, dragEl) {
  15065. dataTransfer.setData('Text', dragEl.textContent);
  15066. },
  15067. dropBubble: false,
  15068. dragoverBubble: false,
  15069. dataIdAttr: 'data-id',
  15070. delay: 0,
  15071. forceFallback: false,
  15072. fallbackClass: 'sortable-fallback',
  15073. fallbackOnBody: false,
  15074. fallbackTolerance: 0,
  15075. fallbackOffset: {x: 0, y: 0}
  15076. };
  15077. // Set default options
  15078. for (var name in defaults) {
  15079. !(name in options) && (options[name] = defaults[name]);
  15080. }
  15081. _prepareGroup(options);
  15082. // Bind all private methods
  15083. for (var fn in this) {
  15084. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  15085. this[fn] = this[fn].bind(this);
  15086. }
  15087. }
  15088. // Setup drag mode
  15089. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  15090. // Bind events
  15091. _on(el, 'mousedown', this._onTapStart);
  15092. _on(el, 'touchstart', this._onTapStart);
  15093. _on(el, 'pointerdown', this._onTapStart);
  15094. if (this.nativeDraggable) {
  15095. _on(el, 'dragover', this);
  15096. _on(el, 'dragenter', this);
  15097. }
  15098. touchDragOverListeners.push(this._onDragOver);
  15099. // Restore sorting
  15100. options.store && this.sort(options.store.get(this));
  15101. }
  15102. Sortable.prototype = /** @lends Sortable.prototype */ {
  15103. constructor: Sortable,
  15104. _onTapStart: function (/** Event|TouchEvent */evt) {
  15105. var _this = this,
  15106. el = this.el,
  15107. options = this.options,
  15108. preventOnFilter = options.preventOnFilter,
  15109. type = evt.type,
  15110. touch = evt.touches && evt.touches[0],
  15111. target = (touch || evt).target,
  15112. originalTarget = evt.target.shadowRoot && evt.path[0] || target,
  15113. filter = options.filter,
  15114. startIndex;
  15115. _saveInputCheckedState(el);
  15116. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  15117. if (dragEl) {
  15118. return;
  15119. }
  15120. if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
  15121. return; // only left button or enabled
  15122. }
  15123. target = _closest(target, options.draggable, el);
  15124. if (!target) {
  15125. return;
  15126. }
  15127. if (lastDownEl === target) {
  15128. // Ignoring duplicate `down`
  15129. return;
  15130. }
  15131. // Get the index of the dragged element within its parent
  15132. startIndex = _index(target, options.draggable);
  15133. // Check filter
  15134. if (typeof filter === 'function') {
  15135. if (filter.call(this, evt, target, this)) {
  15136. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  15137. preventOnFilter && evt.preventDefault();
  15138. return; // cancel dnd
  15139. }
  15140. }
  15141. else if (filter) {
  15142. filter = filter.split(',').some(function (criteria) {
  15143. criteria = _closest(originalTarget, criteria.trim(), el);
  15144. if (criteria) {
  15145. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  15146. return true;
  15147. }
  15148. });
  15149. if (filter) {
  15150. preventOnFilter && evt.preventDefault();
  15151. return; // cancel dnd
  15152. }
  15153. }
  15154. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  15155. return;
  15156. }
  15157. // Prepare `dragstart`
  15158. this._prepareDragStart(evt, touch, target, startIndex);
  15159. },
  15160. _prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  15161. var _this = this,
  15162. el = _this.el,
  15163. options = _this.options,
  15164. ownerDocument = el.ownerDocument,
  15165. dragStartFn;
  15166. if (target && !dragEl && (target.parentNode === el)) {
  15167. tapEvt = evt;
  15168. rootEl = el;
  15169. dragEl = target;
  15170. parentEl = dragEl.parentNode;
  15171. nextEl = dragEl.nextSibling;
  15172. lastDownEl = target;
  15173. activeGroup = options.group;
  15174. oldIndex = startIndex;
  15175. this._lastX = (touch || evt).clientX;
  15176. this._lastY = (touch || evt).clientY;
  15177. dragEl.style['will-change'] = 'transform';
  15178. dragStartFn = function () {
  15179. // Delayed drag has been triggered
  15180. // we can re-enable the events: touchmove/mousemove
  15181. _this._disableDelayedDrag();
  15182. // Make the element draggable
  15183. dragEl.draggable = _this.nativeDraggable;
  15184. // Chosen item
  15185. _toggleClass(dragEl, options.chosenClass, true);
  15186. // Bind the events: dragstart/dragend
  15187. _this._triggerDragStart(evt, touch);
  15188. // Drag start event
  15189. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  15190. };
  15191. // Disable "draggable"
  15192. options.ignore.split(',').forEach(function (criteria) {
  15193. _find(dragEl, criteria.trim(), _disableDraggable);
  15194. });
  15195. _on(ownerDocument, 'mouseup', _this._onDrop);
  15196. _on(ownerDocument, 'touchend', _this._onDrop);
  15197. _on(ownerDocument, 'touchcancel', _this._onDrop);
  15198. _on(ownerDocument, 'pointercancel', _this._onDrop);
  15199. _on(ownerDocument, 'selectstart', _this);
  15200. if (options.delay) {
  15201. // If the user moves the pointer or let go the click or touch
  15202. // before the delay has been reached:
  15203. // disable the delayed drag
  15204. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  15205. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  15206. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  15207. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  15208. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  15209. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  15210. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  15211. } else {
  15212. dragStartFn();
  15213. }
  15214. }
  15215. },
  15216. _disableDelayedDrag: function () {
  15217. var ownerDocument = this.el.ownerDocument;
  15218. clearTimeout(this._dragStartTimer);
  15219. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  15220. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  15221. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  15222. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  15223. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  15224. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  15225. },
  15226. _triggerDragStart: function (/** Event */evt, /** Touch */touch) {
  15227. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  15228. if (touch) {
  15229. // Touch device support
  15230. tapEvt = {
  15231. target: dragEl,
  15232. clientX: touch.clientX,
  15233. clientY: touch.clientY
  15234. };
  15235. this._onDragStart(tapEvt, 'touch');
  15236. }
  15237. else if (!this.nativeDraggable) {
  15238. this._onDragStart(tapEvt, true);
  15239. }
  15240. else {
  15241. _on(dragEl, 'dragend', this);
  15242. _on(rootEl, 'dragstart', this._onDragStart);
  15243. }
  15244. try {
  15245. if (document.selection) {
  15246. // Timeout neccessary for IE9
  15247. setTimeout(function () {
  15248. document.selection.empty();
  15249. });
  15250. } else {
  15251. window.getSelection().removeAllRanges();
  15252. }
  15253. } catch (err) {
  15254. }
  15255. },
  15256. _dragStarted: function () {
  15257. if (rootEl && dragEl) {
  15258. var options = this.options;
  15259. // Apply effect
  15260. _toggleClass(dragEl, options.ghostClass, true);
  15261. _toggleClass(dragEl, options.dragClass, false);
  15262. Sortable.active = this;
  15263. // Drag start event
  15264. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  15265. } else {
  15266. this._nulling();
  15267. }
  15268. },
  15269. _emulateDragOver: function () {
  15270. if (touchEvt) {
  15271. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  15272. return;
  15273. }
  15274. this._lastX = touchEvt.clientX;
  15275. this._lastY = touchEvt.clientY;
  15276. if (!supportCssPointerEvents) {
  15277. _css(ghostEl, 'display', 'none');
  15278. }
  15279. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  15280. parent = target,
  15281. i = touchDragOverListeners.length;
  15282. if (parent) {
  15283. do {
  15284. if (parent[expando]) {
  15285. while (i--) {
  15286. touchDragOverListeners[i]({
  15287. clientX: touchEvt.clientX,
  15288. clientY: touchEvt.clientY,
  15289. target: target,
  15290. rootEl: parent
  15291. });
  15292. }
  15293. break;
  15294. }
  15295. target = parent; // store last element
  15296. }
  15297. /* jshint boss:true */
  15298. while (parent = parent.parentNode);
  15299. }
  15300. if (!supportCssPointerEvents) {
  15301. _css(ghostEl, 'display', '');
  15302. }
  15303. }
  15304. },
  15305. _onTouchMove: function (/**TouchEvent*/evt) {
  15306. if (tapEvt) {
  15307. var options = this.options,
  15308. fallbackTolerance = options.fallbackTolerance,
  15309. fallbackOffset = options.fallbackOffset,
  15310. touch = evt.touches ? evt.touches[0] : evt,
  15311. dx = (touch.clientX - tapEvt.clientX) + fallbackOffset.x,
  15312. dy = (touch.clientY - tapEvt.clientY) + fallbackOffset.y,
  15313. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  15314. // only set the status to dragging, when we are actually dragging
  15315. if (!Sortable.active) {
  15316. if (fallbackTolerance &&
  15317. min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance
  15318. ) {
  15319. return;
  15320. }
  15321. this._dragStarted();
  15322. }
  15323. // as well as creating the ghost element on the document body
  15324. this._appendGhost();
  15325. moved = true;
  15326. touchEvt = touch;
  15327. _css(ghostEl, 'webkitTransform', translate3d);
  15328. _css(ghostEl, 'mozTransform', translate3d);
  15329. _css(ghostEl, 'msTransform', translate3d);
  15330. _css(ghostEl, 'transform', translate3d);
  15331. evt.preventDefault();
  15332. }
  15333. },
  15334. _appendGhost: function () {
  15335. if (!ghostEl) {
  15336. var rect = dragEl.getBoundingClientRect(),
  15337. css = _css(dragEl),
  15338. options = this.options,
  15339. ghostRect;
  15340. ghostEl = dragEl.cloneNode(true);
  15341. _toggleClass(ghostEl, options.ghostClass, false);
  15342. _toggleClass(ghostEl, options.fallbackClass, true);
  15343. _toggleClass(ghostEl, options.dragClass, true);
  15344. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  15345. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  15346. _css(ghostEl, 'width', rect.width);
  15347. _css(ghostEl, 'height', rect.height);
  15348. _css(ghostEl, 'opacity', '0.8');
  15349. _css(ghostEl, 'position', 'fixed');
  15350. _css(ghostEl, 'zIndex', '100000');
  15351. _css(ghostEl, 'pointerEvents', 'none');
  15352. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  15353. // Fixing dimensions.
  15354. ghostRect = ghostEl.getBoundingClientRect();
  15355. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  15356. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  15357. }
  15358. },
  15359. _onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
  15360. var dataTransfer = evt.dataTransfer,
  15361. options = this.options;
  15362. this._offUpEvents();
  15363. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  15364. cloneEl = _clone(dragEl);
  15365. cloneEl.draggable = false;
  15366. cloneEl.style['will-change'] = '';
  15367. _css(cloneEl, 'display', 'none');
  15368. _toggleClass(cloneEl, this.options.chosenClass, false);
  15369. rootEl.insertBefore(cloneEl, dragEl);
  15370. _dispatchEvent(this, rootEl, 'clone', dragEl);
  15371. }
  15372. _toggleClass(dragEl, options.dragClass, true);
  15373. if (useFallback) {
  15374. if (useFallback === 'touch') {
  15375. // Bind touch events
  15376. _on(document, 'touchmove', this._onTouchMove);
  15377. _on(document, 'touchend', this._onDrop);
  15378. _on(document, 'touchcancel', this._onDrop);
  15379. _on(document, 'pointermove', this._onTouchMove);
  15380. _on(document, 'pointerup', this._onDrop);
  15381. } else {
  15382. // Old brwoser
  15383. _on(document, 'mousemove', this._onTouchMove);
  15384. _on(document, 'mouseup', this._onDrop);
  15385. }
  15386. this._loopId = setInterval(this._emulateDragOver, 50);
  15387. }
  15388. else {
  15389. if (dataTransfer) {
  15390. dataTransfer.effectAllowed = 'move';
  15391. options.setData && options.setData.call(this, dataTransfer, dragEl);
  15392. }
  15393. _on(document, 'drop', this);
  15394. setTimeout(this._dragStarted, 0);
  15395. }
  15396. },
  15397. _onDragOver: function (/**Event*/evt) {
  15398. var el = this.el,
  15399. target,
  15400. dragRect,
  15401. targetRect,
  15402. revert,
  15403. options = this.options,
  15404. group = options.group,
  15405. activeSortable = Sortable.active,
  15406. isOwner = (activeGroup === group),
  15407. isMovingBetweenSortable = false,
  15408. canSort = options.sort;
  15409. if (evt.preventDefault !== void 0) {
  15410. evt.preventDefault();
  15411. !options.dragoverBubble && evt.stopPropagation();
  15412. }
  15413. if (dragEl.animated) {
  15414. return;
  15415. }
  15416. moved = true;
  15417. if (activeSortable && !options.disabled &&
  15418. (isOwner
  15419. ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  15420. : (
  15421. putSortable === this ||
  15422. (
  15423. (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
  15424. group.checkPut(this, activeSortable, dragEl, evt)
  15425. )
  15426. )
  15427. ) &&
  15428. (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  15429. ) {
  15430. // Smart auto-scrolling
  15431. _autoScroll(evt, options, this.el);
  15432. if (_silent) {
  15433. return;
  15434. }
  15435. target = _closest(evt.target, options.draggable, el);
  15436. dragRect = dragEl.getBoundingClientRect();
  15437. if (putSortable !== this) {
  15438. putSortable = this;
  15439. isMovingBetweenSortable = true;
  15440. }
  15441. if (revert) {
  15442. _cloneHide(activeSortable, true);
  15443. parentEl = rootEl; // actualization
  15444. if (cloneEl || nextEl) {
  15445. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  15446. }
  15447. else if (!canSort) {
  15448. rootEl.appendChild(dragEl);
  15449. }
  15450. return;
  15451. }
  15452. if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
  15453. (el === evt.target) && (target = _ghostIsLast(el, evt))
  15454. ) {
  15455. if (target) {
  15456. if (target.animated) {
  15457. return;
  15458. }
  15459. targetRect = target.getBoundingClientRect();
  15460. }
  15461. _cloneHide(activeSortable, isOwner);
  15462. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  15463. if (!dragEl.contains(el)) {
  15464. el.appendChild(dragEl);
  15465. parentEl = el; // actualization
  15466. }
  15467. this._animate(dragRect, dragEl);
  15468. target && this._animate(targetRect, target);
  15469. }
  15470. }
  15471. else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
  15472. if (lastEl !== target) {
  15473. lastEl = target;
  15474. lastCSS = _css(target);
  15475. lastParentCSS = _css(target.parentNode);
  15476. }
  15477. targetRect = target.getBoundingClientRect();
  15478. var width = targetRect.right - targetRect.left,
  15479. height = targetRect.bottom - targetRect.top,
  15480. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display)
  15481. || (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
  15482. isWide = (target.offsetWidth > dragEl.offsetWidth),
  15483. isLong = (target.offsetHeight > dragEl.offsetHeight),
  15484. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  15485. nextSibling = target.nextElementSibling,
  15486. moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt),
  15487. after = false
  15488. ;
  15489. if (moveVector !== false) {
  15490. _silent = true;
  15491. setTimeout(_unsilent, 30);
  15492. _cloneHide(activeSortable, isOwner);
  15493. if (moveVector === 1 || moveVector === -1) {
  15494. after = (moveVector === 1);
  15495. }
  15496. else if (floating) {
  15497. var elTop = dragEl.offsetTop,
  15498. tgTop = target.offsetTop;
  15499. if (elTop === tgTop) {
  15500. after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
  15501. }
  15502. else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  15503. after = (evt.clientY - targetRect.top) / height > 0.5;
  15504. } else {
  15505. after = tgTop > elTop;
  15506. }
  15507. } else if (!isMovingBetweenSortable) {
  15508. after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
  15509. }
  15510. if (!dragEl.contains(el)) {
  15511. if (after && !nextSibling) {
  15512. el.appendChild(dragEl);
  15513. } else {
  15514. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  15515. }
  15516. }
  15517. parentEl = dragEl.parentNode; // actualization
  15518. this._animate(dragRect, dragEl);
  15519. this._animate(targetRect, target);
  15520. }
  15521. }
  15522. }
  15523. },
  15524. _animate: function (prevRect, target) {
  15525. var ms = this.options.animation;
  15526. if (ms) {
  15527. var currentRect = target.getBoundingClientRect();
  15528. if (prevRect.nodeType === 1) {
  15529. prevRect = prevRect.getBoundingClientRect();
  15530. }
  15531. _css(target, 'transition', 'none');
  15532. _css(target, 'transform', 'translate3d('
  15533. + (prevRect.left - currentRect.left) + 'px,'
  15534. + (prevRect.top - currentRect.top) + 'px,0)'
  15535. );
  15536. target.offsetWidth; // repaint
  15537. _css(target, 'transition', 'all ' + ms + 'ms');
  15538. _css(target, 'transform', 'translate3d(0,0,0)');
  15539. clearTimeout(target.animated);
  15540. target.animated = setTimeout(function () {
  15541. _css(target, 'transition', '');
  15542. _css(target, 'transform', '');
  15543. target.animated = false;
  15544. }, ms);
  15545. }
  15546. },
  15547. _offUpEvents: function () {
  15548. var ownerDocument = this.el.ownerDocument;
  15549. _off(document, 'touchmove', this._onTouchMove);
  15550. _off(document, 'pointermove', this._onTouchMove);
  15551. _off(ownerDocument, 'mouseup', this._onDrop);
  15552. _off(ownerDocument, 'touchend', this._onDrop);
  15553. _off(ownerDocument, 'pointerup', this._onDrop);
  15554. _off(ownerDocument, 'touchcancel', this._onDrop);
  15555. _off(ownerDocument, 'selectstart', this);
  15556. },
  15557. _onDrop: function (/**Event*/evt) {
  15558. var el = this.el,
  15559. options = this.options;
  15560. clearInterval(this._loopId);
  15561. clearInterval(autoScroll.pid);
  15562. clearTimeout(this._dragStartTimer);
  15563. // Unbind events
  15564. _off(document, 'mousemove', this._onTouchMove);
  15565. if (this.nativeDraggable) {
  15566. _off(document, 'drop', this);
  15567. _off(el, 'dragstart', this._onDragStart);
  15568. }
  15569. this._offUpEvents();
  15570. if (evt) {
  15571. if (moved) {
  15572. evt.preventDefault();
  15573. !options.dropBubble && evt.stopPropagation();
  15574. }
  15575. ghostEl && ghostEl.parentNode.removeChild(ghostEl);
  15576. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  15577. // Remove clone
  15578. cloneEl && cloneEl.parentNode.removeChild(cloneEl);
  15579. }
  15580. if (dragEl) {
  15581. if (this.nativeDraggable) {
  15582. _off(dragEl, 'dragend', this);
  15583. }
  15584. _disableDraggable(dragEl);
  15585. dragEl.style['will-change'] = '';
  15586. // Remove class's
  15587. _toggleClass(dragEl, this.options.ghostClass, false);
  15588. _toggleClass(dragEl, this.options.chosenClass, false);
  15589. if (rootEl !== parentEl) {
  15590. newIndex = _index(dragEl, options.draggable);
  15591. if (newIndex >= 0) {
  15592. // Add event
  15593. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  15594. // Remove event
  15595. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  15596. // drag from one list and drop into another
  15597. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  15598. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  15599. }
  15600. }
  15601. else {
  15602. if (dragEl.nextSibling !== nextEl) {
  15603. // Get the index of the dragged element within its parent
  15604. newIndex = _index(dragEl, options.draggable);
  15605. if (newIndex >= 0) {
  15606. // drag & drop within the same list
  15607. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  15608. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  15609. }
  15610. }
  15611. }
  15612. if (Sortable.active) {
  15613. /* jshint eqnull:true */
  15614. if (newIndex == null || newIndex === -1) {
  15615. newIndex = oldIndex;
  15616. }
  15617. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  15618. // Save sorting
  15619. this.save();
  15620. }
  15621. }
  15622. }
  15623. this._nulling();
  15624. },
  15625. _nulling: function() {
  15626. rootEl =
  15627. dragEl =
  15628. parentEl =
  15629. ghostEl =
  15630. nextEl =
  15631. cloneEl =
  15632. lastDownEl =
  15633. scrollEl =
  15634. scrollParentEl =
  15635. tapEvt =
  15636. touchEvt =
  15637. moved =
  15638. newIndex =
  15639. lastEl =
  15640. lastCSS =
  15641. putSortable =
  15642. activeGroup =
  15643. Sortable.active = null;
  15644. savedInputChecked.forEach(function (el) {
  15645. el.checked = true;
  15646. });
  15647. savedInputChecked.length = 0;
  15648. },
  15649. handleEvent: function (/**Event*/evt) {
  15650. switch (evt.type) {
  15651. case 'drop':
  15652. case 'dragend':
  15653. this._onDrop(evt);
  15654. break;
  15655. case 'dragover':
  15656. case 'dragenter':
  15657. if (dragEl) {
  15658. this._onDragOver(evt);
  15659. _globalDragOver(evt);
  15660. }
  15661. break;
  15662. case 'selectstart':
  15663. evt.preventDefault();
  15664. break;
  15665. }
  15666. },
  15667. /**
  15668. * Serializes the item into an array of string.
  15669. * @returns {String[]}
  15670. */
  15671. toArray: function () {
  15672. var order = [],
  15673. el,
  15674. children = this.el.children,
  15675. i = 0,
  15676. n = children.length,
  15677. options = this.options;
  15678. for (; i < n; i++) {
  15679. el = children[i];
  15680. if (_closest(el, options.draggable, this.el)) {
  15681. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  15682. }
  15683. }
  15684. return order;
  15685. },
  15686. /**
  15687. * Sorts the elements according to the array.
  15688. * @param {String[]} order order of the items
  15689. */
  15690. sort: function (order) {
  15691. var items = {}, rootEl = this.el;
  15692. this.toArray().forEach(function (id, i) {
  15693. var el = rootEl.children[i];
  15694. if (_closest(el, this.options.draggable, rootEl)) {
  15695. items[id] = el;
  15696. }
  15697. }, this);
  15698. order.forEach(function (id) {
  15699. if (items[id]) {
  15700. rootEl.removeChild(items[id]);
  15701. rootEl.appendChild(items[id]);
  15702. }
  15703. });
  15704. },
  15705. /**
  15706. * Save the current sorting
  15707. */
  15708. save: function () {
  15709. var store = this.options.store;
  15710. store && store.set(this);
  15711. },
  15712. /**
  15713. * 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.
  15714. * @param {HTMLElement} el
  15715. * @param {String} [selector] default: `options.draggable`
  15716. * @returns {HTMLElement|null}
  15717. */
  15718. closest: function (el, selector) {
  15719. return _closest(el, selector || this.options.draggable, this.el);
  15720. },
  15721. /**
  15722. * Set/get option
  15723. * @param {string} name
  15724. * @param {*} [value]
  15725. * @returns {*}
  15726. */
  15727. option: function (name, value) {
  15728. var options = this.options;
  15729. if (value === void 0) {
  15730. return options[name];
  15731. } else {
  15732. options[name] = value;
  15733. if (name === 'group') {
  15734. _prepareGroup(options);
  15735. }
  15736. }
  15737. },
  15738. /**
  15739. * Destroy
  15740. */
  15741. destroy: function () {
  15742. var el = this.el;
  15743. el[expando] = null;
  15744. _off(el, 'mousedown', this._onTapStart);
  15745. _off(el, 'touchstart', this._onTapStart);
  15746. _off(el, 'pointerdown', this._onTapStart);
  15747. if (this.nativeDraggable) {
  15748. _off(el, 'dragover', this);
  15749. _off(el, 'dragenter', this);
  15750. }
  15751. // Remove draggable attributes
  15752. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  15753. el.removeAttribute('draggable');
  15754. });
  15755. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  15756. this._onDrop();
  15757. this.el = el = null;
  15758. }
  15759. };
  15760. function _cloneHide(sortable, state) {
  15761. if (sortable.lastPullMode !== 'clone') {
  15762. state = true;
  15763. }
  15764. if (cloneEl && (cloneEl.state !== state)) {
  15765. _css(cloneEl, 'display', state ? 'none' : '');
  15766. if (!state) {
  15767. if (cloneEl.state) {
  15768. if (sortable.options.group.revertClone) {
  15769. rootEl.insertBefore(cloneEl, nextEl);
  15770. sortable._animate(dragEl, cloneEl);
  15771. } else {
  15772. rootEl.insertBefore(cloneEl, dragEl);
  15773. }
  15774. }
  15775. }
  15776. cloneEl.state = state;
  15777. }
  15778. }
  15779. function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  15780. if (el) {
  15781. ctx = ctx || document;
  15782. do {
  15783. if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
  15784. return el;
  15785. }
  15786. /* jshint boss:true */
  15787. } while (el = _getParentOrHost(el));
  15788. }
  15789. return null;
  15790. }
  15791. function _getParentOrHost(el) {
  15792. var parent = el.host;
  15793. return (parent && parent.nodeType) ? parent : el.parentNode;
  15794. }
  15795. function _globalDragOver(/**Event*/evt) {
  15796. if (evt.dataTransfer) {
  15797. evt.dataTransfer.dropEffect = 'move';
  15798. }
  15799. evt.preventDefault();
  15800. }
  15801. function _on(el, event, fn) {
  15802. el.addEventListener(event, fn, captureMode);
  15803. }
  15804. function _off(el, event, fn) {
  15805. el.removeEventListener(event, fn, captureMode);
  15806. }
  15807. function _toggleClass(el, name, state) {
  15808. if (el) {
  15809. if (el.classList) {
  15810. el.classList[state ? 'add' : 'remove'](name);
  15811. }
  15812. else {
  15813. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  15814. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  15815. }
  15816. }
  15817. }
  15818. function _css(el, prop, val) {
  15819. var style = el && el.style;
  15820. if (style) {
  15821. if (val === void 0) {
  15822. if (document.defaultView && document.defaultView.getComputedStyle) {
  15823. val = document.defaultView.getComputedStyle(el, '');
  15824. }
  15825. else if (el.currentStyle) {
  15826. val = el.currentStyle;
  15827. }
  15828. return prop === void 0 ? val : val[prop];
  15829. }
  15830. else {
  15831. if (!(prop in style)) {
  15832. prop = '-webkit-' + prop;
  15833. }
  15834. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  15835. }
  15836. }
  15837. }
  15838. function _find(ctx, tagName, iterator) {
  15839. if (ctx) {
  15840. var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
  15841. if (iterator) {
  15842. for (; i < n; i++) {
  15843. iterator(list[i], i);
  15844. }
  15845. }
  15846. return list;
  15847. }
  15848. return [];
  15849. }
  15850. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  15851. sortable = (sortable || rootEl[expando]);
  15852. var evt = document.createEvent('Event'),
  15853. options = sortable.options,
  15854. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  15855. evt.initEvent(name, true, true);
  15856. evt.to = rootEl;
  15857. evt.from = fromEl || rootEl;
  15858. evt.item = targetEl || rootEl;
  15859. evt.clone = cloneEl;
  15860. evt.oldIndex = startIndex;
  15861. evt.newIndex = newIndex;
  15862. rootEl.dispatchEvent(evt);
  15863. if (options[onName]) {
  15864. options[onName].call(sortable, evt);
  15865. }
  15866. }
  15867. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt) {
  15868. var evt,
  15869. sortable = fromEl[expando],
  15870. onMoveFn = sortable.options.onMove,
  15871. retVal;
  15872. evt = document.createEvent('Event');
  15873. evt.initEvent('move', true, true);
  15874. evt.to = toEl;
  15875. evt.from = fromEl;
  15876. evt.dragged = dragEl;
  15877. evt.draggedRect = dragRect;
  15878. evt.related = targetEl || toEl;
  15879. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  15880. fromEl.dispatchEvent(evt);
  15881. if (onMoveFn) {
  15882. retVal = onMoveFn.call(sortable, evt, originalEvt);
  15883. }
  15884. return retVal;
  15885. }
  15886. function _disableDraggable(el) {
  15887. el.draggable = false;
  15888. }
  15889. function _unsilent() {
  15890. _silent = false;
  15891. }
  15892. /** @returns {HTMLElement|false} */
  15893. function _ghostIsLast(el, evt) {
  15894. var lastEl = el.lastElementChild,
  15895. rect = lastEl.getBoundingClientRect();
  15896. // 5 — min delta
  15897. // abs — нельзя добавлять, а то глюки при наведении сверху
  15898. return (
  15899. (evt.clientY - (rect.top + rect.height) > 5) ||
  15900. (evt.clientX - (rect.right + rect.width) > 5)
  15901. ) && lastEl;
  15902. }
  15903. /**
  15904. * Generate id
  15905. * @param {HTMLElement} el
  15906. * @returns {String}
  15907. * @private
  15908. */
  15909. function _generateId(el) {
  15910. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  15911. i = str.length,
  15912. sum = 0;
  15913. while (i--) {
  15914. sum += str.charCodeAt(i);
  15915. }
  15916. return sum.toString(36);
  15917. }
  15918. /**
  15919. * Returns the index of an element within its parent for a selected set of
  15920. * elements
  15921. * @param {HTMLElement} el
  15922. * @param {selector} selector
  15923. * @return {number}
  15924. */
  15925. function _index(el, selector) {
  15926. var index = 0;
  15927. if (!el || !el.parentNode) {
  15928. return -1;
  15929. }
  15930. while (el && (el = el.previousElementSibling)) {
  15931. if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && (selector === '>*' || _matches(el, selector))) {
  15932. index++;
  15933. }
  15934. }
  15935. return index;
  15936. }
  15937. function _matches(/**HTMLElement*/el, /**String*/selector) {
  15938. if (el) {
  15939. selector = selector.split('.');
  15940. var tag = selector.shift().toUpperCase(),
  15941. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  15942. return (
  15943. (tag === '' || el.nodeName.toUpperCase() == tag) &&
  15944. (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
  15945. );
  15946. }
  15947. return false;
  15948. }
  15949. function _throttle(callback, ms) {
  15950. var args, _this;
  15951. return function () {
  15952. if (args === void 0) {
  15953. args = arguments;
  15954. _this = this;
  15955. setTimeout(function () {
  15956. if (args.length === 1) {
  15957. callback.call(_this, args[0]);
  15958. } else {
  15959. callback.apply(_this, args);
  15960. }
  15961. args = void 0;
  15962. }, ms);
  15963. }
  15964. };
  15965. }
  15966. function _extend(dst, src) {
  15967. if (dst && src) {
  15968. for (var key in src) {
  15969. if (src.hasOwnProperty(key)) {
  15970. dst[key] = src[key];
  15971. }
  15972. }
  15973. }
  15974. return dst;
  15975. }
  15976. function _clone(el) {
  15977. return $
  15978. ? $(el).clone(true)[0]
  15979. : (Polymer && Polymer.dom
  15980. ? Polymer.dom(el).cloneNode(true)
  15981. : el.cloneNode(true)
  15982. );
  15983. }
  15984. function _saveInputCheckedState(root) {
  15985. var inputs = root.getElementsByTagName('input');
  15986. var idx = inputs.length;
  15987. while (idx--) {
  15988. var el = inputs[idx];
  15989. el.checked && savedInputChecked.push(el);
  15990. }
  15991. }
  15992. // Fixed #973:
  15993. _on(document, 'touchmove', function (evt) {
  15994. if (Sortable.active) {
  15995. evt.preventDefault();
  15996. }
  15997. });
  15998. try {
  15999. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  16000. get: function () {
  16001. captureMode = {
  16002. capture: false,
  16003. passive: false
  16004. };
  16005. }
  16006. }));
  16007. } catch (err) {}
  16008. // Export utils
  16009. Sortable.utils = {
  16010. on: _on,
  16011. off: _off,
  16012. css: _css,
  16013. find: _find,
  16014. is: function (el, selector) {
  16015. return !!_closest(el, selector, el);
  16016. },
  16017. extend: _extend,
  16018. throttle: _throttle,
  16019. closest: _closest,
  16020. toggleClass: _toggleClass,
  16021. clone: _clone,
  16022. index: _index
  16023. };
  16024. /**
  16025. * Create sortable instance
  16026. * @param {HTMLElement} el
  16027. * @param {Object} [options]
  16028. */
  16029. Sortable.create = function (el, options) {
  16030. return new Sortable(el, options);
  16031. };
  16032. // Export
  16033. Sortable.version = '1.5.1';
  16034. return Sortable;
  16035. });
  16036. /***/ }),
  16037. /* 78 */
  16038. /***/ (function(module, exports, __webpack_require__) {
  16039. "use strict";
  16040. /**
  16041. * Copyright 2013-present, Facebook, Inc.
  16042. * All rights reserved.
  16043. *
  16044. * This source code is licensed under the BSD-style license found in the
  16045. * LICENSE file in the root directory of this source tree. An additional grant
  16046. * of patent rights can be found in the PATENTS file in the same directory.
  16047. *
  16048. */
  16049. /**
  16050. * CSS properties which accept numbers but are not in units of "px".
  16051. */
  16052. var isUnitlessNumber = {
  16053. animationIterationCount: true,
  16054. borderImageOutset: true,
  16055. borderImageSlice: true,
  16056. borderImageWidth: true,
  16057. boxFlex: true,
  16058. boxFlexGroup: true,
  16059. boxOrdinalGroup: true,
  16060. columnCount: true,
  16061. flex: true,
  16062. flexGrow: true,
  16063. flexPositive: true,
  16064. flexShrink: true,
  16065. flexNegative: true,
  16066. flexOrder: true,
  16067. gridRow: true,
  16068. gridColumn: true,
  16069. fontWeight: true,
  16070. lineClamp: true,
  16071. lineHeight: true,
  16072. opacity: true,
  16073. order: true,
  16074. orphans: true,
  16075. tabSize: true,
  16076. widows: true,
  16077. zIndex: true,
  16078. zoom: true,
  16079. // SVG-related properties
  16080. fillOpacity: true,
  16081. floodOpacity: true,
  16082. stopOpacity: true,
  16083. strokeDasharray: true,
  16084. strokeDashoffset: true,
  16085. strokeMiterlimit: true,
  16086. strokeOpacity: true,
  16087. strokeWidth: true
  16088. };
  16089. /**
  16090. * @param {string} prefix vendor-specific prefix, eg: Webkit
  16091. * @param {string} key style name, eg: transitionDuration
  16092. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  16093. * WebkitTransitionDuration
  16094. */
  16095. function prefixKey(prefix, key) {
  16096. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  16097. }
  16098. /**
  16099. * Support style names that may come passed in prefixed by adding permutations
  16100. * of vendor prefixes.
  16101. */
  16102. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  16103. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  16104. // infinite loop, because it iterates over the newly added props too.
  16105. Object.keys(isUnitlessNumber).forEach(function (prop) {
  16106. prefixes.forEach(function (prefix) {
  16107. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  16108. });
  16109. });
  16110. /**
  16111. * Most style properties can be unset by doing .style[prop] = '' but IE8
  16112. * doesn't like doing that with shorthand properties so for the properties that
  16113. * IE8 breaks on, which are listed here, we instead unset each of the
  16114. * individual properties. See http://bugs.jquery.com/ticket/12385.
  16115. * The 4-value 'clock' properties like margin, padding, border-width seem to
  16116. * behave without any problems. Curiously, list-style works too without any
  16117. * special prodding.
  16118. */
  16119. var shorthandPropertyExpansions = {
  16120. background: {
  16121. backgroundAttachment: true,
  16122. backgroundColor: true,
  16123. backgroundImage: true,
  16124. backgroundPositionX: true,
  16125. backgroundPositionY: true,
  16126. backgroundRepeat: true
  16127. },
  16128. backgroundPosition: {
  16129. backgroundPositionX: true,
  16130. backgroundPositionY: true
  16131. },
  16132. border: {
  16133. borderWidth: true,
  16134. borderStyle: true,
  16135. borderColor: true
  16136. },
  16137. borderBottom: {
  16138. borderBottomWidth: true,
  16139. borderBottomStyle: true,
  16140. borderBottomColor: true
  16141. },
  16142. borderLeft: {
  16143. borderLeftWidth: true,
  16144. borderLeftStyle: true,
  16145. borderLeftColor: true
  16146. },
  16147. borderRight: {
  16148. borderRightWidth: true,
  16149. borderRightStyle: true,
  16150. borderRightColor: true
  16151. },
  16152. borderTop: {
  16153. borderTopWidth: true,
  16154. borderTopStyle: true,
  16155. borderTopColor: true
  16156. },
  16157. font: {
  16158. fontStyle: true,
  16159. fontVariant: true,
  16160. fontWeight: true,
  16161. fontSize: true,
  16162. lineHeight: true,
  16163. fontFamily: true
  16164. },
  16165. outline: {
  16166. outlineWidth: true,
  16167. outlineStyle: true,
  16168. outlineColor: true
  16169. }
  16170. };
  16171. var CSSProperty = {
  16172. isUnitlessNumber: isUnitlessNumber,
  16173. shorthandPropertyExpansions: shorthandPropertyExpansions
  16174. };
  16175. module.exports = CSSProperty;
  16176. /***/ }),
  16177. /* 79 */
  16178. /***/ (function(module, exports, __webpack_require__) {
  16179. "use strict";
  16180. /**
  16181. * Copyright 2013-present, Facebook, Inc.
  16182. * All rights reserved.
  16183. *
  16184. * This source code is licensed under the BSD-style license found in the
  16185. * LICENSE file in the root directory of this source tree. An additional grant
  16186. * of patent rights can be found in the PATENTS file in the same directory.
  16187. *
  16188. *
  16189. */
  16190. var _prodInvariant = __webpack_require__(2);
  16191. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16192. var PooledClass = __webpack_require__(15);
  16193. var invariant = __webpack_require__(0);
  16194. /**
  16195. * A specialized pseudo-event module to help keep track of components waiting to
  16196. * be notified when their DOM representations are available for use.
  16197. *
  16198. * This implements `PooledClass`, so you should never need to instantiate this.
  16199. * Instead, use `CallbackQueue.getPooled()`.
  16200. *
  16201. * @class ReactMountReady
  16202. * @implements PooledClass
  16203. * @internal
  16204. */
  16205. var CallbackQueue = function () {
  16206. function CallbackQueue(arg) {
  16207. _classCallCheck(this, CallbackQueue);
  16208. this._callbacks = null;
  16209. this._contexts = null;
  16210. this._arg = arg;
  16211. }
  16212. /**
  16213. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  16214. *
  16215. * @param {function} callback Invoked when `notifyAll` is invoked.
  16216. * @param {?object} context Context to call `callback` with.
  16217. * @internal
  16218. */
  16219. CallbackQueue.prototype.enqueue = function enqueue(callback, context) {
  16220. this._callbacks = this._callbacks || [];
  16221. this._callbacks.push(callback);
  16222. this._contexts = this._contexts || [];
  16223. this._contexts.push(context);
  16224. };
  16225. /**
  16226. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  16227. * the DOM representation of a component has been created or updated.
  16228. *
  16229. * @internal
  16230. */
  16231. CallbackQueue.prototype.notifyAll = function notifyAll() {
  16232. var callbacks = this._callbacks;
  16233. var contexts = this._contexts;
  16234. var arg = this._arg;
  16235. if (callbacks && contexts) {
  16236. !(callbacks.length === contexts.length) ? false ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0;
  16237. this._callbacks = null;
  16238. this._contexts = null;
  16239. for (var i = 0; i < callbacks.length; i++) {
  16240. callbacks[i].call(contexts[i], arg);
  16241. }
  16242. callbacks.length = 0;
  16243. contexts.length = 0;
  16244. }
  16245. };
  16246. CallbackQueue.prototype.checkpoint = function checkpoint() {
  16247. return this._callbacks ? this._callbacks.length : 0;
  16248. };
  16249. CallbackQueue.prototype.rollback = function rollback(len) {
  16250. if (this._callbacks && this._contexts) {
  16251. this._callbacks.length = len;
  16252. this._contexts.length = len;
  16253. }
  16254. };
  16255. /**
  16256. * Resets the internal queue.
  16257. *
  16258. * @internal
  16259. */
  16260. CallbackQueue.prototype.reset = function reset() {
  16261. this._callbacks = null;
  16262. this._contexts = null;
  16263. };
  16264. /**
  16265. * `PooledClass` looks for this.
  16266. */
  16267. CallbackQueue.prototype.destructor = function destructor() {
  16268. this.reset();
  16269. };
  16270. return CallbackQueue;
  16271. }();
  16272. module.exports = PooledClass.addPoolingTo(CallbackQueue);
  16273. /***/ }),
  16274. /* 80 */
  16275. /***/ (function(module, exports, __webpack_require__) {
  16276. "use strict";
  16277. /**
  16278. * Copyright 2013-present, Facebook, Inc.
  16279. * All rights reserved.
  16280. *
  16281. * This source code is licensed under the BSD-style license found in the
  16282. * LICENSE file in the root directory of this source tree. An additional grant
  16283. * of patent rights can be found in the PATENTS file in the same directory.
  16284. *
  16285. */
  16286. var DOMProperty = __webpack_require__(19);
  16287. var ReactDOMComponentTree = __webpack_require__(5);
  16288. var ReactInstrumentation = __webpack_require__(11);
  16289. var quoteAttributeValueForBrowser = __webpack_require__(231);
  16290. var warning = __webpack_require__(1);
  16291. var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
  16292. var illegalAttributeNameCache = {};
  16293. var validatedAttributeNameCache = {};
  16294. function isAttributeNameSafe(attributeName) {
  16295. if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
  16296. return true;
  16297. }
  16298. if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
  16299. return false;
  16300. }
  16301. if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
  16302. validatedAttributeNameCache[attributeName] = true;
  16303. return true;
  16304. }
  16305. illegalAttributeNameCache[attributeName] = true;
  16306. false ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
  16307. return false;
  16308. }
  16309. function shouldIgnoreValue(propertyInfo, value) {
  16310. return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
  16311. }
  16312. /**
  16313. * Operations for dealing with DOM properties.
  16314. */
  16315. var DOMPropertyOperations = {
  16316. /**
  16317. * Creates markup for the ID property.
  16318. *
  16319. * @param {string} id Unescaped ID.
  16320. * @return {string} Markup string.
  16321. */
  16322. createMarkupForID: function (id) {
  16323. return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
  16324. },
  16325. setAttributeForID: function (node, id) {
  16326. node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
  16327. },
  16328. createMarkupForRoot: function () {
  16329. return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
  16330. },
  16331. setAttributeForRoot: function (node) {
  16332. node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
  16333. },
  16334. /**
  16335. * Creates markup for a property.
  16336. *
  16337. * @param {string} name
  16338. * @param {*} value
  16339. * @return {?string} Markup string, or null if the property was invalid.
  16340. */
  16341. createMarkupForProperty: function (name, value) {
  16342. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  16343. if (propertyInfo) {
  16344. if (shouldIgnoreValue(propertyInfo, value)) {
  16345. return '';
  16346. }
  16347. var attributeName = propertyInfo.attributeName;
  16348. if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  16349. return attributeName + '=""';
  16350. }
  16351. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  16352. } else if (DOMProperty.isCustomAttribute(name)) {
  16353. if (value == null) {
  16354. return '';
  16355. }
  16356. return name + '=' + quoteAttributeValueForBrowser(value);
  16357. }
  16358. return null;
  16359. },
  16360. /**
  16361. * Creates markup for a custom property.
  16362. *
  16363. * @param {string} name
  16364. * @param {*} value
  16365. * @return {string} Markup string, or empty string if the property was invalid.
  16366. */
  16367. createMarkupForCustomAttribute: function (name, value) {
  16368. if (!isAttributeNameSafe(name) || value == null) {
  16369. return '';
  16370. }
  16371. return name + '=' + quoteAttributeValueForBrowser(value);
  16372. },
  16373. /**
  16374. * Sets the value for a property on a node.
  16375. *
  16376. * @param {DOMElement} node
  16377. * @param {string} name
  16378. * @param {*} value
  16379. */
  16380. setValueForProperty: function (node, name, value) {
  16381. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  16382. if (propertyInfo) {
  16383. var mutationMethod = propertyInfo.mutationMethod;
  16384. if (mutationMethod) {
  16385. mutationMethod(node, value);
  16386. } else if (shouldIgnoreValue(propertyInfo, value)) {
  16387. this.deleteValueForProperty(node, name);
  16388. return;
  16389. } else if (propertyInfo.mustUseProperty) {
  16390. // Contrary to `setAttribute`, object properties are properly
  16391. // `toString`ed by IE8/9.
  16392. node[propertyInfo.propertyName] = value;
  16393. } else {
  16394. var attributeName = propertyInfo.attributeName;
  16395. var namespace = propertyInfo.attributeNamespace;
  16396. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  16397. // ('' + value) makes it output the correct toString()-value.
  16398. if (namespace) {
  16399. node.setAttributeNS(namespace, attributeName, '' + value);
  16400. } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
  16401. node.setAttribute(attributeName, '');
  16402. } else {
  16403. node.setAttribute(attributeName, '' + value);
  16404. }
  16405. }
  16406. } else if (DOMProperty.isCustomAttribute(name)) {
  16407. DOMPropertyOperations.setValueForAttribute(node, name, value);
  16408. return;
  16409. }
  16410. if (false) {
  16411. var payload = {};
  16412. payload[name] = value;
  16413. ReactInstrumentation.debugTool.onHostOperation({
  16414. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  16415. type: 'update attribute',
  16416. payload: payload
  16417. });
  16418. }
  16419. },
  16420. setValueForAttribute: function (node, name, value) {
  16421. if (!isAttributeNameSafe(name)) {
  16422. return;
  16423. }
  16424. if (value == null) {
  16425. node.removeAttribute(name);
  16426. } else {
  16427. node.setAttribute(name, '' + value);
  16428. }
  16429. if (false) {
  16430. var payload = {};
  16431. payload[name] = value;
  16432. ReactInstrumentation.debugTool.onHostOperation({
  16433. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  16434. type: 'update attribute',
  16435. payload: payload
  16436. });
  16437. }
  16438. },
  16439. /**
  16440. * Deletes an attributes from a node.
  16441. *
  16442. * @param {DOMElement} node
  16443. * @param {string} name
  16444. */
  16445. deleteValueForAttribute: function (node, name) {
  16446. node.removeAttribute(name);
  16447. if (false) {
  16448. ReactInstrumentation.debugTool.onHostOperation({
  16449. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  16450. type: 'remove attribute',
  16451. payload: name
  16452. });
  16453. }
  16454. },
  16455. /**
  16456. * Deletes the value for a property on a node.
  16457. *
  16458. * @param {DOMElement} node
  16459. * @param {string} name
  16460. */
  16461. deleteValueForProperty: function (node, name) {
  16462. var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
  16463. if (propertyInfo) {
  16464. var mutationMethod = propertyInfo.mutationMethod;
  16465. if (mutationMethod) {
  16466. mutationMethod(node, undefined);
  16467. } else if (propertyInfo.mustUseProperty) {
  16468. var propName = propertyInfo.propertyName;
  16469. if (propertyInfo.hasBooleanValue) {
  16470. node[propName] = false;
  16471. } else {
  16472. node[propName] = '';
  16473. }
  16474. } else {
  16475. node.removeAttribute(propertyInfo.attributeName);
  16476. }
  16477. } else if (DOMProperty.isCustomAttribute(name)) {
  16478. node.removeAttribute(name);
  16479. }
  16480. if (false) {
  16481. ReactInstrumentation.debugTool.onHostOperation({
  16482. instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
  16483. type: 'remove attribute',
  16484. payload: name
  16485. });
  16486. }
  16487. }
  16488. };
  16489. module.exports = DOMPropertyOperations;
  16490. /***/ }),
  16491. /* 81 */
  16492. /***/ (function(module, exports, __webpack_require__) {
  16493. "use strict";
  16494. /**
  16495. * Copyright 2015-present, Facebook, Inc.
  16496. * All rights reserved.
  16497. *
  16498. * This source code is licensed under the BSD-style license found in the
  16499. * LICENSE file in the root directory of this source tree. An additional grant
  16500. * of patent rights can be found in the PATENTS file in the same directory.
  16501. *
  16502. */
  16503. var ReactDOMComponentFlags = {
  16504. hasCachedChildNodes: 1 << 0
  16505. };
  16506. module.exports = ReactDOMComponentFlags;
  16507. /***/ }),
  16508. /* 82 */
  16509. /***/ (function(module, exports, __webpack_require__) {
  16510. "use strict";
  16511. /**
  16512. * Copyright 2013-present, Facebook, Inc.
  16513. * All rights reserved.
  16514. *
  16515. * This source code is licensed under the BSD-style license found in the
  16516. * LICENSE file in the root directory of this source tree. An additional grant
  16517. * of patent rights can be found in the PATENTS file in the same directory.
  16518. *
  16519. */
  16520. var _assign = __webpack_require__(3);
  16521. var LinkedValueUtils = __webpack_require__(55);
  16522. var ReactDOMComponentTree = __webpack_require__(5);
  16523. var ReactUpdates = __webpack_require__(12);
  16524. var warning = __webpack_require__(1);
  16525. var didWarnValueLink = false;
  16526. var didWarnValueDefaultValue = false;
  16527. function updateOptionsIfPendingUpdateAndMounted() {
  16528. if (this._rootNodeID && this._wrapperState.pendingUpdate) {
  16529. this._wrapperState.pendingUpdate = false;
  16530. var props = this._currentElement.props;
  16531. var value = LinkedValueUtils.getValue(props);
  16532. if (value != null) {
  16533. updateOptions(this, Boolean(props.multiple), value);
  16534. }
  16535. }
  16536. }
  16537. function getDeclarationErrorAddendum(owner) {
  16538. if (owner) {
  16539. var name = owner.getName();
  16540. if (name) {
  16541. return ' Check the render method of `' + name + '`.';
  16542. }
  16543. }
  16544. return '';
  16545. }
  16546. var valuePropNames = ['value', 'defaultValue'];
  16547. /**
  16548. * Validation function for `value` and `defaultValue`.
  16549. * @private
  16550. */
  16551. function checkSelectPropTypes(inst, props) {
  16552. var owner = inst._currentElement._owner;
  16553. LinkedValueUtils.checkPropTypes('select', props, owner);
  16554. if (props.valueLink !== undefined && !didWarnValueLink) {
  16555. false ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
  16556. didWarnValueLink = true;
  16557. }
  16558. for (var i = 0; i < valuePropNames.length; i++) {
  16559. var propName = valuePropNames[i];
  16560. if (props[propName] == null) {
  16561. continue;
  16562. }
  16563. var isArray = Array.isArray(props[propName]);
  16564. if (props.multiple && !isArray) {
  16565. false ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  16566. } else if (!props.multiple && isArray) {
  16567. false ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
  16568. }
  16569. }
  16570. }
  16571. /**
  16572. * @param {ReactDOMComponent} inst
  16573. * @param {boolean} multiple
  16574. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  16575. * @private
  16576. */
  16577. function updateOptions(inst, multiple, propValue) {
  16578. var selectedValue, i;
  16579. var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
  16580. if (multiple) {
  16581. selectedValue = {};
  16582. for (i = 0; i < propValue.length; i++) {
  16583. selectedValue['' + propValue[i]] = true;
  16584. }
  16585. for (i = 0; i < options.length; i++) {
  16586. var selected = selectedValue.hasOwnProperty(options[i].value);
  16587. if (options[i].selected !== selected) {
  16588. options[i].selected = selected;
  16589. }
  16590. }
  16591. } else {
  16592. // Do not set `select.value` as exact behavior isn't consistent across all
  16593. // browsers for all cases.
  16594. selectedValue = '' + propValue;
  16595. for (i = 0; i < options.length; i++) {
  16596. if (options[i].value === selectedValue) {
  16597. options[i].selected = true;
  16598. return;
  16599. }
  16600. }
  16601. if (options.length) {
  16602. options[0].selected = true;
  16603. }
  16604. }
  16605. }
  16606. /**
  16607. * Implements a <select> host component that allows optionally setting the
  16608. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  16609. * stringable. If `multiple` is true, the prop must be an array of stringables.
  16610. *
  16611. * If `value` is not supplied (or null/undefined), user actions that change the
  16612. * selected option will trigger updates to the rendered options.
  16613. *
  16614. * If it is supplied (and not null/undefined), the rendered options will not
  16615. * update in response to user actions. Instead, the `value` prop must change in
  16616. * order for the rendered options to update.
  16617. *
  16618. * If `defaultValue` is provided, any options with the supplied values will be
  16619. * selected.
  16620. */
  16621. var ReactDOMSelect = {
  16622. getHostProps: function (inst, props) {
  16623. return _assign({}, props, {
  16624. onChange: inst._wrapperState.onChange,
  16625. value: undefined
  16626. });
  16627. },
  16628. mountWrapper: function (inst, props) {
  16629. if (false) {
  16630. checkSelectPropTypes(inst, props);
  16631. }
  16632. var value = LinkedValueUtils.getValue(props);
  16633. inst._wrapperState = {
  16634. pendingUpdate: false,
  16635. initialValue: value != null ? value : props.defaultValue,
  16636. listeners: null,
  16637. onChange: _handleChange.bind(inst),
  16638. wasMultiple: Boolean(props.multiple)
  16639. };
  16640. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  16641. 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;
  16642. didWarnValueDefaultValue = true;
  16643. }
  16644. },
  16645. getSelectValueContext: function (inst) {
  16646. // ReactDOMOption looks at this initial value so the initial generated
  16647. // markup has correct `selected` attributes
  16648. return inst._wrapperState.initialValue;
  16649. },
  16650. postUpdateWrapper: function (inst) {
  16651. var props = inst._currentElement.props;
  16652. // After the initial mount, we control selected-ness manually so don't pass
  16653. // this value down
  16654. inst._wrapperState.initialValue = undefined;
  16655. var wasMultiple = inst._wrapperState.wasMultiple;
  16656. inst._wrapperState.wasMultiple = Boolean(props.multiple);
  16657. var value = LinkedValueUtils.getValue(props);
  16658. if (value != null) {
  16659. inst._wrapperState.pendingUpdate = false;
  16660. updateOptions(inst, Boolean(props.multiple), value);
  16661. } else if (wasMultiple !== Boolean(props.multiple)) {
  16662. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  16663. if (props.defaultValue != null) {
  16664. updateOptions(inst, Boolean(props.multiple), props.defaultValue);
  16665. } else {
  16666. // Revert the select back to its default unselected state.
  16667. updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
  16668. }
  16669. }
  16670. }
  16671. };
  16672. function _handleChange(event) {
  16673. var props = this._currentElement.props;
  16674. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  16675. if (this._rootNodeID) {
  16676. this._wrapperState.pendingUpdate = true;
  16677. }
  16678. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  16679. return returnValue;
  16680. }
  16681. module.exports = ReactDOMSelect;
  16682. /***/ }),
  16683. /* 83 */
  16684. /***/ (function(module, exports, __webpack_require__) {
  16685. "use strict";
  16686. /**
  16687. * Copyright 2014-present, Facebook, Inc.
  16688. * All rights reserved.
  16689. *
  16690. * This source code is licensed under the BSD-style license found in the
  16691. * LICENSE file in the root directory of this source tree. An additional grant
  16692. * of patent rights can be found in the PATENTS file in the same directory.
  16693. *
  16694. */
  16695. var emptyComponentFactory;
  16696. var ReactEmptyComponentInjection = {
  16697. injectEmptyComponentFactory: function (factory) {
  16698. emptyComponentFactory = factory;
  16699. }
  16700. };
  16701. var ReactEmptyComponent = {
  16702. create: function (instantiate) {
  16703. return emptyComponentFactory(instantiate);
  16704. }
  16705. };
  16706. ReactEmptyComponent.injection = ReactEmptyComponentInjection;
  16707. module.exports = ReactEmptyComponent;
  16708. /***/ }),
  16709. /* 84 */
  16710. /***/ (function(module, exports, __webpack_require__) {
  16711. "use strict";
  16712. /**
  16713. * Copyright 2013-present, Facebook, Inc.
  16714. * All rights reserved.
  16715. *
  16716. * This source code is licensed under the BSD-style license found in the
  16717. * LICENSE file in the root directory of this source tree. An additional grant
  16718. * of patent rights can be found in the PATENTS file in the same directory.
  16719. *
  16720. *
  16721. */
  16722. var ReactFeatureFlags = {
  16723. // When true, call console.time() before and .timeEnd() after each top-level
  16724. // render (both initial renders and updates). Useful when looking at prod-mode
  16725. // timeline profiles in Chrome, for example.
  16726. logTopLevelRenders: false
  16727. };
  16728. module.exports = ReactFeatureFlags;
  16729. /***/ }),
  16730. /* 85 */
  16731. /***/ (function(module, exports, __webpack_require__) {
  16732. "use strict";
  16733. /**
  16734. * Copyright 2014-present, Facebook, Inc.
  16735. * All rights reserved.
  16736. *
  16737. * This source code is licensed under the BSD-style license found in the
  16738. * LICENSE file in the root directory of this source tree. An additional grant
  16739. * of patent rights can be found in the PATENTS file in the same directory.
  16740. *
  16741. */
  16742. var _prodInvariant = __webpack_require__(2);
  16743. var invariant = __webpack_require__(0);
  16744. var genericComponentClass = null;
  16745. var textComponentClass = null;
  16746. var ReactHostComponentInjection = {
  16747. // This accepts a class that receives the tag string. This is a catch all
  16748. // that can render any kind of tag.
  16749. injectGenericComponentClass: function (componentClass) {
  16750. genericComponentClass = componentClass;
  16751. },
  16752. // This accepts a text component class that takes the text string to be
  16753. // rendered as props.
  16754. injectTextComponentClass: function (componentClass) {
  16755. textComponentClass = componentClass;
  16756. }
  16757. };
  16758. /**
  16759. * Get a host internal component class for a specific tag.
  16760. *
  16761. * @param {ReactElement} element The element to create.
  16762. * @return {function} The internal class constructor function.
  16763. */
  16764. function createInternalComponent(element) {
  16765. !genericComponentClass ? false ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
  16766. return new genericComponentClass(element);
  16767. }
  16768. /**
  16769. * @param {ReactText} text
  16770. * @return {ReactComponent}
  16771. */
  16772. function createInstanceForText(text) {
  16773. return new textComponentClass(text);
  16774. }
  16775. /**
  16776. * @param {ReactComponent} component
  16777. * @return {boolean}
  16778. */
  16779. function isTextComponent(component) {
  16780. return component instanceof textComponentClass;
  16781. }
  16782. var ReactHostComponent = {
  16783. createInternalComponent: createInternalComponent,
  16784. createInstanceForText: createInstanceForText,
  16785. isTextComponent: isTextComponent,
  16786. injection: ReactHostComponentInjection
  16787. };
  16788. module.exports = ReactHostComponent;
  16789. /***/ }),
  16790. /* 86 */
  16791. /***/ (function(module, exports, __webpack_require__) {
  16792. "use strict";
  16793. /**
  16794. * Copyright 2013-present, Facebook, Inc.
  16795. * All rights reserved.
  16796. *
  16797. * This source code is licensed under the BSD-style license found in the
  16798. * LICENSE file in the root directory of this source tree. An additional grant
  16799. * of patent rights can be found in the PATENTS file in the same directory.
  16800. *
  16801. */
  16802. var ReactDOMSelection = __webpack_require__(190);
  16803. var containsNode = __webpack_require__(159);
  16804. var focusNode = __webpack_require__(75);
  16805. var getActiveElement = __webpack_require__(76);
  16806. function isInDocument(node) {
  16807. return containsNode(document.documentElement, node);
  16808. }
  16809. /**
  16810. * @ReactInputSelection: React input selection module. Based on Selection.js,
  16811. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  16812. * assume buttons have range selections allowed).
  16813. * Input selection module for React.
  16814. */
  16815. var ReactInputSelection = {
  16816. hasSelectionCapabilities: function (elem) {
  16817. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  16818. return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
  16819. },
  16820. getSelectionInformation: function () {
  16821. var focusedElem = getActiveElement();
  16822. return {
  16823. focusedElem: focusedElem,
  16824. selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
  16825. };
  16826. },
  16827. /**
  16828. * @restoreSelection: If any selection information was potentially lost,
  16829. * restore it. This is useful when performing operations that could remove dom
  16830. * nodes and place them back in, resulting in focus being lost.
  16831. */
  16832. restoreSelection: function (priorSelectionInformation) {
  16833. var curFocusedElem = getActiveElement();
  16834. var priorFocusedElem = priorSelectionInformation.focusedElem;
  16835. var priorSelectionRange = priorSelectionInformation.selectionRange;
  16836. if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  16837. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  16838. ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
  16839. }
  16840. focusNode(priorFocusedElem);
  16841. }
  16842. },
  16843. /**
  16844. * @getSelection: Gets the selection bounds of a focused textarea, input or
  16845. * contentEditable node.
  16846. * -@input: Look up selection bounds of this input
  16847. * -@return {start: selectionStart, end: selectionEnd}
  16848. */
  16849. getSelection: function (input) {
  16850. var selection;
  16851. if ('selectionStart' in input) {
  16852. // Modern browser with input or textarea.
  16853. selection = {
  16854. start: input.selectionStart,
  16855. end: input.selectionEnd
  16856. };
  16857. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  16858. // IE8 input.
  16859. var range = document.selection.createRange();
  16860. // There can only be one selection per document in IE, so it must
  16861. // be in our element.
  16862. if (range.parentElement() === input) {
  16863. selection = {
  16864. start: -range.moveStart('character', -input.value.length),
  16865. end: -range.moveEnd('character', -input.value.length)
  16866. };
  16867. }
  16868. } else {
  16869. // Content editable or old IE textarea.
  16870. selection = ReactDOMSelection.getOffsets(input);
  16871. }
  16872. return selection || { start: 0, end: 0 };
  16873. },
  16874. /**
  16875. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  16876. * the input.
  16877. * -@input Set selection bounds of this input or textarea
  16878. * -@offsets Object of same form that is returned from get*
  16879. */
  16880. setSelection: function (input, offsets) {
  16881. var start = offsets.start;
  16882. var end = offsets.end;
  16883. if (end === undefined) {
  16884. end = start;
  16885. }
  16886. if ('selectionStart' in input) {
  16887. input.selectionStart = start;
  16888. input.selectionEnd = Math.min(end, input.value.length);
  16889. } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
  16890. var range = input.createTextRange();
  16891. range.collapse(true);
  16892. range.moveStart('character', start);
  16893. range.moveEnd('character', end - start);
  16894. range.select();
  16895. } else {
  16896. ReactDOMSelection.setOffsets(input, offsets);
  16897. }
  16898. }
  16899. };
  16900. module.exports = ReactInputSelection;
  16901. /***/ }),
  16902. /* 87 */
  16903. /***/ (function(module, exports, __webpack_require__) {
  16904. "use strict";
  16905. /**
  16906. * Copyright 2013-present, Facebook, Inc.
  16907. * All rights reserved.
  16908. *
  16909. * This source code is licensed under the BSD-style license found in the
  16910. * LICENSE file in the root directory of this source tree. An additional grant
  16911. * of patent rights can be found in the PATENTS file in the same directory.
  16912. *
  16913. */
  16914. var _prodInvariant = __webpack_require__(2);
  16915. var DOMLazyTree = __webpack_require__(18);
  16916. var DOMProperty = __webpack_require__(19);
  16917. var React = __webpack_require__(21);
  16918. var ReactBrowserEventEmitter = __webpack_require__(31);
  16919. var ReactCurrentOwner = __webpack_require__(14);
  16920. var ReactDOMComponentTree = __webpack_require__(5);
  16921. var ReactDOMContainerInfo = __webpack_require__(184);
  16922. var ReactDOMFeatureFlags = __webpack_require__(186);
  16923. var ReactFeatureFlags = __webpack_require__(84);
  16924. var ReactInstanceMap = __webpack_require__(28);
  16925. var ReactInstrumentation = __webpack_require__(11);
  16926. var ReactMarkupChecksum = __webpack_require__(200);
  16927. var ReactReconciler = __webpack_require__(20);
  16928. var ReactUpdateQueue = __webpack_require__(58);
  16929. var ReactUpdates = __webpack_require__(12);
  16930. var emptyObject = __webpack_require__(25);
  16931. var instantiateReactComponent = __webpack_require__(94);
  16932. var invariant = __webpack_require__(0);
  16933. var setInnerHTML = __webpack_require__(35);
  16934. var shouldUpdateReactComponent = __webpack_require__(64);
  16935. var warning = __webpack_require__(1);
  16936. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  16937. var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
  16938. var ELEMENT_NODE_TYPE = 1;
  16939. var DOC_NODE_TYPE = 9;
  16940. var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
  16941. var instancesByReactRootID = {};
  16942. /**
  16943. * Finds the index of the first character
  16944. * that's not common between the two given strings.
  16945. *
  16946. * @return {number} the index of the character where the strings diverge
  16947. */
  16948. function firstDifferenceIndex(string1, string2) {
  16949. var minLen = Math.min(string1.length, string2.length);
  16950. for (var i = 0; i < minLen; i++) {
  16951. if (string1.charAt(i) !== string2.charAt(i)) {
  16952. return i;
  16953. }
  16954. }
  16955. return string1.length === string2.length ? -1 : minLen;
  16956. }
  16957. /**
  16958. * @param {DOMElement|DOMDocument} container DOM element that may contain
  16959. * a React component
  16960. * @return {?*} DOM element that may have the reactRoot ID, or null.
  16961. */
  16962. function getReactRootElementInContainer(container) {
  16963. if (!container) {
  16964. return null;
  16965. }
  16966. if (container.nodeType === DOC_NODE_TYPE) {
  16967. return container.documentElement;
  16968. } else {
  16969. return container.firstChild;
  16970. }
  16971. }
  16972. function internalGetID(node) {
  16973. // If node is something like a window, document, or text node, none of
  16974. // which support attributes or a .getAttribute method, gracefully return
  16975. // the empty string, as if the attribute were missing.
  16976. return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  16977. }
  16978. /**
  16979. * Mounts this component and inserts it into the DOM.
  16980. *
  16981. * @param {ReactComponent} componentInstance The instance to mount.
  16982. * @param {DOMElement} container DOM element to mount into.
  16983. * @param {ReactReconcileTransaction} transaction
  16984. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  16985. */
  16986. function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
  16987. var markerName;
  16988. if (ReactFeatureFlags.logTopLevelRenders) {
  16989. var wrappedElement = wrapperInstance._currentElement.props.child;
  16990. var type = wrappedElement.type;
  16991. markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
  16992. console.time(markerName);
  16993. }
  16994. var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
  16995. );
  16996. if (markerName) {
  16997. console.timeEnd(markerName);
  16998. }
  16999. wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
  17000. ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
  17001. }
  17002. /**
  17003. * Batched mount.
  17004. *
  17005. * @param {ReactComponent} componentInstance The instance to mount.
  17006. * @param {DOMElement} container DOM element to mount into.
  17007. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  17008. */
  17009. function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
  17010. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
  17011. /* useCreateElement */
  17012. !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
  17013. transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
  17014. ReactUpdates.ReactReconcileTransaction.release(transaction);
  17015. }
  17016. /**
  17017. * Unmounts a component and removes it from the DOM.
  17018. *
  17019. * @param {ReactComponent} instance React component instance.
  17020. * @param {DOMElement} container DOM element to unmount from.
  17021. * @final
  17022. * @internal
  17023. * @see {ReactMount.unmountComponentAtNode}
  17024. */
  17025. function unmountComponentFromNode(instance, container, safely) {
  17026. if (false) {
  17027. ReactInstrumentation.debugTool.onBeginFlush();
  17028. }
  17029. ReactReconciler.unmountComponent(instance, safely);
  17030. if (false) {
  17031. ReactInstrumentation.debugTool.onEndFlush();
  17032. }
  17033. if (container.nodeType === DOC_NODE_TYPE) {
  17034. container = container.documentElement;
  17035. }
  17036. // http://jsperf.com/emptying-a-node
  17037. while (container.lastChild) {
  17038. container.removeChild(container.lastChild);
  17039. }
  17040. }
  17041. /**
  17042. * True if the supplied DOM node has a direct React-rendered child that is
  17043. * not a React root element. Useful for warning in `render`,
  17044. * `unmountComponentAtNode`, etc.
  17045. *
  17046. * @param {?DOMElement} node The candidate DOM node.
  17047. * @return {boolean} True if the DOM element contains a direct child that was
  17048. * rendered by React but is not a root element.
  17049. * @internal
  17050. */
  17051. function hasNonRootReactChild(container) {
  17052. var rootEl = getReactRootElementInContainer(container);
  17053. if (rootEl) {
  17054. var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
  17055. return !!(inst && inst._hostParent);
  17056. }
  17057. }
  17058. /**
  17059. * True if the supplied DOM node is a React DOM element and
  17060. * it has been rendered by another copy of React.
  17061. *
  17062. * @param {?DOMElement} node The candidate DOM node.
  17063. * @return {boolean} True if the DOM has been rendered by another copy of React
  17064. * @internal
  17065. */
  17066. function nodeIsRenderedByOtherInstance(container) {
  17067. var rootEl = getReactRootElementInContainer(container);
  17068. return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
  17069. }
  17070. /**
  17071. * True if the supplied DOM node is a valid node element.
  17072. *
  17073. * @param {?DOMElement} node The candidate DOM node.
  17074. * @return {boolean} True if the DOM is a valid DOM node.
  17075. * @internal
  17076. */
  17077. function isValidContainer(node) {
  17078. return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
  17079. }
  17080. /**
  17081. * True if the supplied DOM node is a valid React node element.
  17082. *
  17083. * @param {?DOMElement} node The candidate DOM node.
  17084. * @return {boolean} True if the DOM is a valid React DOM node.
  17085. * @internal
  17086. */
  17087. function isReactNode(node) {
  17088. return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
  17089. }
  17090. function getHostRootInstanceInContainer(container) {
  17091. var rootEl = getReactRootElementInContainer(container);
  17092. var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
  17093. return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
  17094. }
  17095. function getTopLevelWrapperInContainer(container) {
  17096. var root = getHostRootInstanceInContainer(container);
  17097. return root ? root._hostContainerInfo._topLevelWrapper : null;
  17098. }
  17099. /**
  17100. * Temporary (?) hack so that we can store all top-level pending updates on
  17101. * composites instead of having to worry about different types of components
  17102. * here.
  17103. */
  17104. var topLevelRootCounter = 1;
  17105. var TopLevelWrapper = function () {
  17106. this.rootID = topLevelRootCounter++;
  17107. };
  17108. TopLevelWrapper.prototype.isReactComponent = {};
  17109. if (false) {
  17110. TopLevelWrapper.displayName = 'TopLevelWrapper';
  17111. }
  17112. TopLevelWrapper.prototype.render = function () {
  17113. return this.props.child;
  17114. };
  17115. TopLevelWrapper.isReactTopLevelWrapper = true;
  17116. /**
  17117. * Mounting is the process of initializing a React component by creating its
  17118. * representative DOM elements and inserting them into a supplied `container`.
  17119. * Any prior content inside `container` is destroyed in the process.
  17120. *
  17121. * ReactMount.render(
  17122. * component,
  17123. * document.getElementById('container')
  17124. * );
  17125. *
  17126. * <div id="container"> <-- Supplied `container`.
  17127. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  17128. * // ... component.
  17129. * </div>
  17130. * </div>
  17131. *
  17132. * Inside of `container`, the first element rendered is the "reactRoot".
  17133. */
  17134. var ReactMount = {
  17135. TopLevelWrapper: TopLevelWrapper,
  17136. /**
  17137. * Used by devtools. The keys are not important.
  17138. */
  17139. _instancesByReactRootID: instancesByReactRootID,
  17140. /**
  17141. * This is a hook provided to support rendering React components while
  17142. * ensuring that the apparent scroll position of its `container` does not
  17143. * change.
  17144. *
  17145. * @param {DOMElement} container The `container` being rendered into.
  17146. * @param {function} renderCallback This must be called once to do the render.
  17147. */
  17148. scrollMonitor: function (container, renderCallback) {
  17149. renderCallback();
  17150. },
  17151. /**
  17152. * Take a component that's already mounted into the DOM and replace its props
  17153. * @param {ReactComponent} prevComponent component instance already in the DOM
  17154. * @param {ReactElement} nextElement component instance to render
  17155. * @param {DOMElement} container container to render into
  17156. * @param {?function} callback function triggered on completion
  17157. */
  17158. _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) {
  17159. ReactMount.scrollMonitor(container, function () {
  17160. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
  17161. if (callback) {
  17162. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  17163. }
  17164. });
  17165. return prevComponent;
  17166. },
  17167. /**
  17168. * Render a new component into the DOM. Hooked by hooks!
  17169. *
  17170. * @param {ReactElement} nextElement element to render
  17171. * @param {DOMElement} container container to render into
  17172. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  17173. * @return {ReactComponent} nextComponent
  17174. */
  17175. _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
  17176. // Various parts of our code (such as ReactCompositeComponent's
  17177. // _renderValidatedComponent) assume that calls to render aren't nested;
  17178. // verify that that's the case.
  17179. 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;
  17180. !isValidContainer(container) ? false ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;
  17181. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  17182. var componentInstance = instantiateReactComponent(nextElement, false);
  17183. // The initial render is synchronous but any updates that happen during
  17184. // rendering, in componentWillMount or componentDidMount, will be batched
  17185. // according to the current batching strategy.
  17186. ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
  17187. var wrapperID = componentInstance._instance.rootID;
  17188. instancesByReactRootID[wrapperID] = componentInstance;
  17189. return componentInstance;
  17190. },
  17191. /**
  17192. * Renders a React component into the DOM in the supplied `container`.
  17193. *
  17194. * If the React component was previously rendered into `container`, this will
  17195. * perform an update on it and only mutate the DOM as necessary to reflect the
  17196. * latest React component.
  17197. *
  17198. * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
  17199. * @param {ReactElement} nextElement Component element to render.
  17200. * @param {DOMElement} container DOM element to render into.
  17201. * @param {?function} callback function triggered on completion
  17202. * @return {ReactComponent} Component instance rendered in `container`.
  17203. */
  17204. renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  17205. !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? false ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
  17206. return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
  17207. },
  17208. _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
  17209. ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
  17210. !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 />.' :
  17211. // Check if it quacks like an element
  17212. 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;
  17213. 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;
  17214. var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement });
  17215. var nextContext;
  17216. if (parentComponent) {
  17217. var parentInst = ReactInstanceMap.get(parentComponent);
  17218. nextContext = parentInst._processChildContext(parentInst._context);
  17219. } else {
  17220. nextContext = emptyObject;
  17221. }
  17222. var prevComponent = getTopLevelWrapperInContainer(container);
  17223. if (prevComponent) {
  17224. var prevWrappedElement = prevComponent._currentElement;
  17225. var prevElement = prevWrappedElement.props.child;
  17226. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  17227. var publicInst = prevComponent._renderedComponent.getPublicInstance();
  17228. var updatedCallback = callback && function () {
  17229. callback.call(publicInst);
  17230. };
  17231. ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);
  17232. return publicInst;
  17233. } else {
  17234. ReactMount.unmountComponentAtNode(container);
  17235. }
  17236. }
  17237. var reactRootElement = getReactRootElementInContainer(container);
  17238. var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
  17239. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  17240. if (false) {
  17241. 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;
  17242. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  17243. var rootElementSibling = reactRootElement;
  17244. while (rootElementSibling) {
  17245. if (internalGetID(rootElementSibling)) {
  17246. 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;
  17247. break;
  17248. }
  17249. rootElementSibling = rootElementSibling.nextSibling;
  17250. }
  17251. }
  17252. }
  17253. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
  17254. var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();
  17255. if (callback) {
  17256. callback.call(component);
  17257. }
  17258. return component;
  17259. },
  17260. /**
  17261. * Renders a React component into the DOM in the supplied `container`.
  17262. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
  17263. *
  17264. * If the React component was previously rendered into `container`, this will
  17265. * perform an update on it and only mutate the DOM as necessary to reflect the
  17266. * latest React component.
  17267. *
  17268. * @param {ReactElement} nextElement Component element to render.
  17269. * @param {DOMElement} container DOM element to render into.
  17270. * @param {?function} callback function triggered on completion
  17271. * @return {ReactComponent} Component instance rendered in `container`.
  17272. */
  17273. render: function (nextElement, container, callback) {
  17274. return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
  17275. },
  17276. /**
  17277. * Unmounts and destroys the React component rendered in the `container`.
  17278. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
  17279. *
  17280. * @param {DOMElement} container DOM element containing a React component.
  17281. * @return {boolean} True if a component was found in and unmounted from
  17282. * `container`
  17283. */
  17284. unmountComponentAtNode: function (container) {
  17285. // Various parts of our code (such as ReactCompositeComponent's
  17286. // _renderValidatedComponent) assume that calls to render aren't nested;
  17287. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  17288. // render but we still don't expect to be in a render call here.)
  17289. 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;
  17290. !isValidContainer(container) ? false ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
  17291. if (false) {
  17292. 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;
  17293. }
  17294. var prevComponent = getTopLevelWrapperInContainer(container);
  17295. if (!prevComponent) {
  17296. // Check if the node being unmounted was rendered by React, but isn't a
  17297. // root node.
  17298. var containerHasNonRootReactChild = hasNonRootReactChild(container);
  17299. // Check if the container itself is a React root node.
  17300. var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
  17301. if (false) {
  17302. 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;
  17303. }
  17304. return false;
  17305. }
  17306. delete instancesByReactRootID[prevComponent._instance.rootID];
  17307. ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
  17308. return true;
  17309. },
  17310. _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
  17311. !isValidContainer(container) ? false ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;
  17312. if (shouldReuseMarkup) {
  17313. var rootElement = getReactRootElementInContainer(container);
  17314. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  17315. ReactDOMComponentTree.precacheNode(instance, rootElement);
  17316. return;
  17317. } else {
  17318. var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  17319. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  17320. var rootMarkup = rootElement.outerHTML;
  17321. rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
  17322. var normalizedMarkup = markup;
  17323. if (false) {
  17324. // because rootMarkup is retrieved from the DOM, various normalizations
  17325. // will have occurred which will not be present in `markup`. Here,
  17326. // insert markup into a <div> or <iframe> depending on the container
  17327. // type to perform the same normalizations before comparing.
  17328. var normalizer;
  17329. if (container.nodeType === ELEMENT_NODE_TYPE) {
  17330. normalizer = document.createElement('div');
  17331. normalizer.innerHTML = markup;
  17332. normalizedMarkup = normalizer.innerHTML;
  17333. } else {
  17334. normalizer = document.createElement('iframe');
  17335. document.body.appendChild(normalizer);
  17336. normalizer.contentDocument.write(markup);
  17337. normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
  17338. document.body.removeChild(normalizer);
  17339. }
  17340. }
  17341. var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
  17342. var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  17343. !(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;
  17344. if (false) {
  17345. 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;
  17346. }
  17347. }
  17348. }
  17349. !(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;
  17350. if (transaction.useCreateElement) {
  17351. while (container.lastChild) {
  17352. container.removeChild(container.lastChild);
  17353. }
  17354. DOMLazyTree.insertTreeBefore(container, markup, null);
  17355. } else {
  17356. setInnerHTML(container, markup);
  17357. ReactDOMComponentTree.precacheNode(instance, container.firstChild);
  17358. }
  17359. if (false) {
  17360. var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
  17361. if (hostNode._debugID !== 0) {
  17362. ReactInstrumentation.debugTool.onHostOperation({
  17363. instanceID: hostNode._debugID,
  17364. type: 'mount',
  17365. payload: markup.toString()
  17366. });
  17367. }
  17368. }
  17369. }
  17370. };
  17371. module.exports = ReactMount;
  17372. /***/ }),
  17373. /* 88 */
  17374. /***/ (function(module, exports, __webpack_require__) {
  17375. "use strict";
  17376. /**
  17377. * Copyright 2013-present, Facebook, Inc.
  17378. * All rights reserved.
  17379. *
  17380. * This source code is licensed under the BSD-style license found in the
  17381. * LICENSE file in the root directory of this source tree. An additional grant
  17382. * of patent rights can be found in the PATENTS file in the same directory.
  17383. *
  17384. *
  17385. */
  17386. var _prodInvariant = __webpack_require__(2);
  17387. var React = __webpack_require__(21);
  17388. var invariant = __webpack_require__(0);
  17389. var ReactNodeTypes = {
  17390. HOST: 0,
  17391. COMPOSITE: 1,
  17392. EMPTY: 2,
  17393. getType: function (node) {
  17394. if (node === null || node === false) {
  17395. return ReactNodeTypes.EMPTY;
  17396. } else if (React.isValidElement(node)) {
  17397. if (typeof node.type === 'function') {
  17398. return ReactNodeTypes.COMPOSITE;
  17399. } else {
  17400. return ReactNodeTypes.HOST;
  17401. }
  17402. }
  17403. true ? false ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
  17404. }
  17405. };
  17406. module.exports = ReactNodeTypes;
  17407. /***/ }),
  17408. /* 89 */
  17409. /***/ (function(module, exports, __webpack_require__) {
  17410. "use strict";
  17411. /**
  17412. * Copyright 2013-present, Facebook, Inc.
  17413. * All rights reserved.
  17414. *
  17415. * This source code is licensed under the BSD-style license found in the
  17416. * LICENSE file in the root directory of this source tree. An additional grant
  17417. * of patent rights can be found in the PATENTS file in the same directory.
  17418. *
  17419. */
  17420. var ViewportMetrics = {
  17421. currentScrollLeft: 0,
  17422. currentScrollTop: 0,
  17423. refreshScrollValues: function (scrollPosition) {
  17424. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  17425. ViewportMetrics.currentScrollTop = scrollPosition.y;
  17426. }
  17427. };
  17428. module.exports = ViewportMetrics;
  17429. /***/ }),
  17430. /* 90 */
  17431. /***/ (function(module, exports, __webpack_require__) {
  17432. "use strict";
  17433. /**
  17434. * Copyright 2014-present, Facebook, Inc.
  17435. * All rights reserved.
  17436. *
  17437. * This source code is licensed under the BSD-style license found in the
  17438. * LICENSE file in the root directory of this source tree. An additional grant
  17439. * of patent rights can be found in the PATENTS file in the same directory.
  17440. *
  17441. *
  17442. */
  17443. var _prodInvariant = __webpack_require__(2);
  17444. var invariant = __webpack_require__(0);
  17445. /**
  17446. * Accumulates items that must not be null or undefined into the first one. This
  17447. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  17448. * API cleanness. Since `current` can be null before being passed in and not
  17449. * null after this function, make sure to assign it back to `current`:
  17450. *
  17451. * `a = accumulateInto(a, b);`
  17452. *
  17453. * This API should be sparingly used. Try `accumulate` for something cleaner.
  17454. *
  17455. * @return {*|array<*>} An accumulation of items.
  17456. */
  17457. function accumulateInto(current, next) {
  17458. !(next != null) ? false ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
  17459. if (current == null) {
  17460. return next;
  17461. }
  17462. // Both are not empty. Warning: Never call x.concat(y) when you are not
  17463. // certain that x is an Array (x could be a string with concat method).
  17464. if (Array.isArray(current)) {
  17465. if (Array.isArray(next)) {
  17466. current.push.apply(current, next);
  17467. return current;
  17468. }
  17469. current.push(next);
  17470. return current;
  17471. }
  17472. if (Array.isArray(next)) {
  17473. // A bit too dangerous to mutate `next`.
  17474. return [current].concat(next);
  17475. }
  17476. return [current, next];
  17477. }
  17478. module.exports = accumulateInto;
  17479. /***/ }),
  17480. /* 91 */
  17481. /***/ (function(module, exports, __webpack_require__) {
  17482. "use strict";
  17483. /**
  17484. * Copyright 2013-present, Facebook, Inc.
  17485. * All rights reserved.
  17486. *
  17487. * This source code is licensed under the BSD-style license found in the
  17488. * LICENSE file in the root directory of this source tree. An additional grant
  17489. * of patent rights can be found in the PATENTS file in the same directory.
  17490. *
  17491. *
  17492. */
  17493. /**
  17494. * @param {array} arr an "accumulation" of items which is either an Array or
  17495. * a single item. Useful when paired with the `accumulate` module. This is a
  17496. * simple utility that allows us to reason about a collection of items, but
  17497. * handling the case when there is exactly one item (and we do not need to
  17498. * allocate an array).
  17499. */
  17500. function forEachAccumulated(arr, cb, scope) {
  17501. if (Array.isArray(arr)) {
  17502. arr.forEach(cb, scope);
  17503. } else if (arr) {
  17504. cb.call(scope, arr);
  17505. }
  17506. }
  17507. module.exports = forEachAccumulated;
  17508. /***/ }),
  17509. /* 92 */
  17510. /***/ (function(module, exports, __webpack_require__) {
  17511. "use strict";
  17512. /**
  17513. * Copyright 2013-present, Facebook, Inc.
  17514. * All rights reserved.
  17515. *
  17516. * This source code is licensed under the BSD-style license found in the
  17517. * LICENSE file in the root directory of this source tree. An additional grant
  17518. * of patent rights can be found in the PATENTS file in the same directory.
  17519. *
  17520. */
  17521. var ReactNodeTypes = __webpack_require__(88);
  17522. function getHostComponentFromComposite(inst) {
  17523. var type;
  17524. while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
  17525. inst = inst._renderedComponent;
  17526. }
  17527. if (type === ReactNodeTypes.HOST) {
  17528. return inst._renderedComponent;
  17529. } else if (type === ReactNodeTypes.EMPTY) {
  17530. return null;
  17531. }
  17532. }
  17533. module.exports = getHostComponentFromComposite;
  17534. /***/ }),
  17535. /* 93 */
  17536. /***/ (function(module, exports, __webpack_require__) {
  17537. "use strict";
  17538. /**
  17539. * Copyright 2013-present, Facebook, Inc.
  17540. * All rights reserved.
  17541. *
  17542. * This source code is licensed under the BSD-style license found in the
  17543. * LICENSE file in the root directory of this source tree. An additional grant
  17544. * of patent rights can be found in the PATENTS file in the same directory.
  17545. *
  17546. */
  17547. var ExecutionEnvironment = __webpack_require__(9);
  17548. var contentKey = null;
  17549. /**
  17550. * Gets the key used to access text content on a DOM node.
  17551. *
  17552. * @return {?string} Key used to access text content.
  17553. * @internal
  17554. */
  17555. function getTextContentAccessor() {
  17556. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  17557. // Prefer textContent to innerText because many browsers support both but
  17558. // SVG <text> elements don't support innerText even when <div> does.
  17559. contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
  17560. }
  17561. return contentKey;
  17562. }
  17563. module.exports = getTextContentAccessor;
  17564. /***/ }),
  17565. /* 94 */
  17566. /***/ (function(module, exports, __webpack_require__) {
  17567. "use strict";
  17568. /**
  17569. * Copyright 2013-present, Facebook, Inc.
  17570. * All rights reserved.
  17571. *
  17572. * This source code is licensed under the BSD-style license found in the
  17573. * LICENSE file in the root directory of this source tree. An additional grant
  17574. * of patent rights can be found in the PATENTS file in the same directory.
  17575. *
  17576. */
  17577. var _prodInvariant = __webpack_require__(2),
  17578. _assign = __webpack_require__(3);
  17579. var ReactCompositeComponent = __webpack_require__(181);
  17580. var ReactEmptyComponent = __webpack_require__(83);
  17581. var ReactHostComponent = __webpack_require__(85);
  17582. var getNextDebugID = __webpack_require__(228);
  17583. var invariant = __webpack_require__(0);
  17584. var warning = __webpack_require__(1);
  17585. // To avoid a cyclic dependency, we create the final class in this module
  17586. var ReactCompositeComponentWrapper = function (element) {
  17587. this.construct(element);
  17588. };
  17589. _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, {
  17590. _instantiateReactComponent: instantiateReactComponent
  17591. });
  17592. function getDeclarationErrorAddendum(owner) {
  17593. if (owner) {
  17594. var name = owner.getName();
  17595. if (name) {
  17596. return ' Check the render method of `' + name + '`.';
  17597. }
  17598. }
  17599. return '';
  17600. }
  17601. /**
  17602. * Check if the type reference is a known internal type. I.e. not a user
  17603. * provided composite type.
  17604. *
  17605. * @param {function} type
  17606. * @return {boolean} Returns true if this is a valid internal type.
  17607. */
  17608. function isInternalComponentType(type) {
  17609. return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
  17610. }
  17611. /**
  17612. * Given a ReactNode, create an instance that will actually be mounted.
  17613. *
  17614. * @param {ReactNode} node
  17615. * @param {boolean} shouldHaveDebugID
  17616. * @return {object} A new instance of the element's constructor.
  17617. * @protected
  17618. */
  17619. function instantiateReactComponent(node, shouldHaveDebugID) {
  17620. var instance;
  17621. if (node === null || node === false) {
  17622. instance = ReactEmptyComponent.create(instantiateReactComponent);
  17623. } else if (typeof node === 'object') {
  17624. var element = node;
  17625. var type = element.type;
  17626. if (typeof type !== 'function' && typeof type !== 'string') {
  17627. var info = '';
  17628. if (false) {
  17629. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  17630. info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
  17631. }
  17632. }
  17633. info += getDeclarationErrorAddendum(element._owner);
  17634. 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;
  17635. }
  17636. // Special case string values
  17637. if (typeof element.type === 'string') {
  17638. instance = ReactHostComponent.createInternalComponent(element);
  17639. } else if (isInternalComponentType(element.type)) {
  17640. // This is temporarily available for custom components that are not string
  17641. // representations. I.e. ART. Once those are updated to use the string
  17642. // representation, we can drop this code path.
  17643. instance = new element.type(element);
  17644. // We renamed this. Allow the old name for compat. :(
  17645. if (!instance.getHostNode) {
  17646. instance.getHostNode = instance.getNativeNode;
  17647. }
  17648. } else {
  17649. instance = new ReactCompositeComponentWrapper(element);
  17650. }
  17651. } else if (typeof node === 'string' || typeof node === 'number') {
  17652. instance = ReactHostComponent.createInstanceForText(node);
  17653. } else {
  17654. true ? false ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0;
  17655. }
  17656. if (false) {
  17657. 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;
  17658. }
  17659. // These two fields are used by the DOM and ART diffing algorithms
  17660. // respectively. Instead of using expandos on components, we should be
  17661. // storing the state needed by the diffing algorithms elsewhere.
  17662. instance._mountIndex = 0;
  17663. instance._mountImage = null;
  17664. if (false) {
  17665. instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0;
  17666. }
  17667. // Internal instances should fully constructed at this point, so they should
  17668. // not get any new fields added to them at this point.
  17669. if (false) {
  17670. if (Object.preventExtensions) {
  17671. Object.preventExtensions(instance);
  17672. }
  17673. }
  17674. return instance;
  17675. }
  17676. module.exports = instantiateReactComponent;
  17677. /***/ }),
  17678. /* 95 */
  17679. /***/ (function(module, exports, __webpack_require__) {
  17680. "use strict";
  17681. /**
  17682. * Copyright 2013-present, Facebook, Inc.
  17683. * All rights reserved.
  17684. *
  17685. * This source code is licensed under the BSD-style license found in the
  17686. * LICENSE file in the root directory of this source tree. An additional grant
  17687. * of patent rights can be found in the PATENTS file in the same directory.
  17688. *
  17689. *
  17690. */
  17691. /**
  17692. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  17693. */
  17694. var supportedInputTypes = {
  17695. 'color': true,
  17696. 'date': true,
  17697. 'datetime': true,
  17698. 'datetime-local': true,
  17699. 'email': true,
  17700. 'month': true,
  17701. 'number': true,
  17702. 'password': true,
  17703. 'range': true,
  17704. 'search': true,
  17705. 'tel': true,
  17706. 'text': true,
  17707. 'time': true,
  17708. 'url': true,
  17709. 'week': true
  17710. };
  17711. function isTextInputElement(elem) {
  17712. var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
  17713. if (nodeName === 'input') {
  17714. return !!supportedInputTypes[elem.type];
  17715. }
  17716. if (nodeName === 'textarea') {
  17717. return true;
  17718. }
  17719. return false;
  17720. }
  17721. module.exports = isTextInputElement;
  17722. /***/ }),
  17723. /* 96 */
  17724. /***/ (function(module, exports, __webpack_require__) {
  17725. "use strict";
  17726. /**
  17727. * Copyright 2013-present, Facebook, Inc.
  17728. * All rights reserved.
  17729. *
  17730. * This source code is licensed under the BSD-style license found in the
  17731. * LICENSE file in the root directory of this source tree. An additional grant
  17732. * of patent rights can be found in the PATENTS file in the same directory.
  17733. *
  17734. */
  17735. var ExecutionEnvironment = __webpack_require__(9);
  17736. var escapeTextContentForBrowser = __webpack_require__(34);
  17737. var setInnerHTML = __webpack_require__(35);
  17738. /**
  17739. * Set the textContent property of a node, ensuring that whitespace is preserved
  17740. * even in IE8. innerText is a poor substitute for textContent and, among many
  17741. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  17742. * as it should.
  17743. *
  17744. * @param {DOMElement} node
  17745. * @param {string} text
  17746. * @internal
  17747. */
  17748. var setTextContent = function (node, text) {
  17749. if (text) {
  17750. var firstChild = node.firstChild;
  17751. if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) {
  17752. firstChild.nodeValue = text;
  17753. return;
  17754. }
  17755. }
  17756. node.textContent = text;
  17757. };
  17758. if (ExecutionEnvironment.canUseDOM) {
  17759. if (!('textContent' in document.documentElement)) {
  17760. setTextContent = function (node, text) {
  17761. if (node.nodeType === 3) {
  17762. node.nodeValue = text;
  17763. return;
  17764. }
  17765. setInnerHTML(node, escapeTextContentForBrowser(text));
  17766. };
  17767. }
  17768. }
  17769. module.exports = setTextContent;
  17770. /***/ }),
  17771. /* 97 */
  17772. /***/ (function(module, exports, __webpack_require__) {
  17773. "use strict";
  17774. /**
  17775. * Copyright 2013-present, Facebook, Inc.
  17776. * All rights reserved.
  17777. *
  17778. * This source code is licensed under the BSD-style license found in the
  17779. * LICENSE file in the root directory of this source tree. An additional grant
  17780. * of patent rights can be found in the PATENTS file in the same directory.
  17781. *
  17782. */
  17783. var _prodInvariant = __webpack_require__(2);
  17784. var ReactCurrentOwner = __webpack_require__(14);
  17785. var REACT_ELEMENT_TYPE = __webpack_require__(196);
  17786. var getIteratorFn = __webpack_require__(227);
  17787. var invariant = __webpack_require__(0);
  17788. var KeyEscapeUtils = __webpack_require__(54);
  17789. var warning = __webpack_require__(1);
  17790. var SEPARATOR = '.';
  17791. var SUBSEPARATOR = ':';
  17792. /**
  17793. * This is inlined from ReactElement since this file is shared between
  17794. * isomorphic and renderers. We could extract this to a
  17795. *
  17796. */
  17797. /**
  17798. * TODO: Test that a single child and an array with one item have the same key
  17799. * pattern.
  17800. */
  17801. var didWarnAboutMaps = false;
  17802. /**
  17803. * Generate a key string that identifies a component within a set.
  17804. *
  17805. * @param {*} component A component that could contain a manual key.
  17806. * @param {number} index Index that is used if a manual key is not provided.
  17807. * @return {string}
  17808. */
  17809. function getComponentKey(component, index) {
  17810. // Do some typechecking here since we call this blindly. We want to ensure
  17811. // that we don't block potential future ES APIs.
  17812. if (component && typeof component === 'object' && component.key != null) {
  17813. // Explicit key
  17814. return KeyEscapeUtils.escape(component.key);
  17815. }
  17816. // Implicit key determined by the index in the set
  17817. return index.toString(36);
  17818. }
  17819. /**
  17820. * @param {?*} children Children tree container.
  17821. * @param {!string} nameSoFar Name of the key path so far.
  17822. * @param {!function} callback Callback to invoke with each child found.
  17823. * @param {?*} traverseContext Used to pass information throughout the traversal
  17824. * process.
  17825. * @return {!number} The number of children in this subtree.
  17826. */
  17827. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  17828. var type = typeof children;
  17829. if (type === 'undefined' || type === 'boolean') {
  17830. // All of the above are perceived as null.
  17831. children = null;
  17832. }
  17833. if (children === null || type === 'string' || type === 'number' ||
  17834. // The following is inlined from ReactElement. This means we can optimize
  17835. // some checks. React Fiber also inlines this logic for similar purposes.
  17836. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  17837. callback(traverseContext, children,
  17838. // If it's the only child, treat the name as if it was wrapped in an array
  17839. // so that it's consistent if the number of children grows.
  17840. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  17841. return 1;
  17842. }
  17843. var child;
  17844. var nextName;
  17845. var subtreeCount = 0; // Count of children found in the current subtree.
  17846. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  17847. if (Array.isArray(children)) {
  17848. for (var i = 0; i < children.length; i++) {
  17849. child = children[i];
  17850. nextName = nextNamePrefix + getComponentKey(child, i);
  17851. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  17852. }
  17853. } else {
  17854. var iteratorFn = getIteratorFn(children);
  17855. if (iteratorFn) {
  17856. var iterator = iteratorFn.call(children);
  17857. var step;
  17858. if (iteratorFn !== children.entries) {
  17859. var ii = 0;
  17860. while (!(step = iterator.next()).done) {
  17861. child = step.value;
  17862. nextName = nextNamePrefix + getComponentKey(child, ii++);
  17863. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  17864. }
  17865. } else {
  17866. if (false) {
  17867. var mapsAsChildrenAddendum = '';
  17868. if (ReactCurrentOwner.current) {
  17869. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  17870. if (mapsAsChildrenOwnerName) {
  17871. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  17872. }
  17873. }
  17874. 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;
  17875. didWarnAboutMaps = true;
  17876. }
  17877. // Iterator will provide entry [k,v] tuples rather than values.
  17878. while (!(step = iterator.next()).done) {
  17879. var entry = step.value;
  17880. if (entry) {
  17881. child = entry[1];
  17882. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  17883. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  17884. }
  17885. }
  17886. }
  17887. } else if (type === 'object') {
  17888. var addendum = '';
  17889. if (false) {
  17890. 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.';
  17891. if (children._isReactElement) {
  17892. 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.';
  17893. }
  17894. if (ReactCurrentOwner.current) {
  17895. var name = ReactCurrentOwner.current.getName();
  17896. if (name) {
  17897. addendum += ' Check the render method of `' + name + '`.';
  17898. }
  17899. }
  17900. }
  17901. var childrenString = String(children);
  17902. 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;
  17903. }
  17904. }
  17905. return subtreeCount;
  17906. }
  17907. /**
  17908. * Traverses children that are typically specified as `props.children`, but
  17909. * might also be specified through attributes:
  17910. *
  17911. * - `traverseAllChildren(this.props.children, ...)`
  17912. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  17913. *
  17914. * The `traverseContext` is an optional argument that is passed through the
  17915. * entire traversal. It can be used to store accumulations or anything else that
  17916. * the callback might find relevant.
  17917. *
  17918. * @param {?*} children Children tree object.
  17919. * @param {!function} callback To invoke upon traversing each child.
  17920. * @param {?*} traverseContext Context for traversal.
  17921. * @return {!number} The number of children in this subtree.
  17922. */
  17923. function traverseAllChildren(children, callback, traverseContext) {
  17924. if (children == null) {
  17925. return 0;
  17926. }
  17927. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  17928. }
  17929. module.exports = traverseAllChildren;
  17930. /***/ }),
  17931. /* 98 */
  17932. /***/ (function(module, exports, __webpack_require__) {
  17933. "use strict";
  17934. /**
  17935. * Copyright 2016-present, Facebook, Inc.
  17936. * All rights reserved.
  17937. *
  17938. * This source code is licensed under the BSD-style license found in the
  17939. * LICENSE file in the root directory of this source tree. An additional grant
  17940. * of patent rights can be found in the PATENTS file in the same directory.
  17941. *
  17942. *
  17943. */
  17944. var _prodInvariant = __webpack_require__(23);
  17945. var ReactCurrentOwner = __webpack_require__(14);
  17946. var invariant = __webpack_require__(0);
  17947. var warning = __webpack_require__(1);
  17948. function isNative(fn) {
  17949. // Based on isNative() from Lodash
  17950. var funcToString = Function.prototype.toString;
  17951. var hasOwnProperty = Object.prototype.hasOwnProperty;
  17952. var reIsNative = RegExp('^' + funcToString
  17953. // Take an example native function source for comparison
  17954. .call(hasOwnProperty)
  17955. // Strip regex characters so we can use it for regex
  17956. .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
  17957. // Remove hasOwnProperty from the template to make it generic
  17958. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
  17959. try {
  17960. var source = funcToString.call(fn);
  17961. return reIsNative.test(source);
  17962. } catch (err) {
  17963. return false;
  17964. }
  17965. }
  17966. var canUseCollections =
  17967. // Array.from
  17968. typeof Array.from === 'function' &&
  17969. // Map
  17970. typeof Map === 'function' && isNative(Map) &&
  17971. // Map.prototype.keys
  17972. Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
  17973. // Set
  17974. typeof Set === 'function' && isNative(Set) &&
  17975. // Set.prototype.keys
  17976. Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
  17977. var setItem;
  17978. var getItem;
  17979. var removeItem;
  17980. var getItemIDs;
  17981. var addRoot;
  17982. var removeRoot;
  17983. var getRootIDs;
  17984. if (canUseCollections) {
  17985. var itemMap = new Map();
  17986. var rootIDSet = new Set();
  17987. setItem = function (id, item) {
  17988. itemMap.set(id, item);
  17989. };
  17990. getItem = function (id) {
  17991. return itemMap.get(id);
  17992. };
  17993. removeItem = function (id) {
  17994. itemMap['delete'](id);
  17995. };
  17996. getItemIDs = function () {
  17997. return Array.from(itemMap.keys());
  17998. };
  17999. addRoot = function (id) {
  18000. rootIDSet.add(id);
  18001. };
  18002. removeRoot = function (id) {
  18003. rootIDSet['delete'](id);
  18004. };
  18005. getRootIDs = function () {
  18006. return Array.from(rootIDSet.keys());
  18007. };
  18008. } else {
  18009. var itemByKey = {};
  18010. var rootByKey = {};
  18011. // Use non-numeric keys to prevent V8 performance issues:
  18012. // https://github.com/facebook/react/pull/7232
  18013. var getKeyFromID = function (id) {
  18014. return '.' + id;
  18015. };
  18016. var getIDFromKey = function (key) {
  18017. return parseInt(key.substr(1), 10);
  18018. };
  18019. setItem = function (id, item) {
  18020. var key = getKeyFromID(id);
  18021. itemByKey[key] = item;
  18022. };
  18023. getItem = function (id) {
  18024. var key = getKeyFromID(id);
  18025. return itemByKey[key];
  18026. };
  18027. removeItem = function (id) {
  18028. var key = getKeyFromID(id);
  18029. delete itemByKey[key];
  18030. };
  18031. getItemIDs = function () {
  18032. return Object.keys(itemByKey).map(getIDFromKey);
  18033. };
  18034. addRoot = function (id) {
  18035. var key = getKeyFromID(id);
  18036. rootByKey[key] = true;
  18037. };
  18038. removeRoot = function (id) {
  18039. var key = getKeyFromID(id);
  18040. delete rootByKey[key];
  18041. };
  18042. getRootIDs = function () {
  18043. return Object.keys(rootByKey).map(getIDFromKey);
  18044. };
  18045. }
  18046. var unmountedIDs = [];
  18047. function purgeDeep(id) {
  18048. var item = getItem(id);
  18049. if (item) {
  18050. var childIDs = item.childIDs;
  18051. removeItem(id);
  18052. childIDs.forEach(purgeDeep);
  18053. }
  18054. }
  18055. function describeComponentFrame(name, source, ownerName) {
  18056. return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
  18057. }
  18058. function getDisplayName(element) {
  18059. if (element == null) {
  18060. return '#empty';
  18061. } else if (typeof element === 'string' || typeof element === 'number') {
  18062. return '#text';
  18063. } else if (typeof element.type === 'string') {
  18064. return element.type;
  18065. } else {
  18066. return element.type.displayName || element.type.name || 'Unknown';
  18067. }
  18068. }
  18069. function describeID(id) {
  18070. var name = ReactComponentTreeHook.getDisplayName(id);
  18071. var element = ReactComponentTreeHook.getElement(id);
  18072. var ownerID = ReactComponentTreeHook.getOwnerID(id);
  18073. var ownerName;
  18074. if (ownerID) {
  18075. ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
  18076. }
  18077. false ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
  18078. return describeComponentFrame(name, element && element._source, ownerName);
  18079. }
  18080. var ReactComponentTreeHook = {
  18081. onSetChildren: function (id, nextChildIDs) {
  18082. var item = getItem(id);
  18083. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  18084. item.childIDs = nextChildIDs;
  18085. for (var i = 0; i < nextChildIDs.length; i++) {
  18086. var nextChildID = nextChildIDs[i];
  18087. var nextChild = getItem(nextChildID);
  18088. !nextChild ? false ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
  18089. !(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;
  18090. !nextChild.isMounted ? false ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
  18091. if (nextChild.parentID == null) {
  18092. nextChild.parentID = id;
  18093. // TODO: This shouldn't be necessary but mounting a new root during in
  18094. // componentWillMount currently causes not-yet-mounted components to
  18095. // be purged from our tree data so their parent id is missing.
  18096. }
  18097. !(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;
  18098. }
  18099. },
  18100. onBeforeMountComponent: function (id, element, parentID) {
  18101. var item = {
  18102. element: element,
  18103. parentID: parentID,
  18104. text: null,
  18105. childIDs: [],
  18106. isMounted: false,
  18107. updateCount: 0
  18108. };
  18109. setItem(id, item);
  18110. },
  18111. onBeforeUpdateComponent: function (id, element) {
  18112. var item = getItem(id);
  18113. if (!item || !item.isMounted) {
  18114. // We may end up here as a result of setState() in componentWillUnmount().
  18115. // In this case, ignore the element.
  18116. return;
  18117. }
  18118. item.element = element;
  18119. },
  18120. onMountComponent: function (id) {
  18121. var item = getItem(id);
  18122. !item ? false ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
  18123. item.isMounted = true;
  18124. var isRoot = item.parentID === 0;
  18125. if (isRoot) {
  18126. addRoot(id);
  18127. }
  18128. },
  18129. onUpdateComponent: function (id) {
  18130. var item = getItem(id);
  18131. if (!item || !item.isMounted) {
  18132. // We may end up here as a result of setState() in componentWillUnmount().
  18133. // In this case, ignore the element.
  18134. return;
  18135. }
  18136. item.updateCount++;
  18137. },
  18138. onUnmountComponent: function (id) {
  18139. var item = getItem(id);
  18140. if (item) {
  18141. // We need to check if it exists.
  18142. // `item` might not exist if it is inside an error boundary, and a sibling
  18143. // error boundary child threw while mounting. Then this instance never
  18144. // got a chance to mount, but it still gets an unmounting event during
  18145. // the error boundary cleanup.
  18146. item.isMounted = false;
  18147. var isRoot = item.parentID === 0;
  18148. if (isRoot) {
  18149. removeRoot(id);
  18150. }
  18151. }
  18152. unmountedIDs.push(id);
  18153. },
  18154. purgeUnmountedComponents: function () {
  18155. if (ReactComponentTreeHook._preventPurging) {
  18156. // Should only be used for testing.
  18157. return;
  18158. }
  18159. for (var i = 0; i < unmountedIDs.length; i++) {
  18160. var id = unmountedIDs[i];
  18161. purgeDeep(id);
  18162. }
  18163. unmountedIDs.length = 0;
  18164. },
  18165. isMounted: function (id) {
  18166. var item = getItem(id);
  18167. return item ? item.isMounted : false;
  18168. },
  18169. getCurrentStackAddendum: function (topElement) {
  18170. var info = '';
  18171. if (topElement) {
  18172. var name = getDisplayName(topElement);
  18173. var owner = topElement._owner;
  18174. info += describeComponentFrame(name, topElement._source, owner && owner.getName());
  18175. }
  18176. var currentOwner = ReactCurrentOwner.current;
  18177. var id = currentOwner && currentOwner._debugID;
  18178. info += ReactComponentTreeHook.getStackAddendumByID(id);
  18179. return info;
  18180. },
  18181. getStackAddendumByID: function (id) {
  18182. var info = '';
  18183. while (id) {
  18184. info += describeID(id);
  18185. id = ReactComponentTreeHook.getParentID(id);
  18186. }
  18187. return info;
  18188. },
  18189. getChildIDs: function (id) {
  18190. var item = getItem(id);
  18191. return item ? item.childIDs : [];
  18192. },
  18193. getDisplayName: function (id) {
  18194. var element = ReactComponentTreeHook.getElement(id);
  18195. if (!element) {
  18196. return null;
  18197. }
  18198. return getDisplayName(element);
  18199. },
  18200. getElement: function (id) {
  18201. var item = getItem(id);
  18202. return item ? item.element : null;
  18203. },
  18204. getOwnerID: function (id) {
  18205. var element = ReactComponentTreeHook.getElement(id);
  18206. if (!element || !element._owner) {
  18207. return null;
  18208. }
  18209. return element._owner._debugID;
  18210. },
  18211. getParentID: function (id) {
  18212. var item = getItem(id);
  18213. return item ? item.parentID : null;
  18214. },
  18215. getSource: function (id) {
  18216. var item = getItem(id);
  18217. var element = item ? item.element : null;
  18218. var source = element != null ? element._source : null;
  18219. return source;
  18220. },
  18221. getText: function (id) {
  18222. var element = ReactComponentTreeHook.getElement(id);
  18223. if (typeof element === 'string') {
  18224. return element;
  18225. } else if (typeof element === 'number') {
  18226. return '' + element;
  18227. } else {
  18228. return null;
  18229. }
  18230. },
  18231. getUpdateCount: function (id) {
  18232. var item = getItem(id);
  18233. return item ? item.updateCount : 0;
  18234. },
  18235. getRootIDs: getRootIDs,
  18236. getRegisteredIDs: getItemIDs
  18237. };
  18238. module.exports = ReactComponentTreeHook;
  18239. /***/ }),
  18240. /* 99 */
  18241. /***/ (function(module, exports, __webpack_require__) {
  18242. "use strict";
  18243. /**
  18244. * Copyright 2014-present, Facebook, Inc.
  18245. * All rights reserved.
  18246. *
  18247. * This source code is licensed under the BSD-style license found in the
  18248. * LICENSE file in the root directory of this source tree. An additional grant
  18249. * of patent rights can be found in the PATENTS file in the same directory.
  18250. *
  18251. *
  18252. */
  18253. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  18254. // nor polyfill, then a plain number is used for performance.
  18255. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  18256. module.exports = REACT_ELEMENT_TYPE;
  18257. /***/ }),
  18258. /* 100 */
  18259. /***/ (function(module, exports, __webpack_require__) {
  18260. "use strict";
  18261. /**
  18262. * Copyright 2013-present, Facebook, Inc.
  18263. * All rights reserved.
  18264. *
  18265. * This source code is licensed under the BSD-style license found in the
  18266. * LICENSE file in the root directory of this source tree. An additional grant
  18267. * of patent rights can be found in the PATENTS file in the same directory.
  18268. *
  18269. *
  18270. */
  18271. var ReactPropTypeLocationNames = {};
  18272. if (false) {
  18273. ReactPropTypeLocationNames = {
  18274. prop: 'prop',
  18275. context: 'context',
  18276. childContext: 'child context'
  18277. };
  18278. }
  18279. module.exports = ReactPropTypeLocationNames;
  18280. /***/ }),
  18281. /* 101 */
  18282. /***/ (function(module, exports, __webpack_require__) {
  18283. "use strict";
  18284. /**
  18285. * Copyright 2013-present, Facebook, Inc.
  18286. * All rights reserved.
  18287. *
  18288. * This source code is licensed under the BSD-style license found in the
  18289. * LICENSE file in the root directory of this source tree. An additional grant
  18290. * of patent rights can be found in the PATENTS file in the same directory.
  18291. *
  18292. *
  18293. */
  18294. var canDefineProperty = false;
  18295. if (false) {
  18296. try {
  18297. // $FlowFixMe https://github.com/facebook/flow/issues/285
  18298. Object.defineProperty({}, 'x', { get: function () {} });
  18299. canDefineProperty = true;
  18300. } catch (x) {
  18301. // IE will fail on defineProperty
  18302. }
  18303. }
  18304. module.exports = canDefineProperty;
  18305. /***/ }),
  18306. /* 102 */
  18307. /***/ (function(module, exports, __webpack_require__) {
  18308. "use strict";
  18309. /**
  18310. * Copyright 2013-present, Facebook, Inc.
  18311. * All rights reserved.
  18312. *
  18313. * This source code is licensed under the BSD-style license found in the
  18314. * LICENSE file in the root directory of this source tree. An additional grant
  18315. * of patent rights can be found in the PATENTS file in the same directory.
  18316. *
  18317. *
  18318. */
  18319. /* global Symbol */
  18320. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  18321. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  18322. /**
  18323. * Returns the iterator method function contained on the iterable object.
  18324. *
  18325. * Be sure to invoke the function with the iterable as context:
  18326. *
  18327. * var iteratorFn = getIteratorFn(myIterable);
  18328. * if (iteratorFn) {
  18329. * var iterator = iteratorFn.call(myIterable);
  18330. * ...
  18331. * }
  18332. *
  18333. * @param {?object} maybeIterable
  18334. * @return {?function}
  18335. */
  18336. function getIteratorFn(maybeIterable) {
  18337. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  18338. if (typeof iteratorFn === 'function') {
  18339. return iteratorFn;
  18340. }
  18341. }
  18342. module.exports = getIteratorFn;
  18343. /***/ }),
  18344. /* 103 */
  18345. /***/ (function(module, exports, __webpack_require__) {
  18346. "use strict";
  18347. /**
  18348. * @author oldj
  18349. * @blog http://oldj.net
  18350. */
  18351. Object.defineProperty(exports, "__esModule", {
  18352. value: true
  18353. });
  18354. 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; }; }();
  18355. var _react = __webpack_require__(7);
  18356. var _react2 = _interopRequireDefault(_react);
  18357. var _panel = __webpack_require__(152);
  18358. var _panel2 = _interopRequireDefault(_panel);
  18359. var _content = __webpack_require__(142);
  18360. var _content2 = _interopRequireDefault(_content);
  18361. var _sudo = __webpack_require__(147);
  18362. var _sudo2 = _interopRequireDefault(_sudo);
  18363. var _edit = __webpack_require__(144);
  18364. var _edit2 = _interopRequireDefault(_edit);
  18365. var _preferences = __webpack_require__(146);
  18366. var _preferences2 = _interopRequireDefault(_preferences);
  18367. var _Agent = __webpack_require__(4);
  18368. var _Agent2 = _interopRequireDefault(_Agent);
  18369. var _index = __webpack_require__(30);
  18370. __webpack_require__(106);
  18371. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18372. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18373. 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; }
  18374. 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; }
  18375. var App = function (_React$Component) {
  18376. _inherits(App, _React$Component);
  18377. function App(props) {
  18378. _classCallCheck(this, App);
  18379. var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props));
  18380. _this.state = {
  18381. list: [], // 用户的 hosts 列表
  18382. sys_hosts: {}, // 系统 hosts
  18383. current: {}, // 当前 hosts
  18384. lang: {}, // 语言
  18385. just_added_id: null
  18386. };
  18387. _this.is_dragging = false;
  18388. _this.loadHosts();
  18389. _Agent2.default.pact('getPref').then(function (pref) {
  18390. return pref.user_language || 'en';
  18391. }).then(function (l) {
  18392. _Agent2.default.pact('getLang', l).then(function (lang) {
  18393. _this.setState({ lang: lang });
  18394. });
  18395. });
  18396. (0, _index.reg)(_this);
  18397. _Agent2.default.on('drag_start', function () {
  18398. _this.is_dragging = true;
  18399. console.log('drag_start');
  18400. });
  18401. _Agent2.default.on('drag_end', function () {
  18402. _this.is_dragging = false;
  18403. console.log('drag_end');
  18404. });
  18405. setInterval(function () {
  18406. var list = _this.state.list;
  18407. if (_this.is_dragging || !list || list.length === 0) return;
  18408. console.log('checkNeedRemoteRefresh');
  18409. _Agent2.default.pact('checkNeedRemoteRefresh', list).then(function (list) {
  18410. if (!list) return;
  18411. _Agent2.default.emit('list_updated', list);
  18412. }).catch(function (e) {
  18413. console.log(e);
  18414. });
  18415. }, 60 * 1000);
  18416. return _this;
  18417. }
  18418. _createClass(App, [{
  18419. key: 'loadHosts',
  18420. value: function loadHosts() {
  18421. var _this2 = this;
  18422. _Agent2.default.pact('getHosts').then(function (data) {
  18423. var state = {
  18424. list: data.list,
  18425. sys_hosts: data.sys_hosts
  18426. };
  18427. var current = _this2.state.current;
  18428. state.current = data.list.find(function (item) {
  18429. return item.id === current.id;
  18430. }) || data.sys_hosts;
  18431. _this2.setState(state);
  18432. });
  18433. }
  18434. }, {
  18435. key: 'setCurrent',
  18436. value: function setCurrent(hosts) {
  18437. var _this3 = this;
  18438. if (hosts.is_sys) {
  18439. _Agent2.default.pact('getSysHosts').then(function (_hosts) {
  18440. _this3.setState({
  18441. sys_hosts: _hosts,
  18442. current: _hosts
  18443. });
  18444. });
  18445. } else {
  18446. this.setState({
  18447. current: hosts
  18448. });
  18449. }
  18450. }
  18451. }, {
  18452. key: 'toSave',
  18453. value: function toSave() {
  18454. var _this4 = this;
  18455. clearTimeout(this._t);
  18456. this._t = setTimeout(function () {
  18457. _Agent2.default.emit('save', _this4.state.list);
  18458. }, 1000);
  18459. }
  18460. }, {
  18461. key: 'setHostsContent',
  18462. value: function setHostsContent(v) {
  18463. if (this.state.current.content === v) return; // not changed
  18464. this.state.current.content = v || '';
  18465. this.toSave();
  18466. }
  18467. }, {
  18468. key: 'justAdd',
  18469. value: function justAdd(id) {
  18470. this.setState({
  18471. just_added_id: id
  18472. });
  18473. }
  18474. }, {
  18475. key: 'componentDidMount',
  18476. value: function componentDidMount() {
  18477. window.addEventListener('keydown', function (e) {
  18478. if (e.keyCode === 27) {
  18479. _Agent2.default.emit('esc');
  18480. }
  18481. }, false);
  18482. window.addEventListener('mouseup', function () {
  18483. _Agent2.default.emit('drag_end');
  18484. });
  18485. }
  18486. }, {
  18487. key: 'render',
  18488. value: function render() {
  18489. var current = this.state.current;
  18490. return _react2.default.createElement(
  18491. 'div',
  18492. { id: 'app', className: 'platform-' + _Agent2.default.platform },
  18493. _react2.default.createElement(_panel2.default, {
  18494. list: this.state.list,
  18495. sys_hosts: this.state.sys_hosts,
  18496. current: current,
  18497. setCurrent: this.setCurrent.bind(this),
  18498. lang: this.state.lang,
  18499. just_added_id: this.state.just_added_id,
  18500. justAdd: this.justAdd.bind(this)
  18501. }),
  18502. _react2.default.createElement(_content2.default, {
  18503. current: current,
  18504. readonly: App.isReadOnly(current),
  18505. setHostsContent: this.setHostsContent.bind(this),
  18506. lang: this.state.lang
  18507. }),
  18508. _react2.default.createElement(
  18509. 'div',
  18510. { className: 'frames' },
  18511. _react2.default.createElement(_sudo2.default, { lang: this.state.lang }),
  18512. _react2.default.createElement(_edit2.default, {
  18513. lang: this.state.lang,
  18514. list: this.state.list,
  18515. justAdd: this.justAdd.bind(this)
  18516. }),
  18517. _react2.default.createElement(_preferences2.default, {
  18518. lang: this.state.lang
  18519. })
  18520. )
  18521. );
  18522. }
  18523. }], [{
  18524. key: 'isReadOnly',
  18525. value: function isReadOnly(hosts) {
  18526. return !hosts || hosts.is_sys || hosts.where === 'remote' || hosts.where === 'group';
  18527. }
  18528. }]);
  18529. return App;
  18530. }(_react2.default.Component);
  18531. exports.default = App;
  18532. /***/ }),
  18533. /* 104 */
  18534. /***/ (function(module, exports, __webpack_require__) {
  18535. "use strict";
  18536. module.exports = __webpack_require__(182);
  18537. /***/ }),
  18538. /* 105 */
  18539. /***/ (function(module, exports) {
  18540. /**
  18541. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  18542. * embed the css on the page. This breaks all relative urls because now they are relative to a
  18543. * bundle instead of the current page.
  18544. *
  18545. * One solution is to only use full urls, but that may be impossible.
  18546. *
  18547. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  18548. *
  18549. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  18550. *
  18551. */
  18552. module.exports = function (css) {
  18553. // get current location
  18554. var location = typeof window !== "undefined" && window.location;
  18555. if (!location) {
  18556. throw new Error("fixUrls requires window.location");
  18557. }
  18558. // blank or null?
  18559. if (!css || typeof css !== "string") {
  18560. return css;
  18561. }
  18562. var baseUrl = location.protocol + "//" + location.host;
  18563. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  18564. // convert each url(...)
  18565. /*
  18566. This regular expression is just a way to recursively match brackets within
  18567. a string.
  18568. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  18569. ( = Start a capturing group
  18570. (?: = Start a non-capturing group
  18571. [^)(] = Match anything that isn't a parentheses
  18572. | = OR
  18573. \( = Match a start parentheses
  18574. (?: = Start another non-capturing groups
  18575. [^)(]+ = Match anything that isn't a parentheses
  18576. | = OR
  18577. \( = Match a start parentheses
  18578. [^)(]* = Match anything that isn't a parentheses
  18579. \) = Match a end parentheses
  18580. ) = End Group
  18581. *\) = Match anything and then a close parens
  18582. ) = Close non-capturing group
  18583. * = Match anything
  18584. ) = Close capturing group
  18585. \) = Match a close parens
  18586. /gi = Get all matches, not the first. Be case insensitive.
  18587. */
  18588. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  18589. // strip quotes (if they exist)
  18590. var unquotedOrigUrl = origUrl
  18591. .trim()
  18592. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  18593. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  18594. // already a full url? no change
  18595. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) {
  18596. return fullMatch;
  18597. }
  18598. // convert the url to a full url
  18599. var newUrl;
  18600. if (unquotedOrigUrl.indexOf("//") === 0) {
  18601. //TODO: should we add protocol?
  18602. newUrl = unquotedOrigUrl;
  18603. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  18604. // path should be relative to the base url
  18605. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  18606. } else {
  18607. // path should be relative to current directory
  18608. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  18609. }
  18610. // send back the fixed url(...)
  18611. return "url(" + JSON.stringify(newUrl) + ")";
  18612. });
  18613. // send back the fixed css
  18614. return fixedCss;
  18615. };
  18616. /***/ }),
  18617. /* 106 */
  18618. /***/ (function(module, exports, __webpack_require__) {
  18619. // style-loader: Adds some css to the DOM by adding a <style> tag
  18620. // load the styles
  18621. var content = __webpack_require__(120);
  18622. if(typeof content === 'string') content = [[module.i, content, '']];
  18623. // add the styles to the DOM
  18624. var update = __webpack_require__(8)(content, {});
  18625. if(content.locals) module.exports = content.locals;
  18626. // Hot Module Replacement
  18627. if(false) {
  18628. // When the styles change, update the <style> tags
  18629. if(!content.locals) {
  18630. module.hot.accept("!!../node_modules/.0.26.4@css-loader/index.js!../node_modules/.4.0.2@less-loader/dist/index.js!./app.less", function() {
  18631. var newContent = require("!!../node_modules/.0.26.4@css-loader/index.js!../node_modules/.4.0.2@less-loader/dist/index.js!./app.less");
  18632. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18633. update(newContent);
  18634. });
  18635. }
  18636. // When the module is disposed, remove the <style> tags
  18637. module.hot.dispose(function() { update(); });
  18638. }
  18639. /***/ }),
  18640. /* 107 */
  18641. /***/ (function(module, exports, __webpack_require__) {
  18642. // style-loader: Adds some css to the DOM by adding a <style> tag
  18643. // load the styles
  18644. var content = __webpack_require__(121);
  18645. if(typeof content === 'string') content = [[module.i, content, '']];
  18646. // add the styles to the DOM
  18647. var update = __webpack_require__(8)(content, {});
  18648. if(content.locals) module.exports = content.locals;
  18649. // Hot Module Replacement
  18650. if(false) {
  18651. // When the styles change, update the <style> tags
  18652. if(!content.locals) {
  18653. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./content.less", function() {
  18654. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./content.less");
  18655. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18656. update(newContent);
  18657. });
  18658. }
  18659. // When the module is disposed, remove the <style> tags
  18660. module.hot.dispose(function() { update(); });
  18661. }
  18662. /***/ }),
  18663. /* 108 */
  18664. /***/ (function(module, exports, __webpack_require__) {
  18665. // style-loader: Adds some css to the DOM by adding a <style> tag
  18666. // load the styles
  18667. var content = __webpack_require__(122);
  18668. if(typeof content === 'string') content = [[module.i, content, '']];
  18669. // add the styles to the DOM
  18670. var update = __webpack_require__(8)(content, {});
  18671. if(content.locals) module.exports = content.locals;
  18672. // Hot Module Replacement
  18673. if(false) {
  18674. // When the styles change, update the <style> tags
  18675. if(!content.locals) {
  18676. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./editor.less", function() {
  18677. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./editor.less");
  18678. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18679. update(newContent);
  18680. });
  18681. }
  18682. // When the module is disposed, remove the <style> tags
  18683. module.hot.dispose(function() { update(); });
  18684. }
  18685. /***/ }),
  18686. /* 109 */
  18687. /***/ (function(module, exports, __webpack_require__) {
  18688. // style-loader: Adds some css to the DOM by adding a <style> tag
  18689. // load the styles
  18690. var content = __webpack_require__(123);
  18691. if(typeof content === 'string') content = [[module.i, content, '']];
  18692. // add the styles to the DOM
  18693. var update = __webpack_require__(8)(content, {});
  18694. if(content.locals) module.exports = content.locals;
  18695. // Hot Module Replacement
  18696. if(false) {
  18697. // When the styles change, update the <style> tags
  18698. if(!content.locals) {
  18699. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./edit.less", function() {
  18700. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./edit.less");
  18701. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18702. update(newContent);
  18703. });
  18704. }
  18705. // When the module is disposed, remove the <style> tags
  18706. module.hot.dispose(function() { update(); });
  18707. }
  18708. /***/ }),
  18709. /* 110 */
  18710. /***/ (function(module, exports, __webpack_require__) {
  18711. // style-loader: Adds some css to the DOM by adding a <style> tag
  18712. // load the styles
  18713. var content = __webpack_require__(124);
  18714. if(typeof content === 'string') content = [[module.i, content, '']];
  18715. // add the styles to the DOM
  18716. var update = __webpack_require__(8)(content, {});
  18717. if(content.locals) module.exports = content.locals;
  18718. // Hot Module Replacement
  18719. if(false) {
  18720. // When the styles change, update the <style> tags
  18721. if(!content.locals) {
  18722. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./frame.less", function() {
  18723. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./frame.less");
  18724. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18725. update(newContent);
  18726. });
  18727. }
  18728. // When the module is disposed, remove the <style> tags
  18729. module.hot.dispose(function() { update(); });
  18730. }
  18731. /***/ }),
  18732. /* 111 */
  18733. /***/ (function(module, exports, __webpack_require__) {
  18734. // style-loader: Adds some css to the DOM by adding a <style> tag
  18735. // load the styles
  18736. var content = __webpack_require__(125);
  18737. if(typeof content === 'string') content = [[module.i, content, '']];
  18738. // add the styles to the DOM
  18739. var update = __webpack_require__(8)(content, {});
  18740. if(content.locals) module.exports = content.locals;
  18741. // Hot Module Replacement
  18742. if(false) {
  18743. // When the styles change, update the <style> tags
  18744. if(!content.locals) {
  18745. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./group.less", function() {
  18746. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./group.less");
  18747. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18748. update(newContent);
  18749. });
  18750. }
  18751. // When the module is disposed, remove the <style> tags
  18752. module.hot.dispose(function() { update(); });
  18753. }
  18754. /***/ }),
  18755. /* 112 */
  18756. /***/ (function(module, exports, __webpack_require__) {
  18757. // style-loader: Adds some css to the DOM by adding a <style> tag
  18758. // load the styles
  18759. var content = __webpack_require__(126);
  18760. if(typeof content === 'string') content = [[module.i, content, '']];
  18761. // add the styles to the DOM
  18762. var update = __webpack_require__(8)(content, {});
  18763. if(content.locals) module.exports = content.locals;
  18764. // Hot Module Replacement
  18765. if(false) {
  18766. // When the styles change, update the <style> tags
  18767. if(!content.locals) {
  18768. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./preferences.less", function() {
  18769. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./preferences.less");
  18770. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18771. update(newContent);
  18772. });
  18773. }
  18774. // When the module is disposed, remove the <style> tags
  18775. module.hot.dispose(function() { update(); });
  18776. }
  18777. /***/ }),
  18778. /* 113 */
  18779. /***/ (function(module, exports, __webpack_require__) {
  18780. // style-loader: Adds some css to the DOM by adding a <style> tag
  18781. // load the styles
  18782. var content = __webpack_require__(127);
  18783. if(typeof content === 'string') content = [[module.i, content, '']];
  18784. // add the styles to the DOM
  18785. var update = __webpack_require__(8)(content, {});
  18786. if(content.locals) module.exports = content.locals;
  18787. // Hot Module Replacement
  18788. if(false) {
  18789. // When the styles change, update the <style> tags
  18790. if(!content.locals) {
  18791. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./sudo.less", function() {
  18792. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./sudo.less");
  18793. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18794. update(newContent);
  18795. });
  18796. }
  18797. // When the module is disposed, remove the <style> tags
  18798. module.hot.dispose(function() { update(); });
  18799. }
  18800. /***/ }),
  18801. /* 114 */
  18802. /***/ (function(module, exports, __webpack_require__) {
  18803. // style-loader: Adds some css to the DOM by adding a <style> tag
  18804. // load the styles
  18805. var content = __webpack_require__(128);
  18806. if(typeof content === 'string') content = [[module.i, content, '']];
  18807. // add the styles to the DOM
  18808. var update = __webpack_require__(8)(content, {});
  18809. if(content.locals) module.exports = content.locals;
  18810. // Hot Module Replacement
  18811. if(false) {
  18812. // When the styles change, update the <style> tags
  18813. if(!content.locals) {
  18814. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./buttons.less", function() {
  18815. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./buttons.less");
  18816. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18817. update(newContent);
  18818. });
  18819. }
  18820. // When the module is disposed, remove the <style> tags
  18821. module.hot.dispose(function() { update(); });
  18822. }
  18823. /***/ }),
  18824. /* 115 */
  18825. /***/ (function(module, exports, __webpack_require__) {
  18826. // style-loader: Adds some css to the DOM by adding a <style> tag
  18827. // load the styles
  18828. var content = __webpack_require__(129);
  18829. if(typeof content === 'string') content = [[module.i, content, '']];
  18830. // add the styles to the DOM
  18831. var update = __webpack_require__(8)(content, {});
  18832. if(content.locals) module.exports = content.locals;
  18833. // Hot Module Replacement
  18834. if(false) {
  18835. // When the styles change, update the <style> tags
  18836. if(!content.locals) {
  18837. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./list-item.less", function() {
  18838. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./list-item.less");
  18839. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18840. update(newContent);
  18841. });
  18842. }
  18843. // When the module is disposed, remove the <style> tags
  18844. module.hot.dispose(function() { update(); });
  18845. }
  18846. /***/ }),
  18847. /* 116 */
  18848. /***/ (function(module, exports, __webpack_require__) {
  18849. // style-loader: Adds some css to the DOM by adding a <style> tag
  18850. // load the styles
  18851. var content = __webpack_require__(130);
  18852. if(typeof content === 'string') content = [[module.i, content, '']];
  18853. // add the styles to the DOM
  18854. var update = __webpack_require__(8)(content, {});
  18855. if(content.locals) module.exports = content.locals;
  18856. // Hot Module Replacement
  18857. if(false) {
  18858. // When the styles change, update the <style> tags
  18859. if(!content.locals) {
  18860. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./list.less", function() {
  18861. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./list.less");
  18862. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18863. update(newContent);
  18864. });
  18865. }
  18866. // When the module is disposed, remove the <style> tags
  18867. module.hot.dispose(function() { update(); });
  18868. }
  18869. /***/ }),
  18870. /* 117 */
  18871. /***/ (function(module, exports, __webpack_require__) {
  18872. // style-loader: Adds some css to the DOM by adding a <style> tag
  18873. // load the styles
  18874. var content = __webpack_require__(131);
  18875. if(typeof content === 'string') content = [[module.i, content, '']];
  18876. // add the styles to the DOM
  18877. var update = __webpack_require__(8)(content, {});
  18878. if(content.locals) module.exports = content.locals;
  18879. // Hot Module Replacement
  18880. if(false) {
  18881. // When the styles change, update the <style> tags
  18882. if(!content.locals) {
  18883. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./panel.less", function() {
  18884. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./panel.less");
  18885. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18886. update(newContent);
  18887. });
  18888. }
  18889. // When the module is disposed, remove the <style> tags
  18890. module.hot.dispose(function() { update(); });
  18891. }
  18892. /***/ }),
  18893. /* 118 */
  18894. /***/ (function(module, exports, __webpack_require__) {
  18895. // style-loader: Adds some css to the DOM by adding a <style> tag
  18896. // load the styles
  18897. var content = __webpack_require__(132);
  18898. if(typeof content === 'string') content = [[module.i, content, '']];
  18899. // add the styles to the DOM
  18900. var update = __webpack_require__(8)(content, {});
  18901. if(content.locals) module.exports = content.locals;
  18902. // Hot Module Replacement
  18903. if(false) {
  18904. // When the styles change, update the <style> tags
  18905. if(!content.locals) {
  18906. module.hot.accept("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./searchbar.less", function() {
  18907. var newContent = require("!!../../node_modules/.0.26.4@css-loader/index.js!../../node_modules/.4.0.2@less-loader/dist/index.js!./searchbar.less");
  18908. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18909. update(newContent);
  18910. });
  18911. }
  18912. // When the module is disposed, remove the <style> tags
  18913. module.hot.dispose(function() { update(); });
  18914. }
  18915. /***/ }),
  18916. /* 119 */
  18917. /***/ (function(module, exports, __webpack_require__) {
  18918. // style-loader: Adds some css to the DOM by adding a <style> tag
  18919. // load the styles
  18920. var content = __webpack_require__(133);
  18921. if(typeof content === 'string') content = [[module.i, content, '']];
  18922. // add the styles to the DOM
  18923. var update = __webpack_require__(8)(content, {});
  18924. if(content.locals) module.exports = content.locals;
  18925. // Hot Module Replacement
  18926. if(false) {
  18927. // When the styles change, update the <style> tags
  18928. if(!content.locals) {
  18929. module.hot.accept("!!../../../../node_modules/.0.26.4@css-loader/index.js!./codemirror.css", function() {
  18930. var newContent = require("!!../../../../node_modules/.0.26.4@css-loader/index.js!./codemirror.css");
  18931. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  18932. update(newContent);
  18933. });
  18934. }
  18935. // When the module is disposed, remove the <style> tags
  18936. module.hot.dispose(function() { update(); });
  18937. }
  18938. /***/ }),
  18939. /* 120 */
  18940. /***/ (function(module, exports, __webpack_require__) {
  18941. exports = module.exports = __webpack_require__(6)();
  18942. // imports
  18943. // module
  18944. 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", ""]);
  18945. // exports
  18946. /***/ }),
  18947. /* 121 */
  18948. /***/ (function(module, exports, __webpack_require__) {
  18949. exports = module.exports = __webpack_require__(6)();
  18950. // imports
  18951. // module
  18952. 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", ""]);
  18953. // exports
  18954. /***/ }),
  18955. /* 122 */
  18956. /***/ (function(module, exports, __webpack_require__) {
  18957. exports = module.exports = __webpack_require__(6)();
  18958. // imports
  18959. // module
  18960. 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", ""]);
  18961. // exports
  18962. /***/ }),
  18963. /* 123 */
  18964. /***/ (function(module, exports, __webpack_require__) {
  18965. exports = module.exports = __webpack_require__(6)();
  18966. // imports
  18967. // module
  18968. 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", ""]);
  18969. // exports
  18970. /***/ }),
  18971. /* 124 */
  18972. /***/ (function(module, exports, __webpack_require__) {
  18973. exports = module.exports = __webpack_require__(6)();
  18974. // imports
  18975. // module
  18976. 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", ""]);
  18977. // exports
  18978. /***/ }),
  18979. /* 125 */
  18980. /***/ (function(module, exports, __webpack_require__) {
  18981. exports = module.exports = __webpack_require__(6)();
  18982. // imports
  18983. // module
  18984. 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", ""]);
  18985. // exports
  18986. /***/ }),
  18987. /* 126 */
  18988. /***/ (function(module, exports, __webpack_require__) {
  18989. exports = module.exports = __webpack_require__(6)();
  18990. // imports
  18991. // module
  18992. 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", ""]);
  18993. // exports
  18994. /***/ }),
  18995. /* 127 */
  18996. /***/ (function(module, exports, __webpack_require__) {
  18997. exports = module.exports = __webpack_require__(6)();
  18998. // imports
  18999. // module
  19000. 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", ""]);
  19001. // exports
  19002. /***/ }),
  19003. /* 128 */
  19004. /***/ (function(module, exports, __webpack_require__) {
  19005. exports = module.exports = __webpack_require__(6)();
  19006. // imports
  19007. // module
  19008. 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", ""]);
  19009. // exports
  19010. /***/ }),
  19011. /* 129 */
  19012. /***/ (function(module, exports, __webpack_require__) {
  19013. exports = module.exports = __webpack_require__(6)();
  19014. // imports
  19015. // module
  19016. 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", ""]);
  19017. // exports
  19018. /***/ }),
  19019. /* 130 */
  19020. /***/ (function(module, exports, __webpack_require__) {
  19021. exports = module.exports = __webpack_require__(6)();
  19022. // imports
  19023. // module
  19024. 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", ""]);
  19025. // exports
  19026. /***/ }),
  19027. /* 131 */
  19028. /***/ (function(module, exports, __webpack_require__) {
  19029. exports = module.exports = __webpack_require__(6)();
  19030. // imports
  19031. exports.i(__webpack_require__(134), "");
  19032. // module
  19033. exports.push([module.i, "#panel {\n width: 240px;\n height: 100%;\n background: #373d47;\n color: #979da7;\n}\n", ""]);
  19034. // exports
  19035. /***/ }),
  19036. /* 132 */
  19037. /***/ (function(module, exports, __webpack_require__) {
  19038. exports = module.exports = __webpack_require__(6)();
  19039. // imports
  19040. // module
  19041. 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", ""]);
  19042. // exports
  19043. /***/ }),
  19044. /* 133 */
  19045. /***/ (function(module, exports, __webpack_require__) {
  19046. exports = module.exports = __webpack_require__(6)();
  19047. // imports
  19048. // module
  19049. 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", ""]);
  19050. // exports
  19051. /***/ }),
  19052. /* 134 */
  19053. /***/ (function(module, exports, __webpack_require__) {
  19054. exports = module.exports = __webpack_require__(6)();
  19055. // imports
  19056. // module
  19057. exports.push([module.i, "\n@font-face {font-family: \"iconfont\";\n src: url(" + __webpack_require__(70) + "); /* IE9*/\n src: url(" + __webpack_require__(70) + "#iefix) format('embedded-opentype'), \n url(" + __webpack_require__(137) + ") format('woff'), \n url(" + __webpack_require__(136) + ") format('truetype'), \n url(" + __webpack_require__(135) + "#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", ""]);
  19058. // exports
  19059. /***/ }),
  19060. /* 135 */
  19061. /***/ (function(module, exports) {
  19062. 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=="
  19063. /***/ }),
  19064. /* 136 */
  19065. /***/ (function(module, exports) {
  19066. 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=="
  19067. /***/ }),
  19068. /* 137 */
  19069. /***/ (function(module, exports) {
  19070. 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=="
  19071. /***/ }),
  19072. /* 138 */
  19073. /***/ (function(module, exports, __webpack_require__) {
  19074. "use strict";
  19075. /**
  19076. * @author oldj
  19077. * @blog https://oldj.net
  19078. */
  19079. var m_ver = __webpack_require__(71).version;
  19080. module.exports = {
  19081. PORT: 50761,
  19082. version: m_ver.slice(0, 3).join('.'),
  19083. version_full: m_ver.join('.'),
  19084. url_download: 'https://github.com/oldj/SwitchHosts/releases'
  19085. };
  19086. /***/ }),
  19087. /* 139 */
  19088. /***/ (function(module, exports, __webpack_require__) {
  19089. "use strict";
  19090. /**
  19091. * @author oldj
  19092. * @blog https://oldj.net
  19093. */
  19094. module.exports = function (v) {
  19095. return 'v' + v.slice(0, 3).join('.') + (' (' + v[3] + ')');
  19096. };
  19097. /***/ }),
  19098. /* 140 */
  19099. /***/ (function(module, exports, __webpack_require__) {
  19100. "use strict";
  19101. /**
  19102. * @author oldj
  19103. * @blog https://oldj.net
  19104. */
  19105. module.exports = function () {
  19106. return new Date().getTime() + '-' + Math.floor(Math.random() * 1e6);
  19107. };
  19108. /***/ }),
  19109. /* 141 */
  19110. /***/ (function(module, exports, __webpack_require__) {
  19111. "use strict";
  19112. // custom mode
  19113. Object.defineProperty(exports, "__esModule", {
  19114. value: true
  19115. });
  19116. exports.default = function () {
  19117. _codemirror2.default.defineMode('hosts', function () {
  19118. function tokenBase(stream) {
  19119. if (stream.eatSpace()) return null;
  19120. var sol = stream.sol();
  19121. var ch = stream.next();
  19122. var s = stream.string;
  19123. if (ch === '#') {
  19124. stream.skipToEnd();
  19125. return 'comment';
  19126. }
  19127. if (!s.match(/^\s*([\d\.]+|[\da-f:\.%lo]+)\s+\w/i)) {
  19128. return 'error';
  19129. }
  19130. if (sol && ch.match(/[\w\.:%]/)) {
  19131. stream.eatWhile(/[\w\.:%]/);
  19132. return 'ip';
  19133. }
  19134. return null;
  19135. }
  19136. function tokenize(stream, state) {
  19137. return (state.tokens[0] || tokenBase)(stream, state);
  19138. }
  19139. return {
  19140. startState: function startState() {
  19141. return { tokens: [] };
  19142. },
  19143. token: function token(stream, state) {
  19144. return tokenize(stream, state);
  19145. },
  19146. lineComment: '#'
  19147. };
  19148. });
  19149. //CodeMirror.defineMIME('text/x-hosts', 'hosts');
  19150. };
  19151. var _codemirror = __webpack_require__(68);
  19152. var _codemirror2 = _interopRequireDefault(_codemirror);
  19153. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19154. /***/ }),
  19155. /* 142 */
  19156. /***/ (function(module, exports, __webpack_require__) {
  19157. "use strict";
  19158. /**
  19159. * @author oldj
  19160. * @blog https://oldj.net
  19161. */
  19162. Object.defineProperty(exports, "__esModule", {
  19163. value: true
  19164. });
  19165. 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; }; }();
  19166. var _react = __webpack_require__(7);
  19167. var _react2 = _interopRequireDefault(_react);
  19168. var _classnames = __webpack_require__(16);
  19169. var _classnames2 = _interopRequireDefault(_classnames);
  19170. var _editor = __webpack_require__(143);
  19171. var _editor2 = _interopRequireDefault(_editor);
  19172. __webpack_require__(107);
  19173. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19174. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19175. 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; }
  19176. 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; }
  19177. var Content = function (_React$Component) {
  19178. _inherits(Content, _React$Component);
  19179. function Content(props) {
  19180. _classCallCheck(this, Content);
  19181. var _this = _possibleConstructorReturn(this, (Content.__proto__ || Object.getPrototypeOf(Content)).call(this, props));
  19182. _this.state = {
  19183. is_loading: _this.props.current.is_loading
  19184. };
  19185. return _this;
  19186. }
  19187. _createClass(Content, [{
  19188. key: 'setValue',
  19189. value: function setValue(v) {
  19190. this.props.setHostsContent(v);
  19191. }
  19192. }, {
  19193. key: 'render',
  19194. value: function render() {
  19195. var _props = this.props,
  19196. current = _props.current,
  19197. lang = _props.lang;
  19198. return _react2.default.createElement(
  19199. 'div',
  19200. { id: 'sh-content' },
  19201. _react2.default.createElement(
  19202. 'div',
  19203. { className: 'inform' },
  19204. _react2.default.createElement(
  19205. 'span',
  19206. {
  19207. className: (0, _classnames2.default)({
  19208. loading: 1,
  19209. show: this.state.is_loading
  19210. })
  19211. },
  19212. 'loading...'
  19213. ),
  19214. _react2.default.createElement('i', {
  19215. className: (0, _classnames2.default)({
  19216. show: current.where === 'remote',
  19217. iconfont: 1,
  19218. 'icon-earth': 1
  19219. }),
  19220. title: lang.remote_hosts
  19221. }),
  19222. _react2.default.createElement('i', {
  19223. className: (0, _classnames2.default)({
  19224. show: this.props.readonly,
  19225. iconfont: 1,
  19226. 'icon-lock2': 1
  19227. }),
  19228. title: lang.readonly
  19229. })
  19230. ),
  19231. _react2.default.createElement(
  19232. 'div',
  19233. { className: (0, _classnames2.default)({
  19234. errorMessage: 1,
  19235. show: !!this.props.current.error
  19236. }) },
  19237. this.props.current.error
  19238. ),
  19239. _react2.default.createElement(_editor2.default, {
  19240. readonly: this.props.readonly,
  19241. code: this.props.current.content || '',
  19242. setValue: this.setValue.bind(this)
  19243. })
  19244. );
  19245. }
  19246. }]);
  19247. return Content;
  19248. }(_react2.default.Component);
  19249. exports.default = Content;
  19250. /***/ }),
  19251. /* 143 */
  19252. /***/ (function(module, exports, __webpack_require__) {
  19253. "use strict";
  19254. /**
  19255. * @author oldj
  19256. * @blog http://oldj.net
  19257. */
  19258. Object.defineProperty(exports, "__esModule", {
  19259. value: true
  19260. });
  19261. 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; }; }();
  19262. var _react = __webpack_require__(7);
  19263. var _react2 = _interopRequireDefault(_react);
  19264. var _codemirror = __webpack_require__(68);
  19265. var _codemirror2 = _interopRequireDefault(_codemirror);
  19266. __webpack_require__(244);
  19267. var _classnames = __webpack_require__(16);
  19268. var _classnames2 = _interopRequireDefault(_classnames);
  19269. var _kw = __webpack_require__(72);
  19270. var _kw2 = _interopRequireDefault(_kw);
  19271. var _Agent = __webpack_require__(4);
  19272. var _Agent2 = _interopRequireDefault(_Agent);
  19273. __webpack_require__(119);
  19274. __webpack_require__(108);
  19275. var _cm_hl = __webpack_require__(141);
  19276. var _cm_hl2 = _interopRequireDefault(_cm_hl);
  19277. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19278. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19279. 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; }
  19280. 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; }
  19281. // import '../../../node_modules/codemirror/addon/comment/comment'
  19282. (0, _cm_hl2.default)();
  19283. var Editor = function (_React$Component) {
  19284. _inherits(Editor, _React$Component);
  19285. function Editor(props) {
  19286. _classCallCheck(this, Editor);
  19287. var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));
  19288. _this.codemirror = null;
  19289. _this.marks = [];
  19290. _this.kw = '';
  19291. _this.state = {};
  19292. _Agent2.default.on('search', function (kw) {
  19293. _this.kw = kw;
  19294. _this.highlightKeyword();
  19295. });
  19296. return _this;
  19297. }
  19298. _createClass(Editor, [{
  19299. key: 'highlightKeyword',
  19300. value: function highlightKeyword() {
  19301. var _this2 = this;
  19302. while (this.marks.length > 0) {
  19303. this.marks.shift().clear();
  19304. }
  19305. var code = this.props.code;
  19306. var pos = _kw2.default.findPositions(this.kw, code) || [];
  19307. // this.codemirror.markText({line: 6, ch: 16}, {line: 6, ch: 22}, {className: 'cm-hl'});
  19308. pos.map(function (p) {
  19309. _this2.marks.push(_this2.codemirror.markText(p[0], p[1], { className: 'cm-hl' }));
  19310. });
  19311. }
  19312. }, {
  19313. key: 'setValue',
  19314. value: function setValue(v) {
  19315. this.props.setValue(v);
  19316. }
  19317. }, {
  19318. key: 'toComment',
  19319. value: function toComment() {
  19320. var doc = this.codemirror.getDoc();
  19321. var cur = doc.getCursor();
  19322. var line = cur.line;
  19323. var info = doc.lineInfo(line);
  19324. this.codemirror.toggleComment({
  19325. line: line,
  19326. cur: 0
  19327. }, {
  19328. line: line,
  19329. cur: info.text.length
  19330. });
  19331. }
  19332. }, {
  19333. key: 'componentDidMount',
  19334. value: function componentDidMount() {
  19335. var _this3 = this;
  19336. // console.log(this.cnt_node, this.cnt_node.value);
  19337. this.codemirror = _codemirror2.default.fromTextArea(this.cnt_node, {
  19338. lineNumbers: true,
  19339. readOnly: true,
  19340. mode: 'hosts'
  19341. });
  19342. this.codemirror.setSize('100%', '100%');
  19343. this.codemirror.on('change', function (a) {
  19344. var v = a.getDoc().getValue();
  19345. _this3.setValue(v);
  19346. });
  19347. this.codemirror.on('gutterClick', function (cm, n) {
  19348. if (_this3.props.readonly === true) return;
  19349. var info = cm.lineInfo(n);
  19350. //cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker());
  19351. var ln = info.text;
  19352. if (/^\s*$/.test(ln)) return;
  19353. var new_ln = void 0;
  19354. if (/^#/.test(ln)) {
  19355. new_ln = ln.replace(/^#\s*/, '');
  19356. } else {
  19357. new_ln = '# ' + ln;
  19358. }
  19359. _this3.codemirror.getDoc().replaceRange(new_ln, { line: info.line, ch: 0 }, {
  19360. line: info.line,
  19361. ch: ln.length
  19362. });
  19363. //app.caculateHosts();
  19364. });
  19365. _Agent2.default.on('to_comment', function () {
  19366. _this3.toComment();
  19367. });
  19368. }
  19369. }, {
  19370. key: 'componentWillReceiveProps',
  19371. value: function componentWillReceiveProps(next_props) {
  19372. var _this4 = this;
  19373. // console.log(next_props);
  19374. var cm = this.codemirror;
  19375. var v = cm.getDoc().getValue();
  19376. if (v !== next_props.code) {
  19377. cm.getDoc().setValue(next_props.code);
  19378. }
  19379. cm.setOption('readOnly', next_props.readonly);
  19380. setTimeout(function () {
  19381. _this4.highlightKeyword();
  19382. }, 100);
  19383. }
  19384. }, {
  19385. key: 'render',
  19386. value: function render() {
  19387. var _this5 = this;
  19388. return _react2.default.createElement(
  19389. 'div',
  19390. {
  19391. id: 'sh-editor',
  19392. className: (0, _classnames2.default)({
  19393. readonly: this.props.readonly
  19394. }) },
  19395. _react2.default.createElement('textarea', {
  19396. ref: function ref(c) {
  19397. return _this5.cnt_node = c;
  19398. },
  19399. defaultValue: this.props.code || ''
  19400. })
  19401. );
  19402. }
  19403. }]);
  19404. return Editor;
  19405. }(_react2.default.Component);
  19406. exports.default = Editor;
  19407. /***/ }),
  19408. /* 144 */
  19409. /***/ (function(module, exports, __webpack_require__) {
  19410. "use strict";
  19411. /**
  19412. * @author oldj
  19413. * @blog https://oldj.net
  19414. */
  19415. Object.defineProperty(exports, "__esModule", {
  19416. value: true
  19417. });
  19418. 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"); } }; }();
  19419. 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; }; }();
  19420. var _react = __webpack_require__(7);
  19421. var _react2 = _interopRequireDefault(_react);
  19422. var _frame = __webpack_require__(48);
  19423. var _frame2 = _interopRequireDefault(_frame);
  19424. var _classnames = __webpack_require__(16);
  19425. var _classnames2 = _interopRequireDefault(_classnames);
  19426. var _group = __webpack_require__(145);
  19427. var _group2 = _interopRequireDefault(_group);
  19428. var _Agent = __webpack_require__(4);
  19429. var _Agent2 = _interopRequireDefault(_Agent);
  19430. var _makeId = __webpack_require__(140);
  19431. var _makeId2 = _interopRequireDefault(_makeId);
  19432. __webpack_require__(109);
  19433. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19434. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19435. 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; }
  19436. 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; }
  19437. var EditPrompt = function (_React$Component) {
  19438. _inherits(EditPrompt, _React$Component);
  19439. function EditPrompt(props) {
  19440. _classCallCheck(this, EditPrompt);
  19441. var _this = _possibleConstructorReturn(this, (EditPrompt.__proto__ || Object.getPrototypeOf(EditPrompt)).call(this, props));
  19442. _this.state = {
  19443. show: false,
  19444. is_add: true,
  19445. where: 'local',
  19446. title: '',
  19447. url: '',
  19448. last_refresh: null,
  19449. refresh_interval: 0,
  19450. is_loading: false,
  19451. include: []
  19452. };
  19453. _this.current_hosts = null;
  19454. return _this;
  19455. }
  19456. _createClass(EditPrompt, [{
  19457. key: 'tryToFocus',
  19458. value: function tryToFocus() {
  19459. var el = this.refs.body && this.refs.body.querySelector('input[type=text]');
  19460. el && el.focus();
  19461. }
  19462. }, {
  19463. key: 'clear',
  19464. value: function clear() {
  19465. this.setState({
  19466. where: 'local',
  19467. title: '',
  19468. url: '',
  19469. last_refresh: null,
  19470. refresh_interval: 0
  19471. });
  19472. }
  19473. }, {
  19474. key: 'componentDidMount',
  19475. value: function componentDidMount() {
  19476. var _this2 = this;
  19477. _Agent2.default.on('add_hosts', function () {
  19478. _this2.setState({
  19479. show: true,
  19480. is_add: true
  19481. });
  19482. setTimeout(function () {
  19483. _this2.tryToFocus();
  19484. }, 100);
  19485. });
  19486. _Agent2.default.on('edit_hosts', function (hosts) {
  19487. _this2.current_hosts = hosts;
  19488. var include = hosts.include || [];
  19489. include = Array.from(new Set(include));
  19490. _this2.setState({
  19491. id: hosts.id,
  19492. show: true,
  19493. is_add: false,
  19494. where: hosts.where || 'local',
  19495. title: hosts.title || '',
  19496. url: hosts.url || '',
  19497. last_refresh: hosts.last_refresh || null,
  19498. refresh_interval: hosts.refresh_interval || 0,
  19499. include: include
  19500. });
  19501. setTimeout(function () {
  19502. _this2.tryToFocus();
  19503. }, 100);
  19504. });
  19505. _Agent2.default.on('loading_done', function (old_hosts, data) {
  19506. if (old_hosts === _this2.current_hosts) {
  19507. _this2.setState({
  19508. last_refresh: data.last_refresh,
  19509. is_loading: false
  19510. });
  19511. _Agent2.default.emit('hosts_refreshed', data, _this2.current_hosts);
  19512. }
  19513. });
  19514. _Agent2.default.on('list_updated', function (list) {
  19515. var hosts = list.find(function (i) {
  19516. return i.id === _this2.state.id;
  19517. });
  19518. if (hosts) {
  19519. _this2.setState({
  19520. last_refresh: hosts.last_refresh
  19521. });
  19522. }
  19523. });
  19524. }
  19525. }, {
  19526. key: 'onOK',
  19527. value: function onOK() {
  19528. this.setState({
  19529. title: (this.state.title || '').replace(/^\s+|\s+$/g, ''),
  19530. url: (this.state.url || '').replace(/^\s+|\s+$/g, '')
  19531. });
  19532. if (this.state.title === '') {
  19533. this.refs.title.focus();
  19534. return false;
  19535. }
  19536. if (this.state.where === 'remote' && this.state.url === '') {
  19537. this.refs.url.focus();
  19538. return false;
  19539. }
  19540. var new_id = (0, _makeId2.default)();
  19541. var data = Object.assign({}, this.current_hosts, this.state, this.state.is_add ? {
  19542. id: new_id,
  19543. content: '# ' + this.state.title,
  19544. on: false
  19545. } : {});
  19546. if (!data.id) data.id = new_id;
  19547. if (this.state.is_add) {
  19548. this.props.justAdd(new_id);
  19549. }
  19550. delete data['is_add'];
  19551. _Agent2.default.emit('update_hosts', data);
  19552. this.setState({
  19553. show: false
  19554. });
  19555. this.clear();
  19556. }
  19557. }, {
  19558. key: 'onCancel',
  19559. value: function onCancel() {
  19560. this.setState({
  19561. show: false
  19562. });
  19563. this.clear();
  19564. }
  19565. }, {
  19566. key: 'confirmDel',
  19567. value: function confirmDel() {
  19568. var lang = this.props.lang;
  19569. if (!confirm(lang.confirm_del)) return;
  19570. _Agent2.default.emit('del_hosts', this.current_hosts);
  19571. this.setState({
  19572. show: false
  19573. });
  19574. this.clear();
  19575. }
  19576. }, {
  19577. key: 'updateInclude',
  19578. value: function updateInclude(include) {
  19579. this.setState({ include: include });
  19580. }
  19581. }, {
  19582. key: 'getRefreshOptions',
  19583. value: function getRefreshOptions() {
  19584. var lang = this.props.lang;
  19585. var k = [[0, '' + lang.never], [1, '1 ' + lang.hour], [24, '24 ' + lang.hours], [168, '7 ' + lang.days]];
  19586. if (_Agent2.default.IS_DEV) {
  19587. k.splice(1, 0, [0.002778, '10s (for DEV)']); // dev test only
  19588. }
  19589. return k.map(function (_ref, idx) {
  19590. var _ref2 = _slicedToArray(_ref, 2),
  19591. v = _ref2[0],
  19592. n = _ref2[1];
  19593. return _react2.default.createElement(
  19594. 'option',
  19595. { value: v, key: idx },
  19596. n
  19597. );
  19598. });
  19599. }
  19600. }, {
  19601. key: 'getEditOperations',
  19602. value: function getEditOperations() {
  19603. if (this.state.is_add) return null;
  19604. var lang = this.props.lang;
  19605. return _react2.default.createElement(
  19606. 'div',
  19607. null,
  19608. _react2.default.createElement(
  19609. 'div',
  19610. { className: 'ln' },
  19611. _react2.default.createElement(
  19612. 'a',
  19613. { href: '#', className: 'del',
  19614. onClick: this.confirmDel.bind(this)
  19615. },
  19616. _react2.default.createElement('i', { className: 'iconfont icon-delete' }),
  19617. _react2.default.createElement(
  19618. 'span',
  19619. null,
  19620. lang.del_hosts
  19621. )
  19622. )
  19623. )
  19624. );
  19625. }
  19626. }, {
  19627. key: 'refresh',
  19628. value: function refresh() {
  19629. var _this3 = this;
  19630. if (this.state.is_loading) return;
  19631. _Agent2.default.emit('check_hosts_refresh', this.current_hosts);
  19632. this.setState({
  19633. is_loading: true
  19634. }, function () {
  19635. setTimeout(function () {
  19636. _this3.setState({
  19637. is_loading: false
  19638. });
  19639. }, 1000);
  19640. });
  19641. }
  19642. }, {
  19643. key: 'renderGroup',
  19644. value: function renderGroup() {
  19645. if (this.state.where !== 'group') return null;
  19646. return _react2.default.createElement(_group2.default, {
  19647. list: this.props.list,
  19648. include: this.state.include,
  19649. updateInclude: this.updateInclude.bind(this)
  19650. });
  19651. }
  19652. }, {
  19653. key: 'renderRemoteInputs',
  19654. value: function renderRemoteInputs() {
  19655. var _this4 = this;
  19656. if (this.state.where !== 'remote') return null;
  19657. var lang = this.props.lang;
  19658. return _react2.default.createElement(
  19659. 'div',
  19660. { className: 'remote-ipts' },
  19661. _react2.default.createElement(
  19662. 'div',
  19663. { className: 'ln' },
  19664. _react2.default.createElement(
  19665. 'div',
  19666. { className: 'title' },
  19667. lang.url
  19668. ),
  19669. _react2.default.createElement(
  19670. 'div',
  19671. { className: 'cnt' },
  19672. _react2.default.createElement('input', {
  19673. type: 'text',
  19674. ref: 'url',
  19675. value: this.state.url,
  19676. placeholder: 'http://',
  19677. onChange: function onChange(e) {
  19678. return _this4.setState({ url: e.target.value });
  19679. },
  19680. onKeyDown: function onKeyDown(e) {
  19681. return e.keyCode === 13 && _this4.onOK() || e.keyCode === 27 && _this4.onCancel();
  19682. }
  19683. })
  19684. )
  19685. ),
  19686. _react2.default.createElement(
  19687. 'div',
  19688. { className: 'ln' },
  19689. _react2.default.createElement(
  19690. 'div',
  19691. { className: 'title' },
  19692. lang.auto_refresh
  19693. ),
  19694. _react2.default.createElement(
  19695. 'div',
  19696. { className: 'cnt' },
  19697. _react2.default.createElement(
  19698. 'select',
  19699. {
  19700. value: this.state.refresh_interval,
  19701. onChange: function onChange(e) {
  19702. return _this4.setState({ refresh_interval: parseFloat(e.target.value) || 0 });
  19703. }
  19704. },
  19705. this.getRefreshOptions()
  19706. ),
  19707. _react2.default.createElement('i', {
  19708. className: (0, _classnames2.default)({
  19709. iconfont: 1,
  19710. 'icon-refresh': 1,
  19711. 'invisible': !this.current_hosts || this.state.url !== this.current_hosts.url,
  19712. 'loading': this.state.is_loading
  19713. }),
  19714. title: lang.refresh,
  19715. onClick: function onClick() {
  19716. return _this4.refresh();
  19717. }
  19718. }),
  19719. _react2.default.createElement(
  19720. 'span',
  19721. { className: 'last-refresh' },
  19722. lang.last_refresh,
  19723. this.state.last_refresh || 'N/A'
  19724. )
  19725. )
  19726. )
  19727. );
  19728. }
  19729. }, {
  19730. key: 'body',
  19731. value: function body() {
  19732. var _this5 = this;
  19733. var lang = this.props.lang;
  19734. return _react2.default.createElement(
  19735. 'div',
  19736. { ref: 'body' },
  19737. _react2.default.createElement(
  19738. 'div',
  19739. { className: 'ln' },
  19740. _react2.default.createElement('input', { id: 'ipt-local', type: 'radio', name: 'where', value: 'local',
  19741. checked: this.state.where === 'local',
  19742. onChange: function onChange(e) {
  19743. return _this5.setState({ where: e.target.value });
  19744. }
  19745. }),
  19746. _react2.default.createElement(
  19747. 'label',
  19748. { htmlFor: 'ipt-local' },
  19749. lang.where_local
  19750. ),
  19751. _react2.default.createElement('input', { id: 'ipt-remote', type: 'radio', name: 'where', value: 'remote',
  19752. checked: this.state.where === 'remote',
  19753. onChange: function onChange(e) {
  19754. return _this5.setState({ where: e.target.value });
  19755. }
  19756. }),
  19757. _react2.default.createElement(
  19758. 'label',
  19759. { htmlFor: 'ipt-remote' },
  19760. lang.where_remote
  19761. ),
  19762. _react2.default.createElement('input', { id: 'ipt-group', type: 'radio', name: 'where', value: 'group',
  19763. checked: this.state.where === 'group',
  19764. onChange: function onChange(e) {
  19765. return _this5.setState({ where: e.target.value });
  19766. }
  19767. }),
  19768. _react2.default.createElement(
  19769. 'label',
  19770. { htmlFor: 'ipt-group' },
  19771. lang.where_group
  19772. )
  19773. ),
  19774. _react2.default.createElement(
  19775. 'div',
  19776. { className: 'ln' },
  19777. _react2.default.createElement(
  19778. 'div',
  19779. { className: 'title' },
  19780. lang.hosts_title
  19781. ),
  19782. _react2.default.createElement(
  19783. 'div',
  19784. { className: 'cnt' },
  19785. _react2.default.createElement('input', {
  19786. type: 'text',
  19787. ref: 'title',
  19788. name: 'text',
  19789. value: this.state.title,
  19790. onChange: function onChange(e) {
  19791. return _this5.setState({ title: e.target.value });
  19792. },
  19793. onKeyDown: function onKeyDown(e) {
  19794. return e.keyCode === 13 && _this5.onOK() || e.keyCode === 27 && _this5.onCancel();
  19795. }
  19796. })
  19797. )
  19798. ),
  19799. this.renderRemoteInputs(),
  19800. this.renderGroup(),
  19801. this.getEditOperations()
  19802. );
  19803. }
  19804. }, {
  19805. key: 'render',
  19806. value: function render() {
  19807. var _this6 = this;
  19808. var lang = this.props.lang;
  19809. return _react2.default.createElement(_frame2.default, {
  19810. show: this.state.show,
  19811. head: lang[this.state.is_add ? 'add_hosts' : 'edit_hosts'],
  19812. body: this.body(),
  19813. onOK: function onOK() {
  19814. return _this6.onOK();
  19815. },
  19816. onCancel: function onCancel() {
  19817. return _this6.onCancel();
  19818. },
  19819. lang: this.props.lang
  19820. });
  19821. }
  19822. }]);
  19823. return EditPrompt;
  19824. }(_react2.default.Component);
  19825. exports.default = EditPrompt;
  19826. /***/ }),
  19827. /* 145 */
  19828. /***/ (function(module, exports, __webpack_require__) {
  19829. "use strict";
  19830. /**
  19831. * @author oldj
  19832. * @blog https://oldj.net
  19833. */
  19834. Object.defineProperty(exports, "__esModule", {
  19835. value: true
  19836. });
  19837. 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; };
  19838. 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; }; }();
  19839. var _react = __webpack_require__(7);
  19840. var _react2 = _interopRequireDefault(_react);
  19841. var _classnames = __webpack_require__(16);
  19842. var _classnames2 = _interopRequireDefault(_classnames);
  19843. var _sortablejs = __webpack_require__(77);
  19844. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  19845. var _listToArray = __webpack_require__(73);
  19846. var _listToArray2 = _interopRequireDefault(_listToArray);
  19847. __webpack_require__(111);
  19848. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19849. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19850. 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; }
  19851. 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; }
  19852. var Group = function (_React$Component) {
  19853. _inherits(Group, _React$Component);
  19854. function Group(props) {
  19855. _classCallCheck(this, Group);
  19856. var _this = _possibleConstructorReturn(this, (Group.__proto__ || Object.getPrototypeOf(Group)).call(this, props));
  19857. _this.state = {
  19858. list: [],
  19859. include: []
  19860. };
  19861. _this.current_hosts = null;
  19862. _this.ids = [];
  19863. return _this;
  19864. }
  19865. _createClass(Group, [{
  19866. key: 'makeItem',
  19867. value: function makeItem(item) {
  19868. if (!item) {
  19869. return null;
  19870. }
  19871. var attrs = {
  19872. 'data-id': item.id || ''
  19873. };
  19874. return _react2.default.createElement(
  19875. 'div',
  19876. _extends({ className: 'hosts-item' }, attrs),
  19877. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  19878. 'iconfont': 1,
  19879. 'item-icon': 1,
  19880. 'icon-file': item.where !== 'group',
  19881. 'icon-files': item.where === 'group'
  19882. })
  19883. }),
  19884. _react2.default.createElement(
  19885. 'span',
  19886. null,
  19887. item.title || 'untitled'
  19888. )
  19889. );
  19890. }
  19891. }, {
  19892. key: 'makeList',
  19893. value: function makeList() {
  19894. var _this2 = this;
  19895. var include = this.state.include;
  19896. var items = this.state.list.filter(function (item) {
  19897. return item.where !== 'group' && !include.includes(item.id);
  19898. }).map(function (item) {
  19899. return _this2.makeItem(item);
  19900. });
  19901. return _react2.default.createElement(
  19902. 'div',
  19903. { id: 'hosts-group-valid' },
  19904. _react2.default.createElement(
  19905. 'div',
  19906. { ref: 'group_valid', className: 'hosts-group-list' },
  19907. items
  19908. )
  19909. );
  19910. }
  19911. }, {
  19912. key: 'currentList',
  19913. value: function currentList() {
  19914. var _this3 = this;
  19915. var list = this.state.list;
  19916. var items = this.state.include.map(function (id) {
  19917. return list.find(function (item) {
  19918. return item.id === id;
  19919. });
  19920. }).map(function (item) {
  19921. return _this3.makeItem(item);
  19922. });
  19923. return _react2.default.createElement(
  19924. 'div',
  19925. { id: 'hosts-group-current' },
  19926. _react2.default.createElement(
  19927. 'div',
  19928. { ref: 'group_current', className: 'hosts-group-list' },
  19929. items
  19930. )
  19931. );
  19932. }
  19933. }, {
  19934. key: 'getCurrentListFromDOM',
  19935. value: function getCurrentListFromDOM() {
  19936. var updateInclude = this.props.updateInclude;
  19937. var nodes = this.refs.group_current.getElementsByClassName('hosts-item');
  19938. nodes = (0, _listToArray2.default)(nodes);
  19939. var ids = nodes.map(function (item) {
  19940. return item.getAttribute('data-id');
  19941. });
  19942. this.ids = ids;
  19943. updateInclude(ids);
  19944. }
  19945. }, {
  19946. key: 'componentWillMount',
  19947. value: function componentWillMount() {
  19948. this.setState({
  19949. list: this.props.list,
  19950. include: this.props.include
  19951. });
  19952. }
  19953. }, {
  19954. key: 'componentDidMount',
  19955. value: function componentDidMount() {
  19956. var _this4 = this;
  19957. _sortablejs2.default.create(this.refs.group_valid, {
  19958. group: 'sorting',
  19959. animation: 150,
  19960. sort: false
  19961. });
  19962. _sortablejs2.default.create(this.refs.group_current, {
  19963. group: 'sorting',
  19964. animation: 150,
  19965. sort: true,
  19966. onSort: function onSort() {
  19967. _this4.getCurrentListFromDOM();
  19968. }
  19969. });
  19970. }
  19971. }, {
  19972. key: 'render',
  19973. value: function render() {
  19974. return _react2.default.createElement(
  19975. 'div',
  19976. { id: 'hosts-group' },
  19977. this.makeList(),
  19978. _react2.default.createElement('div', { className: 'arrow' }),
  19979. this.currentList()
  19980. );
  19981. }
  19982. }]);
  19983. return Group;
  19984. }(_react2.default.Component);
  19985. exports.default = Group;
  19986. /***/ }),
  19987. /* 146 */
  19988. /***/ (function(module, exports, __webpack_require__) {
  19989. "use strict";
  19990. /**
  19991. * @author oldj
  19992. * @blog http://oldj.net
  19993. */
  19994. Object.defineProperty(exports, "__esModule", {
  19995. value: true
  19996. });
  19997. 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; }; }();
  19998. var _react = __webpack_require__(7);
  19999. var _react2 = _interopRequireDefault(_react);
  20000. var _frame = __webpack_require__(48);
  20001. var _frame2 = _interopRequireDefault(_frame);
  20002. var _classnames = __webpack_require__(16);
  20003. var _classnames2 = _interopRequireDefault(_classnames);
  20004. var _Agent = __webpack_require__(4);
  20005. var _Agent2 = _interopRequireDefault(_Agent);
  20006. var _version = __webpack_require__(71);
  20007. var _formatVersion = __webpack_require__(139);
  20008. var _formatVersion2 = _interopRequireDefault(_formatVersion);
  20009. __webpack_require__(112);
  20010. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20011. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20012. 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; }
  20013. 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; }
  20014. var pref_keys = ['after_cmd', 'auto_launch', 'choice_mode', 'hide_at_launch', 'is_dock_icon_hidden', 'user_language'];
  20015. var PreferencesPrompt = function (_React$Component) {
  20016. _inherits(PreferencesPrompt, _React$Component);
  20017. function PreferencesPrompt(props) {
  20018. _classCallCheck(this, PreferencesPrompt);
  20019. var _this = _possibleConstructorReturn(this, (PreferencesPrompt.__proto__ || Object.getPrototypeOf(PreferencesPrompt)).call(this, props));
  20020. _this.state = {
  20021. show: false,
  20022. user_language: '',
  20023. after_cmd: '',
  20024. choice_mode: '',
  20025. auto_launch: false,
  20026. hide_at_launch: false,
  20027. lang_list: [],
  20028. update_found: false // 发现新版本
  20029. };
  20030. _Agent2.default.pact('getLangList').then(function (lang_list) {
  20031. return _this.setState({ lang_list: lang_list });
  20032. });
  20033. return _this;
  20034. }
  20035. _createClass(PreferencesPrompt, [{
  20036. key: 'componentDidMount',
  20037. value: function componentDidMount() {
  20038. var _this2 = this;
  20039. _Agent2.default.on('show_preferences', function () {
  20040. _Agent2.default.pact('getPref').then(function (pref) {
  20041. _this2.setState(Object.assign({}, pref, { show: true }));
  20042. });
  20043. });
  20044. _Agent2.default.on('update_found', function (v) {
  20045. console.log(v);
  20046. _this2.setState({
  20047. update_found: true
  20048. });
  20049. });
  20050. }
  20051. }, {
  20052. key: 'onOK',
  20053. value: function onOK() {
  20054. var _this3 = this;
  20055. this.setState({
  20056. show: false
  20057. }, function () {
  20058. var prefs = {};
  20059. var d = _this3.state;
  20060. pref_keys.map(function (k) {
  20061. if (d.hasOwnProperty(k)) {
  20062. prefs[k] = d[k];
  20063. }
  20064. });
  20065. _Agent2.default.pact('setPref', prefs).then(function () {
  20066. setTimeout(function () {
  20067. _Agent2.default.pact('relaunch');
  20068. }, 200);
  20069. });
  20070. });
  20071. }
  20072. }, {
  20073. key: 'onCancel',
  20074. value: function onCancel() {
  20075. this.setState({
  20076. show: false
  20077. });
  20078. }
  20079. }, {
  20080. key: 'getLanguageOptions',
  20081. value: function getLanguageOptions() {
  20082. return this.state.lang_list.map(function (_ref, idx) {
  20083. var key = _ref.key,
  20084. name = _ref.name;
  20085. return _react2.default.createElement(
  20086. 'option',
  20087. { value: key, key: idx },
  20088. name
  20089. );
  20090. });
  20091. }
  20092. }, {
  20093. key: 'updateLangKey',
  20094. value: function updateLangKey(v) {
  20095. this.setState({ user_language: v });
  20096. }
  20097. }, {
  20098. key: 'updateChoiceMode',
  20099. value: function updateChoiceMode(v) {
  20100. this.setState({
  20101. choice_mode: v
  20102. });
  20103. }
  20104. }, {
  20105. key: 'updateAfterCmd',
  20106. value: function updateAfterCmd(v) {
  20107. this.setState({
  20108. after_cmd: v
  20109. });
  20110. }
  20111. }, {
  20112. key: 'updateAutoLaunch',
  20113. value: function updateAutoLaunch(v) {
  20114. this.setState({
  20115. auto_launch: v
  20116. });
  20117. // todo set auto launch
  20118. }
  20119. }, {
  20120. key: 'updateMinimizeAtLaunch',
  20121. value: function updateMinimizeAtLaunch(v) {
  20122. this.setState({
  20123. hide_at_launch: v
  20124. });
  20125. }
  20126. }, {
  20127. key: 'prefLanguage',
  20128. value: function prefLanguage() {
  20129. var _this4 = this;
  20130. var lang = this.props.lang;
  20131. return _react2.default.createElement(
  20132. 'div',
  20133. { className: 'ln' },
  20134. _react2.default.createElement(
  20135. 'div',
  20136. { className: 'title' },
  20137. lang.language
  20138. ),
  20139. _react2.default.createElement(
  20140. 'div',
  20141. { className: 'cnt' },
  20142. _react2.default.createElement(
  20143. 'select',
  20144. {
  20145. value: this.state.user_language || '',
  20146. onChange: function onChange(e) {
  20147. return _this4.updateLangKey(e.target.value);
  20148. }
  20149. },
  20150. this.getLanguageOptions()
  20151. ),
  20152. _react2.default.createElement(
  20153. 'div',
  20154. {
  20155. className: 'inform' },
  20156. lang.should_restart_after_change_language
  20157. )
  20158. )
  20159. );
  20160. }
  20161. }, {
  20162. key: 'prefChoiceMode',
  20163. value: function prefChoiceMode() {
  20164. var _this5 = this;
  20165. var lang = this.props.lang;
  20166. return _react2.default.createElement(
  20167. 'div',
  20168. { className: 'ln' },
  20169. _react2.default.createElement(
  20170. 'div',
  20171. { className: 'title' },
  20172. lang.pref_choice_mode
  20173. ),
  20174. _react2.default.createElement(
  20175. 'div',
  20176. { className: 'cnt' },
  20177. _react2.default.createElement('input', { type: 'radio', id: 'pref-choice-mode-single', name: 'choice_mode',
  20178. value: 'single',
  20179. defaultChecked: this.state.choice_mode === 'single',
  20180. onChange: function onChange(e) {
  20181. return _this5.updateChoiceMode(e.target.value);
  20182. }
  20183. }),
  20184. _react2.default.createElement(
  20185. 'label',
  20186. {
  20187. htmlFor: 'pref-choice-mode-single' },
  20188. lang.pref_choice_mode_single
  20189. ),
  20190. _react2.default.createElement('input', { type: 'radio', id: 'pref-choice-mode-multiple', name: 'choice_mode',
  20191. value: 'multiple',
  20192. defaultChecked: this.state.choice_mode === 'multiple',
  20193. onChange: function onChange(e) {
  20194. return _this5.updateChoiceMode(e.target.value);
  20195. }
  20196. }),
  20197. _react2.default.createElement(
  20198. 'label',
  20199. {
  20200. htmlFor: 'pref-choice-mode-multiple' },
  20201. lang.pref_choice_mode_multiple
  20202. )
  20203. )
  20204. );
  20205. }
  20206. }, {
  20207. key: 'prefAfterCmd',
  20208. value: function prefAfterCmd() {
  20209. var _this6 = this;
  20210. var lang = this.props.lang;
  20211. return _react2.default.createElement(
  20212. 'div',
  20213. { className: 'ln' },
  20214. _react2.default.createElement(
  20215. 'div',
  20216. { className: 'title' },
  20217. lang.pref_after_cmd
  20218. ),
  20219. _react2.default.createElement(
  20220. 'div',
  20221. { className: 'cnt' },
  20222. _react2.default.createElement(
  20223. 'div',
  20224. { className: 'inform' },
  20225. lang.pref_after_cmd_info
  20226. ),
  20227. _react2.default.createElement('textarea', {
  20228. name: '',
  20229. defaultValue: this.state.after_cmd,
  20230. placeholder: lang.pref_after_cmd_placeholder,
  20231. onChange: function onChange(e) {
  20232. return _this6.updateAfterCmd(e.target.value);
  20233. }
  20234. })
  20235. )
  20236. );
  20237. }
  20238. }, {
  20239. key: 'prefAutoLaunch',
  20240. value: function prefAutoLaunch() {
  20241. var _this7 = this;
  20242. var lang = this.props.lang;
  20243. return _react2.default.createElement(
  20244. 'div',
  20245. { className: 'ln' },
  20246. _react2.default.createElement(
  20247. 'div',
  20248. { className: 'title' },
  20249. lang.auto_launch
  20250. ),
  20251. _react2.default.createElement(
  20252. 'div',
  20253. { className: 'cnt' },
  20254. _react2.default.createElement('input', { type: 'checkbox', name: '',
  20255. defaultChecked: this.state.auto_launch,
  20256. onChange: function onChange(e) {
  20257. return _this7.updateAutoLaunch(e.target.checked);
  20258. }
  20259. })
  20260. )
  20261. );
  20262. }
  20263. }, {
  20264. key: 'prefMinimizeAtLaunch',
  20265. value: function prefMinimizeAtLaunch() {
  20266. var _this8 = this;
  20267. var lang = this.props.lang;
  20268. return _react2.default.createElement(
  20269. 'div',
  20270. { className: 'ln' },
  20271. _react2.default.createElement(
  20272. 'div',
  20273. { className: 'title' },
  20274. lang.hide_at_launch
  20275. ),
  20276. _react2.default.createElement(
  20277. 'div',
  20278. { className: 'cnt' },
  20279. _react2.default.createElement('input', { type: 'checkbox', name: '',
  20280. defaultChecked: this.state.hide_at_launch,
  20281. onChange: function onChange(e) {
  20282. return _this8.updateMinimizeAtLaunch(e.target.checked);
  20283. }
  20284. })
  20285. )
  20286. );
  20287. }
  20288. }, {
  20289. key: 'body',
  20290. value: function body() {
  20291. return _react2.default.createElement(
  20292. 'div',
  20293. { ref: 'body' },
  20294. _react2.default.createElement(
  20295. 'div',
  20296. {
  20297. className: (0, _classnames2.default)('current-version', { 'update-found': this.state.update_found }) },
  20298. _react2.default.createElement(
  20299. 'a',
  20300. { href: '#',
  20301. onClick: PreferencesPrompt.openDownloadPage },
  20302. (0, _formatVersion2.default)(_version.version)
  20303. )
  20304. ),
  20305. this.prefLanguage(),
  20306. this.prefChoiceMode(),
  20307. this.prefAfterCmd(),
  20308. this.prefMinimizeAtLaunch()
  20309. );
  20310. }
  20311. }, {
  20312. key: 'render',
  20313. value: function render() {
  20314. var _this9 = this;
  20315. var lang = this.props.lang;
  20316. return _react2.default.createElement(_frame2.default, {
  20317. show: this.state.show,
  20318. head: lang.preferences,
  20319. body: this.body(),
  20320. onOK: function onOK() {
  20321. return _this9.onOK();
  20322. },
  20323. onCancel: function onCancel() {
  20324. return _this9.onCancel();
  20325. },
  20326. cancel_title: lang.cancel,
  20327. ok_title: lang.set_and_relaunch_app
  20328. });
  20329. }
  20330. }], [{
  20331. key: 'openDownloadPage',
  20332. value: function openDownloadPage() {
  20333. _Agent2.default.pact('openUrl', __webpack_require__(138).url_download);
  20334. }
  20335. }]);
  20336. return PreferencesPrompt;
  20337. }(_react2.default.Component);
  20338. exports.default = PreferencesPrompt;
  20339. /***/ }),
  20340. /* 147 */
  20341. /***/ (function(module, exports, __webpack_require__) {
  20342. "use strict";
  20343. /**
  20344. * @author oldj
  20345. * @blog http://oldj.net
  20346. */
  20347. Object.defineProperty(exports, "__esModule", {
  20348. value: true
  20349. });
  20350. 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; }; }();
  20351. var _react = __webpack_require__(7);
  20352. var _react2 = _interopRequireDefault(_react);
  20353. var _Agent = __webpack_require__(4);
  20354. var _Agent2 = _interopRequireDefault(_Agent);
  20355. var _frame = __webpack_require__(48);
  20356. var _frame2 = _interopRequireDefault(_frame);
  20357. __webpack_require__(113);
  20358. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20359. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20360. 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; }
  20361. 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; }
  20362. var SudoPrompt = function (_React$Component) {
  20363. _inherits(SudoPrompt, _React$Component);
  20364. function SudoPrompt(props) {
  20365. _classCallCheck(this, SudoPrompt);
  20366. var _this = _possibleConstructorReturn(this, (SudoPrompt.__proto__ || Object.getPrototypeOf(SudoPrompt)).call(this, props));
  20367. _this.onSuccess = null;
  20368. _this.state = {
  20369. show: false,
  20370. pswd: ''
  20371. };
  20372. return _this;
  20373. }
  20374. _createClass(SudoPrompt, [{
  20375. key: 'componentDidMount',
  20376. value: function componentDidMount() {
  20377. var _this2 = this;
  20378. _Agent2.default.on('sudo_prompt', function (success) {
  20379. _this2.setState({ show: true });
  20380. _this2.onSuccess = success;
  20381. setTimeout(function () {
  20382. var el = _this2.refs.body;
  20383. el && el.querySelector('input').focus();
  20384. }, 100);
  20385. });
  20386. }
  20387. }, {
  20388. key: 'onOK',
  20389. value: function onOK() {
  20390. var pswd = this.refs.pswd.value;
  20391. if (!pswd) {
  20392. var el = this.refs.body;
  20393. el && el.querySelector('input').focus();
  20394. return;
  20395. }
  20396. this.setState({
  20397. show: false,
  20398. pswd: pswd
  20399. });
  20400. _Agent2.default.emit('sudo_pswd', pswd);
  20401. if (typeof this.onSuccess === 'function') {
  20402. this.onSuccess(pswd);
  20403. }
  20404. this.onSuccess = null;
  20405. }
  20406. }, {
  20407. key: 'onCancel',
  20408. value: function onCancel() {
  20409. _Agent2.default.emit('sudo_cancel');
  20410. this.setState({
  20411. show: false
  20412. });
  20413. this.onSuccess = null;
  20414. }
  20415. }, {
  20416. key: 'body',
  20417. value: function body() {
  20418. var _this3 = this;
  20419. var lang = this.props.lang;
  20420. return _react2.default.createElement(
  20421. 'div',
  20422. { ref: 'body' },
  20423. _react2.default.createElement(
  20424. 'div',
  20425. { className: 'ln' },
  20426. _react2.default.createElement(
  20427. 'div',
  20428. { className: 'title' },
  20429. lang.sudo_pswd
  20430. ),
  20431. _react2.default.createElement(
  20432. 'div',
  20433. { className: 'cnt' },
  20434. _react2.default.createElement('input', {
  20435. type: 'password',
  20436. ref: 'pswd',
  20437. onKeyDown: function onKeyDown(e) {
  20438. return e.keyCode === 13 && _this3.onOK() || e.keyCode === 27 && _this3.onCancel();
  20439. }
  20440. })
  20441. )
  20442. )
  20443. );
  20444. }
  20445. }, {
  20446. key: 'render',
  20447. value: function render() {
  20448. var _this4 = this;
  20449. var lang = this.props.lang;
  20450. return _react2.default.createElement(_frame2.default, {
  20451. show: this.state.show,
  20452. head: lang.input_sudo_pswd,
  20453. body: this.body(),
  20454. onOK: function onOK() {
  20455. return _this4.onOK();
  20456. },
  20457. onCancel: function onCancel() {
  20458. return _this4.onCancel();
  20459. },
  20460. lang: lang
  20461. });
  20462. }
  20463. }]);
  20464. return SudoPrompt;
  20465. }(_react2.default.Component);
  20466. exports.default = SudoPrompt;
  20467. /***/ }),
  20468. /* 148 */
  20469. /***/ (function(module, exports, __webpack_require__) {
  20470. "use strict";
  20471. /**
  20472. * @author oldj
  20473. * @blog http://oldj.net
  20474. */
  20475. var _react = __webpack_require__(7);
  20476. var _react2 = _interopRequireDefault(_react);
  20477. var _reactDom = __webpack_require__(104);
  20478. var _reactDom2 = _interopRequireDefault(_reactDom);
  20479. var _app = __webpack_require__(103);
  20480. var _app2 = _interopRequireDefault(_app);
  20481. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20482. _reactDom2.default.render(_react2.default.createElement(_app2.default, null), document.getElementById('app'));
  20483. /***/ }),
  20484. /* 149 */
  20485. /***/ (function(module, exports, __webpack_require__) {
  20486. "use strict";
  20487. /**
  20488. * @author oldj
  20489. * @blog https://oldj.net
  20490. */
  20491. Object.defineProperty(exports, "__esModule", {
  20492. value: true
  20493. });
  20494. 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; }; }();
  20495. var _react = __webpack_require__(7);
  20496. var _react2 = _interopRequireDefault(_react);
  20497. var _classnames = __webpack_require__(16);
  20498. var _classnames2 = _interopRequireDefault(_classnames);
  20499. var _Agent = __webpack_require__(4);
  20500. var _Agent2 = _interopRequireDefault(_Agent);
  20501. __webpack_require__(114);
  20502. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20503. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20504. 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; }
  20505. 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; }
  20506. var Buttons = function (_React$Component) {
  20507. _inherits(Buttons, _React$Component);
  20508. function Buttons(props) {
  20509. _classCallCheck(this, Buttons);
  20510. var _this = _possibleConstructorReturn(this, (Buttons.__proto__ || Object.getPrototypeOf(Buttons)).call(this, props));
  20511. _this.state = {
  20512. top_toggle_on: true,
  20513. search_on: false
  20514. };
  20515. _this.on_ids = [];
  20516. return _this;
  20517. }
  20518. _createClass(Buttons, [{
  20519. key: 'btnToggle',
  20520. value: function btnToggle() {
  20521. var _this2 = this;
  20522. var doToggle = function doToggle() {
  20523. var on = !_this2.state.top_toggle_on;
  20524. _Agent2.default.emit('top_toggle', on, _this2.on_ids, function (e) {
  20525. if (e) {
  20526. console.log(e);
  20527. return;
  20528. }
  20529. _this2.setState({
  20530. top_toggle_on: on
  20531. }, function () {
  20532. if (_this2.state.top_toggle_on) {
  20533. _this2.on_ids = [];
  20534. }
  20535. });
  20536. });
  20537. };
  20538. if (this.state.top_toggle_on) {
  20539. _Agent2.default.emit('get_on_hosts', function (ids) {
  20540. _this2.on_ids = ids;
  20541. doToggle();
  20542. });
  20543. } else {
  20544. doToggle();
  20545. }
  20546. }
  20547. }, {
  20548. key: 'btnSearch',
  20549. value: function btnSearch() {
  20550. var _this3 = this;
  20551. this.setState({
  20552. search_on: !this.state.search_on
  20553. }, function () {
  20554. _Agent2.default.emit(_this3.state.search_on ? 'search_on' : 'search_off');
  20555. });
  20556. }
  20557. }, {
  20558. key: 'cancelSearch',
  20559. value: function cancelSearch() {
  20560. this.setState({
  20561. search_on: false
  20562. }, function () {
  20563. _Agent2.default.emit('search_off');
  20564. });
  20565. }
  20566. }, {
  20567. key: 'componentDidMount',
  20568. value: function componentDidMount() {
  20569. var _this4 = this;
  20570. _Agent2.default.on('to_search', function () {
  20571. _this4.btnSearch();
  20572. });
  20573. _Agent2.default.on('esc', function () {
  20574. if (_this4.state.search_on) {
  20575. _this4.btnSearch();
  20576. }
  20577. });
  20578. }
  20579. }, {
  20580. key: 'render',
  20581. value: function render() {
  20582. var _this5 = this;
  20583. return _react2.default.createElement(
  20584. 'div',
  20585. { id: 'sh-buttons' },
  20586. _react2.default.createElement(
  20587. 'div',
  20588. { className: 'left' },
  20589. _react2.default.createElement(
  20590. 'a',
  20591. {
  20592. className: 'btn-add',
  20593. href: '#',
  20594. onClick: function onClick() {
  20595. return Buttons.btnAdd();
  20596. }
  20597. },
  20598. '+'
  20599. )
  20600. ),
  20601. _react2.default.createElement(
  20602. 'div',
  20603. { className: 'right' },
  20604. _react2.default.createElement('i', {
  20605. className: (0, _classnames2.default)({
  20606. iconfont: 1,
  20607. 'icon-search': 1,
  20608. 'on': this.state.search_on
  20609. }),
  20610. onClick: function onClick() {
  20611. return _this5.btnSearch();
  20612. }
  20613. }),
  20614. _react2.default.createElement('i', {
  20615. className: (0, _classnames2.default)({
  20616. iconfont: 1,
  20617. 'icon-switchon': this.state.top_toggle_on,
  20618. 'icon-switchoff': !this.state.top_toggle_on
  20619. }),
  20620. onClick: function onClick() {
  20621. return _this5.btnToggle();
  20622. }
  20623. })
  20624. )
  20625. );
  20626. }
  20627. }], [{
  20628. key: 'btnAdd',
  20629. value: function btnAdd() {
  20630. _Agent2.default.emit('add_hosts');
  20631. }
  20632. }]);
  20633. return Buttons;
  20634. }(_react2.default.Component);
  20635. exports.default = Buttons;
  20636. /***/ }),
  20637. /* 150 */
  20638. /***/ (function(module, exports, __webpack_require__) {
  20639. "use strict";
  20640. /**
  20641. * @author oldj
  20642. * @blog https://oldj.net
  20643. */
  20644. Object.defineProperty(exports, "__esModule", {
  20645. value: true
  20646. });
  20647. 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; };
  20648. 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; }; }();
  20649. var _react = __webpack_require__(7);
  20650. var _react2 = _interopRequireDefault(_react);
  20651. var _classnames = __webpack_require__(16);
  20652. var _classnames2 = _interopRequireDefault(_classnames);
  20653. var _Agent = __webpack_require__(4);
  20654. var _Agent2 = _interopRequireDefault(_Agent);
  20655. var _isInViewport = __webpack_require__(156);
  20656. var _isInViewport2 = _interopRequireDefault(_isInViewport);
  20657. __webpack_require__(115);
  20658. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20659. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20660. 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; }
  20661. 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; }
  20662. var ListItem = function (_React$Component) {
  20663. _inherits(ListItem, _React$Component);
  20664. function ListItem(props) {
  20665. _classCallCheck(this, ListItem);
  20666. var _this = _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).call(this, props));
  20667. _this.is_sys = !!_this.props.sys;
  20668. _this.state = {};
  20669. return _this;
  20670. }
  20671. _createClass(ListItem, [{
  20672. key: 'getTitle',
  20673. value: function getTitle() {
  20674. var lang = this.props.lang;
  20675. return this.is_sys ? lang.sys_hosts_title : this.props.data.title || lang.untitled;
  20676. }
  20677. }, {
  20678. key: 'beSelected',
  20679. value: function beSelected() {
  20680. this.props.setCurrent(this.props.data);
  20681. }
  20682. }, {
  20683. key: 'toggle',
  20684. value: function toggle() {
  20685. _Agent2.default.emit('toggle_hosts', Object.assign({}, this.props.data));
  20686. }
  20687. }, {
  20688. key: 'toEdit',
  20689. value: function toEdit() {
  20690. _Agent2.default.emit('edit_hosts', Object.assign({}, this.props.data));
  20691. }
  20692. }, {
  20693. key: 'componentDidMount',
  20694. value: function componentDidMount() {
  20695. var _props = this.props,
  20696. just_added_id = _props.just_added_id,
  20697. data = _props.data;
  20698. //Agent.on('select_hosts', id => {
  20699. // if (id && id === this.props.data.id) {
  20700. // this.beSelected()
  20701. // this.el && this.el.scrollIntoView()
  20702. // }
  20703. //})
  20704. if (!this.el) {
  20705. return;
  20706. }
  20707. var el = this.el;
  20708. if (just_added_id === data.id && !(0, _isInViewport2.default)(el)) {
  20709. el.scrollIntoView();
  20710. this.props.justAdd(null);
  20711. }
  20712. }
  20713. }, {
  20714. key: 'render',
  20715. value: function render() {
  20716. var _this2 = this;
  20717. var _props2 = this.props,
  20718. data = _props2.data,
  20719. sys = _props2.sys,
  20720. current = _props2.current,
  20721. show = _props2.show;
  20722. if (!data) return null;
  20723. var is_selected = data.id === current.id || data.is_sys && current.is_sys;
  20724. var attrs = {
  20725. 'data-id': data.id || ''
  20726. };
  20727. return _react2.default.createElement(
  20728. 'div',
  20729. _extends({ className: (0, _classnames2.default)({
  20730. 'list-item': 1
  20731. //, 'hidden': !this.isMatched()
  20732. , 'sys-hosts': sys,
  20733. 'selected': is_selected,
  20734. 'hidden': show === false
  20735. }),
  20736. onClick: this.beSelected.bind(this),
  20737. ref: function ref(el) {
  20738. return _this2.el = el;
  20739. }
  20740. }, attrs),
  20741. sys ? null : _react2.default.createElement(
  20742. 'div',
  20743. { className: 'item-buttons' },
  20744. _react2.default.createElement('i', {
  20745. className: 'iconfont icon-edit',
  20746. onClick: this.toEdit.bind(this)
  20747. }),
  20748. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  20749. 'switch': 1,
  20750. 'iconfont': 1,
  20751. 'icon-on': data.on,
  20752. 'icon-off': !data.on
  20753. }),
  20754. onClick: this.toggle.bind(this)
  20755. })
  20756. ),
  20757. _react2.default.createElement('i', { className: (0, _classnames2.default)({
  20758. 'iconfont': 1,
  20759. 'item-icon': 1,
  20760. 'icon-warn': !!data.error,
  20761. 'icon-file': !sys && !data.error && data.where !== 'group',
  20762. 'icon-files': data.where === 'group',
  20763. 'icon-sysserver': sys && !data.error
  20764. }),
  20765. title: data.error || ''
  20766. }),
  20767. _react2.default.createElement(
  20768. 'span',
  20769. null,
  20770. this.getTitle()
  20771. )
  20772. );
  20773. }
  20774. }]);
  20775. return ListItem;
  20776. }(_react2.default.Component);
  20777. exports.default = ListItem;
  20778. /***/ }),
  20779. /* 151 */
  20780. /***/ (function(module, exports, __webpack_require__) {
  20781. "use strict";
  20782. /**
  20783. * @author oldj
  20784. * @blog https://oldj.net
  20785. */
  20786. Object.defineProperty(exports, "__esModule", {
  20787. value: true
  20788. });
  20789. 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; };
  20790. 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; }; }();
  20791. var _react = __webpack_require__(7);
  20792. var _react2 = _interopRequireDefault(_react);
  20793. var _listItem = __webpack_require__(150);
  20794. var _listItem2 = _interopRequireDefault(_listItem);
  20795. var _sortablejs = __webpack_require__(77);
  20796. var _sortablejs2 = _interopRequireDefault(_sortablejs);
  20797. var _listToArray = __webpack_require__(73);
  20798. var _listToArray2 = _interopRequireDefault(_listToArray);
  20799. var _Agent = __webpack_require__(4);
  20800. var _Agent2 = _interopRequireDefault(_Agent);
  20801. var _kw = __webpack_require__(72);
  20802. __webpack_require__(116);
  20803. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20804. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20805. 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; }
  20806. 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; }
  20807. var List = function (_React$Component) {
  20808. _inherits(List, _React$Component);
  20809. function List(props) {
  20810. _classCallCheck(this, List);
  20811. var _this = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, props));
  20812. _this.state = {
  20813. kw: ''
  20814. };
  20815. _Agent2.default.on('search', function (kw) {
  20816. _this.setState({ kw: kw });
  20817. });
  20818. return _this;
  20819. }
  20820. _createClass(List, [{
  20821. key: 'customItems',
  20822. value: function customItems() {
  20823. var _this2 = this;
  20824. var kw = this.state.kw;
  20825. function match(kw, item) {
  20826. return (0, _kw.findPositions)(kw, item.content).length > 0 || (0, _kw.findPositions)(kw, item.title).length > 0;
  20827. }
  20828. return this.props.list.map(function (item, idx) {
  20829. var show = true;
  20830. if (kw && !match(kw, item)) {
  20831. show = false;
  20832. }
  20833. return _react2.default.createElement(_listItem2.default, _extends({
  20834. data: item,
  20835. idx: idx,
  20836. key: 'hosts-' + idx + Math.random(),
  20837. show: show
  20838. }, _this2.props));
  20839. });
  20840. }
  20841. }, {
  20842. key: 'getCurrentListFromDOM',
  20843. value: function getCurrentListFromDOM() {
  20844. var nodes = this.refs.items.getElementsByClassName('list-item');
  20845. nodes = (0, _listToArray2.default)(nodes);
  20846. var ids = nodes.map(function (el) {
  20847. return el.getAttribute('data-id');
  20848. });
  20849. _Agent2.default.emit('sort', ids);
  20850. }
  20851. }, {
  20852. key: 'componentDidMount',
  20853. value: function componentDidMount() {
  20854. var _this3 = this;
  20855. _sortablejs2.default.create(this.refs.items, {
  20856. group: 'list-sorting',
  20857. sort: true,
  20858. animation: 150,
  20859. onStart: function onStart() {
  20860. _Agent2.default.emit('drag_start');
  20861. },
  20862. onSort: function onSort() {
  20863. _this3.getCurrentListFromDOM();
  20864. _Agent2.default.emit('drag_end');
  20865. //console.log(evt)
  20866. //console.log(evt.item)
  20867. //console.log(evt.oldIndex, evt.newIndex)
  20868. }
  20869. });
  20870. }
  20871. }, {
  20872. key: 'render',
  20873. value: function render() {
  20874. return _react2.default.createElement(
  20875. 'div',
  20876. { id: 'sh-list' },
  20877. _react2.default.createElement(_listItem2.default, _extends({
  20878. data: this.props.sys_hosts
  20879. }, this.props, {
  20880. sys: '1' })),
  20881. _react2.default.createElement(
  20882. 'div',
  20883. { ref: 'items', className: 'custom-items' },
  20884. this.customItems()
  20885. )
  20886. );
  20887. }
  20888. }]);
  20889. return List;
  20890. }(_react2.default.Component);
  20891. exports.default = List;
  20892. /***/ }),
  20893. /* 152 */
  20894. /***/ (function(module, exports, __webpack_require__) {
  20895. "use strict";
  20896. /**
  20897. * @author oldj
  20898. * @blog http://oldj.net
  20899. */
  20900. Object.defineProperty(exports, "__esModule", {
  20901. value: true
  20902. });
  20903. 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; }; }();
  20904. var _react = __webpack_require__(7);
  20905. var _react2 = _interopRequireDefault(_react);
  20906. var _buttons = __webpack_require__(149);
  20907. var _buttons2 = _interopRequireDefault(_buttons);
  20908. var _searchbar = __webpack_require__(153);
  20909. var _searchbar2 = _interopRequireDefault(_searchbar);
  20910. var _list = __webpack_require__(151);
  20911. var _list2 = _interopRequireDefault(_list);
  20912. __webpack_require__(117);
  20913. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20914. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20915. 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; }
  20916. 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; }
  20917. var Panel = function (_React$Component) {
  20918. _inherits(Panel, _React$Component);
  20919. function Panel() {
  20920. _classCallCheck(this, Panel);
  20921. return _possibleConstructorReturn(this, (Panel.__proto__ || Object.getPrototypeOf(Panel)).apply(this, arguments));
  20922. }
  20923. _createClass(Panel, [{
  20924. key: 'render',
  20925. value: function render() {
  20926. return _react2.default.createElement(
  20927. 'div',
  20928. { id: 'panel' },
  20929. _react2.default.createElement(_list2.default, this.props),
  20930. _react2.default.createElement(_searchbar2.default, null),
  20931. _react2.default.createElement(_buttons2.default, null)
  20932. );
  20933. }
  20934. }]);
  20935. return Panel;
  20936. }(_react2.default.Component);
  20937. exports.default = Panel;
  20938. /***/ }),
  20939. /* 153 */
  20940. /***/ (function(module, exports, __webpack_require__) {
  20941. "use strict";
  20942. /**
  20943. * @author oldj
  20944. * @blog http://oldj.net
  20945. */
  20946. Object.defineProperty(exports, "__esModule", {
  20947. value: true
  20948. });
  20949. 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; }; }();
  20950. var _react = __webpack_require__(7);
  20951. var _react2 = _interopRequireDefault(_react);
  20952. var _Agent = __webpack_require__(4);
  20953. var _Agent2 = _interopRequireDefault(_Agent);
  20954. __webpack_require__(118);
  20955. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20956. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20957. 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; }
  20958. 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; }
  20959. var SearchBar = function (_React$Component) {
  20960. _inherits(SearchBar, _React$Component);
  20961. function SearchBar(props) {
  20962. _classCallCheck(this, SearchBar);
  20963. var _this = _possibleConstructorReturn(this, (SearchBar.__proto__ || Object.getPrototypeOf(SearchBar)).call(this, props));
  20964. _this.state = {
  20965. show: false,
  20966. keyword: ''
  20967. };
  20968. _this._t = null;
  20969. _Agent2.default.on('search_on', function () {
  20970. _this.setState({
  20971. show: true
  20972. }, function () {
  20973. setTimeout(function () {
  20974. _this.refs.keyword.focus();
  20975. }, 100);
  20976. });
  20977. });
  20978. _Agent2.default.on('search_off', function () {
  20979. _this.clearSearch();
  20980. });
  20981. return _this;
  20982. }
  20983. _createClass(SearchBar, [{
  20984. key: 'clearSearch',
  20985. value: function clearSearch() {
  20986. this.setState({
  20987. show: false,
  20988. keyword: ''
  20989. });
  20990. _Agent2.default.emit('search', '');
  20991. }
  20992. }, {
  20993. key: 'doSearch',
  20994. value: function doSearch(kw) {
  20995. this.setState({
  20996. keyword: kw
  20997. });
  20998. clearTimeout(this._t);
  20999. this._t = setTimeout(function () {
  21000. _Agent2.default.emit('search', kw);
  21001. }, 300);
  21002. }
  21003. }, {
  21004. key: 'render',
  21005. value: function render() {
  21006. var _this2 = this;
  21007. if (!this.state.show) {
  21008. return null;
  21009. }
  21010. return _react2.default.createElement(
  21011. 'div',
  21012. { id: 'sh-searchbar' },
  21013. _react2.default.createElement('input', {
  21014. ref: 'keyword',
  21015. type: 'text',
  21016. placeholder: 'keyword',
  21017. value: this.state.keyword,
  21018. onChange: function onChange(e) {
  21019. return _this2.doSearch(e.target.value);
  21020. },
  21021. onKeyDown: function onKeyDown(e) {
  21022. return e.keyCode === 27 && SearchBar.onCancel();
  21023. }
  21024. })
  21025. );
  21026. }
  21027. }], [{
  21028. key: 'onCancel',
  21029. value: function onCancel() {
  21030. _Agent2.default.emit('cancel_search');
  21031. }
  21032. }]);
  21033. return SearchBar;
  21034. }(_react2.default.Component);
  21035. exports.default = SearchBar;
  21036. /***/ }),
  21037. /* 154 */
  21038. /***/ (function(module, exports, __webpack_require__) {
  21039. var map = {
  21040. "./alert": 36,
  21041. "./alert.js": 36,
  21042. "./check_hosts_refresh": 37,
  21043. "./check_hosts_refresh.js": 37,
  21044. "./del_hosts": 38,
  21045. "./del_hosts.js": 38,
  21046. "./esc": 39,
  21047. "./esc.js": 39,
  21048. "./get_on_hosts": 40,
  21049. "./get_on_hosts.js": 40,
  21050. "./index": 30,
  21051. "./index.js": 30,
  21052. "./list_updated": 17,
  21053. "./list_updated.js": 17,
  21054. "./reload": 41,
  21055. "./reload.js": 41,
  21056. "./save": 24,
  21057. "./save.js": 24,
  21058. "./sort": 42,
  21059. "./sort.js": 42,
  21060. "./sudo_cancel": 43,
  21061. "./sudo_cancel.js": 43,
  21062. "./sudo_pswd": 44,
  21063. "./sudo_pswd.js": 44,
  21064. "./toggle_hosts": 45,
  21065. "./toggle_hosts.js": 45,
  21066. "./top_toggle": 46,
  21067. "./top_toggle.js": 46,
  21068. "./update_hosts": 47,
  21069. "./update_hosts.js": 47
  21070. };
  21071. function webpackContext(req) {
  21072. return __webpack_require__(webpackContextResolve(req));
  21073. };
  21074. function webpackContextResolve(req) {
  21075. var id = map[req];
  21076. if(!(id + 1)) // check for number or string
  21077. throw new Error("Cannot find module '" + req + "'.");
  21078. return id;
  21079. };
  21080. webpackContext.keys = function webpackContextKeys() {
  21081. return Object.keys(map);
  21082. };
  21083. webpackContext.resolve = webpackContextResolve;
  21084. module.exports = webpackContext;
  21085. webpackContext.id = 154;
  21086. /***/ }),
  21087. /* 155 */
  21088. /***/ (function(module, exports, __webpack_require__) {
  21089. var map = {
  21090. "./alert.js": 36,
  21091. "./check_hosts_refresh.js": 37,
  21092. "./del_hosts.js": 38,
  21093. "./esc.js": 39,
  21094. "./get_on_hosts.js": 40,
  21095. "./index.js": 30,
  21096. "./list_updated.js": 17,
  21097. "./reload.js": 41,
  21098. "./save.js": 24,
  21099. "./sort.js": 42,
  21100. "./sudo_cancel.js": 43,
  21101. "./sudo_pswd.js": 44,
  21102. "./toggle_hosts.js": 45,
  21103. "./top_toggle.js": 46,
  21104. "./update_hosts.js": 47
  21105. };
  21106. function webpackContext(req) {
  21107. return __webpack_require__(webpackContextResolve(req));
  21108. };
  21109. function webpackContextResolve(req) {
  21110. var id = map[req];
  21111. if(!(id + 1)) // check for number or string
  21112. throw new Error("Cannot find module '" + req + "'.");
  21113. return id;
  21114. };
  21115. webpackContext.keys = function webpackContextKeys() {
  21116. return Object.keys(map);
  21117. };
  21118. webpackContext.resolve = webpackContextResolve;
  21119. module.exports = webpackContext;
  21120. webpackContext.id = 155;
  21121. /***/ }),
  21122. /* 156 */
  21123. /***/ (function(module, exports, __webpack_require__) {
  21124. "use strict";
  21125. /**
  21126. * @author oldj
  21127. * @blog https://oldj.net
  21128. */
  21129. module.exports = (element) => {
  21130. let rect = element.getBoundingClientRect()
  21131. let docEl = document.documentElement
  21132. return (
  21133. rect.top >= 0 &&
  21134. rect.left >= 0 &&
  21135. rect.bottom <= (window.innerHeight || docEl.clientHeight) &&
  21136. rect.right <= (window.innerWidth || docEl.clientWidth)
  21137. )
  21138. }
  21139. /***/ }),
  21140. /* 157 */
  21141. /***/ (function(module, exports, __webpack_require__) {
  21142. "use strict";
  21143. /**
  21144. * Copyright (c) 2013-present, Facebook, Inc.
  21145. * All rights reserved.
  21146. *
  21147. * This source code is licensed under the BSD-style license found in the
  21148. * LICENSE file in the root directory of this source tree. An additional grant
  21149. * of patent rights can be found in the PATENTS file in the same directory.
  21150. *
  21151. * @typechecks
  21152. */
  21153. var _hyphenPattern = /-(.)/g;
  21154. /**
  21155. * Camelcases a hyphenated string, for example:
  21156. *
  21157. * > camelize('background-color')
  21158. * < "backgroundColor"
  21159. *
  21160. * @param {string} string
  21161. * @return {string}
  21162. */
  21163. function camelize(string) {
  21164. return string.replace(_hyphenPattern, function (_, character) {
  21165. return character.toUpperCase();
  21166. });
  21167. }
  21168. module.exports = camelize;
  21169. /***/ }),
  21170. /* 158 */
  21171. /***/ (function(module, exports, __webpack_require__) {
  21172. "use strict";
  21173. /**
  21174. * Copyright (c) 2013-present, Facebook, Inc.
  21175. * All rights reserved.
  21176. *
  21177. * This source code is licensed under the BSD-style license found in the
  21178. * LICENSE file in the root directory of this source tree. An additional grant
  21179. * of patent rights can be found in the PATENTS file in the same directory.
  21180. *
  21181. * @typechecks
  21182. */
  21183. var camelize = __webpack_require__(157);
  21184. var msPattern = /^-ms-/;
  21185. /**
  21186. * Camelcases a hyphenated CSS property name, for example:
  21187. *
  21188. * > camelizeStyleName('background-color')
  21189. * < "backgroundColor"
  21190. * > camelizeStyleName('-moz-transition')
  21191. * < "MozTransition"
  21192. * > camelizeStyleName('-ms-transition')
  21193. * < "msTransition"
  21194. *
  21195. * As Andi Smith suggests
  21196. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  21197. * is converted to lowercase `ms`.
  21198. *
  21199. * @param {string} string
  21200. * @return {string}
  21201. */
  21202. function camelizeStyleName(string) {
  21203. return camelize(string.replace(msPattern, 'ms-'));
  21204. }
  21205. module.exports = camelizeStyleName;
  21206. /***/ }),
  21207. /* 159 */
  21208. /***/ (function(module, exports, __webpack_require__) {
  21209. "use strict";
  21210. /**
  21211. * Copyright (c) 2013-present, Facebook, Inc.
  21212. * All rights reserved.
  21213. *
  21214. * This source code is licensed under the BSD-style license found in the
  21215. * LICENSE file in the root directory of this source tree. An additional grant
  21216. * of patent rights can be found in the PATENTS file in the same directory.
  21217. *
  21218. *
  21219. */
  21220. var isTextNode = __webpack_require__(167);
  21221. /*eslint-disable no-bitwise */
  21222. /**
  21223. * Checks if a given DOM node contains or is another DOM node.
  21224. */
  21225. function containsNode(outerNode, innerNode) {
  21226. if (!outerNode || !innerNode) {
  21227. return false;
  21228. } else if (outerNode === innerNode) {
  21229. return true;
  21230. } else if (isTextNode(outerNode)) {
  21231. return false;
  21232. } else if (isTextNode(innerNode)) {
  21233. return containsNode(outerNode, innerNode.parentNode);
  21234. } else if ('contains' in outerNode) {
  21235. return outerNode.contains(innerNode);
  21236. } else if (outerNode.compareDocumentPosition) {
  21237. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  21238. } else {
  21239. return false;
  21240. }
  21241. }
  21242. module.exports = containsNode;
  21243. /***/ }),
  21244. /* 160 */
  21245. /***/ (function(module, exports, __webpack_require__) {
  21246. "use strict";
  21247. /**
  21248. * Copyright (c) 2013-present, Facebook, Inc.
  21249. * All rights reserved.
  21250. *
  21251. * This source code is licensed under the BSD-style license found in the
  21252. * LICENSE file in the root directory of this source tree. An additional grant
  21253. * of patent rights can be found in the PATENTS file in the same directory.
  21254. *
  21255. * @typechecks
  21256. */
  21257. var invariant = __webpack_require__(0);
  21258. /**
  21259. * Convert array-like objects to arrays.
  21260. *
  21261. * This API assumes the caller knows the contents of the data type. For less
  21262. * well defined inputs use createArrayFromMixed.
  21263. *
  21264. * @param {object|function|filelist} obj
  21265. * @return {array}
  21266. */
  21267. function toArray(obj) {
  21268. var length = obj.length;
  21269. // Some browsers builtin objects can report typeof 'function' (e.g. NodeList
  21270. // in old versions of Safari).
  21271. !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? false ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
  21272. !(typeof length === 'number') ? false ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
  21273. !(length === 0 || length - 1 in obj) ? false ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
  21274. !(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;
  21275. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  21276. // without method will throw during the slice call and skip straight to the
  21277. // fallback.
  21278. if (obj.hasOwnProperty) {
  21279. try {
  21280. return Array.prototype.slice.call(obj);
  21281. } catch (e) {
  21282. // IE < 9 does not support Array#slice on collections objects
  21283. }
  21284. }
  21285. // Fall back to copying key by key. This assumes all keys have a value,
  21286. // so will not preserve sparsely populated inputs.
  21287. var ret = Array(length);
  21288. for (var ii = 0; ii < length; ii++) {
  21289. ret[ii] = obj[ii];
  21290. }
  21291. return ret;
  21292. }
  21293. /**
  21294. * Perform a heuristic test to determine if an object is "array-like".
  21295. *
  21296. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  21297. * Joshu replied: "Mu."
  21298. *
  21299. * This function determines if its argument has "array nature": it returns
  21300. * true if the argument is an actual array, an `arguments' object, or an
  21301. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  21302. *
  21303. * It will return false for other array-like objects like Filelist.
  21304. *
  21305. * @param {*} obj
  21306. * @return {boolean}
  21307. */
  21308. function hasArrayNature(obj) {
  21309. return (
  21310. // not null/false
  21311. !!obj && (
  21312. // arrays are objects, NodeLists are functions in Safari
  21313. typeof obj == 'object' || typeof obj == 'function') &&
  21314. // quacks like an array
  21315. 'length' in obj &&
  21316. // not window
  21317. !('setInterval' in obj) &&
  21318. // no DOM node should be considered an array-like
  21319. // a 'select' element has 'length' and 'item' properties on IE8
  21320. typeof obj.nodeType != 'number' && (
  21321. // a real array
  21322. Array.isArray(obj) ||
  21323. // arguments
  21324. 'callee' in obj ||
  21325. // HTMLCollection/NodeList
  21326. 'item' in obj)
  21327. );
  21328. }
  21329. /**
  21330. * Ensure that the argument is an array by wrapping it in an array if it is not.
  21331. * Creates a copy of the argument if it is already an array.
  21332. *
  21333. * This is mostly useful idiomatically:
  21334. *
  21335. * var createArrayFromMixed = require('createArrayFromMixed');
  21336. *
  21337. * function takesOneOrMoreThings(things) {
  21338. * things = createArrayFromMixed(things);
  21339. * ...
  21340. * }
  21341. *
  21342. * This allows you to treat `things' as an array, but accept scalars in the API.
  21343. *
  21344. * If you need to convert an array-like object, like `arguments`, into an array
  21345. * use toArray instead.
  21346. *
  21347. * @param {*} obj
  21348. * @return {array}
  21349. */
  21350. function createArrayFromMixed(obj) {
  21351. if (!hasArrayNature(obj)) {
  21352. return [obj];
  21353. } else if (Array.isArray(obj)) {
  21354. return obj.slice();
  21355. } else {
  21356. return toArray(obj);
  21357. }
  21358. }
  21359. module.exports = createArrayFromMixed;
  21360. /***/ }),
  21361. /* 161 */
  21362. /***/ (function(module, exports, __webpack_require__) {
  21363. "use strict";
  21364. /**
  21365. * Copyright (c) 2013-present, Facebook, Inc.
  21366. * All rights reserved.
  21367. *
  21368. * This source code is licensed under the BSD-style license found in the
  21369. * LICENSE file in the root directory of this source tree. An additional grant
  21370. * of patent rights can be found in the PATENTS file in the same directory.
  21371. *
  21372. * @typechecks
  21373. */
  21374. /*eslint-disable fb-www/unsafe-html*/
  21375. var ExecutionEnvironment = __webpack_require__(9);
  21376. var createArrayFromMixed = __webpack_require__(160);
  21377. var getMarkupWrap = __webpack_require__(162);
  21378. var invariant = __webpack_require__(0);
  21379. /**
  21380. * Dummy container used to render all markup.
  21381. */
  21382. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  21383. /**
  21384. * Pattern used by `getNodeName`.
  21385. */
  21386. var nodeNamePattern = /^\s*<(\w+)/;
  21387. /**
  21388. * Extracts the `nodeName` of the first element in a string of markup.
  21389. *
  21390. * @param {string} markup String of markup.
  21391. * @return {?string} Node name of the supplied markup.
  21392. */
  21393. function getNodeName(markup) {
  21394. var nodeNameMatch = markup.match(nodeNamePattern);
  21395. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  21396. }
  21397. /**
  21398. * Creates an array containing the nodes rendered from the supplied markup. The
  21399. * optionally supplied `handleScript` function will be invoked once for each
  21400. * <script> element that is rendered. If no `handleScript` function is supplied,
  21401. * an exception is thrown if any <script> elements are rendered.
  21402. *
  21403. * @param {string} markup A string of valid HTML markup.
  21404. * @param {?function} handleScript Invoked once for each rendered <script>.
  21405. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  21406. */
  21407. function createNodesFromMarkup(markup, handleScript) {
  21408. var node = dummyNode;
  21409. !!!dummyNode ? false ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
  21410. var nodeName = getNodeName(markup);
  21411. var wrap = nodeName && getMarkupWrap(nodeName);
  21412. if (wrap) {
  21413. node.innerHTML = wrap[1] + markup + wrap[2];
  21414. var wrapDepth = wrap[0];
  21415. while (wrapDepth--) {
  21416. node = node.lastChild;
  21417. }
  21418. } else {
  21419. node.innerHTML = markup;
  21420. }
  21421. var scripts = node.getElementsByTagName('script');
  21422. if (scripts.length) {
  21423. !handleScript ? false ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
  21424. createArrayFromMixed(scripts).forEach(handleScript);
  21425. }
  21426. var nodes = Array.from(node.childNodes);
  21427. while (node.lastChild) {
  21428. node.removeChild(node.lastChild);
  21429. }
  21430. return nodes;
  21431. }
  21432. module.exports = createNodesFromMarkup;
  21433. /***/ }),
  21434. /* 162 */
  21435. /***/ (function(module, exports, __webpack_require__) {
  21436. "use strict";
  21437. /**
  21438. * Copyright (c) 2013-present, Facebook, Inc.
  21439. * All rights reserved.
  21440. *
  21441. * This source code is licensed under the BSD-style license found in the
  21442. * LICENSE file in the root directory of this source tree. An additional grant
  21443. * of patent rights can be found in the PATENTS file in the same directory.
  21444. *
  21445. */
  21446. /*eslint-disable fb-www/unsafe-html */
  21447. var ExecutionEnvironment = __webpack_require__(9);
  21448. var invariant = __webpack_require__(0);
  21449. /**
  21450. * Dummy container used to detect which wraps are necessary.
  21451. */
  21452. var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  21453. /**
  21454. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  21455. * so we wrap them, render the wrapped nodes, then extract the desired node.
  21456. *
  21457. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  21458. */
  21459. var shouldWrap = {};
  21460. var selectWrap = [1, '<select multiple="true">', '</select>'];
  21461. var tableWrap = [1, '<table>', '</table>'];
  21462. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  21463. var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
  21464. var markupWrap = {
  21465. '*': [1, '?<div>', '</div>'],
  21466. 'area': [1, '<map>', '</map>'],
  21467. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  21468. 'legend': [1, '<fieldset>', '</fieldset>'],
  21469. 'param': [1, '<object>', '</object>'],
  21470. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  21471. 'optgroup': selectWrap,
  21472. 'option': selectWrap,
  21473. 'caption': tableWrap,
  21474. 'colgroup': tableWrap,
  21475. 'tbody': tableWrap,
  21476. 'tfoot': tableWrap,
  21477. 'thead': tableWrap,
  21478. 'td': trWrap,
  21479. 'th': trWrap
  21480. };
  21481. // Initialize the SVG elements since we know they'll always need to be wrapped
  21482. // consistently. If they are created inside a <div> they will be initialized in
  21483. // the wrong namespace (and will not display).
  21484. var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
  21485. svgElements.forEach(function (nodeName) {
  21486. markupWrap[nodeName] = svgWrap;
  21487. shouldWrap[nodeName] = true;
  21488. });
  21489. /**
  21490. * Gets the markup wrap configuration for the supplied `nodeName`.
  21491. *
  21492. * NOTE: This lazily detects which wraps are necessary for the current browser.
  21493. *
  21494. * @param {string} nodeName Lowercase `nodeName`.
  21495. * @return {?array} Markup wrap configuration, if applicable.
  21496. */
  21497. function getMarkupWrap(nodeName) {
  21498. !!!dummyNode ? false ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
  21499. if (!markupWrap.hasOwnProperty(nodeName)) {
  21500. nodeName = '*';
  21501. }
  21502. if (!shouldWrap.hasOwnProperty(nodeName)) {
  21503. if (nodeName === '*') {
  21504. dummyNode.innerHTML = '<link />';
  21505. } else {
  21506. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  21507. }
  21508. shouldWrap[nodeName] = !dummyNode.firstChild;
  21509. }
  21510. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  21511. }
  21512. module.exports = getMarkupWrap;
  21513. /***/ }),
  21514. /* 163 */
  21515. /***/ (function(module, exports, __webpack_require__) {
  21516. "use strict";
  21517. /**
  21518. * Copyright (c) 2013-present, Facebook, Inc.
  21519. * All rights reserved.
  21520. *
  21521. * This source code is licensed under the BSD-style license found in the
  21522. * LICENSE file in the root directory of this source tree. An additional grant
  21523. * of patent rights can be found in the PATENTS file in the same directory.
  21524. *
  21525. * @typechecks
  21526. */
  21527. /**
  21528. * Gets the scroll position of the supplied element or window.
  21529. *
  21530. * The return values are unbounded, unlike `getScrollPosition`. This means they
  21531. * may be negative or exceed the element boundaries (which is possible using
  21532. * inertial scrolling).
  21533. *
  21534. * @param {DOMWindow|DOMElement} scrollable
  21535. * @return {object} Map with `x` and `y` keys.
  21536. */
  21537. function getUnboundedScrollPosition(scrollable) {
  21538. if (scrollable.Window && scrollable instanceof scrollable.Window) {
  21539. return {
  21540. x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
  21541. y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
  21542. };
  21543. }
  21544. return {
  21545. x: scrollable.scrollLeft,
  21546. y: scrollable.scrollTop
  21547. };
  21548. }
  21549. module.exports = getUnboundedScrollPosition;
  21550. /***/ }),
  21551. /* 164 */
  21552. /***/ (function(module, exports, __webpack_require__) {
  21553. "use strict";
  21554. /**
  21555. * Copyright (c) 2013-present, Facebook, Inc.
  21556. * All rights reserved.
  21557. *
  21558. * This source code is licensed under the BSD-style license found in the
  21559. * LICENSE file in the root directory of this source tree. An additional grant
  21560. * of patent rights can be found in the PATENTS file in the same directory.
  21561. *
  21562. * @typechecks
  21563. */
  21564. var _uppercasePattern = /([A-Z])/g;
  21565. /**
  21566. * Hyphenates a camelcased string, for example:
  21567. *
  21568. * > hyphenate('backgroundColor')
  21569. * < "background-color"
  21570. *
  21571. * For CSS style names, use `hyphenateStyleName` instead which works properly
  21572. * with all vendor prefixes, including `ms`.
  21573. *
  21574. * @param {string} string
  21575. * @return {string}
  21576. */
  21577. function hyphenate(string) {
  21578. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  21579. }
  21580. module.exports = hyphenate;
  21581. /***/ }),
  21582. /* 165 */
  21583. /***/ (function(module, exports, __webpack_require__) {
  21584. "use strict";
  21585. /**
  21586. * Copyright (c) 2013-present, Facebook, Inc.
  21587. * All rights reserved.
  21588. *
  21589. * This source code is licensed under the BSD-style license found in the
  21590. * LICENSE file in the root directory of this source tree. An additional grant
  21591. * of patent rights can be found in the PATENTS file in the same directory.
  21592. *
  21593. * @typechecks
  21594. */
  21595. var hyphenate = __webpack_require__(164);
  21596. var msPattern = /^ms-/;
  21597. /**
  21598. * Hyphenates a camelcased CSS property name, for example:
  21599. *
  21600. * > hyphenateStyleName('backgroundColor')
  21601. * < "background-color"
  21602. * > hyphenateStyleName('MozTransition')
  21603. * < "-moz-transition"
  21604. * > hyphenateStyleName('msTransition')
  21605. * < "-ms-transition"
  21606. *
  21607. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  21608. * is converted to `-ms-`.
  21609. *
  21610. * @param {string} string
  21611. * @return {string}
  21612. */
  21613. function hyphenateStyleName(string) {
  21614. return hyphenate(string).replace(msPattern, '-ms-');
  21615. }
  21616. module.exports = hyphenateStyleName;
  21617. /***/ }),
  21618. /* 166 */
  21619. /***/ (function(module, exports, __webpack_require__) {
  21620. "use strict";
  21621. /**
  21622. * Copyright (c) 2013-present, Facebook, Inc.
  21623. * All rights reserved.
  21624. *
  21625. * This source code is licensed under the BSD-style license found in the
  21626. * LICENSE file in the root directory of this source tree. An additional grant
  21627. * of patent rights can be found in the PATENTS file in the same directory.
  21628. *
  21629. * @typechecks
  21630. */
  21631. /**
  21632. * @param {*} object The object to check.
  21633. * @return {boolean} Whether or not the object is a DOM node.
  21634. */
  21635. function isNode(object) {
  21636. var doc = object ? object.ownerDocument || object : document;
  21637. var defaultView = doc.defaultView || window;
  21638. return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
  21639. }
  21640. module.exports = isNode;
  21641. /***/ }),
  21642. /* 167 */
  21643. /***/ (function(module, exports, __webpack_require__) {
  21644. "use strict";
  21645. /**
  21646. * Copyright (c) 2013-present, Facebook, Inc.
  21647. * All rights reserved.
  21648. *
  21649. * This source code is licensed under the BSD-style license found in the
  21650. * LICENSE file in the root directory of this source tree. An additional grant
  21651. * of patent rights can be found in the PATENTS file in the same directory.
  21652. *
  21653. * @typechecks
  21654. */
  21655. var isNode = __webpack_require__(166);
  21656. /**
  21657. * @param {*} object The object to check.
  21658. * @return {boolean} Whether or not the object is a DOM text node.
  21659. */
  21660. function isTextNode(object) {
  21661. return isNode(object) && object.nodeType == 3;
  21662. }
  21663. module.exports = isTextNode;
  21664. /***/ }),
  21665. /* 168 */
  21666. /***/ (function(module, exports, __webpack_require__) {
  21667. "use strict";
  21668. /**
  21669. * Copyright (c) 2013-present, Facebook, Inc.
  21670. * All rights reserved.
  21671. *
  21672. * This source code is licensed under the BSD-style license found in the
  21673. * LICENSE file in the root directory of this source tree. An additional grant
  21674. * of patent rights can be found in the PATENTS file in the same directory.
  21675. *
  21676. *
  21677. * @typechecks static-only
  21678. */
  21679. /**
  21680. * Memoizes the return value of a function that accepts one string argument.
  21681. */
  21682. function memoizeStringOnly(callback) {
  21683. var cache = {};
  21684. return function (string) {
  21685. if (!cache.hasOwnProperty(string)) {
  21686. cache[string] = callback.call(this, string);
  21687. }
  21688. return cache[string];
  21689. };
  21690. }
  21691. module.exports = memoizeStringOnly;
  21692. /***/ }),
  21693. /* 169 */
  21694. /***/ (function(module, exports, __webpack_require__) {
  21695. "use strict";
  21696. /**
  21697. * Copyright 2013-present, Facebook, Inc.
  21698. * All rights reserved.
  21699. *
  21700. * This source code is licensed under the BSD-style license found in the
  21701. * LICENSE file in the root directory of this source tree. An additional grant
  21702. * of patent rights can be found in the PATENTS file in the same directory.
  21703. *
  21704. */
  21705. var ARIADOMPropertyConfig = {
  21706. Properties: {
  21707. // Global States and Properties
  21708. 'aria-current': 0, // state
  21709. 'aria-details': 0,
  21710. 'aria-disabled': 0, // state
  21711. 'aria-hidden': 0, // state
  21712. 'aria-invalid': 0, // state
  21713. 'aria-keyshortcuts': 0,
  21714. 'aria-label': 0,
  21715. 'aria-roledescription': 0,
  21716. // Widget Attributes
  21717. 'aria-autocomplete': 0,
  21718. 'aria-checked': 0,
  21719. 'aria-expanded': 0,
  21720. 'aria-haspopup': 0,
  21721. 'aria-level': 0,
  21722. 'aria-modal': 0,
  21723. 'aria-multiline': 0,
  21724. 'aria-multiselectable': 0,
  21725. 'aria-orientation': 0,
  21726. 'aria-placeholder': 0,
  21727. 'aria-pressed': 0,
  21728. 'aria-readonly': 0,
  21729. 'aria-required': 0,
  21730. 'aria-selected': 0,
  21731. 'aria-sort': 0,
  21732. 'aria-valuemax': 0,
  21733. 'aria-valuemin': 0,
  21734. 'aria-valuenow': 0,
  21735. 'aria-valuetext': 0,
  21736. // Live Region Attributes
  21737. 'aria-atomic': 0,
  21738. 'aria-busy': 0,
  21739. 'aria-live': 0,
  21740. 'aria-relevant': 0,
  21741. // Drag-and-Drop Attributes
  21742. 'aria-dropeffect': 0,
  21743. 'aria-grabbed': 0,
  21744. // Relationship Attributes
  21745. 'aria-activedescendant': 0,
  21746. 'aria-colcount': 0,
  21747. 'aria-colindex': 0,
  21748. 'aria-colspan': 0,
  21749. 'aria-controls': 0,
  21750. 'aria-describedby': 0,
  21751. 'aria-errormessage': 0,
  21752. 'aria-flowto': 0,
  21753. 'aria-labelledby': 0,
  21754. 'aria-owns': 0,
  21755. 'aria-posinset': 0,
  21756. 'aria-rowcount': 0,
  21757. 'aria-rowindex': 0,
  21758. 'aria-rowspan': 0,
  21759. 'aria-setsize': 0
  21760. },
  21761. DOMAttributeNames: {},
  21762. DOMPropertyNames: {}
  21763. };
  21764. module.exports = ARIADOMPropertyConfig;
  21765. /***/ }),
  21766. /* 170 */
  21767. /***/ (function(module, exports, __webpack_require__) {
  21768. "use strict";
  21769. /**
  21770. * Copyright 2013-present, Facebook, Inc.
  21771. * All rights reserved.
  21772. *
  21773. * This source code is licensed under the BSD-style license found in the
  21774. * LICENSE file in the root directory of this source tree. An additional grant
  21775. * of patent rights can be found in the PATENTS file in the same directory.
  21776. *
  21777. */
  21778. var ReactDOMComponentTree = __webpack_require__(5);
  21779. var focusNode = __webpack_require__(75);
  21780. var AutoFocusUtils = {
  21781. focusDOMComponent: function () {
  21782. focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
  21783. }
  21784. };
  21785. module.exports = AutoFocusUtils;
  21786. /***/ }),
  21787. /* 171 */
  21788. /***/ (function(module, exports, __webpack_require__) {
  21789. "use strict";
  21790. /**
  21791. * Copyright 2013-present Facebook, Inc.
  21792. * All rights reserved.
  21793. *
  21794. * This source code is licensed under the BSD-style license found in the
  21795. * LICENSE file in the root directory of this source tree. An additional grant
  21796. * of patent rights can be found in the PATENTS file in the same directory.
  21797. *
  21798. */
  21799. var EventPropagators = __webpack_require__(27);
  21800. var ExecutionEnvironment = __webpack_require__(9);
  21801. var FallbackCompositionState = __webpack_require__(177);
  21802. var SyntheticCompositionEvent = __webpack_require__(214);
  21803. var SyntheticInputEvent = __webpack_require__(217);
  21804. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  21805. var START_KEYCODE = 229;
  21806. var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
  21807. var documentMode = null;
  21808. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  21809. documentMode = document.documentMode;
  21810. }
  21811. // Webkit offers a very useful `textInput` event that can be used to
  21812. // directly represent `beforeInput`. The IE `textinput` event is not as
  21813. // useful, so we don't use it.
  21814. var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
  21815. // In IE9+, we have access to composition events, but the data supplied
  21816. // by the native compositionend event may be incorrect. Japanese ideographic
  21817. // spaces, for instance (\u3000) are not recorded correctly.
  21818. var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
  21819. /**
  21820. * Opera <= 12 includes TextEvent in window, but does not fire
  21821. * text input events. Rely on keypress instead.
  21822. */
  21823. function isPresto() {
  21824. var opera = window.opera;
  21825. return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
  21826. }
  21827. var SPACEBAR_CODE = 32;
  21828. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  21829. // Events and their corresponding property names.
  21830. var eventTypes = {
  21831. beforeInput: {
  21832. phasedRegistrationNames: {
  21833. bubbled: 'onBeforeInput',
  21834. captured: 'onBeforeInputCapture'
  21835. },
  21836. dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
  21837. },
  21838. compositionEnd: {
  21839. phasedRegistrationNames: {
  21840. bubbled: 'onCompositionEnd',
  21841. captured: 'onCompositionEndCapture'
  21842. },
  21843. dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21844. },
  21845. compositionStart: {
  21846. phasedRegistrationNames: {
  21847. bubbled: 'onCompositionStart',
  21848. captured: 'onCompositionStartCapture'
  21849. },
  21850. dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21851. },
  21852. compositionUpdate: {
  21853. phasedRegistrationNames: {
  21854. bubbled: 'onCompositionUpdate',
  21855. captured: 'onCompositionUpdateCapture'
  21856. },
  21857. dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
  21858. }
  21859. };
  21860. // Track whether we've ever handled a keypress on the space key.
  21861. var hasSpaceKeypress = false;
  21862. /**
  21863. * Return whether a native keypress event is assumed to be a command.
  21864. * This is required because Firefox fires `keypress` events for key commands
  21865. * (cut, copy, select-all, etc.) even though no character is inserted.
  21866. */
  21867. function isKeypressCommand(nativeEvent) {
  21868. return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  21869. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  21870. !(nativeEvent.ctrlKey && nativeEvent.altKey);
  21871. }
  21872. /**
  21873. * Translate native top level events into event types.
  21874. *
  21875. * @param {string} topLevelType
  21876. * @return {object}
  21877. */
  21878. function getCompositionEventType(topLevelType) {
  21879. switch (topLevelType) {
  21880. case 'topCompositionStart':
  21881. return eventTypes.compositionStart;
  21882. case 'topCompositionEnd':
  21883. return eventTypes.compositionEnd;
  21884. case 'topCompositionUpdate':
  21885. return eventTypes.compositionUpdate;
  21886. }
  21887. }
  21888. /**
  21889. * Does our fallback best-guess model think this event signifies that
  21890. * composition has begun?
  21891. *
  21892. * @param {string} topLevelType
  21893. * @param {object} nativeEvent
  21894. * @return {boolean}
  21895. */
  21896. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  21897. return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
  21898. }
  21899. /**
  21900. * Does our fallback mode think that this event is the end of composition?
  21901. *
  21902. * @param {string} topLevelType
  21903. * @param {object} nativeEvent
  21904. * @return {boolean}
  21905. */
  21906. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  21907. switch (topLevelType) {
  21908. case 'topKeyUp':
  21909. // Command keys insert or clear IME input.
  21910. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
  21911. case 'topKeyDown':
  21912. // Expect IME keyCode on each keydown. If we get any other
  21913. // code we must have exited earlier.
  21914. return nativeEvent.keyCode !== START_KEYCODE;
  21915. case 'topKeyPress':
  21916. case 'topMouseDown':
  21917. case 'topBlur':
  21918. // Events are not possible without cancelling IME.
  21919. return true;
  21920. default:
  21921. return false;
  21922. }
  21923. }
  21924. /**
  21925. * Google Input Tools provides composition data via a CustomEvent,
  21926. * with the `data` property populated in the `detail` object. If this
  21927. * is available on the event object, use it. If not, this is a plain
  21928. * composition event and we have nothing special to extract.
  21929. *
  21930. * @param {object} nativeEvent
  21931. * @return {?string}
  21932. */
  21933. function getDataFromCustomEvent(nativeEvent) {
  21934. var detail = nativeEvent.detail;
  21935. if (typeof detail === 'object' && 'data' in detail) {
  21936. return detail.data;
  21937. }
  21938. return null;
  21939. }
  21940. // Track the current IME composition fallback object, if any.
  21941. var currentComposition = null;
  21942. /**
  21943. * @return {?object} A SyntheticCompositionEvent.
  21944. */
  21945. function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  21946. var eventType;
  21947. var fallbackData;
  21948. if (canUseCompositionEvent) {
  21949. eventType = getCompositionEventType(topLevelType);
  21950. } else if (!currentComposition) {
  21951. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  21952. eventType = eventTypes.compositionStart;
  21953. }
  21954. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  21955. eventType = eventTypes.compositionEnd;
  21956. }
  21957. if (!eventType) {
  21958. return null;
  21959. }
  21960. if (useFallbackCompositionData) {
  21961. // The current composition is stored statically and must not be
  21962. // overwritten while composition continues.
  21963. if (!currentComposition && eventType === eventTypes.compositionStart) {
  21964. currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
  21965. } else if (eventType === eventTypes.compositionEnd) {
  21966. if (currentComposition) {
  21967. fallbackData = currentComposition.getData();
  21968. }
  21969. }
  21970. }
  21971. var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
  21972. if (fallbackData) {
  21973. // Inject data generated from fallback path into the synthetic event.
  21974. // This matches the property of native CompositionEventInterface.
  21975. event.data = fallbackData;
  21976. } else {
  21977. var customData = getDataFromCustomEvent(nativeEvent);
  21978. if (customData !== null) {
  21979. event.data = customData;
  21980. }
  21981. }
  21982. EventPropagators.accumulateTwoPhaseDispatches(event);
  21983. return event;
  21984. }
  21985. /**
  21986. * @param {string} topLevelType Record from `EventConstants`.
  21987. * @param {object} nativeEvent Native browser event.
  21988. * @return {?string} The string corresponding to this `beforeInput` event.
  21989. */
  21990. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  21991. switch (topLevelType) {
  21992. case 'topCompositionEnd':
  21993. return getDataFromCustomEvent(nativeEvent);
  21994. case 'topKeyPress':
  21995. /**
  21996. * If native `textInput` events are available, our goal is to make
  21997. * use of them. However, there is a special case: the spacebar key.
  21998. * In Webkit, preventing default on a spacebar `textInput` event
  21999. * cancels character insertion, but it *also* causes the browser
  22000. * to fall back to its default spacebar behavior of scrolling the
  22001. * page.
  22002. *
  22003. * Tracking at:
  22004. * https://code.google.com/p/chromium/issues/detail?id=355103
  22005. *
  22006. * To avoid this issue, use the keypress event as if no `textInput`
  22007. * event is available.
  22008. */
  22009. var which = nativeEvent.which;
  22010. if (which !== SPACEBAR_CODE) {
  22011. return null;
  22012. }
  22013. hasSpaceKeypress = true;
  22014. return SPACEBAR_CHAR;
  22015. case 'topTextInput':
  22016. // Record the characters to be added to the DOM.
  22017. var chars = nativeEvent.data;
  22018. // If it's a spacebar character, assume that we have already handled
  22019. // it at the keypress level and bail immediately. Android Chrome
  22020. // doesn't give us keycodes, so we need to blacklist it.
  22021. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  22022. return null;
  22023. }
  22024. return chars;
  22025. default:
  22026. // For other native event types, do nothing.
  22027. return null;
  22028. }
  22029. }
  22030. /**
  22031. * For browsers that do not provide the `textInput` event, extract the
  22032. * appropriate string to use for SyntheticInputEvent.
  22033. *
  22034. * @param {string} topLevelType Record from `EventConstants`.
  22035. * @param {object} nativeEvent Native browser event.
  22036. * @return {?string} The fallback string for this `beforeInput` event.
  22037. */
  22038. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  22039. // If we are currently composing (IME) and using a fallback to do so,
  22040. // try to extract the composed characters from the fallback object.
  22041. // If composition event is available, we extract a string only at
  22042. // compositionevent, otherwise extract it at fallback events.
  22043. if (currentComposition) {
  22044. if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  22045. var chars = currentComposition.getData();
  22046. FallbackCompositionState.release(currentComposition);
  22047. currentComposition = null;
  22048. return chars;
  22049. }
  22050. return null;
  22051. }
  22052. switch (topLevelType) {
  22053. case 'topPaste':
  22054. // If a paste event occurs after a keypress, throw out the input
  22055. // chars. Paste events should not lead to BeforeInput events.
  22056. return null;
  22057. case 'topKeyPress':
  22058. /**
  22059. * As of v27, Firefox may fire keypress events even when no character
  22060. * will be inserted. A few possibilities:
  22061. *
  22062. * - `which` is `0`. Arrow keys, Esc key, etc.
  22063. *
  22064. * - `which` is the pressed key code, but no char is available.
  22065. * Ex: 'AltGr + d` in Polish. There is no modified character for
  22066. * this key combination and no character is inserted into the
  22067. * document, but FF fires the keypress for char code `100` anyway.
  22068. * No `input` event will occur.
  22069. *
  22070. * - `which` is the pressed key code, but a command combination is
  22071. * being used. Ex: `Cmd+C`. No character is inserted, and no
  22072. * `input` event will occur.
  22073. */
  22074. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  22075. return String.fromCharCode(nativeEvent.which);
  22076. }
  22077. return null;
  22078. case 'topCompositionEnd':
  22079. return useFallbackCompositionData ? null : nativeEvent.data;
  22080. default:
  22081. return null;
  22082. }
  22083. }
  22084. /**
  22085. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  22086. * `textInput` or fallback behavior.
  22087. *
  22088. * @return {?object} A SyntheticInputEvent.
  22089. */
  22090. function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22091. var chars;
  22092. if (canUseTextInputEvent) {
  22093. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  22094. } else {
  22095. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  22096. }
  22097. // If no characters are being inserted, no BeforeInput event should
  22098. // be fired.
  22099. if (!chars) {
  22100. return null;
  22101. }
  22102. var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
  22103. event.data = chars;
  22104. EventPropagators.accumulateTwoPhaseDispatches(event);
  22105. return event;
  22106. }
  22107. /**
  22108. * Create an `onBeforeInput` event to match
  22109. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  22110. *
  22111. * This event plugin is based on the native `textInput` event
  22112. * available in Chrome, Safari, Opera, and IE. This event fires after
  22113. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  22114. *
  22115. * `beforeInput` is spec'd but not implemented in any browsers, and
  22116. * the `input` event does not provide any useful information about what has
  22117. * actually been added, contrary to the spec. Thus, `textInput` is the best
  22118. * available event to identify the characters that have actually been inserted
  22119. * into the target node.
  22120. *
  22121. * This plugin is also responsible for emitting `composition` events, thus
  22122. * allowing us to share composition fallback code for both `beforeInput` and
  22123. * `composition` event types.
  22124. */
  22125. var BeforeInputEventPlugin = {
  22126. eventTypes: eventTypes,
  22127. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22128. return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
  22129. }
  22130. };
  22131. module.exports = BeforeInputEventPlugin;
  22132. /***/ }),
  22133. /* 172 */
  22134. /***/ (function(module, exports, __webpack_require__) {
  22135. "use strict";
  22136. /**
  22137. * Copyright 2013-present, Facebook, Inc.
  22138. * All rights reserved.
  22139. *
  22140. * This source code is licensed under the BSD-style license found in the
  22141. * LICENSE file in the root directory of this source tree. An additional grant
  22142. * of patent rights can be found in the PATENTS file in the same directory.
  22143. *
  22144. */
  22145. var CSSProperty = __webpack_require__(78);
  22146. var ExecutionEnvironment = __webpack_require__(9);
  22147. var ReactInstrumentation = __webpack_require__(11);
  22148. var camelizeStyleName = __webpack_require__(158);
  22149. var dangerousStyleValue = __webpack_require__(223);
  22150. var hyphenateStyleName = __webpack_require__(165);
  22151. var memoizeStringOnly = __webpack_require__(168);
  22152. var warning = __webpack_require__(1);
  22153. var processStyleName = memoizeStringOnly(function (styleName) {
  22154. return hyphenateStyleName(styleName);
  22155. });
  22156. var hasShorthandPropertyBug = false;
  22157. var styleFloatAccessor = 'cssFloat';
  22158. if (ExecutionEnvironment.canUseDOM) {
  22159. var tempStyle = document.createElement('div').style;
  22160. try {
  22161. // IE8 throws "Invalid argument." if resetting shorthand style properties.
  22162. tempStyle.font = '';
  22163. } catch (e) {
  22164. hasShorthandPropertyBug = true;
  22165. }
  22166. // IE8 only supports accessing cssFloat (standard) as styleFloat
  22167. if (document.documentElement.style.cssFloat === undefined) {
  22168. styleFloatAccessor = 'styleFloat';
  22169. }
  22170. }
  22171. if (false) {
  22172. // 'msTransform' is correct, but the other prefixes should be capitalized
  22173. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  22174. // style values shouldn't contain a semicolon
  22175. var badStyleValueWithSemicolonPattern = /;\s*$/;
  22176. var warnedStyleNames = {};
  22177. var warnedStyleValues = {};
  22178. var warnedForNaNValue = false;
  22179. var warnHyphenatedStyleName = function (name, owner) {
  22180. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  22181. return;
  22182. }
  22183. warnedStyleNames[name] = true;
  22184. process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
  22185. };
  22186. var warnBadVendoredStyleName = function (name, owner) {
  22187. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  22188. return;
  22189. }
  22190. warnedStyleNames[name] = true;
  22191. 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;
  22192. };
  22193. var warnStyleValueWithSemicolon = function (name, value, owner) {
  22194. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  22195. return;
  22196. }
  22197. warnedStyleValues[value] = true;
  22198. 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;
  22199. };
  22200. var warnStyleValueIsNaN = function (name, value, owner) {
  22201. if (warnedForNaNValue) {
  22202. return;
  22203. }
  22204. warnedForNaNValue = true;
  22205. process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
  22206. };
  22207. var checkRenderMessage = function (owner) {
  22208. if (owner) {
  22209. var name = owner.getName();
  22210. if (name) {
  22211. return ' Check the render method of `' + name + '`.';
  22212. }
  22213. }
  22214. return '';
  22215. };
  22216. /**
  22217. * @param {string} name
  22218. * @param {*} value
  22219. * @param {ReactDOMComponent} component
  22220. */
  22221. var warnValidStyle = function (name, value, component) {
  22222. var owner;
  22223. if (component) {
  22224. owner = component._currentElement._owner;
  22225. }
  22226. if (name.indexOf('-') > -1) {
  22227. warnHyphenatedStyleName(name, owner);
  22228. } else if (badVendoredStyleNamePattern.test(name)) {
  22229. warnBadVendoredStyleName(name, owner);
  22230. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  22231. warnStyleValueWithSemicolon(name, value, owner);
  22232. }
  22233. if (typeof value === 'number' && isNaN(value)) {
  22234. warnStyleValueIsNaN(name, value, owner);
  22235. }
  22236. };
  22237. }
  22238. /**
  22239. * Operations for dealing with CSS properties.
  22240. */
  22241. var CSSPropertyOperations = {
  22242. /**
  22243. * Serializes a mapping of style properties for use as inline styles:
  22244. *
  22245. * > createMarkupForStyles({width: '200px', height: 0})
  22246. * "width:200px;height:0;"
  22247. *
  22248. * Undefined values are ignored so that declarative programming is easier.
  22249. * The result should be HTML-escaped before insertion into the DOM.
  22250. *
  22251. * @param {object} styles
  22252. * @param {ReactDOMComponent} component
  22253. * @return {?string}
  22254. */
  22255. createMarkupForStyles: function (styles, component) {
  22256. var serialized = '';
  22257. for (var styleName in styles) {
  22258. if (!styles.hasOwnProperty(styleName)) {
  22259. continue;
  22260. }
  22261. var styleValue = styles[styleName];
  22262. if (false) {
  22263. warnValidStyle(styleName, styleValue, component);
  22264. }
  22265. if (styleValue != null) {
  22266. serialized += processStyleName(styleName) + ':';
  22267. serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
  22268. }
  22269. }
  22270. return serialized || null;
  22271. },
  22272. /**
  22273. * Sets the value for multiple styles on a node. If a value is specified as
  22274. * '' (empty string), the corresponding style property will be unset.
  22275. *
  22276. * @param {DOMElement} node
  22277. * @param {object} styles
  22278. * @param {ReactDOMComponent} component
  22279. */
  22280. setValueForStyles: function (node, styles, component) {
  22281. if (false) {
  22282. ReactInstrumentation.debugTool.onHostOperation({
  22283. instanceID: component._debugID,
  22284. type: 'update styles',
  22285. payload: styles
  22286. });
  22287. }
  22288. var style = node.style;
  22289. for (var styleName in styles) {
  22290. if (!styles.hasOwnProperty(styleName)) {
  22291. continue;
  22292. }
  22293. if (false) {
  22294. warnValidStyle(styleName, styles[styleName], component);
  22295. }
  22296. var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
  22297. if (styleName === 'float' || styleName === 'cssFloat') {
  22298. styleName = styleFloatAccessor;
  22299. }
  22300. if (styleValue) {
  22301. style[styleName] = styleValue;
  22302. } else {
  22303. var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
  22304. if (expansion) {
  22305. // Shorthand property that IE8 won't like unsetting, so unset each
  22306. // component to placate it
  22307. for (var individualStyleName in expansion) {
  22308. style[individualStyleName] = '';
  22309. }
  22310. } else {
  22311. style[styleName] = '';
  22312. }
  22313. }
  22314. }
  22315. }
  22316. };
  22317. module.exports = CSSPropertyOperations;
  22318. /***/ }),
  22319. /* 173 */
  22320. /***/ (function(module, exports, __webpack_require__) {
  22321. "use strict";
  22322. /**
  22323. * Copyright 2013-present, Facebook, Inc.
  22324. * All rights reserved.
  22325. *
  22326. * This source code is licensed under the BSD-style license found in the
  22327. * LICENSE file in the root directory of this source tree. An additional grant
  22328. * of patent rights can be found in the PATENTS file in the same directory.
  22329. *
  22330. */
  22331. var EventPluginHub = __webpack_require__(26);
  22332. var EventPropagators = __webpack_require__(27);
  22333. var ExecutionEnvironment = __webpack_require__(9);
  22334. var ReactDOMComponentTree = __webpack_require__(5);
  22335. var ReactUpdates = __webpack_require__(12);
  22336. var SyntheticEvent = __webpack_require__(13);
  22337. var getEventTarget = __webpack_require__(62);
  22338. var isEventSupported = __webpack_require__(63);
  22339. var isTextInputElement = __webpack_require__(95);
  22340. var eventTypes = {
  22341. change: {
  22342. phasedRegistrationNames: {
  22343. bubbled: 'onChange',
  22344. captured: 'onChangeCapture'
  22345. },
  22346. dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
  22347. }
  22348. };
  22349. /**
  22350. * For IE shims
  22351. */
  22352. var activeElement = null;
  22353. var activeElementInst = null;
  22354. var activeElementValue = null;
  22355. var activeElementValueProp = null;
  22356. /**
  22357. * SECTION: handle `change` event
  22358. */
  22359. function shouldUseChangeEvent(elem) {
  22360. var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  22361. return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
  22362. }
  22363. var doesChangeEventBubble = false;
  22364. if (ExecutionEnvironment.canUseDOM) {
  22365. // See `handleChange` comment below
  22366. doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8);
  22367. }
  22368. function manualDispatchChangeEvent(nativeEvent) {
  22369. var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
  22370. EventPropagators.accumulateTwoPhaseDispatches(event);
  22371. // If change and propertychange bubbled, we'd just bind to it like all the
  22372. // other events and have it go through ReactBrowserEventEmitter. Since it
  22373. // doesn't, we manually listen for the events and so we have to enqueue and
  22374. // process the abstract event manually.
  22375. //
  22376. // Batching is necessary here in order to ensure that all event handlers run
  22377. // before the next rerender (including event handlers attached to ancestor
  22378. // elements instead of directly on the input). Without this, controlled
  22379. // components don't work properly in conjunction with event bubbling because
  22380. // the component is rerendered and the value reverted before all the event
  22381. // handlers can run. See https://github.com/facebook/react/issues/708.
  22382. ReactUpdates.batchedUpdates(runEventInBatch, event);
  22383. }
  22384. function runEventInBatch(event) {
  22385. EventPluginHub.enqueueEvents(event);
  22386. EventPluginHub.processEventQueue(false);
  22387. }
  22388. function startWatchingForChangeEventIE8(target, targetInst) {
  22389. activeElement = target;
  22390. activeElementInst = targetInst;
  22391. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  22392. }
  22393. function stopWatchingForChangeEventIE8() {
  22394. if (!activeElement) {
  22395. return;
  22396. }
  22397. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  22398. activeElement = null;
  22399. activeElementInst = null;
  22400. }
  22401. function getTargetInstForChangeEvent(topLevelType, targetInst) {
  22402. if (topLevelType === 'topChange') {
  22403. return targetInst;
  22404. }
  22405. }
  22406. function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
  22407. if (topLevelType === 'topFocus') {
  22408. // stopWatching() should be a noop here but we call it just in case we
  22409. // missed a blur event somehow.
  22410. stopWatchingForChangeEventIE8();
  22411. startWatchingForChangeEventIE8(target, targetInst);
  22412. } else if (topLevelType === 'topBlur') {
  22413. stopWatchingForChangeEventIE8();
  22414. }
  22415. }
  22416. /**
  22417. * SECTION: handle `input` event
  22418. */
  22419. var isInputEventSupported = false;
  22420. if (ExecutionEnvironment.canUseDOM) {
  22421. // IE9 claims to support the input event but fails to trigger it when
  22422. // deleting text, so we ignore its input events.
  22423. // IE10+ fire input events to often, such when a placeholder
  22424. // changes or when an input with a placeholder is focused.
  22425. isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11);
  22426. }
  22427. /**
  22428. * (For IE <=11) Replacement getter/setter for the `value` property that gets
  22429. * set on the active element.
  22430. */
  22431. var newValueProp = {
  22432. get: function () {
  22433. return activeElementValueProp.get.call(this);
  22434. },
  22435. set: function (val) {
  22436. // Cast to a string so we can do equality checks.
  22437. activeElementValue = '' + val;
  22438. activeElementValueProp.set.call(this, val);
  22439. }
  22440. };
  22441. /**
  22442. * (For IE <=11) Starts tracking propertychange events on the passed-in element
  22443. * and override the value property so that we can distinguish user events from
  22444. * value changes in JS.
  22445. */
  22446. function startWatchingForValueChange(target, targetInst) {
  22447. activeElement = target;
  22448. activeElementInst = targetInst;
  22449. activeElementValue = target.value;
  22450. activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
  22451. // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
  22452. // on DOM elements
  22453. Object.defineProperty(activeElement, 'value', newValueProp);
  22454. if (activeElement.attachEvent) {
  22455. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  22456. } else {
  22457. activeElement.addEventListener('propertychange', handlePropertyChange, false);
  22458. }
  22459. }
  22460. /**
  22461. * (For IE <=11) Removes the event listeners from the currently-tracked element,
  22462. * if any exists.
  22463. */
  22464. function stopWatchingForValueChange() {
  22465. if (!activeElement) {
  22466. return;
  22467. }
  22468. // delete restores the original property definition
  22469. delete activeElement.value;
  22470. if (activeElement.detachEvent) {
  22471. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  22472. } else {
  22473. activeElement.removeEventListener('propertychange', handlePropertyChange, false);
  22474. }
  22475. activeElement = null;
  22476. activeElementInst = null;
  22477. activeElementValue = null;
  22478. activeElementValueProp = null;
  22479. }
  22480. /**
  22481. * (For IE <=11) Handles a propertychange event, sending a `change` event if
  22482. * the value of the active element has changed.
  22483. */
  22484. function handlePropertyChange(nativeEvent) {
  22485. if (nativeEvent.propertyName !== 'value') {
  22486. return;
  22487. }
  22488. var value = nativeEvent.srcElement.value;
  22489. if (value === activeElementValue) {
  22490. return;
  22491. }
  22492. activeElementValue = value;
  22493. manualDispatchChangeEvent(nativeEvent);
  22494. }
  22495. /**
  22496. * If a `change` event should be fired, returns the target's ID.
  22497. */
  22498. function getTargetInstForInputEvent(topLevelType, targetInst) {
  22499. if (topLevelType === 'topInput') {
  22500. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  22501. // what we want so fall through here and trigger an abstract event
  22502. return targetInst;
  22503. }
  22504. }
  22505. function handleEventsForInputEventIE(topLevelType, target, targetInst) {
  22506. if (topLevelType === 'topFocus') {
  22507. // In IE8, we can capture almost all .value changes by adding a
  22508. // propertychange handler and looking for events with propertyName
  22509. // equal to 'value'
  22510. // In IE9-11, propertychange fires for most input events but is buggy and
  22511. // doesn't fire when text is deleted, but conveniently, selectionchange
  22512. // appears to fire in all of the remaining cases so we catch those and
  22513. // forward the event if the value has changed
  22514. // In either case, we don't want to call the event handler if the value
  22515. // is changed from JS so we redefine a setter for `.value` that updates
  22516. // our activeElementValue variable, allowing us to ignore those changes
  22517. //
  22518. // stopWatching() should be a noop here but we call it just in case we
  22519. // missed a blur event somehow.
  22520. stopWatchingForValueChange();
  22521. startWatchingForValueChange(target, targetInst);
  22522. } else if (topLevelType === 'topBlur') {
  22523. stopWatchingForValueChange();
  22524. }
  22525. }
  22526. // For IE8 and IE9.
  22527. function getTargetInstForInputEventIE(topLevelType, targetInst) {
  22528. if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
  22529. // On the selectionchange event, the target is just document which isn't
  22530. // helpful for us so just check activeElement instead.
  22531. //
  22532. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  22533. // propertychange on the first input event after setting `value` from a
  22534. // script and fires only keydown, keypress, keyup. Catching keyup usually
  22535. // gets it and catching keydown lets us fire an event for the first
  22536. // keystroke if user does a key repeat (it'll be a little delayed: right
  22537. // before the second keystroke). Other input methods (e.g., paste) seem to
  22538. // fire selectionchange normally.
  22539. if (activeElement && activeElement.value !== activeElementValue) {
  22540. activeElementValue = activeElement.value;
  22541. return activeElementInst;
  22542. }
  22543. }
  22544. }
  22545. /**
  22546. * SECTION: handle `click` event
  22547. */
  22548. function shouldUseClickEvent(elem) {
  22549. // Use the `click` event to detect changes to checkbox and radio inputs.
  22550. // This approach works across all browsers, whereas `change` does not fire
  22551. // until `blur` in IE8.
  22552. return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
  22553. }
  22554. function getTargetInstForClickEvent(topLevelType, targetInst) {
  22555. if (topLevelType === 'topClick') {
  22556. return targetInst;
  22557. }
  22558. }
  22559. /**
  22560. * This plugin creates an `onChange` event that normalizes change events
  22561. * across form elements. This event fires at a time when it's possible to
  22562. * change the element's value without seeing a flicker.
  22563. *
  22564. * Supported elements are:
  22565. * - input (see `isTextInputElement`)
  22566. * - textarea
  22567. * - select
  22568. */
  22569. var ChangeEventPlugin = {
  22570. eventTypes: eventTypes,
  22571. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22572. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  22573. var getTargetInstFunc, handleEventFunc;
  22574. if (shouldUseChangeEvent(targetNode)) {
  22575. if (doesChangeEventBubble) {
  22576. getTargetInstFunc = getTargetInstForChangeEvent;
  22577. } else {
  22578. handleEventFunc = handleEventsForChangeEventIE8;
  22579. }
  22580. } else if (isTextInputElement(targetNode)) {
  22581. if (isInputEventSupported) {
  22582. getTargetInstFunc = getTargetInstForInputEvent;
  22583. } else {
  22584. getTargetInstFunc = getTargetInstForInputEventIE;
  22585. handleEventFunc = handleEventsForInputEventIE;
  22586. }
  22587. } else if (shouldUseClickEvent(targetNode)) {
  22588. getTargetInstFunc = getTargetInstForClickEvent;
  22589. }
  22590. if (getTargetInstFunc) {
  22591. var inst = getTargetInstFunc(topLevelType, targetInst);
  22592. if (inst) {
  22593. var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
  22594. event.type = 'change';
  22595. EventPropagators.accumulateTwoPhaseDispatches(event);
  22596. return event;
  22597. }
  22598. }
  22599. if (handleEventFunc) {
  22600. handleEventFunc(topLevelType, targetNode, targetInst);
  22601. }
  22602. }
  22603. };
  22604. module.exports = ChangeEventPlugin;
  22605. /***/ }),
  22606. /* 174 */
  22607. /***/ (function(module, exports, __webpack_require__) {
  22608. "use strict";
  22609. /**
  22610. * Copyright 2013-present, Facebook, Inc.
  22611. * All rights reserved.
  22612. *
  22613. * This source code is licensed under the BSD-style license found in the
  22614. * LICENSE file in the root directory of this source tree. An additional grant
  22615. * of patent rights can be found in the PATENTS file in the same directory.
  22616. *
  22617. */
  22618. var _prodInvariant = __webpack_require__(2);
  22619. var DOMLazyTree = __webpack_require__(18);
  22620. var ExecutionEnvironment = __webpack_require__(9);
  22621. var createNodesFromMarkup = __webpack_require__(161);
  22622. var emptyFunction = __webpack_require__(10);
  22623. var invariant = __webpack_require__(0);
  22624. var Danger = {
  22625. /**
  22626. * Replaces a node with a string of markup at its current position within its
  22627. * parent. The markup must render into a single root node.
  22628. *
  22629. * @param {DOMElement} oldChild Child node to replace.
  22630. * @param {string} markup Markup to render in place of the child node.
  22631. * @internal
  22632. */
  22633. dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
  22634. !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;
  22635. !markup ? false ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
  22636. !(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;
  22637. if (typeof markup === 'string') {
  22638. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  22639. oldChild.parentNode.replaceChild(newChild, oldChild);
  22640. } else {
  22641. DOMLazyTree.replaceChildWithTree(oldChild, markup);
  22642. }
  22643. }
  22644. };
  22645. module.exports = Danger;
  22646. /***/ }),
  22647. /* 175 */
  22648. /***/ (function(module, exports, __webpack_require__) {
  22649. "use strict";
  22650. /**
  22651. * Copyright 2013-present, Facebook, Inc.
  22652. * All rights reserved.
  22653. *
  22654. * This source code is licensed under the BSD-style license found in the
  22655. * LICENSE file in the root directory of this source tree. An additional grant
  22656. * of patent rights can be found in the PATENTS file in the same directory.
  22657. *
  22658. */
  22659. /**
  22660. * Module that is injectable into `EventPluginHub`, that specifies a
  22661. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  22662. * plugins, without having to package every one of them. This is better than
  22663. * having plugins be ordered in the same order that they are injected because
  22664. * that ordering would be influenced by the packaging order.
  22665. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  22666. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  22667. */
  22668. var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
  22669. module.exports = DefaultEventPluginOrder;
  22670. /***/ }),
  22671. /* 176 */
  22672. /***/ (function(module, exports, __webpack_require__) {
  22673. "use strict";
  22674. /**
  22675. * Copyright 2013-present, Facebook, Inc.
  22676. * All rights reserved.
  22677. *
  22678. * This source code is licensed under the BSD-style license found in the
  22679. * LICENSE file in the root directory of this source tree. An additional grant
  22680. * of patent rights can be found in the PATENTS file in the same directory.
  22681. *
  22682. */
  22683. var EventPropagators = __webpack_require__(27);
  22684. var ReactDOMComponentTree = __webpack_require__(5);
  22685. var SyntheticMouseEvent = __webpack_require__(32);
  22686. var eventTypes = {
  22687. mouseEnter: {
  22688. registrationName: 'onMouseEnter',
  22689. dependencies: ['topMouseOut', 'topMouseOver']
  22690. },
  22691. mouseLeave: {
  22692. registrationName: 'onMouseLeave',
  22693. dependencies: ['topMouseOut', 'topMouseOver']
  22694. }
  22695. };
  22696. var EnterLeaveEventPlugin = {
  22697. eventTypes: eventTypes,
  22698. /**
  22699. * For almost every interaction we care about, there will be both a top-level
  22700. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  22701. * we do not extract duplicate events. However, moving the mouse into the
  22702. * browser from outside will not fire a `mouseout` event. In this case, we use
  22703. * the `mouseover` top-level event.
  22704. */
  22705. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  22706. if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  22707. return null;
  22708. }
  22709. if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
  22710. // Must not be a mouse in or mouse out - ignoring.
  22711. return null;
  22712. }
  22713. var win;
  22714. if (nativeEventTarget.window === nativeEventTarget) {
  22715. // `nativeEventTarget` is probably a window object.
  22716. win = nativeEventTarget;
  22717. } else {
  22718. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  22719. var doc = nativeEventTarget.ownerDocument;
  22720. if (doc) {
  22721. win = doc.defaultView || doc.parentWindow;
  22722. } else {
  22723. win = window;
  22724. }
  22725. }
  22726. var from;
  22727. var to;
  22728. if (topLevelType === 'topMouseOut') {
  22729. from = targetInst;
  22730. var related = nativeEvent.relatedTarget || nativeEvent.toElement;
  22731. to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
  22732. } else {
  22733. // Moving to a node from outside the window.
  22734. from = null;
  22735. to = targetInst;
  22736. }
  22737. if (from === to) {
  22738. // Nothing pertains to our managed components.
  22739. return null;
  22740. }
  22741. var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
  22742. var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
  22743. var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
  22744. leave.type = 'mouseleave';
  22745. leave.target = fromNode;
  22746. leave.relatedTarget = toNode;
  22747. var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
  22748. enter.type = 'mouseenter';
  22749. enter.target = toNode;
  22750. enter.relatedTarget = fromNode;
  22751. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
  22752. return [leave, enter];
  22753. }
  22754. };
  22755. module.exports = EnterLeaveEventPlugin;
  22756. /***/ }),
  22757. /* 177 */
  22758. /***/ (function(module, exports, __webpack_require__) {
  22759. "use strict";
  22760. /**
  22761. * Copyright 2013-present, Facebook, Inc.
  22762. * All rights reserved.
  22763. *
  22764. * This source code is licensed under the BSD-style license found in the
  22765. * LICENSE file in the root directory of this source tree. An additional grant
  22766. * of patent rights can be found in the PATENTS file in the same directory.
  22767. *
  22768. */
  22769. var _assign = __webpack_require__(3);
  22770. var PooledClass = __webpack_require__(15);
  22771. var getTextContentAccessor = __webpack_require__(93);
  22772. /**
  22773. * This helper class stores information about text content of a target node,
  22774. * allowing comparison of content before and after a given event.
  22775. *
  22776. * Identify the node where selection currently begins, then observe
  22777. * both its text content and its current position in the DOM. Since the
  22778. * browser may natively replace the target node during composition, we can
  22779. * use its position to find its replacement.
  22780. *
  22781. * @param {DOMEventTarget} root
  22782. */
  22783. function FallbackCompositionState(root) {
  22784. this._root = root;
  22785. this._startText = this.getText();
  22786. this._fallbackText = null;
  22787. }
  22788. _assign(FallbackCompositionState.prototype, {
  22789. destructor: function () {
  22790. this._root = null;
  22791. this._startText = null;
  22792. this._fallbackText = null;
  22793. },
  22794. /**
  22795. * Get current text of input.
  22796. *
  22797. * @return {string}
  22798. */
  22799. getText: function () {
  22800. if ('value' in this._root) {
  22801. return this._root.value;
  22802. }
  22803. return this._root[getTextContentAccessor()];
  22804. },
  22805. /**
  22806. * Determine the differing substring between the initially stored
  22807. * text content and the current content.
  22808. *
  22809. * @return {string}
  22810. */
  22811. getData: function () {
  22812. if (this._fallbackText) {
  22813. return this._fallbackText;
  22814. }
  22815. var start;
  22816. var startValue = this._startText;
  22817. var startLength = startValue.length;
  22818. var end;
  22819. var endValue = this.getText();
  22820. var endLength = endValue.length;
  22821. for (start = 0; start < startLength; start++) {
  22822. if (startValue[start] !== endValue[start]) {
  22823. break;
  22824. }
  22825. }
  22826. var minEnd = startLength - start;
  22827. for (end = 1; end <= minEnd; end++) {
  22828. if (startValue[startLength - end] !== endValue[endLength - end]) {
  22829. break;
  22830. }
  22831. }
  22832. var sliceTail = end > 1 ? 1 - end : undefined;
  22833. this._fallbackText = endValue.slice(start, sliceTail);
  22834. return this._fallbackText;
  22835. }
  22836. });
  22837. PooledClass.addPoolingTo(FallbackCompositionState);
  22838. module.exports = FallbackCompositionState;
  22839. /***/ }),
  22840. /* 178 */
  22841. /***/ (function(module, exports, __webpack_require__) {
  22842. "use strict";
  22843. /**
  22844. * Copyright 2013-present, Facebook, Inc.
  22845. * All rights reserved.
  22846. *
  22847. * This source code is licensed under the BSD-style license found in the
  22848. * LICENSE file in the root directory of this source tree. An additional grant
  22849. * of patent rights can be found in the PATENTS file in the same directory.
  22850. *
  22851. */
  22852. var DOMProperty = __webpack_require__(19);
  22853. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  22854. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  22855. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  22856. var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  22857. var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  22858. var HTMLDOMPropertyConfig = {
  22859. isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
  22860. Properties: {
  22861. /**
  22862. * Standard Properties
  22863. */
  22864. accept: 0,
  22865. acceptCharset: 0,
  22866. accessKey: 0,
  22867. action: 0,
  22868. allowFullScreen: HAS_BOOLEAN_VALUE,
  22869. allowTransparency: 0,
  22870. alt: 0,
  22871. // specifies target context for links with `preload` type
  22872. as: 0,
  22873. async: HAS_BOOLEAN_VALUE,
  22874. autoComplete: 0,
  22875. // autoFocus is polyfilled/normalized by AutoFocusUtils
  22876. // autoFocus: HAS_BOOLEAN_VALUE,
  22877. autoPlay: HAS_BOOLEAN_VALUE,
  22878. capture: HAS_BOOLEAN_VALUE,
  22879. cellPadding: 0,
  22880. cellSpacing: 0,
  22881. charSet: 0,
  22882. challenge: 0,
  22883. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22884. cite: 0,
  22885. classID: 0,
  22886. className: 0,
  22887. cols: HAS_POSITIVE_NUMERIC_VALUE,
  22888. colSpan: 0,
  22889. content: 0,
  22890. contentEditable: 0,
  22891. contextMenu: 0,
  22892. controls: HAS_BOOLEAN_VALUE,
  22893. coords: 0,
  22894. crossOrigin: 0,
  22895. data: 0, // For `<object />` acts as `src`.
  22896. dateTime: 0,
  22897. 'default': HAS_BOOLEAN_VALUE,
  22898. defer: HAS_BOOLEAN_VALUE,
  22899. dir: 0,
  22900. disabled: HAS_BOOLEAN_VALUE,
  22901. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  22902. draggable: 0,
  22903. encType: 0,
  22904. form: 0,
  22905. formAction: 0,
  22906. formEncType: 0,
  22907. formMethod: 0,
  22908. formNoValidate: HAS_BOOLEAN_VALUE,
  22909. formTarget: 0,
  22910. frameBorder: 0,
  22911. headers: 0,
  22912. height: 0,
  22913. hidden: HAS_BOOLEAN_VALUE,
  22914. high: 0,
  22915. href: 0,
  22916. hrefLang: 0,
  22917. htmlFor: 0,
  22918. httpEquiv: 0,
  22919. icon: 0,
  22920. id: 0,
  22921. inputMode: 0,
  22922. integrity: 0,
  22923. is: 0,
  22924. keyParams: 0,
  22925. keyType: 0,
  22926. kind: 0,
  22927. label: 0,
  22928. lang: 0,
  22929. list: 0,
  22930. loop: HAS_BOOLEAN_VALUE,
  22931. low: 0,
  22932. manifest: 0,
  22933. marginHeight: 0,
  22934. marginWidth: 0,
  22935. max: 0,
  22936. maxLength: 0,
  22937. media: 0,
  22938. mediaGroup: 0,
  22939. method: 0,
  22940. min: 0,
  22941. minLength: 0,
  22942. // Caution; `option.selected` is not updated if `select.multiple` is
  22943. // disabled with `removeAttribute`.
  22944. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22945. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22946. name: 0,
  22947. nonce: 0,
  22948. noValidate: HAS_BOOLEAN_VALUE,
  22949. open: HAS_BOOLEAN_VALUE,
  22950. optimum: 0,
  22951. pattern: 0,
  22952. placeholder: 0,
  22953. playsInline: HAS_BOOLEAN_VALUE,
  22954. poster: 0,
  22955. preload: 0,
  22956. profile: 0,
  22957. radioGroup: 0,
  22958. readOnly: HAS_BOOLEAN_VALUE,
  22959. referrerPolicy: 0,
  22960. rel: 0,
  22961. required: HAS_BOOLEAN_VALUE,
  22962. reversed: HAS_BOOLEAN_VALUE,
  22963. role: 0,
  22964. rows: HAS_POSITIVE_NUMERIC_VALUE,
  22965. rowSpan: HAS_NUMERIC_VALUE,
  22966. sandbox: 0,
  22967. scope: 0,
  22968. scoped: HAS_BOOLEAN_VALUE,
  22969. scrolling: 0,
  22970. seamless: HAS_BOOLEAN_VALUE,
  22971. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  22972. shape: 0,
  22973. size: HAS_POSITIVE_NUMERIC_VALUE,
  22974. sizes: 0,
  22975. span: HAS_POSITIVE_NUMERIC_VALUE,
  22976. spellCheck: 0,
  22977. src: 0,
  22978. srcDoc: 0,
  22979. srcLang: 0,
  22980. srcSet: 0,
  22981. start: HAS_NUMERIC_VALUE,
  22982. step: 0,
  22983. style: 0,
  22984. summary: 0,
  22985. tabIndex: 0,
  22986. target: 0,
  22987. title: 0,
  22988. // Setting .type throws on non-<input> tags
  22989. type: 0,
  22990. useMap: 0,
  22991. value: 0,
  22992. width: 0,
  22993. wmode: 0,
  22994. wrap: 0,
  22995. /**
  22996. * RDFa Properties
  22997. */
  22998. about: 0,
  22999. datatype: 0,
  23000. inlist: 0,
  23001. prefix: 0,
  23002. // property is also supported for OpenGraph in meta tags.
  23003. property: 0,
  23004. resource: 0,
  23005. 'typeof': 0,
  23006. vocab: 0,
  23007. /**
  23008. * Non-standard Properties
  23009. */
  23010. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  23011. // keyboard hints.
  23012. autoCapitalize: 0,
  23013. autoCorrect: 0,
  23014. // autoSave allows WebKit/Blink to persist values of input fields on page reloads
  23015. autoSave: 0,
  23016. // color is for Safari mask-icon link
  23017. color: 0,
  23018. // itemProp, itemScope, itemType are for
  23019. // Microdata support. See http://schema.org/docs/gs.html
  23020. itemProp: 0,
  23021. itemScope: HAS_BOOLEAN_VALUE,
  23022. itemType: 0,
  23023. // itemID and itemRef are for Microdata support as well but
  23024. // only specified in the WHATWG spec document. See
  23025. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  23026. itemID: 0,
  23027. itemRef: 0,
  23028. // results show looking glass icon and recent searches on input
  23029. // search fields in WebKit/Blink
  23030. results: 0,
  23031. // IE-only attribute that specifies security restrictions on an iframe
  23032. // as an alternative to the sandbox attribute on IE<10
  23033. security: 0,
  23034. // IE-only attribute that controls focus behavior
  23035. unselectable: 0
  23036. },
  23037. DOMAttributeNames: {
  23038. acceptCharset: 'accept-charset',
  23039. className: 'class',
  23040. htmlFor: 'for',
  23041. httpEquiv: 'http-equiv'
  23042. },
  23043. DOMPropertyNames: {}
  23044. };
  23045. module.exports = HTMLDOMPropertyConfig;
  23046. /***/ }),
  23047. /* 179 */
  23048. /***/ (function(module, exports, __webpack_require__) {
  23049. "use strict";
  23050. /* WEBPACK VAR INJECTION */(function(process) {/**
  23051. * Copyright 2014-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 ReactReconciler = __webpack_require__(20);
  23060. var instantiateReactComponent = __webpack_require__(94);
  23061. var KeyEscapeUtils = __webpack_require__(54);
  23062. var shouldUpdateReactComponent = __webpack_require__(64);
  23063. var traverseAllChildren = __webpack_require__(97);
  23064. var warning = __webpack_require__(1);
  23065. var ReactComponentTreeHook;
  23066. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  23067. // Temporary hack.
  23068. // Inline requires don't work well with Jest:
  23069. // https://github.com/facebook/react/issues/7240
  23070. // Remove the inline requires when we don't need them anymore:
  23071. // https://github.com/facebook/react/pull/7178
  23072. ReactComponentTreeHook = __webpack_require__(98);
  23073. }
  23074. function instantiateChild(childInstances, child, name, selfDebugID) {
  23075. // We found a component instance.
  23076. var keyUnique = childInstances[name] === undefined;
  23077. if (false) {
  23078. if (!ReactComponentTreeHook) {
  23079. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  23080. }
  23081. if (!keyUnique) {
  23082. 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;
  23083. }
  23084. }
  23085. if (child != null && keyUnique) {
  23086. childInstances[name] = instantiateReactComponent(child, true);
  23087. }
  23088. }
  23089. /**
  23090. * ReactChildReconciler provides helpers for initializing or updating a set of
  23091. * children. Its output is suitable for passing it onto ReactMultiChild which
  23092. * does diffed reordering and insertion.
  23093. */
  23094. var ReactChildReconciler = {
  23095. /**
  23096. * Generates a "mount image" for each of the supplied children. In the case
  23097. * of `ReactDOMComponent`, a mount image is a string of markup.
  23098. *
  23099. * @param {?object} nestedChildNodes Nested child maps.
  23100. * @return {?object} A set of child instances.
  23101. * @internal
  23102. */
  23103. instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots
  23104. ) {
  23105. if (nestedChildNodes == null) {
  23106. return null;
  23107. }
  23108. var childInstances = {};
  23109. if (false) {
  23110. traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
  23111. return instantiateChild(childInsts, child, name, selfDebugID);
  23112. }, childInstances);
  23113. } else {
  23114. traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
  23115. }
  23116. return childInstances;
  23117. },
  23118. /**
  23119. * Updates the rendered children and returns a new set of children.
  23120. *
  23121. * @param {?object} prevChildren Previously initialized set of children.
  23122. * @param {?object} nextChildren Flat child element maps.
  23123. * @param {ReactReconcileTransaction} transaction
  23124. * @param {object} context
  23125. * @return {?object} A new set of child instances.
  23126. * @internal
  23127. */
  23128. updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots
  23129. ) {
  23130. // We currently don't have a way to track moves here but if we use iterators
  23131. // instead of for..in we can zip the iterators and check if an item has
  23132. // moved.
  23133. // TODO: If nothing has changed, return the prevChildren object so that we
  23134. // can quickly bailout if nothing has changed.
  23135. if (!nextChildren && !prevChildren) {
  23136. return;
  23137. }
  23138. var name;
  23139. var prevChild;
  23140. for (name in nextChildren) {
  23141. if (!nextChildren.hasOwnProperty(name)) {
  23142. continue;
  23143. }
  23144. prevChild = prevChildren && prevChildren[name];
  23145. var prevElement = prevChild && prevChild._currentElement;
  23146. var nextElement = nextChildren[name];
  23147. if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
  23148. ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
  23149. nextChildren[name] = prevChild;
  23150. } else {
  23151. if (prevChild) {
  23152. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  23153. ReactReconciler.unmountComponent(prevChild, false);
  23154. }
  23155. // The child must be instantiated before it's mounted.
  23156. var nextChildInstance = instantiateReactComponent(nextElement, true);
  23157. nextChildren[name] = nextChildInstance;
  23158. // Creating mount image now ensures refs are resolved in right order
  23159. // (see https://github.com/facebook/react/pull/7101 for explanation).
  23160. var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID);
  23161. mountImages.push(nextChildMountImage);
  23162. }
  23163. }
  23164. // Unmount children that are no longer present.
  23165. for (name in prevChildren) {
  23166. if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
  23167. prevChild = prevChildren[name];
  23168. removedNodes[name] = ReactReconciler.getHostNode(prevChild);
  23169. ReactReconciler.unmountComponent(prevChild, false);
  23170. }
  23171. }
  23172. },
  23173. /**
  23174. * Unmounts all rendered children. This should be used to clean up children
  23175. * when this component is unmounted.
  23176. *
  23177. * @param {?object} renderedChildren Previously initialized set of children.
  23178. * @internal
  23179. */
  23180. unmountChildren: function (renderedChildren, safely) {
  23181. for (var name in renderedChildren) {
  23182. if (renderedChildren.hasOwnProperty(name)) {
  23183. var renderedChild = renderedChildren[name];
  23184. ReactReconciler.unmountComponent(renderedChild, safely);
  23185. }
  23186. }
  23187. }
  23188. };
  23189. module.exports = ReactChildReconciler;
  23190. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(69)))
  23191. /***/ }),
  23192. /* 180 */
  23193. /***/ (function(module, exports, __webpack_require__) {
  23194. "use strict";
  23195. /**
  23196. * Copyright 2013-present, Facebook, Inc.
  23197. * All rights reserved.
  23198. *
  23199. * This source code is licensed under the BSD-style license found in the
  23200. * LICENSE file in the root directory of this source tree. An additional grant
  23201. * of patent rights can be found in the PATENTS file in the same directory.
  23202. *
  23203. */
  23204. var DOMChildrenOperations = __webpack_require__(50);
  23205. var ReactDOMIDOperations = __webpack_require__(187);
  23206. /**
  23207. * Abstracts away all functionality of the reconciler that requires knowledge of
  23208. * the browser context. TODO: These callers should be refactored to avoid the
  23209. * need for this injection.
  23210. */
  23211. var ReactComponentBrowserEnvironment = {
  23212. processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  23213. replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup
  23214. };
  23215. module.exports = ReactComponentBrowserEnvironment;
  23216. /***/ }),
  23217. /* 181 */
  23218. /***/ (function(module, exports, __webpack_require__) {
  23219. "use strict";
  23220. /**
  23221. * Copyright 2013-present, Facebook, Inc.
  23222. * All rights reserved.
  23223. *
  23224. * This source code is licensed under the BSD-style license found in the
  23225. * LICENSE file in the root directory of this source tree. An additional grant
  23226. * of patent rights can be found in the PATENTS file in the same directory.
  23227. *
  23228. */
  23229. var _prodInvariant = __webpack_require__(2),
  23230. _assign = __webpack_require__(3);
  23231. var React = __webpack_require__(21);
  23232. var ReactComponentEnvironment = __webpack_require__(56);
  23233. var ReactCurrentOwner = __webpack_require__(14);
  23234. var ReactErrorUtils = __webpack_require__(57);
  23235. var ReactInstanceMap = __webpack_require__(28);
  23236. var ReactInstrumentation = __webpack_require__(11);
  23237. var ReactNodeTypes = __webpack_require__(88);
  23238. var ReactReconciler = __webpack_require__(20);
  23239. if (false) {
  23240. var checkReactTypeSpec = require('./checkReactTypeSpec');
  23241. }
  23242. var emptyObject = __webpack_require__(25);
  23243. var invariant = __webpack_require__(0);
  23244. var shallowEqual = __webpack_require__(49);
  23245. var shouldUpdateReactComponent = __webpack_require__(64);
  23246. var warning = __webpack_require__(1);
  23247. var CompositeTypes = {
  23248. ImpureClass: 0,
  23249. PureClass: 1,
  23250. StatelessFunctional: 2
  23251. };
  23252. function StatelessComponent(Component) {}
  23253. StatelessComponent.prototype.render = function () {
  23254. var Component = ReactInstanceMap.get(this)._currentElement.type;
  23255. var element = Component(this.props, this.context, this.updater);
  23256. warnIfInvalidElement(Component, element);
  23257. return element;
  23258. };
  23259. function warnIfInvalidElement(Component, element) {
  23260. if (false) {
  23261. 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;
  23262. process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
  23263. }
  23264. }
  23265. function shouldConstruct(Component) {
  23266. return !!(Component.prototype && Component.prototype.isReactComponent);
  23267. }
  23268. function isPureComponent(Component) {
  23269. return !!(Component.prototype && Component.prototype.isPureReactComponent);
  23270. }
  23271. // Separated into a function to contain deoptimizations caused by try/finally.
  23272. function measureLifeCyclePerf(fn, debugID, timerType) {
  23273. if (debugID === 0) {
  23274. // Top-level wrappers (see ReactMount) and empty components (see
  23275. // ReactDOMEmptyComponent) are invisible to hooks and devtools.
  23276. // Both are implementation details that should go away in the future.
  23277. return fn();
  23278. }
  23279. ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
  23280. try {
  23281. return fn();
  23282. } finally {
  23283. ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
  23284. }
  23285. }
  23286. /**
  23287. * ------------------ The Life-Cycle of a Composite Component ------------------
  23288. *
  23289. * - constructor: Initialization of state. The instance is now retained.
  23290. * - componentWillMount
  23291. * - render
  23292. * - [children's constructors]
  23293. * - [children's componentWillMount and render]
  23294. * - [children's componentDidMount]
  23295. * - componentDidMount
  23296. *
  23297. * Update Phases:
  23298. * - componentWillReceiveProps (only called if parent updated)
  23299. * - shouldComponentUpdate
  23300. * - componentWillUpdate
  23301. * - render
  23302. * - [children's constructors or receive props phases]
  23303. * - componentDidUpdate
  23304. *
  23305. * - componentWillUnmount
  23306. * - [children's componentWillUnmount]
  23307. * - [children destroyed]
  23308. * - (destroyed): The instance is now blank, released by React and ready for GC.
  23309. *
  23310. * -----------------------------------------------------------------------------
  23311. */
  23312. /**
  23313. * An incrementing ID assigned to each component when it is mounted. This is
  23314. * used to enforce the order in which `ReactUpdates` updates dirty components.
  23315. *
  23316. * @private
  23317. */
  23318. var nextMountID = 1;
  23319. /**
  23320. * @lends {ReactCompositeComponent.prototype}
  23321. */
  23322. var ReactCompositeComponent = {
  23323. /**
  23324. * Base constructor for all composite component.
  23325. *
  23326. * @param {ReactElement} element
  23327. * @final
  23328. * @internal
  23329. */
  23330. construct: function (element) {
  23331. this._currentElement = element;
  23332. this._rootNodeID = 0;
  23333. this._compositeType = null;
  23334. this._instance = null;
  23335. this._hostParent = null;
  23336. this._hostContainerInfo = null;
  23337. // See ReactUpdateQueue
  23338. this._updateBatchNumber = null;
  23339. this._pendingElement = null;
  23340. this._pendingStateQueue = null;
  23341. this._pendingReplaceState = false;
  23342. this._pendingForceUpdate = false;
  23343. this._renderedNodeType = null;
  23344. this._renderedComponent = null;
  23345. this._context = null;
  23346. this._mountOrder = 0;
  23347. this._topLevelWrapper = null;
  23348. // See ReactUpdates and ReactUpdateQueue.
  23349. this._pendingCallbacks = null;
  23350. // ComponentWillUnmount shall only be called once
  23351. this._calledComponentWillUnmount = false;
  23352. if (false) {
  23353. this._warnedAboutRefsInRender = false;
  23354. }
  23355. },
  23356. /**
  23357. * Initializes the component, renders markup, and registers event listeners.
  23358. *
  23359. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  23360. * @param {?object} hostParent
  23361. * @param {?object} hostContainerInfo
  23362. * @param {?object} context
  23363. * @return {?string} Rendered markup to be inserted into the DOM.
  23364. * @final
  23365. * @internal
  23366. */
  23367. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  23368. var _this = this;
  23369. this._context = context;
  23370. this._mountOrder = nextMountID++;
  23371. this._hostParent = hostParent;
  23372. this._hostContainerInfo = hostContainerInfo;
  23373. var publicProps = this._currentElement.props;
  23374. var publicContext = this._processContext(context);
  23375. var Component = this._currentElement.type;
  23376. var updateQueue = transaction.getUpdateQueue();
  23377. // Initialize the public class
  23378. var doConstruct = shouldConstruct(Component);
  23379. var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
  23380. var renderedElement;
  23381. // Support functional components
  23382. if (!doConstruct && (inst == null || inst.render == null)) {
  23383. renderedElement = inst;
  23384. warnIfInvalidElement(Component, renderedElement);
  23385. !(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;
  23386. inst = new StatelessComponent(Component);
  23387. this._compositeType = CompositeTypes.StatelessFunctional;
  23388. } else {
  23389. if (isPureComponent(Component)) {
  23390. this._compositeType = CompositeTypes.PureClass;
  23391. } else {
  23392. this._compositeType = CompositeTypes.ImpureClass;
  23393. }
  23394. }
  23395. if (false) {
  23396. // This will throw later in _renderValidatedComponent, but add an early
  23397. // warning now to help debugging
  23398. if (inst.render == null) {
  23399. 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;
  23400. }
  23401. var propsMutated = inst.props !== publicProps;
  23402. var componentName = Component.displayName || Component.name || 'Component';
  23403. 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;
  23404. }
  23405. // These should be set up in the constructor, but as a convenience for
  23406. // simpler class abstractions, we set them up after the fact.
  23407. inst.props = publicProps;
  23408. inst.context = publicContext;
  23409. inst.refs = emptyObject;
  23410. inst.updater = updateQueue;
  23411. this._instance = inst;
  23412. // Store a reference from the instance back to the internal representation
  23413. ReactInstanceMap.set(inst, this);
  23414. if (false) {
  23415. // Since plain JS classes are defined without any special initialization
  23416. // logic, we can not catch common errors early. Therefore, we have to
  23417. // catch them here, at initialization time, instead.
  23418. 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;
  23419. 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;
  23420. 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;
  23421. 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;
  23422. 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;
  23423. 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;
  23424. 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;
  23425. }
  23426. var initialState = inst.state;
  23427. if (initialState === undefined) {
  23428. inst.state = initialState = null;
  23429. }
  23430. !(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;
  23431. this._pendingStateQueue = null;
  23432. this._pendingReplaceState = false;
  23433. this._pendingForceUpdate = false;
  23434. var markup;
  23435. if (inst.unstable_handleError) {
  23436. markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23437. } else {
  23438. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23439. }
  23440. if (inst.componentDidMount) {
  23441. if (false) {
  23442. transaction.getReactMountReady().enqueue(function () {
  23443. measureLifeCyclePerf(function () {
  23444. return inst.componentDidMount();
  23445. }, _this._debugID, 'componentDidMount');
  23446. });
  23447. } else {
  23448. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  23449. }
  23450. }
  23451. return markup;
  23452. },
  23453. _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
  23454. if (false) {
  23455. ReactCurrentOwner.current = this;
  23456. try {
  23457. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  23458. } finally {
  23459. ReactCurrentOwner.current = null;
  23460. }
  23461. } else {
  23462. return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
  23463. }
  23464. },
  23465. _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
  23466. var Component = this._currentElement.type;
  23467. if (doConstruct) {
  23468. if (false) {
  23469. return measureLifeCyclePerf(function () {
  23470. return new Component(publicProps, publicContext, updateQueue);
  23471. }, this._debugID, 'ctor');
  23472. } else {
  23473. return new Component(publicProps, publicContext, updateQueue);
  23474. }
  23475. }
  23476. // This can still be an instance in case of factory components
  23477. // but we'll count this as time spent rendering as the more common case.
  23478. if (false) {
  23479. return measureLifeCyclePerf(function () {
  23480. return Component(publicProps, publicContext, updateQueue);
  23481. }, this._debugID, 'render');
  23482. } else {
  23483. return Component(publicProps, publicContext, updateQueue);
  23484. }
  23485. },
  23486. performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  23487. var markup;
  23488. var checkpoint = transaction.checkpoint();
  23489. try {
  23490. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23491. } catch (e) {
  23492. // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
  23493. transaction.rollback(checkpoint);
  23494. this._instance.unstable_handleError(e);
  23495. if (this._pendingStateQueue) {
  23496. this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
  23497. }
  23498. checkpoint = transaction.checkpoint();
  23499. this._renderedComponent.unmountComponent(true);
  23500. transaction.rollback(checkpoint);
  23501. // Try again - we've informed the component about the error, so they can render an error message this time.
  23502. // If this throws again, the error will bubble up (and can be caught by a higher error boundary).
  23503. markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
  23504. }
  23505. return markup;
  23506. },
  23507. performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
  23508. var inst = this._instance;
  23509. var debugID = 0;
  23510. if (false) {
  23511. debugID = this._debugID;
  23512. }
  23513. if (inst.componentWillMount) {
  23514. if (false) {
  23515. measureLifeCyclePerf(function () {
  23516. return inst.componentWillMount();
  23517. }, debugID, 'componentWillMount');
  23518. } else {
  23519. inst.componentWillMount();
  23520. }
  23521. // When mounting, calls to `setState` by `componentWillMount` will set
  23522. // `this._pendingStateQueue` without triggering a re-render.
  23523. if (this._pendingStateQueue) {
  23524. inst.state = this._processPendingState(inst.props, inst.context);
  23525. }
  23526. }
  23527. // If not a stateless component, we now render
  23528. if (renderedElement === undefined) {
  23529. renderedElement = this._renderValidatedComponent();
  23530. }
  23531. var nodeType = ReactNodeTypes.getType(renderedElement);
  23532. this._renderedNodeType = nodeType;
  23533. var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  23534. );
  23535. this._renderedComponent = child;
  23536. var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
  23537. if (false) {
  23538. if (debugID !== 0) {
  23539. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  23540. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  23541. }
  23542. }
  23543. return markup;
  23544. },
  23545. getHostNode: function () {
  23546. return ReactReconciler.getHostNode(this._renderedComponent);
  23547. },
  23548. /**
  23549. * Releases any resources allocated by `mountComponent`.
  23550. *
  23551. * @final
  23552. * @internal
  23553. */
  23554. unmountComponent: function (safely) {
  23555. if (!this._renderedComponent) {
  23556. return;
  23557. }
  23558. var inst = this._instance;
  23559. if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
  23560. inst._calledComponentWillUnmount = true;
  23561. if (safely) {
  23562. var name = this.getName() + '.componentWillUnmount()';
  23563. ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
  23564. } else {
  23565. if (false) {
  23566. measureLifeCyclePerf(function () {
  23567. return inst.componentWillUnmount();
  23568. }, this._debugID, 'componentWillUnmount');
  23569. } else {
  23570. inst.componentWillUnmount();
  23571. }
  23572. }
  23573. }
  23574. if (this._renderedComponent) {
  23575. ReactReconciler.unmountComponent(this._renderedComponent, safely);
  23576. this._renderedNodeType = null;
  23577. this._renderedComponent = null;
  23578. this._instance = null;
  23579. }
  23580. // Reset pending fields
  23581. // Even if this component is scheduled for another update in ReactUpdates,
  23582. // it would still be ignored because these fields are reset.
  23583. this._pendingStateQueue = null;
  23584. this._pendingReplaceState = false;
  23585. this._pendingForceUpdate = false;
  23586. this._pendingCallbacks = null;
  23587. this._pendingElement = null;
  23588. // These fields do not really need to be reset since this object is no
  23589. // longer accessible.
  23590. this._context = null;
  23591. this._rootNodeID = 0;
  23592. this._topLevelWrapper = null;
  23593. // Delete the reference from the instance to this internal representation
  23594. // which allow the internals to be properly cleaned up even if the user
  23595. // leaks a reference to the public instance.
  23596. ReactInstanceMap.remove(inst);
  23597. // Some existing components rely on inst.props even after they've been
  23598. // destroyed (in event handlers).
  23599. // TODO: inst.props = null;
  23600. // TODO: inst.state = null;
  23601. // TODO: inst.context = null;
  23602. },
  23603. /**
  23604. * Filters the context object to only contain keys specified in
  23605. * `contextTypes`
  23606. *
  23607. * @param {object} context
  23608. * @return {?object}
  23609. * @private
  23610. */
  23611. _maskContext: function (context) {
  23612. var Component = this._currentElement.type;
  23613. var contextTypes = Component.contextTypes;
  23614. if (!contextTypes) {
  23615. return emptyObject;
  23616. }
  23617. var maskedContext = {};
  23618. for (var contextName in contextTypes) {
  23619. maskedContext[contextName] = context[contextName];
  23620. }
  23621. return maskedContext;
  23622. },
  23623. /**
  23624. * Filters the context object to only contain keys specified in
  23625. * `contextTypes`, and asserts that they are valid.
  23626. *
  23627. * @param {object} context
  23628. * @return {?object}
  23629. * @private
  23630. */
  23631. _processContext: function (context) {
  23632. var maskedContext = this._maskContext(context);
  23633. if (false) {
  23634. var Component = this._currentElement.type;
  23635. if (Component.contextTypes) {
  23636. this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
  23637. }
  23638. }
  23639. return maskedContext;
  23640. },
  23641. /**
  23642. * @param {object} currentContext
  23643. * @return {object}
  23644. * @private
  23645. */
  23646. _processChildContext: function (currentContext) {
  23647. var Component = this._currentElement.type;
  23648. var inst = this._instance;
  23649. var childContext;
  23650. if (inst.getChildContext) {
  23651. if (false) {
  23652. ReactInstrumentation.debugTool.onBeginProcessingChildContext();
  23653. try {
  23654. childContext = inst.getChildContext();
  23655. } finally {
  23656. ReactInstrumentation.debugTool.onEndProcessingChildContext();
  23657. }
  23658. } else {
  23659. childContext = inst.getChildContext();
  23660. }
  23661. }
  23662. if (childContext) {
  23663. !(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;
  23664. if (false) {
  23665. this._checkContextTypes(Component.childContextTypes, childContext, 'childContext');
  23666. }
  23667. for (var name in childContext) {
  23668. !(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;
  23669. }
  23670. return _assign({}, currentContext, childContext);
  23671. }
  23672. return currentContext;
  23673. },
  23674. /**
  23675. * Assert that the context types are valid
  23676. *
  23677. * @param {object} typeSpecs Map of context field to a ReactPropType
  23678. * @param {object} values Runtime values that need to be type-checked
  23679. * @param {string} location e.g. "prop", "context", "child context"
  23680. * @private
  23681. */
  23682. _checkContextTypes: function (typeSpecs, values, location) {
  23683. if (false) {
  23684. checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
  23685. }
  23686. },
  23687. receiveComponent: function (nextElement, transaction, nextContext) {
  23688. var prevElement = this._currentElement;
  23689. var prevContext = this._context;
  23690. this._pendingElement = null;
  23691. this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
  23692. },
  23693. /**
  23694. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  23695. * is set, update the component.
  23696. *
  23697. * @param {ReactReconcileTransaction} transaction
  23698. * @internal
  23699. */
  23700. performUpdateIfNecessary: function (transaction) {
  23701. if (this._pendingElement != null) {
  23702. ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
  23703. } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  23704. this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
  23705. } else {
  23706. this._updateBatchNumber = null;
  23707. }
  23708. },
  23709. /**
  23710. * Perform an update to a mounted component. The componentWillReceiveProps and
  23711. * shouldComponentUpdate methods are called, then (assuming the update isn't
  23712. * skipped) the remaining update lifecycle methods are called and the DOM
  23713. * representation is updated.
  23714. *
  23715. * By default, this implements React's rendering and reconciliation algorithm.
  23716. * Sophisticated clients may wish to override this.
  23717. *
  23718. * @param {ReactReconcileTransaction} transaction
  23719. * @param {ReactElement} prevParentElement
  23720. * @param {ReactElement} nextParentElement
  23721. * @internal
  23722. * @overridable
  23723. */
  23724. updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
  23725. var inst = this._instance;
  23726. !(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;
  23727. var willReceive = false;
  23728. var nextContext;
  23729. // Determine if the context has changed or not
  23730. if (this._context === nextUnmaskedContext) {
  23731. nextContext = inst.context;
  23732. } else {
  23733. nextContext = this._processContext(nextUnmaskedContext);
  23734. willReceive = true;
  23735. }
  23736. var prevProps = prevParentElement.props;
  23737. var nextProps = nextParentElement.props;
  23738. // Not a simple state update but a props update
  23739. if (prevParentElement !== nextParentElement) {
  23740. willReceive = true;
  23741. }
  23742. // An update here will schedule an update but immediately set
  23743. // _pendingStateQueue which will ensure that any state updates gets
  23744. // immediately reconciled instead of waiting for the next batch.
  23745. if (willReceive && inst.componentWillReceiveProps) {
  23746. if (false) {
  23747. measureLifeCyclePerf(function () {
  23748. return inst.componentWillReceiveProps(nextProps, nextContext);
  23749. }, this._debugID, 'componentWillReceiveProps');
  23750. } else {
  23751. inst.componentWillReceiveProps(nextProps, nextContext);
  23752. }
  23753. }
  23754. var nextState = this._processPendingState(nextProps, nextContext);
  23755. var shouldUpdate = true;
  23756. if (!this._pendingForceUpdate) {
  23757. if (inst.shouldComponentUpdate) {
  23758. if (false) {
  23759. shouldUpdate = measureLifeCyclePerf(function () {
  23760. return inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  23761. }, this._debugID, 'shouldComponentUpdate');
  23762. } else {
  23763. shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  23764. }
  23765. } else {
  23766. if (this._compositeType === CompositeTypes.PureClass) {
  23767. shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState);
  23768. }
  23769. }
  23770. }
  23771. if (false) {
  23772. 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;
  23773. }
  23774. this._updateBatchNumber = null;
  23775. if (shouldUpdate) {
  23776. this._pendingForceUpdate = false;
  23777. // Will set `this.props`, `this.state` and `this.context`.
  23778. this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
  23779. } else {
  23780. // If it's determined that a component should not update, we still want
  23781. // to set props and state but we shortcut the rest of the update.
  23782. this._currentElement = nextParentElement;
  23783. this._context = nextUnmaskedContext;
  23784. inst.props = nextProps;
  23785. inst.state = nextState;
  23786. inst.context = nextContext;
  23787. }
  23788. },
  23789. _processPendingState: function (props, context) {
  23790. var inst = this._instance;
  23791. var queue = this._pendingStateQueue;
  23792. var replace = this._pendingReplaceState;
  23793. this._pendingReplaceState = false;
  23794. this._pendingStateQueue = null;
  23795. if (!queue) {
  23796. return inst.state;
  23797. }
  23798. if (replace && queue.length === 1) {
  23799. return queue[0];
  23800. }
  23801. var nextState = _assign({}, replace ? queue[0] : inst.state);
  23802. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  23803. var partial = queue[i];
  23804. _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
  23805. }
  23806. return nextState;
  23807. },
  23808. /**
  23809. * Merges new props and state, notifies delegate methods of update and
  23810. * performs update.
  23811. *
  23812. * @param {ReactElement} nextElement Next element
  23813. * @param {object} nextProps Next public object to set as properties.
  23814. * @param {?object} nextState Next object to set as state.
  23815. * @param {?object} nextContext Next public object to set as context.
  23816. * @param {ReactReconcileTransaction} transaction
  23817. * @param {?object} unmaskedContext
  23818. * @private
  23819. */
  23820. _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
  23821. var _this2 = this;
  23822. var inst = this._instance;
  23823. var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
  23824. var prevProps;
  23825. var prevState;
  23826. var prevContext;
  23827. if (hasComponentDidUpdate) {
  23828. prevProps = inst.props;
  23829. prevState = inst.state;
  23830. prevContext = inst.context;
  23831. }
  23832. if (inst.componentWillUpdate) {
  23833. if (false) {
  23834. measureLifeCyclePerf(function () {
  23835. return inst.componentWillUpdate(nextProps, nextState, nextContext);
  23836. }, this._debugID, 'componentWillUpdate');
  23837. } else {
  23838. inst.componentWillUpdate(nextProps, nextState, nextContext);
  23839. }
  23840. }
  23841. this._currentElement = nextElement;
  23842. this._context = unmaskedContext;
  23843. inst.props = nextProps;
  23844. inst.state = nextState;
  23845. inst.context = nextContext;
  23846. this._updateRenderedComponent(transaction, unmaskedContext);
  23847. if (hasComponentDidUpdate) {
  23848. if (false) {
  23849. transaction.getReactMountReady().enqueue(function () {
  23850. measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate');
  23851. });
  23852. } else {
  23853. transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
  23854. }
  23855. }
  23856. },
  23857. /**
  23858. * Call the component's `render` method and update the DOM accordingly.
  23859. *
  23860. * @param {ReactReconcileTransaction} transaction
  23861. * @internal
  23862. */
  23863. _updateRenderedComponent: function (transaction, context) {
  23864. var prevComponentInstance = this._renderedComponent;
  23865. var prevRenderedElement = prevComponentInstance._currentElement;
  23866. var nextRenderedElement = this._renderValidatedComponent();
  23867. var debugID = 0;
  23868. if (false) {
  23869. debugID = this._debugID;
  23870. }
  23871. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  23872. ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
  23873. } else {
  23874. var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance);
  23875. ReactReconciler.unmountComponent(prevComponentInstance, false);
  23876. var nodeType = ReactNodeTypes.getType(nextRenderedElement);
  23877. this._renderedNodeType = nodeType;
  23878. var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
  23879. );
  23880. this._renderedComponent = child;
  23881. var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID);
  23882. if (false) {
  23883. if (debugID !== 0) {
  23884. var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
  23885. ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
  23886. }
  23887. }
  23888. this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance);
  23889. }
  23890. },
  23891. /**
  23892. * Overridden in shallow rendering.
  23893. *
  23894. * @protected
  23895. */
  23896. _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) {
  23897. ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance);
  23898. },
  23899. /**
  23900. * @protected
  23901. */
  23902. _renderValidatedComponentWithoutOwnerOrContext: function () {
  23903. var inst = this._instance;
  23904. var renderedElement;
  23905. if (false) {
  23906. renderedElement = measureLifeCyclePerf(function () {
  23907. return inst.render();
  23908. }, this._debugID, 'render');
  23909. } else {
  23910. renderedElement = inst.render();
  23911. }
  23912. if (false) {
  23913. // We allow auto-mocks to proceed as if they're returning null.
  23914. if (renderedElement === undefined && inst.render._isMockFunction) {
  23915. // This is probably bad practice. Consider warning here and
  23916. // deprecating this convenience.
  23917. renderedElement = null;
  23918. }
  23919. }
  23920. return renderedElement;
  23921. },
  23922. /**
  23923. * @private
  23924. */
  23925. _renderValidatedComponent: function () {
  23926. var renderedElement;
  23927. if ("production" !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) {
  23928. ReactCurrentOwner.current = this;
  23929. try {
  23930. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  23931. } finally {
  23932. ReactCurrentOwner.current = null;
  23933. }
  23934. } else {
  23935. renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
  23936. }
  23937. !(
  23938. // TODO: An `isValidNode` function would probably be more appropriate
  23939. 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;
  23940. return renderedElement;
  23941. },
  23942. /**
  23943. * Lazily allocates the refs object and stores `component` as `ref`.
  23944. *
  23945. * @param {string} ref Reference name.
  23946. * @param {component} component Component to store as `ref`.
  23947. * @final
  23948. * @private
  23949. */
  23950. attachRef: function (ref, component) {
  23951. var inst = this.getPublicInstance();
  23952. !(inst != null) ? false ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
  23953. var publicComponentInstance = component.getPublicInstance();
  23954. if (false) {
  23955. var componentName = component && component.getName ? component.getName() : 'a component';
  23956. 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;
  23957. }
  23958. var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
  23959. refs[ref] = publicComponentInstance;
  23960. },
  23961. /**
  23962. * Detaches a reference name.
  23963. *
  23964. * @param {string} ref Name to dereference.
  23965. * @final
  23966. * @private
  23967. */
  23968. detachRef: function (ref) {
  23969. var refs = this.getPublicInstance().refs;
  23970. delete refs[ref];
  23971. },
  23972. /**
  23973. * Get a text description of the component that can be used to identify it
  23974. * in error messages.
  23975. * @return {string} The name or null.
  23976. * @internal
  23977. */
  23978. getName: function () {
  23979. var type = this._currentElement.type;
  23980. var constructor = this._instance && this._instance.constructor;
  23981. return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
  23982. },
  23983. /**
  23984. * Get the publicly accessible representation of this component - i.e. what
  23985. * is exposed by refs and returned by render. Can be null for stateless
  23986. * components.
  23987. *
  23988. * @return {ReactComponent} the public component instance.
  23989. * @internal
  23990. */
  23991. getPublicInstance: function () {
  23992. var inst = this._instance;
  23993. if (this._compositeType === CompositeTypes.StatelessFunctional) {
  23994. return null;
  23995. }
  23996. return inst;
  23997. },
  23998. // Stub
  23999. _instantiateReactComponent: null
  24000. };
  24001. module.exports = ReactCompositeComponent;
  24002. /***/ }),
  24003. /* 182 */
  24004. /***/ (function(module, exports, __webpack_require__) {
  24005. "use strict";
  24006. /**
  24007. * Copyright 2013-present, Facebook, Inc.
  24008. * All rights reserved.
  24009. *
  24010. * This source code is licensed under the BSD-style license found in the
  24011. * LICENSE file in the root directory of this source tree. An additional grant
  24012. * of patent rights can be found in the PATENTS file in the same directory.
  24013. *
  24014. */
  24015. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  24016. var ReactDOMComponentTree = __webpack_require__(5);
  24017. var ReactDefaultInjection = __webpack_require__(195);
  24018. var ReactMount = __webpack_require__(87);
  24019. var ReactReconciler = __webpack_require__(20);
  24020. var ReactUpdates = __webpack_require__(12);
  24021. var ReactVersion = __webpack_require__(208);
  24022. var findDOMNode = __webpack_require__(224);
  24023. var getHostComponentFromComposite = __webpack_require__(92);
  24024. var renderSubtreeIntoContainer = __webpack_require__(232);
  24025. var warning = __webpack_require__(1);
  24026. ReactDefaultInjection.inject();
  24027. var ReactDOM = {
  24028. findDOMNode: findDOMNode,
  24029. render: ReactMount.render,
  24030. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  24031. version: ReactVersion,
  24032. /* eslint-disable camelcase */
  24033. unstable_batchedUpdates: ReactUpdates.batchedUpdates,
  24034. unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
  24035. };
  24036. // Inject the runtime into a devtools global hook regardless of browser.
  24037. // Allows for debugging when the hook is injected on the page.
  24038. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  24039. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  24040. ComponentTree: {
  24041. getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
  24042. getNodeFromInstance: function (inst) {
  24043. // inst is an internal instance (but could be a composite)
  24044. if (inst._renderedComponent) {
  24045. inst = getHostComponentFromComposite(inst);
  24046. }
  24047. if (inst) {
  24048. return ReactDOMComponentTree.getNodeFromInstance(inst);
  24049. } else {
  24050. return null;
  24051. }
  24052. }
  24053. },
  24054. Mount: ReactMount,
  24055. Reconciler: ReactReconciler
  24056. });
  24057. }
  24058. if (false) {
  24059. var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
  24060. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  24061. // First check if devtools is not installed
  24062. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  24063. // If we're in Chrome or Firefox, provide a download link if not installed.
  24064. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
  24065. // Firefox does not have the issue with devtools loaded over file://
  24066. var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
  24067. 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');
  24068. }
  24069. }
  24070. var testFunc = function testFn() {};
  24071. 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;
  24072. // If we're in IE8, check to see if we are in compatibility mode and provide
  24073. // information on preventing compatibility mode
  24074. var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
  24075. 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;
  24076. var expectedFeatures = [
  24077. // shims
  24078. Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim];
  24079. for (var i = 0; i < expectedFeatures.length; i++) {
  24080. if (!expectedFeatures[i]) {
  24081. 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;
  24082. break;
  24083. }
  24084. }
  24085. }
  24086. }
  24087. if (false) {
  24088. var ReactInstrumentation = require('./ReactInstrumentation');
  24089. var ReactDOMUnknownPropertyHook = require('./ReactDOMUnknownPropertyHook');
  24090. var ReactDOMNullInputValuePropHook = require('./ReactDOMNullInputValuePropHook');
  24091. var ReactDOMInvalidARIAHook = require('./ReactDOMInvalidARIAHook');
  24092. ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook);
  24093. ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook);
  24094. ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook);
  24095. }
  24096. module.exports = ReactDOM;
  24097. /***/ }),
  24098. /* 183 */
  24099. /***/ (function(module, exports, __webpack_require__) {
  24100. "use strict";
  24101. /**
  24102. * Copyright 2013-present, Facebook, Inc.
  24103. * All rights reserved.
  24104. *
  24105. * This source code is licensed under the BSD-style license found in the
  24106. * LICENSE file in the root directory of this source tree. An additional grant
  24107. * of patent rights can be found in the PATENTS file in the same directory.
  24108. *
  24109. */
  24110. /* global hasOwnProperty:true */
  24111. var _prodInvariant = __webpack_require__(2),
  24112. _assign = __webpack_require__(3);
  24113. var AutoFocusUtils = __webpack_require__(170);
  24114. var CSSPropertyOperations = __webpack_require__(172);
  24115. var DOMLazyTree = __webpack_require__(18);
  24116. var DOMNamespaces = __webpack_require__(51);
  24117. var DOMProperty = __webpack_require__(19);
  24118. var DOMPropertyOperations = __webpack_require__(80);
  24119. var EventPluginHub = __webpack_require__(26);
  24120. var EventPluginRegistry = __webpack_require__(52);
  24121. var ReactBrowserEventEmitter = __webpack_require__(31);
  24122. var ReactDOMComponentFlags = __webpack_require__(81);
  24123. var ReactDOMComponentTree = __webpack_require__(5);
  24124. var ReactDOMInput = __webpack_require__(188);
  24125. var ReactDOMOption = __webpack_require__(189);
  24126. var ReactDOMSelect = __webpack_require__(82);
  24127. var ReactDOMTextarea = __webpack_require__(192);
  24128. var ReactInstrumentation = __webpack_require__(11);
  24129. var ReactMultiChild = __webpack_require__(201);
  24130. var ReactServerRenderingTransaction = __webpack_require__(206);
  24131. var emptyFunction = __webpack_require__(10);
  24132. var escapeTextContentForBrowser = __webpack_require__(34);
  24133. var invariant = __webpack_require__(0);
  24134. var isEventSupported = __webpack_require__(63);
  24135. var shallowEqual = __webpack_require__(49);
  24136. var validateDOMNesting = __webpack_require__(65);
  24137. var warning = __webpack_require__(1);
  24138. var Flags = ReactDOMComponentFlags;
  24139. var deleteListener = EventPluginHub.deleteListener;
  24140. var getNode = ReactDOMComponentTree.getNodeFromInstance;
  24141. var listenTo = ReactBrowserEventEmitter.listenTo;
  24142. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  24143. // For quickly matching children type, to test if can be treated as content.
  24144. var CONTENT_TYPES = { 'string': true, 'number': true };
  24145. var STYLE = 'style';
  24146. var HTML = '__html';
  24147. var RESERVED_PROPS = {
  24148. children: null,
  24149. dangerouslySetInnerHTML: null,
  24150. suppressContentEditableWarning: null
  24151. };
  24152. // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
  24153. var DOC_FRAGMENT_TYPE = 11;
  24154. function getDeclarationErrorAddendum(internalInstance) {
  24155. if (internalInstance) {
  24156. var owner = internalInstance._currentElement._owner || null;
  24157. if (owner) {
  24158. var name = owner.getName();
  24159. if (name) {
  24160. return ' This DOM node was rendered by `' + name + '`.';
  24161. }
  24162. }
  24163. }
  24164. return '';
  24165. }
  24166. function friendlyStringify(obj) {
  24167. if (typeof obj === 'object') {
  24168. if (Array.isArray(obj)) {
  24169. return '[' + obj.map(friendlyStringify).join(', ') + ']';
  24170. } else {
  24171. var pairs = [];
  24172. for (var key in obj) {
  24173. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  24174. var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
  24175. pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
  24176. }
  24177. }
  24178. return '{' + pairs.join(', ') + '}';
  24179. }
  24180. } else if (typeof obj === 'string') {
  24181. return JSON.stringify(obj);
  24182. } else if (typeof obj === 'function') {
  24183. return '[function object]';
  24184. }
  24185. // Differs from JSON.stringify in that undefined because undefined and that
  24186. // inf and nan don't become null
  24187. return String(obj);
  24188. }
  24189. var styleMutationWarning = {};
  24190. function checkAndWarnForMutatedStyle(style1, style2, component) {
  24191. if (style1 == null || style2 == null) {
  24192. return;
  24193. }
  24194. if (shallowEqual(style1, style2)) {
  24195. return;
  24196. }
  24197. var componentName = component._tag;
  24198. var owner = component._currentElement._owner;
  24199. var ownerName;
  24200. if (owner) {
  24201. ownerName = owner.getName();
  24202. }
  24203. var hash = ownerName + '|' + componentName;
  24204. if (styleMutationWarning.hasOwnProperty(hash)) {
  24205. return;
  24206. }
  24207. styleMutationWarning[hash] = true;
  24208. 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;
  24209. }
  24210. /**
  24211. * @param {object} component
  24212. * @param {?object} props
  24213. */
  24214. function assertValidProps(component, props) {
  24215. if (!props) {
  24216. return;
  24217. }
  24218. // Note the use of `==` which checks for null or undefined.
  24219. if (voidElementTags[component._tag]) {
  24220. !(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;
  24221. }
  24222. if (props.dangerouslySetInnerHTML != null) {
  24223. !(props.children == null) ? false ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0;
  24224. !(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;
  24225. }
  24226. if (false) {
  24227. 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;
  24228. 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;
  24229. 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;
  24230. }
  24231. !(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;
  24232. }
  24233. function enqueuePutListener(inst, registrationName, listener, transaction) {
  24234. if (transaction instanceof ReactServerRenderingTransaction) {
  24235. return;
  24236. }
  24237. if (false) {
  24238. // IE8 has no API for event capturing and the `onScroll` event doesn't
  24239. // bubble.
  24240. process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
  24241. }
  24242. var containerInfo = inst._hostContainerInfo;
  24243. var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
  24244. var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
  24245. listenTo(registrationName, doc);
  24246. transaction.getReactMountReady().enqueue(putListener, {
  24247. inst: inst,
  24248. registrationName: registrationName,
  24249. listener: listener
  24250. });
  24251. }
  24252. function putListener() {
  24253. var listenerToPut = this;
  24254. EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
  24255. }
  24256. function inputPostMount() {
  24257. var inst = this;
  24258. ReactDOMInput.postMountWrapper(inst);
  24259. }
  24260. function textareaPostMount() {
  24261. var inst = this;
  24262. ReactDOMTextarea.postMountWrapper(inst);
  24263. }
  24264. function optionPostMount() {
  24265. var inst = this;
  24266. ReactDOMOption.postMountWrapper(inst);
  24267. }
  24268. var setAndValidateContentChildDev = emptyFunction;
  24269. if (false) {
  24270. setAndValidateContentChildDev = function (content) {
  24271. var hasExistingContent = this._contentDebugID != null;
  24272. var debugID = this._debugID;
  24273. // This ID represents the inlined child that has no backing instance:
  24274. var contentDebugID = -debugID;
  24275. if (content == null) {
  24276. if (hasExistingContent) {
  24277. ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
  24278. }
  24279. this._contentDebugID = null;
  24280. return;
  24281. }
  24282. validateDOMNesting(null, String(content), this, this._ancestorInfo);
  24283. this._contentDebugID = contentDebugID;
  24284. if (hasExistingContent) {
  24285. ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
  24286. ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID);
  24287. } else {
  24288. ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID);
  24289. ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
  24290. ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
  24291. }
  24292. };
  24293. }
  24294. // There are so many media events, it makes sense to just
  24295. // maintain a list rather than create a `trapBubbledEvent` for each
  24296. var mediaEvents = {
  24297. topAbort: 'abort',
  24298. topCanPlay: 'canplay',
  24299. topCanPlayThrough: 'canplaythrough',
  24300. topDurationChange: 'durationchange',
  24301. topEmptied: 'emptied',
  24302. topEncrypted: 'encrypted',
  24303. topEnded: 'ended',
  24304. topError: 'error',
  24305. topLoadedData: 'loadeddata',
  24306. topLoadedMetadata: 'loadedmetadata',
  24307. topLoadStart: 'loadstart',
  24308. topPause: 'pause',
  24309. topPlay: 'play',
  24310. topPlaying: 'playing',
  24311. topProgress: 'progress',
  24312. topRateChange: 'ratechange',
  24313. topSeeked: 'seeked',
  24314. topSeeking: 'seeking',
  24315. topStalled: 'stalled',
  24316. topSuspend: 'suspend',
  24317. topTimeUpdate: 'timeupdate',
  24318. topVolumeChange: 'volumechange',
  24319. topWaiting: 'waiting'
  24320. };
  24321. function trapBubbledEventsLocal() {
  24322. var inst = this;
  24323. // If a component renders to null or if another component fatals and causes
  24324. // the state of the tree to be corrupted, `node` here can be null.
  24325. !inst._rootNodeID ? false ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0;
  24326. var node = getNode(inst);
  24327. !node ? false ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0;
  24328. switch (inst._tag) {
  24329. case 'iframe':
  24330. case 'object':
  24331. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  24332. break;
  24333. case 'video':
  24334. case 'audio':
  24335. inst._wrapperState.listeners = [];
  24336. // Create listener for each media event
  24337. for (var event in mediaEvents) {
  24338. if (mediaEvents.hasOwnProperty(event)) {
  24339. inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node));
  24340. }
  24341. }
  24342. break;
  24343. case 'source':
  24344. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)];
  24345. break;
  24346. case 'img':
  24347. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
  24348. break;
  24349. case 'form':
  24350. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)];
  24351. break;
  24352. case 'input':
  24353. case 'select':
  24354. case 'textarea':
  24355. inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)];
  24356. break;
  24357. }
  24358. }
  24359. function postUpdateSelectWrapper() {
  24360. ReactDOMSelect.postUpdateWrapper(this);
  24361. }
  24362. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  24363. // those special-case tags.
  24364. var omittedCloseTags = {
  24365. 'area': true,
  24366. 'base': true,
  24367. 'br': true,
  24368. 'col': true,
  24369. 'embed': true,
  24370. 'hr': true,
  24371. 'img': true,
  24372. 'input': true,
  24373. 'keygen': true,
  24374. 'link': true,
  24375. 'meta': true,
  24376. 'param': true,
  24377. 'source': true,
  24378. 'track': true,
  24379. 'wbr': true
  24380. };
  24381. var newlineEatingTags = {
  24382. 'listing': true,
  24383. 'pre': true,
  24384. 'textarea': true
  24385. };
  24386. // For HTML, certain tags cannot have children. This has the same purpose as
  24387. // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  24388. var voidElementTags = _assign({
  24389. 'menuitem': true
  24390. }, omittedCloseTags);
  24391. // We accept any tag to be rendered but since this gets injected into arbitrary
  24392. // HTML, we want to make sure that it's a safe tag.
  24393. // http://www.w3.org/TR/REC-xml/#NT-Name
  24394. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  24395. var validatedTagCache = {};
  24396. var hasOwnProperty = {}.hasOwnProperty;
  24397. function validateDangerousTag(tag) {
  24398. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  24399. !VALID_TAG_REGEX.test(tag) ? false ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0;
  24400. validatedTagCache[tag] = true;
  24401. }
  24402. }
  24403. function isCustomComponent(tagName, props) {
  24404. return tagName.indexOf('-') >= 0 || props.is != null;
  24405. }
  24406. var globalIdCounter = 1;
  24407. /**
  24408. * Creates a new React class that is idempotent and capable of containing other
  24409. * React components. It accepts event listeners and DOM properties that are
  24410. * valid according to `DOMProperty`.
  24411. *
  24412. * - Event listeners: `onClick`, `onMouseDown`, etc.
  24413. * - DOM properties: `className`, `name`, `title`, etc.
  24414. *
  24415. * The `style` property functions differently from the DOM API. It accepts an
  24416. * object mapping of style properties to values.
  24417. *
  24418. * @constructor ReactDOMComponent
  24419. * @extends ReactMultiChild
  24420. */
  24421. function ReactDOMComponent(element) {
  24422. var tag = element.type;
  24423. validateDangerousTag(tag);
  24424. this._currentElement = element;
  24425. this._tag = tag.toLowerCase();
  24426. this._namespaceURI = null;
  24427. this._renderedChildren = null;
  24428. this._previousStyle = null;
  24429. this._previousStyleCopy = null;
  24430. this._hostNode = null;
  24431. this._hostParent = null;
  24432. this._rootNodeID = 0;
  24433. this._domID = 0;
  24434. this._hostContainerInfo = null;
  24435. this._wrapperState = null;
  24436. this._topLevelWrapper = null;
  24437. this._flags = 0;
  24438. if (false) {
  24439. this._ancestorInfo = null;
  24440. setAndValidateContentChildDev.call(this, null);
  24441. }
  24442. }
  24443. ReactDOMComponent.displayName = 'ReactDOMComponent';
  24444. ReactDOMComponent.Mixin = {
  24445. /**
  24446. * Generates root tag markup then recurses. This method has side effects and
  24447. * is not idempotent.
  24448. *
  24449. * @internal
  24450. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24451. * @param {?ReactDOMComponent} the parent component instance
  24452. * @param {?object} info about the host container
  24453. * @param {object} context
  24454. * @return {string} The computed markup.
  24455. */
  24456. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  24457. this._rootNodeID = globalIdCounter++;
  24458. this._domID = hostContainerInfo._idCounter++;
  24459. this._hostParent = hostParent;
  24460. this._hostContainerInfo = hostContainerInfo;
  24461. var props = this._currentElement.props;
  24462. switch (this._tag) {
  24463. case 'audio':
  24464. case 'form':
  24465. case 'iframe':
  24466. case 'img':
  24467. case 'link':
  24468. case 'object':
  24469. case 'source':
  24470. case 'video':
  24471. this._wrapperState = {
  24472. listeners: null
  24473. };
  24474. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24475. break;
  24476. case 'input':
  24477. ReactDOMInput.mountWrapper(this, props, hostParent);
  24478. props = ReactDOMInput.getHostProps(this, props);
  24479. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24480. break;
  24481. case 'option':
  24482. ReactDOMOption.mountWrapper(this, props, hostParent);
  24483. props = ReactDOMOption.getHostProps(this, props);
  24484. break;
  24485. case 'select':
  24486. ReactDOMSelect.mountWrapper(this, props, hostParent);
  24487. props = ReactDOMSelect.getHostProps(this, props);
  24488. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24489. break;
  24490. case 'textarea':
  24491. ReactDOMTextarea.mountWrapper(this, props, hostParent);
  24492. props = ReactDOMTextarea.getHostProps(this, props);
  24493. transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
  24494. break;
  24495. }
  24496. assertValidProps(this, props);
  24497. // We create tags in the namespace of their parent container, except HTML
  24498. // tags get no namespace.
  24499. var namespaceURI;
  24500. var parentTag;
  24501. if (hostParent != null) {
  24502. namespaceURI = hostParent._namespaceURI;
  24503. parentTag = hostParent._tag;
  24504. } else if (hostContainerInfo._tag) {
  24505. namespaceURI = hostContainerInfo._namespaceURI;
  24506. parentTag = hostContainerInfo._tag;
  24507. }
  24508. if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
  24509. namespaceURI = DOMNamespaces.html;
  24510. }
  24511. if (namespaceURI === DOMNamespaces.html) {
  24512. if (this._tag === 'svg') {
  24513. namespaceURI = DOMNamespaces.svg;
  24514. } else if (this._tag === 'math') {
  24515. namespaceURI = DOMNamespaces.mathml;
  24516. }
  24517. }
  24518. this._namespaceURI = namespaceURI;
  24519. if (false) {
  24520. var parentInfo;
  24521. if (hostParent != null) {
  24522. parentInfo = hostParent._ancestorInfo;
  24523. } else if (hostContainerInfo._tag) {
  24524. parentInfo = hostContainerInfo._ancestorInfo;
  24525. }
  24526. if (parentInfo) {
  24527. // parentInfo should always be present except for the top-level
  24528. // component when server rendering
  24529. validateDOMNesting(this._tag, null, this, parentInfo);
  24530. }
  24531. this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
  24532. }
  24533. var mountImage;
  24534. if (transaction.useCreateElement) {
  24535. var ownerDocument = hostContainerInfo._ownerDocument;
  24536. var el;
  24537. if (namespaceURI === DOMNamespaces.html) {
  24538. if (this._tag === 'script') {
  24539. // Create the script via .innerHTML so its "parser-inserted" flag is
  24540. // set to true and it does not execute
  24541. var div = ownerDocument.createElement('div');
  24542. var type = this._currentElement.type;
  24543. div.innerHTML = '<' + type + '></' + type + '>';
  24544. el = div.removeChild(div.firstChild);
  24545. } else if (props.is) {
  24546. el = ownerDocument.createElement(this._currentElement.type, props.is);
  24547. } else {
  24548. // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
  24549. // See discussion in https://github.com/facebook/react/pull/6896
  24550. // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  24551. el = ownerDocument.createElement(this._currentElement.type);
  24552. }
  24553. } else {
  24554. el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
  24555. }
  24556. ReactDOMComponentTree.precacheNode(this, el);
  24557. this._flags |= Flags.hasCachedChildNodes;
  24558. if (!this._hostParent) {
  24559. DOMPropertyOperations.setAttributeForRoot(el);
  24560. }
  24561. this._updateDOMProperties(null, props, transaction);
  24562. var lazyTree = DOMLazyTree(el);
  24563. this._createInitialChildren(transaction, props, context, lazyTree);
  24564. mountImage = lazyTree;
  24565. } else {
  24566. var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
  24567. var tagContent = this._createContentMarkup(transaction, props, context);
  24568. if (!tagContent && omittedCloseTags[this._tag]) {
  24569. mountImage = tagOpen + '/>';
  24570. } else {
  24571. mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
  24572. }
  24573. }
  24574. switch (this._tag) {
  24575. case 'input':
  24576. transaction.getReactMountReady().enqueue(inputPostMount, this);
  24577. if (props.autoFocus) {
  24578. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24579. }
  24580. break;
  24581. case 'textarea':
  24582. transaction.getReactMountReady().enqueue(textareaPostMount, this);
  24583. if (props.autoFocus) {
  24584. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24585. }
  24586. break;
  24587. case 'select':
  24588. if (props.autoFocus) {
  24589. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24590. }
  24591. break;
  24592. case 'button':
  24593. if (props.autoFocus) {
  24594. transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
  24595. }
  24596. break;
  24597. case 'option':
  24598. transaction.getReactMountReady().enqueue(optionPostMount, this);
  24599. break;
  24600. }
  24601. return mountImage;
  24602. },
  24603. /**
  24604. * Creates markup for the open tag and all attributes.
  24605. *
  24606. * This method has side effects because events get registered.
  24607. *
  24608. * Iterating over object properties is faster than iterating over arrays.
  24609. * @see http://jsperf.com/obj-vs-arr-iteration
  24610. *
  24611. * @private
  24612. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24613. * @param {object} props
  24614. * @return {string} Markup of opening tag.
  24615. */
  24616. _createOpenTagMarkupAndPutListeners: function (transaction, props) {
  24617. var ret = '<' + this._currentElement.type;
  24618. for (var propKey in props) {
  24619. if (!props.hasOwnProperty(propKey)) {
  24620. continue;
  24621. }
  24622. var propValue = props[propKey];
  24623. if (propValue == null) {
  24624. continue;
  24625. }
  24626. if (registrationNameModules.hasOwnProperty(propKey)) {
  24627. if (propValue) {
  24628. enqueuePutListener(this, propKey, propValue, transaction);
  24629. }
  24630. } else {
  24631. if (propKey === STYLE) {
  24632. if (propValue) {
  24633. if (false) {
  24634. // See `_updateDOMProperties`. style block
  24635. this._previousStyle = propValue;
  24636. }
  24637. propValue = this._previousStyleCopy = _assign({}, props.style);
  24638. }
  24639. propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
  24640. }
  24641. var markup = null;
  24642. if (this._tag != null && isCustomComponent(this._tag, props)) {
  24643. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24644. markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
  24645. }
  24646. } else {
  24647. markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  24648. }
  24649. if (markup) {
  24650. ret += ' ' + markup;
  24651. }
  24652. }
  24653. }
  24654. // For static pages, no need to put React ID and checksum. Saves lots of
  24655. // bytes.
  24656. if (transaction.renderToStaticMarkup) {
  24657. return ret;
  24658. }
  24659. if (!this._hostParent) {
  24660. ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
  24661. }
  24662. ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
  24663. return ret;
  24664. },
  24665. /**
  24666. * Creates markup for the content between the tags.
  24667. *
  24668. * @private
  24669. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24670. * @param {object} props
  24671. * @param {object} context
  24672. * @return {string} Content markup.
  24673. */
  24674. _createContentMarkup: function (transaction, props, context) {
  24675. var ret = '';
  24676. // Intentional use of != to avoid catching zero/false.
  24677. var innerHTML = props.dangerouslySetInnerHTML;
  24678. if (innerHTML != null) {
  24679. if (innerHTML.__html != null) {
  24680. ret = innerHTML.__html;
  24681. }
  24682. } else {
  24683. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  24684. var childrenToUse = contentToUse != null ? null : props.children;
  24685. if (contentToUse != null) {
  24686. // TODO: Validate that text is allowed as a child of this node
  24687. ret = escapeTextContentForBrowser(contentToUse);
  24688. if (false) {
  24689. setAndValidateContentChildDev.call(this, contentToUse);
  24690. }
  24691. } else if (childrenToUse != null) {
  24692. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  24693. ret = mountImages.join('');
  24694. }
  24695. }
  24696. if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
  24697. // text/html ignores the first character in these tags if it's a newline
  24698. // Prefer to break application/xml over text/html (for now) by adding
  24699. // a newline specifically to get eaten by the parser. (Alternately for
  24700. // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
  24701. // \r is normalized out by HTMLTextAreaElement#value.)
  24702. // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
  24703. // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
  24704. // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
  24705. // See: Parsing of "textarea" "listing" and "pre" elements
  24706. // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
  24707. return '\n' + ret;
  24708. } else {
  24709. return ret;
  24710. }
  24711. },
  24712. _createInitialChildren: function (transaction, props, context, lazyTree) {
  24713. // Intentional use of != to avoid catching zero/false.
  24714. var innerHTML = props.dangerouslySetInnerHTML;
  24715. if (innerHTML != null) {
  24716. if (innerHTML.__html != null) {
  24717. DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
  24718. }
  24719. } else {
  24720. var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
  24721. var childrenToUse = contentToUse != null ? null : props.children;
  24722. // TODO: Validate that text is allowed as a child of this node
  24723. if (contentToUse != null) {
  24724. // Avoid setting textContent when the text is empty. In IE11 setting
  24725. // textContent on a text area will cause the placeholder to not
  24726. // show within the textarea until it has been focused and blurred again.
  24727. // https://github.com/facebook/react/issues/6731#issuecomment-254874553
  24728. if (contentToUse !== '') {
  24729. if (false) {
  24730. setAndValidateContentChildDev.call(this, contentToUse);
  24731. }
  24732. DOMLazyTree.queueText(lazyTree, contentToUse);
  24733. }
  24734. } else if (childrenToUse != null) {
  24735. var mountImages = this.mountChildren(childrenToUse, transaction, context);
  24736. for (var i = 0; i < mountImages.length; i++) {
  24737. DOMLazyTree.queueChild(lazyTree, mountImages[i]);
  24738. }
  24739. }
  24740. }
  24741. },
  24742. /**
  24743. * Receives a next element and updates the component.
  24744. *
  24745. * @internal
  24746. * @param {ReactElement} nextElement
  24747. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  24748. * @param {object} context
  24749. */
  24750. receiveComponent: function (nextElement, transaction, context) {
  24751. var prevElement = this._currentElement;
  24752. this._currentElement = nextElement;
  24753. this.updateComponent(transaction, prevElement, nextElement, context);
  24754. },
  24755. /**
  24756. * Updates a DOM component after it has already been allocated and
  24757. * attached to the DOM. Reconciles the root DOM node, then recurses.
  24758. *
  24759. * @param {ReactReconcileTransaction} transaction
  24760. * @param {ReactElement} prevElement
  24761. * @param {ReactElement} nextElement
  24762. * @internal
  24763. * @overridable
  24764. */
  24765. updateComponent: function (transaction, prevElement, nextElement, context) {
  24766. var lastProps = prevElement.props;
  24767. var nextProps = this._currentElement.props;
  24768. switch (this._tag) {
  24769. case 'input':
  24770. lastProps = ReactDOMInput.getHostProps(this, lastProps);
  24771. nextProps = ReactDOMInput.getHostProps(this, nextProps);
  24772. break;
  24773. case 'option':
  24774. lastProps = ReactDOMOption.getHostProps(this, lastProps);
  24775. nextProps = ReactDOMOption.getHostProps(this, nextProps);
  24776. break;
  24777. case 'select':
  24778. lastProps = ReactDOMSelect.getHostProps(this, lastProps);
  24779. nextProps = ReactDOMSelect.getHostProps(this, nextProps);
  24780. break;
  24781. case 'textarea':
  24782. lastProps = ReactDOMTextarea.getHostProps(this, lastProps);
  24783. nextProps = ReactDOMTextarea.getHostProps(this, nextProps);
  24784. break;
  24785. }
  24786. assertValidProps(this, nextProps);
  24787. this._updateDOMProperties(lastProps, nextProps, transaction);
  24788. this._updateDOMChildren(lastProps, nextProps, transaction, context);
  24789. switch (this._tag) {
  24790. case 'input':
  24791. // Update the wrapper around inputs *after* updating props. This has to
  24792. // happen after `_updateDOMProperties`. Otherwise HTML5 input validations
  24793. // raise warnings and prevent the new value from being assigned.
  24794. ReactDOMInput.updateWrapper(this);
  24795. break;
  24796. case 'textarea':
  24797. ReactDOMTextarea.updateWrapper(this);
  24798. break;
  24799. case 'select':
  24800. // <select> value update needs to occur after <option> children
  24801. // reconciliation
  24802. transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
  24803. break;
  24804. }
  24805. },
  24806. /**
  24807. * Reconciles the properties by detecting differences in property values and
  24808. * updating the DOM as necessary. This function is probably the single most
  24809. * critical path for performance optimization.
  24810. *
  24811. * TODO: Benchmark whether checking for changed values in memory actually
  24812. * improves performance (especially statically positioned elements).
  24813. * TODO: Benchmark the effects of putting this at the top since 99% of props
  24814. * do not change for a given reconciliation.
  24815. * TODO: Benchmark areas that can be improved with caching.
  24816. *
  24817. * @private
  24818. * @param {object} lastProps
  24819. * @param {object} nextProps
  24820. * @param {?DOMElement} node
  24821. */
  24822. _updateDOMProperties: function (lastProps, nextProps, transaction) {
  24823. var propKey;
  24824. var styleName;
  24825. var styleUpdates;
  24826. for (propKey in lastProps) {
  24827. if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
  24828. continue;
  24829. }
  24830. if (propKey === STYLE) {
  24831. var lastStyle = this._previousStyleCopy;
  24832. for (styleName in lastStyle) {
  24833. if (lastStyle.hasOwnProperty(styleName)) {
  24834. styleUpdates = styleUpdates || {};
  24835. styleUpdates[styleName] = '';
  24836. }
  24837. }
  24838. this._previousStyleCopy = null;
  24839. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  24840. if (lastProps[propKey]) {
  24841. // Only call deleteListener if there was a listener previously or
  24842. // else willDeleteListener gets called when there wasn't actually a
  24843. // listener (e.g., onClick={null})
  24844. deleteListener(this, propKey);
  24845. }
  24846. } else if (isCustomComponent(this._tag, lastProps)) {
  24847. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24848. DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey);
  24849. }
  24850. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  24851. DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
  24852. }
  24853. }
  24854. for (propKey in nextProps) {
  24855. var nextProp = nextProps[propKey];
  24856. var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
  24857. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
  24858. continue;
  24859. }
  24860. if (propKey === STYLE) {
  24861. if (nextProp) {
  24862. if (false) {
  24863. checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
  24864. this._previousStyle = nextProp;
  24865. }
  24866. nextProp = this._previousStyleCopy = _assign({}, nextProp);
  24867. } else {
  24868. this._previousStyleCopy = null;
  24869. }
  24870. if (lastProp) {
  24871. // Unset styles on `lastProp` but not on `nextProp`.
  24872. for (styleName in lastProp) {
  24873. if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  24874. styleUpdates = styleUpdates || {};
  24875. styleUpdates[styleName] = '';
  24876. }
  24877. }
  24878. // Update styles that changed since `lastProp`.
  24879. for (styleName in nextProp) {
  24880. if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  24881. styleUpdates = styleUpdates || {};
  24882. styleUpdates[styleName] = nextProp[styleName];
  24883. }
  24884. }
  24885. } else {
  24886. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  24887. styleUpdates = nextProp;
  24888. }
  24889. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  24890. if (nextProp) {
  24891. enqueuePutListener(this, propKey, nextProp, transaction);
  24892. } else if (lastProp) {
  24893. deleteListener(this, propKey);
  24894. }
  24895. } else if (isCustomComponent(this._tag, nextProps)) {
  24896. if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
  24897. DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
  24898. }
  24899. } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
  24900. var node = getNode(this);
  24901. // If we're updating to null or undefined, we should remove the property
  24902. // from the DOM node instead of inadvertently setting to a string. This
  24903. // brings us in line with the same behavior we have on initial render.
  24904. if (nextProp != null) {
  24905. DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
  24906. } else {
  24907. DOMPropertyOperations.deleteValueForProperty(node, propKey);
  24908. }
  24909. }
  24910. }
  24911. if (styleUpdates) {
  24912. CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
  24913. }
  24914. },
  24915. /**
  24916. * Reconciles the children with the various properties that affect the
  24917. * children content.
  24918. *
  24919. * @param {object} lastProps
  24920. * @param {object} nextProps
  24921. * @param {ReactReconcileTransaction} transaction
  24922. * @param {object} context
  24923. */
  24924. _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
  24925. var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  24926. var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  24927. var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
  24928. var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
  24929. // Note the use of `!=` which checks for null or undefined.
  24930. var lastChildren = lastContent != null ? null : lastProps.children;
  24931. var nextChildren = nextContent != null ? null : nextProps.children;
  24932. // If we're switching from children to content/html or vice versa, remove
  24933. // the old content
  24934. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  24935. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  24936. if (lastChildren != null && nextChildren == null) {
  24937. this.updateChildren(null, transaction, context);
  24938. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  24939. this.updateTextContent('');
  24940. if (false) {
  24941. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  24942. }
  24943. }
  24944. if (nextContent != null) {
  24945. if (lastContent !== nextContent) {
  24946. this.updateTextContent('' + nextContent);
  24947. if (false) {
  24948. setAndValidateContentChildDev.call(this, nextContent);
  24949. }
  24950. }
  24951. } else if (nextHtml != null) {
  24952. if (lastHtml !== nextHtml) {
  24953. this.updateMarkup('' + nextHtml);
  24954. }
  24955. if (false) {
  24956. ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
  24957. }
  24958. } else if (nextChildren != null) {
  24959. if (false) {
  24960. setAndValidateContentChildDev.call(this, null);
  24961. }
  24962. this.updateChildren(nextChildren, transaction, context);
  24963. }
  24964. },
  24965. getHostNode: function () {
  24966. return getNode(this);
  24967. },
  24968. /**
  24969. * Destroys all event registrations for this instance. Does not remove from
  24970. * the DOM. That must be done by the parent.
  24971. *
  24972. * @internal
  24973. */
  24974. unmountComponent: function (safely) {
  24975. switch (this._tag) {
  24976. case 'audio':
  24977. case 'form':
  24978. case 'iframe':
  24979. case 'img':
  24980. case 'link':
  24981. case 'object':
  24982. case 'source':
  24983. case 'video':
  24984. var listeners = this._wrapperState.listeners;
  24985. if (listeners) {
  24986. for (var i = 0; i < listeners.length; i++) {
  24987. listeners[i].remove();
  24988. }
  24989. }
  24990. break;
  24991. case 'html':
  24992. case 'head':
  24993. case 'body':
  24994. /**
  24995. * Components like <html> <head> and <body> can't be removed or added
  24996. * easily in a cross-browser way, however it's valuable to be able to
  24997. * take advantage of React's reconciliation for styling and <title>
  24998. * management. So we just document it and throw in dangerous cases.
  24999. */
  25000. 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;
  25001. break;
  25002. }
  25003. this.unmountChildren(safely);
  25004. ReactDOMComponentTree.uncacheNode(this);
  25005. EventPluginHub.deleteAllListeners(this);
  25006. this._rootNodeID = 0;
  25007. this._domID = 0;
  25008. this._wrapperState = null;
  25009. if (false) {
  25010. setAndValidateContentChildDev.call(this, null);
  25011. }
  25012. },
  25013. getPublicInstance: function () {
  25014. return getNode(this);
  25015. }
  25016. };
  25017. _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
  25018. module.exports = ReactDOMComponent;
  25019. /***/ }),
  25020. /* 184 */
  25021. /***/ (function(module, exports, __webpack_require__) {
  25022. "use strict";
  25023. /**
  25024. * Copyright 2013-present, Facebook, Inc.
  25025. * All rights reserved.
  25026. *
  25027. * This source code is licensed under the BSD-style license found in the
  25028. * LICENSE file in the root directory of this source tree. An additional grant
  25029. * of patent rights can be found in the PATENTS file in the same directory.
  25030. *
  25031. */
  25032. var validateDOMNesting = __webpack_require__(65);
  25033. var DOC_NODE_TYPE = 9;
  25034. function ReactDOMContainerInfo(topLevelWrapper, node) {
  25035. var info = {
  25036. _topLevelWrapper: topLevelWrapper,
  25037. _idCounter: 1,
  25038. _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
  25039. _node: node,
  25040. _tag: node ? node.nodeName.toLowerCase() : null,
  25041. _namespaceURI: node ? node.namespaceURI : null
  25042. };
  25043. if (false) {
  25044. info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
  25045. }
  25046. return info;
  25047. }
  25048. module.exports = ReactDOMContainerInfo;
  25049. /***/ }),
  25050. /* 185 */
  25051. /***/ (function(module, exports, __webpack_require__) {
  25052. "use strict";
  25053. /**
  25054. * Copyright 2014-present, Facebook, Inc.
  25055. * All rights reserved.
  25056. *
  25057. * This source code is licensed under the BSD-style license found in the
  25058. * LICENSE file in the root directory of this source tree. An additional grant
  25059. * of patent rights can be found in the PATENTS file in the same directory.
  25060. *
  25061. */
  25062. var _assign = __webpack_require__(3);
  25063. var DOMLazyTree = __webpack_require__(18);
  25064. var ReactDOMComponentTree = __webpack_require__(5);
  25065. var ReactDOMEmptyComponent = function (instantiate) {
  25066. // ReactCompositeComponent uses this:
  25067. this._currentElement = null;
  25068. // ReactDOMComponentTree uses these:
  25069. this._hostNode = null;
  25070. this._hostParent = null;
  25071. this._hostContainerInfo = null;
  25072. this._domID = 0;
  25073. };
  25074. _assign(ReactDOMEmptyComponent.prototype, {
  25075. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  25076. var domID = hostContainerInfo._idCounter++;
  25077. this._domID = domID;
  25078. this._hostParent = hostParent;
  25079. this._hostContainerInfo = hostContainerInfo;
  25080. var nodeValue = ' react-empty: ' + this._domID + ' ';
  25081. if (transaction.useCreateElement) {
  25082. var ownerDocument = hostContainerInfo._ownerDocument;
  25083. var node = ownerDocument.createComment(nodeValue);
  25084. ReactDOMComponentTree.precacheNode(this, node);
  25085. return DOMLazyTree(node);
  25086. } else {
  25087. if (transaction.renderToStaticMarkup) {
  25088. // Normally we'd insert a comment node, but since this is a situation
  25089. // where React won't take over (static pages), we can simply return
  25090. // nothing.
  25091. return '';
  25092. }
  25093. return '<!--' + nodeValue + '-->';
  25094. }
  25095. },
  25096. receiveComponent: function () {},
  25097. getHostNode: function () {
  25098. return ReactDOMComponentTree.getNodeFromInstance(this);
  25099. },
  25100. unmountComponent: function () {
  25101. ReactDOMComponentTree.uncacheNode(this);
  25102. }
  25103. });
  25104. module.exports = ReactDOMEmptyComponent;
  25105. /***/ }),
  25106. /* 186 */
  25107. /***/ (function(module, exports, __webpack_require__) {
  25108. "use strict";
  25109. /**
  25110. * Copyright 2013-present, Facebook, Inc.
  25111. * All rights reserved.
  25112. *
  25113. * This source code is licensed under the BSD-style license found in the
  25114. * LICENSE file in the root directory of this source tree. An additional grant
  25115. * of patent rights can be found in the PATENTS file in the same directory.
  25116. *
  25117. */
  25118. var ReactDOMFeatureFlags = {
  25119. useCreateElement: true,
  25120. useFiber: false
  25121. };
  25122. module.exports = ReactDOMFeatureFlags;
  25123. /***/ }),
  25124. /* 187 */
  25125. /***/ (function(module, exports, __webpack_require__) {
  25126. "use strict";
  25127. /**
  25128. * Copyright 2013-present, Facebook, Inc.
  25129. * All rights reserved.
  25130. *
  25131. * This source code is licensed under the BSD-style license found in the
  25132. * LICENSE file in the root directory of this source tree. An additional grant
  25133. * of patent rights can be found in the PATENTS file in the same directory.
  25134. *
  25135. */
  25136. var DOMChildrenOperations = __webpack_require__(50);
  25137. var ReactDOMComponentTree = __webpack_require__(5);
  25138. /**
  25139. * Operations used to process updates to DOM nodes.
  25140. */
  25141. var ReactDOMIDOperations = {
  25142. /**
  25143. * Updates a component's children by processing a series of updates.
  25144. *
  25145. * @param {array<object>} updates List of update configurations.
  25146. * @internal
  25147. */
  25148. dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
  25149. var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
  25150. DOMChildrenOperations.processUpdates(node, updates);
  25151. }
  25152. };
  25153. module.exports = ReactDOMIDOperations;
  25154. /***/ }),
  25155. /* 188 */
  25156. /***/ (function(module, exports, __webpack_require__) {
  25157. "use strict";
  25158. /**
  25159. * Copyright 2013-present, Facebook, Inc.
  25160. * All rights reserved.
  25161. *
  25162. * This source code is licensed under the BSD-style license found in the
  25163. * LICENSE file in the root directory of this source tree. An additional grant
  25164. * of patent rights can be found in the PATENTS file in the same directory.
  25165. *
  25166. */
  25167. var _prodInvariant = __webpack_require__(2),
  25168. _assign = __webpack_require__(3);
  25169. var DOMPropertyOperations = __webpack_require__(80);
  25170. var LinkedValueUtils = __webpack_require__(55);
  25171. var ReactDOMComponentTree = __webpack_require__(5);
  25172. var ReactUpdates = __webpack_require__(12);
  25173. var invariant = __webpack_require__(0);
  25174. var warning = __webpack_require__(1);
  25175. var didWarnValueLink = false;
  25176. var didWarnCheckedLink = false;
  25177. var didWarnValueDefaultValue = false;
  25178. var didWarnCheckedDefaultChecked = false;
  25179. var didWarnControlledToUncontrolled = false;
  25180. var didWarnUncontrolledToControlled = false;
  25181. function forceUpdateIfMounted() {
  25182. if (this._rootNodeID) {
  25183. // DOM component is still mounted; update
  25184. ReactDOMInput.updateWrapper(this);
  25185. }
  25186. }
  25187. function isControlled(props) {
  25188. var usesChecked = props.type === 'checkbox' || props.type === 'radio';
  25189. return usesChecked ? props.checked != null : props.value != null;
  25190. }
  25191. /**
  25192. * Implements an <input> host component that allows setting these optional
  25193. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  25194. *
  25195. * If `checked` or `value` are not supplied (or null/undefined), user actions
  25196. * that affect the checked state or value will trigger updates to the element.
  25197. *
  25198. * If they are supplied (and not null/undefined), the rendered element will not
  25199. * trigger updates to the element. Instead, the props must change in order for
  25200. * the rendered element to be updated.
  25201. *
  25202. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  25203. * with an empty value (or `defaultValue`).
  25204. *
  25205. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  25206. */
  25207. var ReactDOMInput = {
  25208. getHostProps: function (inst, props) {
  25209. var value = LinkedValueUtils.getValue(props);
  25210. var checked = LinkedValueUtils.getChecked(props);
  25211. var hostProps = _assign({
  25212. // Make sure we set .type before any other properties (setting .value
  25213. // before .type means .value is lost in IE11 and below)
  25214. type: undefined,
  25215. // Make sure we set .step before .value (setting .value before .step
  25216. // means .value is rounded on mount, based upon step precision)
  25217. step: undefined,
  25218. // Make sure we set .min & .max before .value (to ensure proper order
  25219. // in corner cases such as min or max deriving from value, e.g. Issue #7170)
  25220. min: undefined,
  25221. max: undefined
  25222. }, props, {
  25223. defaultChecked: undefined,
  25224. defaultValue: undefined,
  25225. value: value != null ? value : inst._wrapperState.initialValue,
  25226. checked: checked != null ? checked : inst._wrapperState.initialChecked,
  25227. onChange: inst._wrapperState.onChange
  25228. });
  25229. return hostProps;
  25230. },
  25231. mountWrapper: function (inst, props) {
  25232. if (false) {
  25233. LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
  25234. var owner = inst._currentElement._owner;
  25235. if (props.valueLink !== undefined && !didWarnValueLink) {
  25236. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  25237. didWarnValueLink = true;
  25238. }
  25239. if (props.checkedLink !== undefined && !didWarnCheckedLink) {
  25240. process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
  25241. didWarnCheckedLink = true;
  25242. }
  25243. if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
  25244. 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;
  25245. didWarnCheckedDefaultChecked = true;
  25246. }
  25247. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
  25248. 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;
  25249. didWarnValueDefaultValue = true;
  25250. }
  25251. }
  25252. var defaultValue = props.defaultValue;
  25253. inst._wrapperState = {
  25254. initialChecked: props.checked != null ? props.checked : props.defaultChecked,
  25255. initialValue: props.value != null ? props.value : defaultValue,
  25256. listeners: null,
  25257. onChange: _handleChange.bind(inst)
  25258. };
  25259. if (false) {
  25260. inst._wrapperState.controlled = isControlled(props);
  25261. }
  25262. },
  25263. updateWrapper: function (inst) {
  25264. var props = inst._currentElement.props;
  25265. if (false) {
  25266. var controlled = isControlled(props);
  25267. var owner = inst._currentElement._owner;
  25268. if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
  25269. 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;
  25270. didWarnUncontrolledToControlled = true;
  25271. }
  25272. if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
  25273. 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;
  25274. didWarnControlledToUncontrolled = true;
  25275. }
  25276. }
  25277. // TODO: Shouldn't this be getChecked(props)?
  25278. var checked = props.checked;
  25279. if (checked != null) {
  25280. DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
  25281. }
  25282. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25283. var value = LinkedValueUtils.getValue(props);
  25284. if (value != null) {
  25285. // Cast `value` to a string to ensure the value is set correctly. While
  25286. // browsers typically do this as necessary, jsdom doesn't.
  25287. var newValue = '' + value;
  25288. // To avoid side effects (such as losing text selection), only set value if changed
  25289. if (newValue !== node.value) {
  25290. node.value = newValue;
  25291. }
  25292. } else {
  25293. if (props.value == null && props.defaultValue != null) {
  25294. // In Chrome, assigning defaultValue to certain input types triggers input validation.
  25295. // For number inputs, the display value loses trailing decimal points. For email inputs,
  25296. // Chrome raises "The specified value <x> is not a valid email address".
  25297. //
  25298. // Here we check to see if the defaultValue has actually changed, avoiding these problems
  25299. // when the user is inputting text
  25300. //
  25301. // https://github.com/facebook/react/issues/7253
  25302. if (node.defaultValue !== '' + props.defaultValue) {
  25303. node.defaultValue = '' + props.defaultValue;
  25304. }
  25305. }
  25306. if (props.checked == null && props.defaultChecked != null) {
  25307. node.defaultChecked = !!props.defaultChecked;
  25308. }
  25309. }
  25310. },
  25311. postMountWrapper: function (inst) {
  25312. var props = inst._currentElement.props;
  25313. // This is in postMount because we need access to the DOM node, which is not
  25314. // available until after the component has mounted.
  25315. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25316. // Detach value from defaultValue. We won't do anything if we're working on
  25317. // submit or reset inputs as those values & defaultValues are linked. They
  25318. // are not resetable nodes so this operation doesn't matter and actually
  25319. // removes browser-default values (eg "Submit Query") when no value is
  25320. // provided.
  25321. switch (props.type) {
  25322. case 'submit':
  25323. case 'reset':
  25324. break;
  25325. case 'color':
  25326. case 'date':
  25327. case 'datetime':
  25328. case 'datetime-local':
  25329. case 'month':
  25330. case 'time':
  25331. case 'week':
  25332. // This fixes the no-show issue on iOS Safari and Android Chrome:
  25333. // https://github.com/facebook/react/issues/7233
  25334. node.value = '';
  25335. node.value = node.defaultValue;
  25336. break;
  25337. default:
  25338. node.value = node.value;
  25339. break;
  25340. }
  25341. // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
  25342. // this is needed to work around a chrome bug where setting defaultChecked
  25343. // will sometimes influence the value of checked (even after detachment).
  25344. // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
  25345. // We need to temporarily unset name to avoid disrupting radio button groups.
  25346. var name = node.name;
  25347. if (name !== '') {
  25348. node.name = '';
  25349. }
  25350. node.defaultChecked = !node.defaultChecked;
  25351. node.defaultChecked = !node.defaultChecked;
  25352. if (name !== '') {
  25353. node.name = name;
  25354. }
  25355. }
  25356. };
  25357. function _handleChange(event) {
  25358. var props = this._currentElement.props;
  25359. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  25360. // Here we use asap to wait until all updates have propagated, which
  25361. // is important when using controlled components within layers:
  25362. // https://github.com/facebook/react/issues/1698
  25363. ReactUpdates.asap(forceUpdateIfMounted, this);
  25364. var name = props.name;
  25365. if (props.type === 'radio' && name != null) {
  25366. var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
  25367. var queryRoot = rootNode;
  25368. while (queryRoot.parentNode) {
  25369. queryRoot = queryRoot.parentNode;
  25370. }
  25371. // If `rootNode.form` was non-null, then we could try `form.elements`,
  25372. // but that sometimes behaves strangely in IE8. We could also try using
  25373. // `form.getElementsByName`, but that will only return direct children
  25374. // and won't include inputs that use the HTML5 `form=` attribute. Since
  25375. // the input might not even be in a form, let's just use the global
  25376. // `querySelectorAll` to ensure we don't miss anything.
  25377. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  25378. for (var i = 0; i < group.length; i++) {
  25379. var otherNode = group[i];
  25380. if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  25381. continue;
  25382. }
  25383. // This will throw if radio buttons rendered by different copies of React
  25384. // and the same name are rendered into the same form (same as #1939).
  25385. // That's probably okay; we don't support it just as we don't support
  25386. // mixing React radio buttons with non-React ones.
  25387. var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
  25388. !otherInstance ? false ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0;
  25389. // If this is a controlled radio button group, forcing the input that
  25390. // was previously checked to update will cause it to be come re-checked
  25391. // as appropriate.
  25392. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  25393. }
  25394. }
  25395. return returnValue;
  25396. }
  25397. module.exports = ReactDOMInput;
  25398. /***/ }),
  25399. /* 189 */
  25400. /***/ (function(module, exports, __webpack_require__) {
  25401. "use strict";
  25402. /**
  25403. * Copyright 2013-present, Facebook, Inc.
  25404. * All rights reserved.
  25405. *
  25406. * This source code is licensed under the BSD-style license found in the
  25407. * LICENSE file in the root directory of this source tree. An additional grant
  25408. * of patent rights can be found in the PATENTS file in the same directory.
  25409. *
  25410. */
  25411. var _assign = __webpack_require__(3);
  25412. var React = __webpack_require__(21);
  25413. var ReactDOMComponentTree = __webpack_require__(5);
  25414. var ReactDOMSelect = __webpack_require__(82);
  25415. var warning = __webpack_require__(1);
  25416. var didWarnInvalidOptionChildren = false;
  25417. function flattenChildren(children) {
  25418. var content = '';
  25419. // Flatten children and warn if they aren't strings or numbers;
  25420. // invalid types are ignored.
  25421. React.Children.forEach(children, function (child) {
  25422. if (child == null) {
  25423. return;
  25424. }
  25425. if (typeof child === 'string' || typeof child === 'number') {
  25426. content += child;
  25427. } else if (!didWarnInvalidOptionChildren) {
  25428. didWarnInvalidOptionChildren = true;
  25429. false ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
  25430. }
  25431. });
  25432. return content;
  25433. }
  25434. /**
  25435. * Implements an <option> host component that warns when `selected` is set.
  25436. */
  25437. var ReactDOMOption = {
  25438. mountWrapper: function (inst, props, hostParent) {
  25439. // TODO (yungsters): Remove support for `selected` in <option>.
  25440. if (false) {
  25441. 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;
  25442. }
  25443. // Look up whether this option is 'selected'
  25444. var selectValue = null;
  25445. if (hostParent != null) {
  25446. var selectParent = hostParent;
  25447. if (selectParent._tag === 'optgroup') {
  25448. selectParent = selectParent._hostParent;
  25449. }
  25450. if (selectParent != null && selectParent._tag === 'select') {
  25451. selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
  25452. }
  25453. }
  25454. // If the value is null (e.g., no specified value or after initial mount)
  25455. // or missing (e.g., for <datalist>), we don't change props.selected
  25456. var selected = null;
  25457. if (selectValue != null) {
  25458. var value;
  25459. if (props.value != null) {
  25460. value = props.value + '';
  25461. } else {
  25462. value = flattenChildren(props.children);
  25463. }
  25464. selected = false;
  25465. if (Array.isArray(selectValue)) {
  25466. // multiple
  25467. for (var i = 0; i < selectValue.length; i++) {
  25468. if ('' + selectValue[i] === value) {
  25469. selected = true;
  25470. break;
  25471. }
  25472. }
  25473. } else {
  25474. selected = '' + selectValue === value;
  25475. }
  25476. }
  25477. inst._wrapperState = { selected: selected };
  25478. },
  25479. postMountWrapper: function (inst) {
  25480. // value="" should make a value attribute (#6219)
  25481. var props = inst._currentElement.props;
  25482. if (props.value != null) {
  25483. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25484. node.setAttribute('value', props.value);
  25485. }
  25486. },
  25487. getHostProps: function (inst, props) {
  25488. var hostProps = _assign({ selected: undefined, children: undefined }, props);
  25489. // Read state only from initial mount because <select> updates value
  25490. // manually; we need the initial state only for server rendering
  25491. if (inst._wrapperState.selected != null) {
  25492. hostProps.selected = inst._wrapperState.selected;
  25493. }
  25494. var content = flattenChildren(props.children);
  25495. if (content) {
  25496. hostProps.children = content;
  25497. }
  25498. return hostProps;
  25499. }
  25500. };
  25501. module.exports = ReactDOMOption;
  25502. /***/ }),
  25503. /* 190 */
  25504. /***/ (function(module, exports, __webpack_require__) {
  25505. "use strict";
  25506. /**
  25507. * Copyright 2013-present, Facebook, Inc.
  25508. * All rights reserved.
  25509. *
  25510. * This source code is licensed under the BSD-style license found in the
  25511. * LICENSE file in the root directory of this source tree. An additional grant
  25512. * of patent rights can be found in the PATENTS file in the same directory.
  25513. *
  25514. */
  25515. var ExecutionEnvironment = __webpack_require__(9);
  25516. var getNodeForCharacterOffset = __webpack_require__(229);
  25517. var getTextContentAccessor = __webpack_require__(93);
  25518. /**
  25519. * While `isCollapsed` is available on the Selection object and `collapsed`
  25520. * is available on the Range object, IE11 sometimes gets them wrong.
  25521. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  25522. */
  25523. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  25524. return anchorNode === focusNode && anchorOffset === focusOffset;
  25525. }
  25526. /**
  25527. * Get the appropriate anchor and focus node/offset pairs for IE.
  25528. *
  25529. * The catch here is that IE's selection API doesn't provide information
  25530. * about whether the selection is forward or backward, so we have to
  25531. * behave as though it's always forward.
  25532. *
  25533. * IE text differs from modern selection in that it behaves as though
  25534. * block elements end with a new line. This means character offsets will
  25535. * differ between the two APIs.
  25536. *
  25537. * @param {DOMElement} node
  25538. * @return {object}
  25539. */
  25540. function getIEOffsets(node) {
  25541. var selection = document.selection;
  25542. var selectedRange = selection.createRange();
  25543. var selectedLength = selectedRange.text.length;
  25544. // Duplicate selection so we can move range without breaking user selection.
  25545. var fromStart = selectedRange.duplicate();
  25546. fromStart.moveToElementText(node);
  25547. fromStart.setEndPoint('EndToStart', selectedRange);
  25548. var startOffset = fromStart.text.length;
  25549. var endOffset = startOffset + selectedLength;
  25550. return {
  25551. start: startOffset,
  25552. end: endOffset
  25553. };
  25554. }
  25555. /**
  25556. * @param {DOMElement} node
  25557. * @return {?object}
  25558. */
  25559. function getModernOffsets(node) {
  25560. var selection = window.getSelection && window.getSelection();
  25561. if (!selection || selection.rangeCount === 0) {
  25562. return null;
  25563. }
  25564. var anchorNode = selection.anchorNode;
  25565. var anchorOffset = selection.anchorOffset;
  25566. var focusNode = selection.focusNode;
  25567. var focusOffset = selection.focusOffset;
  25568. var currentRange = selection.getRangeAt(0);
  25569. // In Firefox, range.startContainer and range.endContainer can be "anonymous
  25570. // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
  25571. // divs do not seem to expose properties, triggering a "Permission denied
  25572. // error" if any of its properties are accessed. The only seemingly possible
  25573. // way to avoid erroring is to access a property that typically works for
  25574. // non-anonymous divs and catch any error that may otherwise arise. See
  25575. // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  25576. try {
  25577. /* eslint-disable no-unused-expressions */
  25578. currentRange.startContainer.nodeType;
  25579. currentRange.endContainer.nodeType;
  25580. /* eslint-enable no-unused-expressions */
  25581. } catch (e) {
  25582. return null;
  25583. }
  25584. // If the node and offset values are the same, the selection is collapsed.
  25585. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  25586. // this value wrong.
  25587. var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
  25588. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  25589. var tempRange = currentRange.cloneRange();
  25590. tempRange.selectNodeContents(node);
  25591. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  25592. var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
  25593. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  25594. var end = start + rangeLength;
  25595. // Detect whether the selection is backward.
  25596. var detectionRange = document.createRange();
  25597. detectionRange.setStart(anchorNode, anchorOffset);
  25598. detectionRange.setEnd(focusNode, focusOffset);
  25599. var isBackward = detectionRange.collapsed;
  25600. return {
  25601. start: isBackward ? end : start,
  25602. end: isBackward ? start : end
  25603. };
  25604. }
  25605. /**
  25606. * @param {DOMElement|DOMTextNode} node
  25607. * @param {object} offsets
  25608. */
  25609. function setIEOffsets(node, offsets) {
  25610. var range = document.selection.createRange().duplicate();
  25611. var start, end;
  25612. if (offsets.end === undefined) {
  25613. start = offsets.start;
  25614. end = start;
  25615. } else if (offsets.start > offsets.end) {
  25616. start = offsets.end;
  25617. end = offsets.start;
  25618. } else {
  25619. start = offsets.start;
  25620. end = offsets.end;
  25621. }
  25622. range.moveToElementText(node);
  25623. range.moveStart('character', start);
  25624. range.setEndPoint('EndToStart', range);
  25625. range.moveEnd('character', end - start);
  25626. range.select();
  25627. }
  25628. /**
  25629. * In modern non-IE browsers, we can support both forward and backward
  25630. * selections.
  25631. *
  25632. * Note: IE10+ supports the Selection object, but it does not support
  25633. * the `extend` method, which means that even in modern IE, it's not possible
  25634. * to programmatically create a backward selection. Thus, for all IE
  25635. * versions, we use the old IE API to create our selections.
  25636. *
  25637. * @param {DOMElement|DOMTextNode} node
  25638. * @param {object} offsets
  25639. */
  25640. function setModernOffsets(node, offsets) {
  25641. if (!window.getSelection) {
  25642. return;
  25643. }
  25644. var selection = window.getSelection();
  25645. var length = node[getTextContentAccessor()].length;
  25646. var start = Math.min(offsets.start, length);
  25647. var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
  25648. // IE 11 uses modern selection, but doesn't support the extend method.
  25649. // Flip backward selections, so we can set with a single range.
  25650. if (!selection.extend && start > end) {
  25651. var temp = end;
  25652. end = start;
  25653. start = temp;
  25654. }
  25655. var startMarker = getNodeForCharacterOffset(node, start);
  25656. var endMarker = getNodeForCharacterOffset(node, end);
  25657. if (startMarker && endMarker) {
  25658. var range = document.createRange();
  25659. range.setStart(startMarker.node, startMarker.offset);
  25660. selection.removeAllRanges();
  25661. if (start > end) {
  25662. selection.addRange(range);
  25663. selection.extend(endMarker.node, endMarker.offset);
  25664. } else {
  25665. range.setEnd(endMarker.node, endMarker.offset);
  25666. selection.addRange(range);
  25667. }
  25668. }
  25669. }
  25670. var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
  25671. var ReactDOMSelection = {
  25672. /**
  25673. * @param {DOMElement} node
  25674. */
  25675. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  25676. /**
  25677. * @param {DOMElement|DOMTextNode} node
  25678. * @param {object} offsets
  25679. */
  25680. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  25681. };
  25682. module.exports = ReactDOMSelection;
  25683. /***/ }),
  25684. /* 191 */
  25685. /***/ (function(module, exports, __webpack_require__) {
  25686. "use strict";
  25687. /**
  25688. * Copyright 2013-present, Facebook, Inc.
  25689. * All rights reserved.
  25690. *
  25691. * This source code is licensed under the BSD-style license found in the
  25692. * LICENSE file in the root directory of this source tree. An additional grant
  25693. * of patent rights can be found in the PATENTS file in the same directory.
  25694. *
  25695. */
  25696. var _prodInvariant = __webpack_require__(2),
  25697. _assign = __webpack_require__(3);
  25698. var DOMChildrenOperations = __webpack_require__(50);
  25699. var DOMLazyTree = __webpack_require__(18);
  25700. var ReactDOMComponentTree = __webpack_require__(5);
  25701. var escapeTextContentForBrowser = __webpack_require__(34);
  25702. var invariant = __webpack_require__(0);
  25703. var validateDOMNesting = __webpack_require__(65);
  25704. /**
  25705. * Text nodes violate a couple assumptions that React makes about components:
  25706. *
  25707. * - When mounting text into the DOM, adjacent text nodes are merged.
  25708. * - Text nodes cannot be assigned a React root ID.
  25709. *
  25710. * This component is used to wrap strings between comment nodes so that they
  25711. * can undergo the same reconciliation that is applied to elements.
  25712. *
  25713. * TODO: Investigate representing React components in the DOM with text nodes.
  25714. *
  25715. * @class ReactDOMTextComponent
  25716. * @extends ReactComponent
  25717. * @internal
  25718. */
  25719. var ReactDOMTextComponent = function (text) {
  25720. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  25721. this._currentElement = text;
  25722. this._stringText = '' + text;
  25723. // ReactDOMComponentTree uses these:
  25724. this._hostNode = null;
  25725. this._hostParent = null;
  25726. // Properties
  25727. this._domID = 0;
  25728. this._mountIndex = 0;
  25729. this._closingComment = null;
  25730. this._commentNodes = null;
  25731. };
  25732. _assign(ReactDOMTextComponent.prototype, {
  25733. /**
  25734. * Creates the markup for this text node. This node is not intended to have
  25735. * any features besides containing text content.
  25736. *
  25737. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  25738. * @return {string} Markup for this text node.
  25739. * @internal
  25740. */
  25741. mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
  25742. if (false) {
  25743. var parentInfo;
  25744. if (hostParent != null) {
  25745. parentInfo = hostParent._ancestorInfo;
  25746. } else if (hostContainerInfo != null) {
  25747. parentInfo = hostContainerInfo._ancestorInfo;
  25748. }
  25749. if (parentInfo) {
  25750. // parentInfo should always be present except for the top-level
  25751. // component when server rendering
  25752. validateDOMNesting(null, this._stringText, this, parentInfo);
  25753. }
  25754. }
  25755. var domID = hostContainerInfo._idCounter++;
  25756. var openingValue = ' react-text: ' + domID + ' ';
  25757. var closingValue = ' /react-text ';
  25758. this._domID = domID;
  25759. this._hostParent = hostParent;
  25760. if (transaction.useCreateElement) {
  25761. var ownerDocument = hostContainerInfo._ownerDocument;
  25762. var openingComment = ownerDocument.createComment(openingValue);
  25763. var closingComment = ownerDocument.createComment(closingValue);
  25764. var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
  25765. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
  25766. if (this._stringText) {
  25767. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
  25768. }
  25769. DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
  25770. ReactDOMComponentTree.precacheNode(this, openingComment);
  25771. this._closingComment = closingComment;
  25772. return lazyTree;
  25773. } else {
  25774. var escapedText = escapeTextContentForBrowser(this._stringText);
  25775. if (transaction.renderToStaticMarkup) {
  25776. // Normally we'd wrap this between comment nodes for the reasons stated
  25777. // above, but since this is a situation where React won't take over
  25778. // (static pages), we can simply return the text as it is.
  25779. return escapedText;
  25780. }
  25781. return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
  25782. }
  25783. },
  25784. /**
  25785. * Updates this component by updating the text content.
  25786. *
  25787. * @param {ReactText} nextText The next text content
  25788. * @param {ReactReconcileTransaction} transaction
  25789. * @internal
  25790. */
  25791. receiveComponent: function (nextText, transaction) {
  25792. if (nextText !== this._currentElement) {
  25793. this._currentElement = nextText;
  25794. var nextStringText = '' + nextText;
  25795. if (nextStringText !== this._stringText) {
  25796. // TODO: Save this as pending props and use performUpdateIfNecessary
  25797. // and/or updateComponent to do the actual update for consistency with
  25798. // other component types?
  25799. this._stringText = nextStringText;
  25800. var commentNodes = this.getHostNode();
  25801. DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
  25802. }
  25803. }
  25804. },
  25805. getHostNode: function () {
  25806. var hostNode = this._commentNodes;
  25807. if (hostNode) {
  25808. return hostNode;
  25809. }
  25810. if (!this._closingComment) {
  25811. var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
  25812. var node = openingComment.nextSibling;
  25813. while (true) {
  25814. !(node != null) ? false ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0;
  25815. if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
  25816. this._closingComment = node;
  25817. break;
  25818. }
  25819. node = node.nextSibling;
  25820. }
  25821. }
  25822. hostNode = [this._hostNode, this._closingComment];
  25823. this._commentNodes = hostNode;
  25824. return hostNode;
  25825. },
  25826. unmountComponent: function () {
  25827. this._closingComment = null;
  25828. this._commentNodes = null;
  25829. ReactDOMComponentTree.uncacheNode(this);
  25830. }
  25831. });
  25832. module.exports = ReactDOMTextComponent;
  25833. /***/ }),
  25834. /* 192 */
  25835. /***/ (function(module, exports, __webpack_require__) {
  25836. "use strict";
  25837. /**
  25838. * Copyright 2013-present, Facebook, Inc.
  25839. * All rights reserved.
  25840. *
  25841. * This source code is licensed under the BSD-style license found in the
  25842. * LICENSE file in the root directory of this source tree. An additional grant
  25843. * of patent rights can be found in the PATENTS file in the same directory.
  25844. *
  25845. */
  25846. var _prodInvariant = __webpack_require__(2),
  25847. _assign = __webpack_require__(3);
  25848. var LinkedValueUtils = __webpack_require__(55);
  25849. var ReactDOMComponentTree = __webpack_require__(5);
  25850. var ReactUpdates = __webpack_require__(12);
  25851. var invariant = __webpack_require__(0);
  25852. var warning = __webpack_require__(1);
  25853. var didWarnValueLink = false;
  25854. var didWarnValDefaultVal = false;
  25855. function forceUpdateIfMounted() {
  25856. if (this._rootNodeID) {
  25857. // DOM component is still mounted; update
  25858. ReactDOMTextarea.updateWrapper(this);
  25859. }
  25860. }
  25861. /**
  25862. * Implements a <textarea> host component that allows setting `value`, and
  25863. * `defaultValue`. This differs from the traditional DOM API because value is
  25864. * usually set as PCDATA children.
  25865. *
  25866. * If `value` is not supplied (or null/undefined), user actions that affect the
  25867. * value will trigger updates to the element.
  25868. *
  25869. * If `value` is supplied (and not null/undefined), the rendered element will
  25870. * not trigger updates to the element. Instead, the `value` prop must change in
  25871. * order for the rendered element to be updated.
  25872. *
  25873. * The rendered element will be initialized with an empty value, the prop
  25874. * `defaultValue` if specified, or the children content (deprecated).
  25875. */
  25876. var ReactDOMTextarea = {
  25877. getHostProps: function (inst, props) {
  25878. !(props.dangerouslySetInnerHTML == null) ? false ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0;
  25879. // Always set children to the same thing. In IE9, the selection range will
  25880. // get reset if `textContent` is mutated. We could add a check in setTextContent
  25881. // to only set the value if/when the value differs from the node value (which would
  25882. // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution.
  25883. // The value can be a boolean or object so that's why it's forced to be a string.
  25884. var hostProps = _assign({}, props, {
  25885. value: undefined,
  25886. defaultValue: undefined,
  25887. children: '' + inst._wrapperState.initialValue,
  25888. onChange: inst._wrapperState.onChange
  25889. });
  25890. return hostProps;
  25891. },
  25892. mountWrapper: function (inst, props) {
  25893. if (false) {
  25894. LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
  25895. if (props.valueLink !== undefined && !didWarnValueLink) {
  25896. process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
  25897. didWarnValueLink = true;
  25898. }
  25899. if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
  25900. 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;
  25901. didWarnValDefaultVal = true;
  25902. }
  25903. }
  25904. var value = LinkedValueUtils.getValue(props);
  25905. var initialValue = value;
  25906. // Only bother fetching default value if we're going to use it
  25907. if (value == null) {
  25908. var defaultValue = props.defaultValue;
  25909. // TODO (yungsters): Remove support for children content in <textarea>.
  25910. var children = props.children;
  25911. if (children != null) {
  25912. if (false) {
  25913. process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
  25914. }
  25915. !(defaultValue == null) ? false ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0;
  25916. if (Array.isArray(children)) {
  25917. !(children.length <= 1) ? false ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0;
  25918. children = children[0];
  25919. }
  25920. defaultValue = '' + children;
  25921. }
  25922. if (defaultValue == null) {
  25923. defaultValue = '';
  25924. }
  25925. initialValue = defaultValue;
  25926. }
  25927. inst._wrapperState = {
  25928. initialValue: '' + initialValue,
  25929. listeners: null,
  25930. onChange: _handleChange.bind(inst)
  25931. };
  25932. },
  25933. updateWrapper: function (inst) {
  25934. var props = inst._currentElement.props;
  25935. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25936. var value = LinkedValueUtils.getValue(props);
  25937. if (value != null) {
  25938. // Cast `value` to a string to ensure the value is set correctly. While
  25939. // browsers typically do this as necessary, jsdom doesn't.
  25940. var newValue = '' + value;
  25941. // To avoid side effects (such as losing text selection), only set value if changed
  25942. if (newValue !== node.value) {
  25943. node.value = newValue;
  25944. }
  25945. if (props.defaultValue == null) {
  25946. node.defaultValue = newValue;
  25947. }
  25948. }
  25949. if (props.defaultValue != null) {
  25950. node.defaultValue = props.defaultValue;
  25951. }
  25952. },
  25953. postMountWrapper: function (inst) {
  25954. // This is in postMount because we need access to the DOM node, which is not
  25955. // available until after the component has mounted.
  25956. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  25957. var textContent = node.textContent;
  25958. // Only set node.value if textContent is equal to the expected
  25959. // initial value. In IE10/IE11 there is a bug where the placeholder attribute
  25960. // will populate textContent as well.
  25961. // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
  25962. if (textContent === inst._wrapperState.initialValue) {
  25963. node.value = textContent;
  25964. }
  25965. }
  25966. };
  25967. function _handleChange(event) {
  25968. var props = this._currentElement.props;
  25969. var returnValue = LinkedValueUtils.executeOnChange(props, event);
  25970. ReactUpdates.asap(forceUpdateIfMounted, this);
  25971. return returnValue;
  25972. }
  25973. module.exports = ReactDOMTextarea;
  25974. /***/ }),
  25975. /* 193 */
  25976. /***/ (function(module, exports, __webpack_require__) {
  25977. "use strict";
  25978. /**
  25979. * Copyright 2015-present, Facebook, Inc.
  25980. * All rights reserved.
  25981. *
  25982. * This source code is licensed under the BSD-style license found in the
  25983. * LICENSE file in the root directory of this source tree. An additional grant
  25984. * of patent rights can be found in the PATENTS file in the same directory.
  25985. *
  25986. */
  25987. var _prodInvariant = __webpack_require__(2);
  25988. var invariant = __webpack_require__(0);
  25989. /**
  25990. * Return the lowest common ancestor of A and B, or null if they are in
  25991. * different trees.
  25992. */
  25993. function getLowestCommonAncestor(instA, instB) {
  25994. !('_hostNode' in instA) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  25995. !('_hostNode' in instB) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
  25996. var depthA = 0;
  25997. for (var tempA = instA; tempA; tempA = tempA._hostParent) {
  25998. depthA++;
  25999. }
  26000. var depthB = 0;
  26001. for (var tempB = instB; tempB; tempB = tempB._hostParent) {
  26002. depthB++;
  26003. }
  26004. // If A is deeper, crawl up.
  26005. while (depthA - depthB > 0) {
  26006. instA = instA._hostParent;
  26007. depthA--;
  26008. }
  26009. // If B is deeper, crawl up.
  26010. while (depthB - depthA > 0) {
  26011. instB = instB._hostParent;
  26012. depthB--;
  26013. }
  26014. // Walk in lockstep until we find a match.
  26015. var depth = depthA;
  26016. while (depth--) {
  26017. if (instA === instB) {
  26018. return instA;
  26019. }
  26020. instA = instA._hostParent;
  26021. instB = instB._hostParent;
  26022. }
  26023. return null;
  26024. }
  26025. /**
  26026. * Return if A is an ancestor of B.
  26027. */
  26028. function isAncestor(instA, instB) {
  26029. !('_hostNode' in instA) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  26030. !('_hostNode' in instB) ? false ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
  26031. while (instB) {
  26032. if (instB === instA) {
  26033. return true;
  26034. }
  26035. instB = instB._hostParent;
  26036. }
  26037. return false;
  26038. }
  26039. /**
  26040. * Return the parent instance of the passed-in instance.
  26041. */
  26042. function getParentInstance(inst) {
  26043. !('_hostNode' in inst) ? false ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
  26044. return inst._hostParent;
  26045. }
  26046. /**
  26047. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  26048. */
  26049. function traverseTwoPhase(inst, fn, arg) {
  26050. var path = [];
  26051. while (inst) {
  26052. path.push(inst);
  26053. inst = inst._hostParent;
  26054. }
  26055. var i;
  26056. for (i = path.length; i-- > 0;) {
  26057. fn(path[i], 'captured', arg);
  26058. }
  26059. for (i = 0; i < path.length; i++) {
  26060. fn(path[i], 'bubbled', arg);
  26061. }
  26062. }
  26063. /**
  26064. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  26065. * should would receive a `mouseEnter` or `mouseLeave` event.
  26066. *
  26067. * Does not invoke the callback on the nearest common ancestor because nothing
  26068. * "entered" or "left" that element.
  26069. */
  26070. function traverseEnterLeave(from, to, fn, argFrom, argTo) {
  26071. var common = from && to ? getLowestCommonAncestor(from, to) : null;
  26072. var pathFrom = [];
  26073. while (from && from !== common) {
  26074. pathFrom.push(from);
  26075. from = from._hostParent;
  26076. }
  26077. var pathTo = [];
  26078. while (to && to !== common) {
  26079. pathTo.push(to);
  26080. to = to._hostParent;
  26081. }
  26082. var i;
  26083. for (i = 0; i < pathFrom.length; i++) {
  26084. fn(pathFrom[i], 'bubbled', argFrom);
  26085. }
  26086. for (i = pathTo.length; i-- > 0;) {
  26087. fn(pathTo[i], 'captured', argTo);
  26088. }
  26089. }
  26090. module.exports = {
  26091. isAncestor: isAncestor,
  26092. getLowestCommonAncestor: getLowestCommonAncestor,
  26093. getParentInstance: getParentInstance,
  26094. traverseTwoPhase: traverseTwoPhase,
  26095. traverseEnterLeave: traverseEnterLeave
  26096. };
  26097. /***/ }),
  26098. /* 194 */
  26099. /***/ (function(module, exports, __webpack_require__) {
  26100. "use strict";
  26101. /**
  26102. * Copyright 2013-present, Facebook, Inc.
  26103. * All rights reserved.
  26104. *
  26105. * This source code is licensed under the BSD-style license found in the
  26106. * LICENSE file in the root directory of this source tree. An additional grant
  26107. * of patent rights can be found in the PATENTS file in the same directory.
  26108. *
  26109. */
  26110. var _assign = __webpack_require__(3);
  26111. var ReactUpdates = __webpack_require__(12);
  26112. var Transaction = __webpack_require__(33);
  26113. var emptyFunction = __webpack_require__(10);
  26114. var RESET_BATCHED_UPDATES = {
  26115. initialize: emptyFunction,
  26116. close: function () {
  26117. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  26118. }
  26119. };
  26120. var FLUSH_BATCHED_UPDATES = {
  26121. initialize: emptyFunction,
  26122. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  26123. };
  26124. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  26125. function ReactDefaultBatchingStrategyTransaction() {
  26126. this.reinitializeTransaction();
  26127. }
  26128. _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, {
  26129. getTransactionWrappers: function () {
  26130. return TRANSACTION_WRAPPERS;
  26131. }
  26132. });
  26133. var transaction = new ReactDefaultBatchingStrategyTransaction();
  26134. var ReactDefaultBatchingStrategy = {
  26135. isBatchingUpdates: false,
  26136. /**
  26137. * Call the provided function in a context within which calls to `setState`
  26138. * and friends are batched such that components aren't updated unnecessarily.
  26139. */
  26140. batchedUpdates: function (callback, a, b, c, d, e) {
  26141. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  26142. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  26143. // The code is written this way to avoid extra allocations
  26144. if (alreadyBatchingUpdates) {
  26145. return callback(a, b, c, d, e);
  26146. } else {
  26147. return transaction.perform(callback, null, a, b, c, d, e);
  26148. }
  26149. }
  26150. };
  26151. module.exports = ReactDefaultBatchingStrategy;
  26152. /***/ }),
  26153. /* 195 */
  26154. /***/ (function(module, exports, __webpack_require__) {
  26155. "use strict";
  26156. /**
  26157. * Copyright 2013-present, Facebook, Inc.
  26158. * All rights reserved.
  26159. *
  26160. * This source code is licensed under the BSD-style license found in the
  26161. * LICENSE file in the root directory of this source tree. An additional grant
  26162. * of patent rights can be found in the PATENTS file in the same directory.
  26163. *
  26164. */
  26165. var ARIADOMPropertyConfig = __webpack_require__(169);
  26166. var BeforeInputEventPlugin = __webpack_require__(171);
  26167. var ChangeEventPlugin = __webpack_require__(173);
  26168. var DefaultEventPluginOrder = __webpack_require__(175);
  26169. var EnterLeaveEventPlugin = __webpack_require__(176);
  26170. var HTMLDOMPropertyConfig = __webpack_require__(178);
  26171. var ReactComponentBrowserEnvironment = __webpack_require__(180);
  26172. var ReactDOMComponent = __webpack_require__(183);
  26173. var ReactDOMComponentTree = __webpack_require__(5);
  26174. var ReactDOMEmptyComponent = __webpack_require__(185);
  26175. var ReactDOMTreeTraversal = __webpack_require__(193);
  26176. var ReactDOMTextComponent = __webpack_require__(191);
  26177. var ReactDefaultBatchingStrategy = __webpack_require__(194);
  26178. var ReactEventListener = __webpack_require__(198);
  26179. var ReactInjection = __webpack_require__(199);
  26180. var ReactReconcileTransaction = __webpack_require__(204);
  26181. var SVGDOMPropertyConfig = __webpack_require__(209);
  26182. var SelectEventPlugin = __webpack_require__(210);
  26183. var SimpleEventPlugin = __webpack_require__(211);
  26184. var alreadyInjected = false;
  26185. function inject() {
  26186. if (alreadyInjected) {
  26187. // TODO: This is currently true because these injections are shared between
  26188. // the client and the server package. They should be built independently
  26189. // and not share any injection state. Then this problem will be solved.
  26190. return;
  26191. }
  26192. alreadyInjected = true;
  26193. ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
  26194. /**
  26195. * Inject modules for resolving DOM hierarchy and plugin ordering.
  26196. */
  26197. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  26198. ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
  26199. ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
  26200. /**
  26201. * Some important event plugins included by default (without having to require
  26202. * them).
  26203. */
  26204. ReactInjection.EventPluginHub.injectEventPluginsByName({
  26205. SimpleEventPlugin: SimpleEventPlugin,
  26206. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  26207. ChangeEventPlugin: ChangeEventPlugin,
  26208. SelectEventPlugin: SelectEventPlugin,
  26209. BeforeInputEventPlugin: BeforeInputEventPlugin
  26210. });
  26211. ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
  26212. ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
  26213. ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig);
  26214. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  26215. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  26216. ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
  26217. return new ReactDOMEmptyComponent(instantiate);
  26218. });
  26219. ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
  26220. ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
  26221. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  26222. }
  26223. module.exports = {
  26224. inject: inject
  26225. };
  26226. /***/ }),
  26227. /* 196 */
  26228. /***/ (function(module, exports, __webpack_require__) {
  26229. "use strict";
  26230. /**
  26231. * Copyright 2014-present, Facebook, Inc.
  26232. * All rights reserved.
  26233. *
  26234. * This source code is licensed under the BSD-style license found in the
  26235. * LICENSE file in the root directory of this source tree. An additional grant
  26236. * of patent rights can be found in the PATENTS file in the same directory.
  26237. *
  26238. *
  26239. */
  26240. // The Symbol used to tag the ReactElement type. If there is no native Symbol
  26241. // nor polyfill, then a plain number is used for performance.
  26242. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
  26243. module.exports = REACT_ELEMENT_TYPE;
  26244. /***/ }),
  26245. /* 197 */
  26246. /***/ (function(module, exports, __webpack_require__) {
  26247. "use strict";
  26248. /**
  26249. * Copyright 2013-present, Facebook, Inc.
  26250. * All rights reserved.
  26251. *
  26252. * This source code is licensed under the BSD-style license found in the
  26253. * LICENSE file in the root directory of this source tree. An additional grant
  26254. * of patent rights can be found in the PATENTS file in the same directory.
  26255. *
  26256. */
  26257. var EventPluginHub = __webpack_require__(26);
  26258. function runEventQueueInBatch(events) {
  26259. EventPluginHub.enqueueEvents(events);
  26260. EventPluginHub.processEventQueue(false);
  26261. }
  26262. var ReactEventEmitterMixin = {
  26263. /**
  26264. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  26265. * opportunity to create `ReactEvent`s to be dispatched.
  26266. */
  26267. handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  26268. var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
  26269. runEventQueueInBatch(events);
  26270. }
  26271. };
  26272. module.exports = ReactEventEmitterMixin;
  26273. /***/ }),
  26274. /* 198 */
  26275. /***/ (function(module, exports, __webpack_require__) {
  26276. "use strict";
  26277. /**
  26278. * Copyright 2013-present, Facebook, Inc.
  26279. * All rights reserved.
  26280. *
  26281. * This source code is licensed under the BSD-style license found in the
  26282. * LICENSE file in the root directory of this source tree. An additional grant
  26283. * of patent rights can be found in the PATENTS file in the same directory.
  26284. *
  26285. */
  26286. var _assign = __webpack_require__(3);
  26287. var EventListener = __webpack_require__(74);
  26288. var ExecutionEnvironment = __webpack_require__(9);
  26289. var PooledClass = __webpack_require__(15);
  26290. var ReactDOMComponentTree = __webpack_require__(5);
  26291. var ReactUpdates = __webpack_require__(12);
  26292. var getEventTarget = __webpack_require__(62);
  26293. var getUnboundedScrollPosition = __webpack_require__(163);
  26294. /**
  26295. * Find the deepest React component completely containing the root of the
  26296. * passed-in instance (for use when entire React trees are nested within each
  26297. * other). If React trees are not nested, returns null.
  26298. */
  26299. function findParent(inst) {
  26300. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  26301. // traversal, but caching is difficult to do correctly without using a
  26302. // mutation observer to listen for all DOM changes.
  26303. while (inst._hostParent) {
  26304. inst = inst._hostParent;
  26305. }
  26306. var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
  26307. var container = rootNode.parentNode;
  26308. return ReactDOMComponentTree.getClosestInstanceFromNode(container);
  26309. }
  26310. // Used to store ancestor hierarchy in top level callback
  26311. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  26312. this.topLevelType = topLevelType;
  26313. this.nativeEvent = nativeEvent;
  26314. this.ancestors = [];
  26315. }
  26316. _assign(TopLevelCallbackBookKeeping.prototype, {
  26317. destructor: function () {
  26318. this.topLevelType = null;
  26319. this.nativeEvent = null;
  26320. this.ancestors.length = 0;
  26321. }
  26322. });
  26323. PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
  26324. function handleTopLevelImpl(bookKeeping) {
  26325. var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
  26326. var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
  26327. // Loop through the hierarchy, in case there's any nested components.
  26328. // It's important that we build the array of ancestors before calling any
  26329. // event handlers, because event handlers can modify the DOM, leading to
  26330. // inconsistencies with ReactMount's node cache. See #1105.
  26331. var ancestor = targetInst;
  26332. do {
  26333. bookKeeping.ancestors.push(ancestor);
  26334. ancestor = ancestor && findParent(ancestor);
  26335. } while (ancestor);
  26336. for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  26337. targetInst = bookKeeping.ancestors[i];
  26338. ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
  26339. }
  26340. }
  26341. function scrollValueMonitor(cb) {
  26342. var scrollPosition = getUnboundedScrollPosition(window);
  26343. cb(scrollPosition);
  26344. }
  26345. var ReactEventListener = {
  26346. _enabled: true,
  26347. _handleTopLevel: null,
  26348. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  26349. setHandleTopLevel: function (handleTopLevel) {
  26350. ReactEventListener._handleTopLevel = handleTopLevel;
  26351. },
  26352. setEnabled: function (enabled) {
  26353. ReactEventListener._enabled = !!enabled;
  26354. },
  26355. isEnabled: function () {
  26356. return ReactEventListener._enabled;
  26357. },
  26358. /**
  26359. * Traps top-level events by using event bubbling.
  26360. *
  26361. * @param {string} topLevelType Record from `EventConstants`.
  26362. * @param {string} handlerBaseName Event name (e.g. "click").
  26363. * @param {object} element Element on which to attach listener.
  26364. * @return {?object} An object with a remove function which will forcefully
  26365. * remove the listener.
  26366. * @internal
  26367. */
  26368. trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
  26369. if (!element) {
  26370. return null;
  26371. }
  26372. return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  26373. },
  26374. /**
  26375. * Traps a top-level event by using event capturing.
  26376. *
  26377. * @param {string} topLevelType Record from `EventConstants`.
  26378. * @param {string} handlerBaseName Event name (e.g. "click").
  26379. * @param {object} element Element on which to attach listener.
  26380. * @return {?object} An object with a remove function which will forcefully
  26381. * remove the listener.
  26382. * @internal
  26383. */
  26384. trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
  26385. if (!element) {
  26386. return null;
  26387. }
  26388. return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
  26389. },
  26390. monitorScrollValue: function (refresh) {
  26391. var callback = scrollValueMonitor.bind(null, refresh);
  26392. EventListener.listen(window, 'scroll', callback);
  26393. },
  26394. dispatchEvent: function (topLevelType, nativeEvent) {
  26395. if (!ReactEventListener._enabled) {
  26396. return;
  26397. }
  26398. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
  26399. try {
  26400. // Event queue being processed in the same cycle allows
  26401. // `preventDefault`.
  26402. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  26403. } finally {
  26404. TopLevelCallbackBookKeeping.release(bookKeeping);
  26405. }
  26406. }
  26407. };
  26408. module.exports = ReactEventListener;
  26409. /***/ }),
  26410. /* 199 */
  26411. /***/ (function(module, exports, __webpack_require__) {
  26412. "use strict";
  26413. /**
  26414. * Copyright 2013-present, Facebook, Inc.
  26415. * All rights reserved.
  26416. *
  26417. * This source code is licensed under the BSD-style license found in the
  26418. * LICENSE file in the root directory of this source tree. An additional grant
  26419. * of patent rights can be found in the PATENTS file in the same directory.
  26420. *
  26421. */
  26422. var DOMProperty = __webpack_require__(19);
  26423. var EventPluginHub = __webpack_require__(26);
  26424. var EventPluginUtils = __webpack_require__(53);
  26425. var ReactComponentEnvironment = __webpack_require__(56);
  26426. var ReactEmptyComponent = __webpack_require__(83);
  26427. var ReactBrowserEventEmitter = __webpack_require__(31);
  26428. var ReactHostComponent = __webpack_require__(85);
  26429. var ReactUpdates = __webpack_require__(12);
  26430. var ReactInjection = {
  26431. Component: ReactComponentEnvironment.injection,
  26432. DOMProperty: DOMProperty.injection,
  26433. EmptyComponent: ReactEmptyComponent.injection,
  26434. EventPluginHub: EventPluginHub.injection,
  26435. EventPluginUtils: EventPluginUtils.injection,
  26436. EventEmitter: ReactBrowserEventEmitter.injection,
  26437. HostComponent: ReactHostComponent.injection,
  26438. Updates: ReactUpdates.injection
  26439. };
  26440. module.exports = ReactInjection;
  26441. /***/ }),
  26442. /* 200 */
  26443. /***/ (function(module, exports, __webpack_require__) {
  26444. "use strict";
  26445. /**
  26446. * Copyright 2013-present, Facebook, Inc.
  26447. * All rights reserved.
  26448. *
  26449. * This source code is licensed under the BSD-style license found in the
  26450. * LICENSE file in the root directory of this source tree. An additional grant
  26451. * of patent rights can be found in the PATENTS file in the same directory.
  26452. *
  26453. */
  26454. var adler32 = __webpack_require__(222);
  26455. var TAG_END = /\/?>/;
  26456. var COMMENT_START = /^<\!\-\-/;
  26457. var ReactMarkupChecksum = {
  26458. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  26459. /**
  26460. * @param {string} markup Markup string
  26461. * @return {string} Markup string with checksum attribute attached
  26462. */
  26463. addChecksumToMarkup: function (markup) {
  26464. var checksum = adler32(markup);
  26465. // Add checksum (handle both parent tags, comments and self-closing tags)
  26466. if (COMMENT_START.test(markup)) {
  26467. return markup;
  26468. } else {
  26469. return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
  26470. }
  26471. },
  26472. /**
  26473. * @param {string} markup to use
  26474. * @param {DOMElement} element root React element
  26475. * @returns {boolean} whether or not the markup is the same
  26476. */
  26477. canReuseMarkup: function (markup, element) {
  26478. var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  26479. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  26480. var markupChecksum = adler32(markup);
  26481. return markupChecksum === existingChecksum;
  26482. }
  26483. };
  26484. module.exports = ReactMarkupChecksum;
  26485. /***/ }),
  26486. /* 201 */
  26487. /***/ (function(module, exports, __webpack_require__) {
  26488. "use strict";
  26489. /**
  26490. * Copyright 2013-present, Facebook, Inc.
  26491. * All rights reserved.
  26492. *
  26493. * This source code is licensed under the BSD-style license found in the
  26494. * LICENSE file in the root directory of this source tree. An additional grant
  26495. * of patent rights can be found in the PATENTS file in the same directory.
  26496. *
  26497. */
  26498. var _prodInvariant = __webpack_require__(2);
  26499. var ReactComponentEnvironment = __webpack_require__(56);
  26500. var ReactInstanceMap = __webpack_require__(28);
  26501. var ReactInstrumentation = __webpack_require__(11);
  26502. var ReactCurrentOwner = __webpack_require__(14);
  26503. var ReactReconciler = __webpack_require__(20);
  26504. var ReactChildReconciler = __webpack_require__(179);
  26505. var emptyFunction = __webpack_require__(10);
  26506. var flattenChildren = __webpack_require__(225);
  26507. var invariant = __webpack_require__(0);
  26508. /**
  26509. * Make an update for markup to be rendered and inserted at a supplied index.
  26510. *
  26511. * @param {string} markup Markup that renders into an element.
  26512. * @param {number} toIndex Destination index.
  26513. * @private
  26514. */
  26515. function makeInsertMarkup(markup, afterNode, toIndex) {
  26516. // NOTE: Null values reduce hidden classes.
  26517. return {
  26518. type: 'INSERT_MARKUP',
  26519. content: markup,
  26520. fromIndex: null,
  26521. fromNode: null,
  26522. toIndex: toIndex,
  26523. afterNode: afterNode
  26524. };
  26525. }
  26526. /**
  26527. * Make an update for moving an existing element to another index.
  26528. *
  26529. * @param {number} fromIndex Source index of the existing element.
  26530. * @param {number} toIndex Destination index of the element.
  26531. * @private
  26532. */
  26533. function makeMove(child, afterNode, toIndex) {
  26534. // NOTE: Null values reduce hidden classes.
  26535. return {
  26536. type: 'MOVE_EXISTING',
  26537. content: null,
  26538. fromIndex: child._mountIndex,
  26539. fromNode: ReactReconciler.getHostNode(child),
  26540. toIndex: toIndex,
  26541. afterNode: afterNode
  26542. };
  26543. }
  26544. /**
  26545. * Make an update for removing an element at an index.
  26546. *
  26547. * @param {number} fromIndex Index of the element to remove.
  26548. * @private
  26549. */
  26550. function makeRemove(child, node) {
  26551. // NOTE: Null values reduce hidden classes.
  26552. return {
  26553. type: 'REMOVE_NODE',
  26554. content: null,
  26555. fromIndex: child._mountIndex,
  26556. fromNode: node,
  26557. toIndex: null,
  26558. afterNode: null
  26559. };
  26560. }
  26561. /**
  26562. * Make an update for setting the markup of a node.
  26563. *
  26564. * @param {string} markup Markup that renders into an element.
  26565. * @private
  26566. */
  26567. function makeSetMarkup(markup) {
  26568. // NOTE: Null values reduce hidden classes.
  26569. return {
  26570. type: 'SET_MARKUP',
  26571. content: markup,
  26572. fromIndex: null,
  26573. fromNode: null,
  26574. toIndex: null,
  26575. afterNode: null
  26576. };
  26577. }
  26578. /**
  26579. * Make an update for setting the text content.
  26580. *
  26581. * @param {string} textContent Text content to set.
  26582. * @private
  26583. */
  26584. function makeTextContent(textContent) {
  26585. // NOTE: Null values reduce hidden classes.
  26586. return {
  26587. type: 'TEXT_CONTENT',
  26588. content: textContent,
  26589. fromIndex: null,
  26590. fromNode: null,
  26591. toIndex: null,
  26592. afterNode: null
  26593. };
  26594. }
  26595. /**
  26596. * Push an update, if any, onto the queue. Creates a new queue if none is
  26597. * passed and always returns the queue. Mutative.
  26598. */
  26599. function enqueue(queue, update) {
  26600. if (update) {
  26601. queue = queue || [];
  26602. queue.push(update);
  26603. }
  26604. return queue;
  26605. }
  26606. /**
  26607. * Processes any enqueued updates.
  26608. *
  26609. * @private
  26610. */
  26611. function processQueue(inst, updateQueue) {
  26612. ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
  26613. }
  26614. var setChildrenForInstrumentation = emptyFunction;
  26615. if (false) {
  26616. var getDebugID = function (inst) {
  26617. if (!inst._debugID) {
  26618. // Check for ART-like instances. TODO: This is silly/gross.
  26619. var internal;
  26620. if (internal = ReactInstanceMap.get(inst)) {
  26621. inst = internal;
  26622. }
  26623. }
  26624. return inst._debugID;
  26625. };
  26626. setChildrenForInstrumentation = function (children) {
  26627. var debugID = getDebugID(this);
  26628. // TODO: React Native empty components are also multichild.
  26629. // This means they still get into this method but don't have _debugID.
  26630. if (debugID !== 0) {
  26631. ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
  26632. return children[key]._debugID;
  26633. }) : []);
  26634. }
  26635. };
  26636. }
  26637. /**
  26638. * ReactMultiChild are capable of reconciling multiple children.
  26639. *
  26640. * @class ReactMultiChild
  26641. * @internal
  26642. */
  26643. var ReactMultiChild = {
  26644. /**
  26645. * Provides common functionality for components that must reconcile multiple
  26646. * children. This is used by `ReactDOMComponent` to mount, update, and
  26647. * unmount child components.
  26648. *
  26649. * @lends {ReactMultiChild.prototype}
  26650. */
  26651. Mixin: {
  26652. _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
  26653. if (false) {
  26654. var selfDebugID = getDebugID(this);
  26655. if (this._currentElement) {
  26656. try {
  26657. ReactCurrentOwner.current = this._currentElement._owner;
  26658. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
  26659. } finally {
  26660. ReactCurrentOwner.current = null;
  26661. }
  26662. }
  26663. }
  26664. return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
  26665. },
  26666. _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
  26667. var nextChildren;
  26668. var selfDebugID = 0;
  26669. if (false) {
  26670. selfDebugID = getDebugID(this);
  26671. if (this._currentElement) {
  26672. try {
  26673. ReactCurrentOwner.current = this._currentElement._owner;
  26674. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  26675. } finally {
  26676. ReactCurrentOwner.current = null;
  26677. }
  26678. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26679. return nextChildren;
  26680. }
  26681. }
  26682. nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
  26683. ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26684. return nextChildren;
  26685. },
  26686. /**
  26687. * Generates a "mount image" for each of the supplied children. In the case
  26688. * of `ReactDOMComponent`, a mount image is a string of markup.
  26689. *
  26690. * @param {?object} nestedChildren Nested child maps.
  26691. * @return {array} An array of mounted representations.
  26692. * @internal
  26693. */
  26694. mountChildren: function (nestedChildren, transaction, context) {
  26695. var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
  26696. this._renderedChildren = children;
  26697. var mountImages = [];
  26698. var index = 0;
  26699. for (var name in children) {
  26700. if (children.hasOwnProperty(name)) {
  26701. var child = children[name];
  26702. var selfDebugID = 0;
  26703. if (false) {
  26704. selfDebugID = getDebugID(this);
  26705. }
  26706. var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
  26707. child._mountIndex = index++;
  26708. mountImages.push(mountImage);
  26709. }
  26710. }
  26711. if (false) {
  26712. setChildrenForInstrumentation.call(this, children);
  26713. }
  26714. return mountImages;
  26715. },
  26716. /**
  26717. * Replaces any rendered children with a text content string.
  26718. *
  26719. * @param {string} nextContent String of content.
  26720. * @internal
  26721. */
  26722. updateTextContent: function (nextContent) {
  26723. var prevChildren = this._renderedChildren;
  26724. // Remove any rendered children.
  26725. ReactChildReconciler.unmountChildren(prevChildren, false);
  26726. for (var name in prevChildren) {
  26727. if (prevChildren.hasOwnProperty(name)) {
  26728. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  26729. }
  26730. }
  26731. // Set new text content.
  26732. var updates = [makeTextContent(nextContent)];
  26733. processQueue(this, updates);
  26734. },
  26735. /**
  26736. * Replaces any rendered children with a markup string.
  26737. *
  26738. * @param {string} nextMarkup String of markup.
  26739. * @internal
  26740. */
  26741. updateMarkup: function (nextMarkup) {
  26742. var prevChildren = this._renderedChildren;
  26743. // Remove any rendered children.
  26744. ReactChildReconciler.unmountChildren(prevChildren, false);
  26745. for (var name in prevChildren) {
  26746. if (prevChildren.hasOwnProperty(name)) {
  26747. true ? false ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
  26748. }
  26749. }
  26750. var updates = [makeSetMarkup(nextMarkup)];
  26751. processQueue(this, updates);
  26752. },
  26753. /**
  26754. * Updates the rendered children with new children.
  26755. *
  26756. * @param {?object} nextNestedChildrenElements Nested child element maps.
  26757. * @param {ReactReconcileTransaction} transaction
  26758. * @internal
  26759. */
  26760. updateChildren: function (nextNestedChildrenElements, transaction, context) {
  26761. // Hook used by React ART
  26762. this._updateChildren(nextNestedChildrenElements, transaction, context);
  26763. },
  26764. /**
  26765. * @param {?object} nextNestedChildrenElements Nested child element maps.
  26766. * @param {ReactReconcileTransaction} transaction
  26767. * @final
  26768. * @protected
  26769. */
  26770. _updateChildren: function (nextNestedChildrenElements, transaction, context) {
  26771. var prevChildren = this._renderedChildren;
  26772. var removedNodes = {};
  26773. var mountImages = [];
  26774. var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context);
  26775. if (!nextChildren && !prevChildren) {
  26776. return;
  26777. }
  26778. var updates = null;
  26779. var name;
  26780. // `nextIndex` will increment for each child in `nextChildren`, but
  26781. // `lastIndex` will be the last index visited in `prevChildren`.
  26782. var nextIndex = 0;
  26783. var lastIndex = 0;
  26784. // `nextMountIndex` will increment for each newly mounted child.
  26785. var nextMountIndex = 0;
  26786. var lastPlacedNode = null;
  26787. for (name in nextChildren) {
  26788. if (!nextChildren.hasOwnProperty(name)) {
  26789. continue;
  26790. }
  26791. var prevChild = prevChildren && prevChildren[name];
  26792. var nextChild = nextChildren[name];
  26793. if (prevChild === nextChild) {
  26794. updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
  26795. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  26796. prevChild._mountIndex = nextIndex;
  26797. } else {
  26798. if (prevChild) {
  26799. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  26800. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  26801. // The `removedNodes` loop below will actually remove the child.
  26802. }
  26803. // The child must be instantiated before it's mounted.
  26804. updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context));
  26805. nextMountIndex++;
  26806. }
  26807. nextIndex++;
  26808. lastPlacedNode = ReactReconciler.getHostNode(nextChild);
  26809. }
  26810. // Remove children that are no longer present.
  26811. for (name in removedNodes) {
  26812. if (removedNodes.hasOwnProperty(name)) {
  26813. updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
  26814. }
  26815. }
  26816. if (updates) {
  26817. processQueue(this, updates);
  26818. }
  26819. this._renderedChildren = nextChildren;
  26820. if (false) {
  26821. setChildrenForInstrumentation.call(this, nextChildren);
  26822. }
  26823. },
  26824. /**
  26825. * Unmounts all rendered children. This should be used to clean up children
  26826. * when this component is unmounted. It does not actually perform any
  26827. * backend operations.
  26828. *
  26829. * @internal
  26830. */
  26831. unmountChildren: function (safely) {
  26832. var renderedChildren = this._renderedChildren;
  26833. ReactChildReconciler.unmountChildren(renderedChildren, safely);
  26834. this._renderedChildren = null;
  26835. },
  26836. /**
  26837. * Moves a child component to the supplied index.
  26838. *
  26839. * @param {ReactComponent} child Component to move.
  26840. * @param {number} toIndex Destination index of the element.
  26841. * @param {number} lastIndex Last index visited of the siblings of `child`.
  26842. * @protected
  26843. */
  26844. moveChild: function (child, afterNode, toIndex, lastIndex) {
  26845. // If the index of `child` is less than `lastIndex`, then it needs to
  26846. // be moved. Otherwise, we do not need to move it because a child will be
  26847. // inserted or moved before `child`.
  26848. if (child._mountIndex < lastIndex) {
  26849. return makeMove(child, afterNode, toIndex);
  26850. }
  26851. },
  26852. /**
  26853. * Creates a child component.
  26854. *
  26855. * @param {ReactComponent} child Component to create.
  26856. * @param {string} mountImage Markup to insert.
  26857. * @protected
  26858. */
  26859. createChild: function (child, afterNode, mountImage) {
  26860. return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
  26861. },
  26862. /**
  26863. * Removes a child component.
  26864. *
  26865. * @param {ReactComponent} child Child to remove.
  26866. * @protected
  26867. */
  26868. removeChild: function (child, node) {
  26869. return makeRemove(child, node);
  26870. },
  26871. /**
  26872. * Mounts a child with the supplied name.
  26873. *
  26874. * NOTE: This is part of `updateChildren` and is here for readability.
  26875. *
  26876. * @param {ReactComponent} child Component to mount.
  26877. * @param {string} name Name of the child.
  26878. * @param {number} index Index at which to insert the child.
  26879. * @param {ReactReconcileTransaction} transaction
  26880. * @private
  26881. */
  26882. _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) {
  26883. child._mountIndex = index;
  26884. return this.createChild(child, afterNode, mountImage);
  26885. },
  26886. /**
  26887. * Unmounts a rendered child.
  26888. *
  26889. * NOTE: This is part of `updateChildren` and is here for readability.
  26890. *
  26891. * @param {ReactComponent} child Component to unmount.
  26892. * @private
  26893. */
  26894. _unmountChild: function (child, node) {
  26895. var update = this.removeChild(child, node);
  26896. child._mountIndex = null;
  26897. return update;
  26898. }
  26899. }
  26900. };
  26901. module.exports = ReactMultiChild;
  26902. /***/ }),
  26903. /* 202 */
  26904. /***/ (function(module, exports, __webpack_require__) {
  26905. "use strict";
  26906. /**
  26907. * Copyright 2013-present, Facebook, Inc.
  26908. * All rights reserved.
  26909. *
  26910. * This source code is licensed under the BSD-style license found in the
  26911. * LICENSE file in the root directory of this source tree. An additional grant
  26912. * of patent rights can be found in the PATENTS file in the same directory.
  26913. *
  26914. *
  26915. */
  26916. var _prodInvariant = __webpack_require__(2);
  26917. var invariant = __webpack_require__(0);
  26918. /**
  26919. * @param {?object} object
  26920. * @return {boolean} True if `object` is a valid owner.
  26921. * @final
  26922. */
  26923. function isValidOwner(object) {
  26924. return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
  26925. }
  26926. /**
  26927. * ReactOwners are capable of storing references to owned components.
  26928. *
  26929. * All components are capable of //being// referenced by owner components, but
  26930. * only ReactOwner components are capable of //referencing// owned components.
  26931. * The named reference is known as a "ref".
  26932. *
  26933. * Refs are available when mounted and updated during reconciliation.
  26934. *
  26935. * var MyComponent = React.createClass({
  26936. * render: function() {
  26937. * return (
  26938. * <div onClick={this.handleClick}>
  26939. * <CustomComponent ref="custom" />
  26940. * </div>
  26941. * );
  26942. * },
  26943. * handleClick: function() {
  26944. * this.refs.custom.handleClick();
  26945. * },
  26946. * componentDidMount: function() {
  26947. * this.refs.custom.initialize();
  26948. * }
  26949. * });
  26950. *
  26951. * Refs should rarely be used. When refs are used, they should only be done to
  26952. * control data that is not handled by React's data flow.
  26953. *
  26954. * @class ReactOwner
  26955. */
  26956. var ReactOwner = {
  26957. /**
  26958. * Adds a component by ref to an owner component.
  26959. *
  26960. * @param {ReactComponent} component Component to reference.
  26961. * @param {string} ref Name by which to refer to the component.
  26962. * @param {ReactOwner} owner Component on which to record the ref.
  26963. * @final
  26964. * @internal
  26965. */
  26966. addComponentAsRefTo: function (component, ref, owner) {
  26967. !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;
  26968. owner.attachRef(ref, component);
  26969. },
  26970. /**
  26971. * Removes a component by ref from an owner component.
  26972. *
  26973. * @param {ReactComponent} component Component to dereference.
  26974. * @param {string} ref Name of the ref to remove.
  26975. * @param {ReactOwner} owner Component on which the ref is recorded.
  26976. * @final
  26977. * @internal
  26978. */
  26979. removeComponentAsRefFrom: function (component, ref, owner) {
  26980. !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;
  26981. var ownerPublicInstance = owner.getPublicInstance();
  26982. // Check that `component`'s owner is still alive and that `component` is still the current ref
  26983. // because we do not want to detach the ref if another component stole it.
  26984. if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
  26985. owner.detachRef(ref);
  26986. }
  26987. }
  26988. };
  26989. module.exports = ReactOwner;
  26990. /***/ }),
  26991. /* 203 */
  26992. /***/ (function(module, exports, __webpack_require__) {
  26993. "use strict";
  26994. /**
  26995. * Copyright 2013-present, Facebook, Inc.
  26996. * All rights reserved.
  26997. *
  26998. * This source code is licensed under the BSD-style license found in the
  26999. * LICENSE file in the root directory of this source tree. An additional grant
  27000. * of patent rights can be found in the PATENTS file in the same directory.
  27001. *
  27002. *
  27003. */
  27004. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  27005. module.exports = ReactPropTypesSecret;
  27006. /***/ }),
  27007. /* 204 */
  27008. /***/ (function(module, exports, __webpack_require__) {
  27009. "use strict";
  27010. /**
  27011. * Copyright 2013-present, Facebook, Inc.
  27012. * All rights reserved.
  27013. *
  27014. * This source code is licensed under the BSD-style license found in the
  27015. * LICENSE file in the root directory of this source tree. An additional grant
  27016. * of patent rights can be found in the PATENTS file in the same directory.
  27017. *
  27018. */
  27019. var _assign = __webpack_require__(3);
  27020. var CallbackQueue = __webpack_require__(79);
  27021. var PooledClass = __webpack_require__(15);
  27022. var ReactBrowserEventEmitter = __webpack_require__(31);
  27023. var ReactInputSelection = __webpack_require__(86);
  27024. var ReactInstrumentation = __webpack_require__(11);
  27025. var Transaction = __webpack_require__(33);
  27026. var ReactUpdateQueue = __webpack_require__(58);
  27027. /**
  27028. * Ensures that, when possible, the selection range (currently selected text
  27029. * input) is not disturbed by performing the transaction.
  27030. */
  27031. var SELECTION_RESTORATION = {
  27032. /**
  27033. * @return {Selection} Selection information.
  27034. */
  27035. initialize: ReactInputSelection.getSelectionInformation,
  27036. /**
  27037. * @param {Selection} sel Selection information returned from `initialize`.
  27038. */
  27039. close: ReactInputSelection.restoreSelection
  27040. };
  27041. /**
  27042. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  27043. * high level DOM manipulations (like temporarily removing a text input from the
  27044. * DOM).
  27045. */
  27046. var EVENT_SUPPRESSION = {
  27047. /**
  27048. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  27049. * the reconciliation.
  27050. */
  27051. initialize: function () {
  27052. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  27053. ReactBrowserEventEmitter.setEnabled(false);
  27054. return currentlyEnabled;
  27055. },
  27056. /**
  27057. * @param {boolean} previouslyEnabled Enabled status of
  27058. * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
  27059. * restores the previous value.
  27060. */
  27061. close: function (previouslyEnabled) {
  27062. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  27063. }
  27064. };
  27065. /**
  27066. * Provides a queue for collecting `componentDidMount` and
  27067. * `componentDidUpdate` callbacks during the transaction.
  27068. */
  27069. var ON_DOM_READY_QUEUEING = {
  27070. /**
  27071. * Initializes the internal `onDOMReady` queue.
  27072. */
  27073. initialize: function () {
  27074. this.reactMountReady.reset();
  27075. },
  27076. /**
  27077. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  27078. */
  27079. close: function () {
  27080. this.reactMountReady.notifyAll();
  27081. }
  27082. };
  27083. /**
  27084. * Executed within the scope of the `Transaction` instance. Consider these as
  27085. * being member methods, but with an implied ordering while being isolated from
  27086. * each other.
  27087. */
  27088. var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
  27089. if (false) {
  27090. TRANSACTION_WRAPPERS.push({
  27091. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  27092. close: ReactInstrumentation.debugTool.onEndFlush
  27093. });
  27094. }
  27095. /**
  27096. * Currently:
  27097. * - The order that these are listed in the transaction is critical:
  27098. * - Suppresses events.
  27099. * - Restores selection range.
  27100. *
  27101. * Future:
  27102. * - Restore document/overflow scroll positions that were unintentionally
  27103. * modified via DOM insertions above the top viewport boundary.
  27104. * - Implement/integrate with customized constraint based layout system and keep
  27105. * track of which dimensions must be remeasured.
  27106. *
  27107. * @class ReactReconcileTransaction
  27108. */
  27109. function ReactReconcileTransaction(useCreateElement) {
  27110. this.reinitializeTransaction();
  27111. // Only server-side rendering really needs this option (see
  27112. // `ReactServerRendering`), but server-side uses
  27113. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  27114. // accessible and defaults to false when `ReactDOMComponent` and
  27115. // `ReactDOMTextComponent` checks it in `mountComponent`.`
  27116. this.renderToStaticMarkup = false;
  27117. this.reactMountReady = CallbackQueue.getPooled(null);
  27118. this.useCreateElement = useCreateElement;
  27119. }
  27120. var Mixin = {
  27121. /**
  27122. * @see Transaction
  27123. * @abstract
  27124. * @final
  27125. * @return {array<object>} List of operation wrap procedures.
  27126. * TODO: convert to array<TransactionWrapper>
  27127. */
  27128. getTransactionWrappers: function () {
  27129. return TRANSACTION_WRAPPERS;
  27130. },
  27131. /**
  27132. * @return {object} The queue to collect `onDOMReady` callbacks with.
  27133. */
  27134. getReactMountReady: function () {
  27135. return this.reactMountReady;
  27136. },
  27137. /**
  27138. * @return {object} The queue to collect React async events.
  27139. */
  27140. getUpdateQueue: function () {
  27141. return ReactUpdateQueue;
  27142. },
  27143. /**
  27144. * Save current transaction state -- if the return value from this method is
  27145. * passed to `rollback`, the transaction will be reset to that state.
  27146. */
  27147. checkpoint: function () {
  27148. // reactMountReady is the our only stateful wrapper
  27149. return this.reactMountReady.checkpoint();
  27150. },
  27151. rollback: function (checkpoint) {
  27152. this.reactMountReady.rollback(checkpoint);
  27153. },
  27154. /**
  27155. * `PooledClass` looks for this, and will invoke this before allowing this
  27156. * instance to be reused.
  27157. */
  27158. destructor: function () {
  27159. CallbackQueue.release(this.reactMountReady);
  27160. this.reactMountReady = null;
  27161. }
  27162. };
  27163. _assign(ReactReconcileTransaction.prototype, Transaction, Mixin);
  27164. PooledClass.addPoolingTo(ReactReconcileTransaction);
  27165. module.exports = ReactReconcileTransaction;
  27166. /***/ }),
  27167. /* 205 */
  27168. /***/ (function(module, exports, __webpack_require__) {
  27169. "use strict";
  27170. /**
  27171. * Copyright 2013-present, Facebook, Inc.
  27172. * All rights reserved.
  27173. *
  27174. * This source code is licensed under the BSD-style license found in the
  27175. * LICENSE file in the root directory of this source tree. An additional grant
  27176. * of patent rights can be found in the PATENTS file in the same directory.
  27177. *
  27178. *
  27179. */
  27180. var ReactOwner = __webpack_require__(202);
  27181. var ReactRef = {};
  27182. function attachRef(ref, component, owner) {
  27183. if (typeof ref === 'function') {
  27184. ref(component.getPublicInstance());
  27185. } else {
  27186. // Legacy ref
  27187. ReactOwner.addComponentAsRefTo(component, ref, owner);
  27188. }
  27189. }
  27190. function detachRef(ref, component, owner) {
  27191. if (typeof ref === 'function') {
  27192. ref(null);
  27193. } else {
  27194. // Legacy ref
  27195. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  27196. }
  27197. }
  27198. ReactRef.attachRefs = function (instance, element) {
  27199. if (element === null || typeof element !== 'object') {
  27200. return;
  27201. }
  27202. var ref = element.ref;
  27203. if (ref != null) {
  27204. attachRef(ref, instance, element._owner);
  27205. }
  27206. };
  27207. ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
  27208. // If either the owner or a `ref` has changed, make sure the newest owner
  27209. // has stored a reference to `this`, and the previous owner (if different)
  27210. // has forgotten the reference to `this`. We use the element instead
  27211. // of the public this.props because the post processing cannot determine
  27212. // a ref. The ref conceptually lives on the element.
  27213. // TODO: Should this even be possible? The owner cannot change because
  27214. // it's forbidden by shouldUpdateReactComponent. The ref can change
  27215. // if you swap the keys of but not the refs. Reconsider where this check
  27216. // is made. It probably belongs where the key checking and
  27217. // instantiateReactComponent is done.
  27218. var prevRef = null;
  27219. var prevOwner = null;
  27220. if (prevElement !== null && typeof prevElement === 'object') {
  27221. prevRef = prevElement.ref;
  27222. prevOwner = prevElement._owner;
  27223. }
  27224. var nextRef = null;
  27225. var nextOwner = null;
  27226. if (nextElement !== null && typeof nextElement === 'object') {
  27227. nextRef = nextElement.ref;
  27228. nextOwner = nextElement._owner;
  27229. }
  27230. return prevRef !== nextRef ||
  27231. // If owner changes but we have an unchanged function ref, don't update refs
  27232. typeof nextRef === 'string' && nextOwner !== prevOwner;
  27233. };
  27234. ReactRef.detachRefs = function (instance, element) {
  27235. if (element === null || typeof element !== 'object') {
  27236. return;
  27237. }
  27238. var ref = element.ref;
  27239. if (ref != null) {
  27240. detachRef(ref, instance, element._owner);
  27241. }
  27242. };
  27243. module.exports = ReactRef;
  27244. /***/ }),
  27245. /* 206 */
  27246. /***/ (function(module, exports, __webpack_require__) {
  27247. "use strict";
  27248. /**
  27249. * Copyright 2014-present, Facebook, Inc.
  27250. * All rights reserved.
  27251. *
  27252. * This source code is licensed under the BSD-style license found in the
  27253. * LICENSE file in the root directory of this source tree. An additional grant
  27254. * of patent rights can be found in the PATENTS file in the same directory.
  27255. *
  27256. */
  27257. var _assign = __webpack_require__(3);
  27258. var PooledClass = __webpack_require__(15);
  27259. var Transaction = __webpack_require__(33);
  27260. var ReactInstrumentation = __webpack_require__(11);
  27261. var ReactServerUpdateQueue = __webpack_require__(207);
  27262. /**
  27263. * Executed within the scope of the `Transaction` instance. Consider these as
  27264. * being member methods, but with an implied ordering while being isolated from
  27265. * each other.
  27266. */
  27267. var TRANSACTION_WRAPPERS = [];
  27268. if (false) {
  27269. TRANSACTION_WRAPPERS.push({
  27270. initialize: ReactInstrumentation.debugTool.onBeginFlush,
  27271. close: ReactInstrumentation.debugTool.onEndFlush
  27272. });
  27273. }
  27274. var noopCallbackQueue = {
  27275. enqueue: function () {}
  27276. };
  27277. /**
  27278. * @class ReactServerRenderingTransaction
  27279. * @param {boolean} renderToStaticMarkup
  27280. */
  27281. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  27282. this.reinitializeTransaction();
  27283. this.renderToStaticMarkup = renderToStaticMarkup;
  27284. this.useCreateElement = false;
  27285. this.updateQueue = new ReactServerUpdateQueue(this);
  27286. }
  27287. var Mixin = {
  27288. /**
  27289. * @see Transaction
  27290. * @abstract
  27291. * @final
  27292. * @return {array} Empty list of operation wrap procedures.
  27293. */
  27294. getTransactionWrappers: function () {
  27295. return TRANSACTION_WRAPPERS;
  27296. },
  27297. /**
  27298. * @return {object} The queue to collect `onDOMReady` callbacks with.
  27299. */
  27300. getReactMountReady: function () {
  27301. return noopCallbackQueue;
  27302. },
  27303. /**
  27304. * @return {object} The queue to collect React async events.
  27305. */
  27306. getUpdateQueue: function () {
  27307. return this.updateQueue;
  27308. },
  27309. /**
  27310. * `PooledClass` looks for this, and will invoke this before allowing this
  27311. * instance to be reused.
  27312. */
  27313. destructor: function () {},
  27314. checkpoint: function () {},
  27315. rollback: function () {}
  27316. };
  27317. _assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin);
  27318. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  27319. module.exports = ReactServerRenderingTransaction;
  27320. /***/ }),
  27321. /* 207 */
  27322. /***/ (function(module, exports, __webpack_require__) {
  27323. "use strict";
  27324. /**
  27325. * Copyright 2015-present, Facebook, Inc.
  27326. * All rights reserved.
  27327. *
  27328. * This source code is licensed under the BSD-style license found in the
  27329. * LICENSE file in the root directory of this source tree. An additional grant
  27330. * of patent rights can be found in the PATENTS file in the same directory.
  27331. *
  27332. *
  27333. */
  27334. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  27335. var ReactUpdateQueue = __webpack_require__(58);
  27336. var warning = __webpack_require__(1);
  27337. function warnNoop(publicInstance, callerName) {
  27338. if (false) {
  27339. var constructor = publicInstance.constructor;
  27340. 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;
  27341. }
  27342. }
  27343. /**
  27344. * This is the update queue used for server rendering.
  27345. * It delegates to ReactUpdateQueue while server rendering is in progress and
  27346. * switches to ReactNoopUpdateQueue after the transaction has completed.
  27347. * @class ReactServerUpdateQueue
  27348. * @param {Transaction} transaction
  27349. */
  27350. var ReactServerUpdateQueue = function () {
  27351. function ReactServerUpdateQueue(transaction) {
  27352. _classCallCheck(this, ReactServerUpdateQueue);
  27353. this.transaction = transaction;
  27354. }
  27355. /**
  27356. * Checks whether or not this composite component is mounted.
  27357. * @param {ReactClass} publicInstance The instance we want to test.
  27358. * @return {boolean} True if mounted, false otherwise.
  27359. * @protected
  27360. * @final
  27361. */
  27362. ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
  27363. return false;
  27364. };
  27365. /**
  27366. * Enqueue a callback that will be executed after all the pending updates
  27367. * have processed.
  27368. *
  27369. * @param {ReactClass} publicInstance The instance to use as `this` context.
  27370. * @param {?function} callback Called after state is updated.
  27371. * @internal
  27372. */
  27373. ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
  27374. if (this.transaction.isInTransaction()) {
  27375. ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
  27376. }
  27377. };
  27378. /**
  27379. * Forces an update. This should only be invoked when it is known with
  27380. * certainty that we are **not** in a DOM transaction.
  27381. *
  27382. * You may want to call this when you know that some deeper aspect of the
  27383. * component's state has changed but `setState` was not called.
  27384. *
  27385. * This will not invoke `shouldComponentUpdate`, but it will invoke
  27386. * `componentWillUpdate` and `componentDidUpdate`.
  27387. *
  27388. * @param {ReactClass} publicInstance The instance that should rerender.
  27389. * @internal
  27390. */
  27391. ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
  27392. if (this.transaction.isInTransaction()) {
  27393. ReactUpdateQueue.enqueueForceUpdate(publicInstance);
  27394. } else {
  27395. warnNoop(publicInstance, 'forceUpdate');
  27396. }
  27397. };
  27398. /**
  27399. * Replaces all of the state. Always use this or `setState` to mutate state.
  27400. * You should treat `this.state` as immutable.
  27401. *
  27402. * There is no guarantee that `this.state` will be immediately updated, so
  27403. * accessing `this.state` after calling this method may return the old value.
  27404. *
  27405. * @param {ReactClass} publicInstance The instance that should rerender.
  27406. * @param {object|function} completeState Next state.
  27407. * @internal
  27408. */
  27409. ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
  27410. if (this.transaction.isInTransaction()) {
  27411. ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
  27412. } else {
  27413. warnNoop(publicInstance, 'replaceState');
  27414. }
  27415. };
  27416. /**
  27417. * Sets a subset of the state. This only exists because _pendingState is
  27418. * internal. This provides a merging strategy that is not available to deep
  27419. * properties which is confusing. TODO: Expose pendingState or don't use it
  27420. * during the merge.
  27421. *
  27422. * @param {ReactClass} publicInstance The instance that should rerender.
  27423. * @param {object|function} partialState Next partial state to be merged with state.
  27424. * @internal
  27425. */
  27426. ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
  27427. if (this.transaction.isInTransaction()) {
  27428. ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
  27429. } else {
  27430. warnNoop(publicInstance, 'setState');
  27431. }
  27432. };
  27433. return ReactServerUpdateQueue;
  27434. }();
  27435. module.exports = ReactServerUpdateQueue;
  27436. /***/ }),
  27437. /* 208 */
  27438. /***/ (function(module, exports, __webpack_require__) {
  27439. "use strict";
  27440. /**
  27441. * Copyright 2013-present, Facebook, Inc.
  27442. * All rights reserved.
  27443. *
  27444. * This source code is licensed under the BSD-style license found in the
  27445. * LICENSE file in the root directory of this source tree. An additional grant
  27446. * of patent rights can be found in the PATENTS file in the same directory.
  27447. *
  27448. */
  27449. module.exports = '15.4.2';
  27450. /***/ }),
  27451. /* 209 */
  27452. /***/ (function(module, exports, __webpack_require__) {
  27453. "use strict";
  27454. /**
  27455. * Copyright 2013-present, Facebook, Inc.
  27456. * All rights reserved.
  27457. *
  27458. * This source code is licensed under the BSD-style license found in the
  27459. * LICENSE file in the root directory of this source tree. An additional grant
  27460. * of patent rights can be found in the PATENTS file in the same directory.
  27461. *
  27462. */
  27463. var NS = {
  27464. xlink: 'http://www.w3.org/1999/xlink',
  27465. xml: 'http://www.w3.org/XML/1998/namespace'
  27466. };
  27467. // We use attributes for everything SVG so let's avoid some duplication and run
  27468. // code instead.
  27469. // The following are all specified in the HTML config already so we exclude here.
  27470. // - class (as className)
  27471. // - color
  27472. // - height
  27473. // - id
  27474. // - lang
  27475. // - max
  27476. // - media
  27477. // - method
  27478. // - min
  27479. // - name
  27480. // - style
  27481. // - target
  27482. // - type
  27483. // - width
  27484. var ATTRS = {
  27485. accentHeight: 'accent-height',
  27486. accumulate: 0,
  27487. additive: 0,
  27488. alignmentBaseline: 'alignment-baseline',
  27489. allowReorder: 'allowReorder',
  27490. alphabetic: 0,
  27491. amplitude: 0,
  27492. arabicForm: 'arabic-form',
  27493. ascent: 0,
  27494. attributeName: 'attributeName',
  27495. attributeType: 'attributeType',
  27496. autoReverse: 'autoReverse',
  27497. azimuth: 0,
  27498. baseFrequency: 'baseFrequency',
  27499. baseProfile: 'baseProfile',
  27500. baselineShift: 'baseline-shift',
  27501. bbox: 0,
  27502. begin: 0,
  27503. bias: 0,
  27504. by: 0,
  27505. calcMode: 'calcMode',
  27506. capHeight: 'cap-height',
  27507. clip: 0,
  27508. clipPath: 'clip-path',
  27509. clipRule: 'clip-rule',
  27510. clipPathUnits: 'clipPathUnits',
  27511. colorInterpolation: 'color-interpolation',
  27512. colorInterpolationFilters: 'color-interpolation-filters',
  27513. colorProfile: 'color-profile',
  27514. colorRendering: 'color-rendering',
  27515. contentScriptType: 'contentScriptType',
  27516. contentStyleType: 'contentStyleType',
  27517. cursor: 0,
  27518. cx: 0,
  27519. cy: 0,
  27520. d: 0,
  27521. decelerate: 0,
  27522. descent: 0,
  27523. diffuseConstant: 'diffuseConstant',
  27524. direction: 0,
  27525. display: 0,
  27526. divisor: 0,
  27527. dominantBaseline: 'dominant-baseline',
  27528. dur: 0,
  27529. dx: 0,
  27530. dy: 0,
  27531. edgeMode: 'edgeMode',
  27532. elevation: 0,
  27533. enableBackground: 'enable-background',
  27534. end: 0,
  27535. exponent: 0,
  27536. externalResourcesRequired: 'externalResourcesRequired',
  27537. fill: 0,
  27538. fillOpacity: 'fill-opacity',
  27539. fillRule: 'fill-rule',
  27540. filter: 0,
  27541. filterRes: 'filterRes',
  27542. filterUnits: 'filterUnits',
  27543. floodColor: 'flood-color',
  27544. floodOpacity: 'flood-opacity',
  27545. focusable: 0,
  27546. fontFamily: 'font-family',
  27547. fontSize: 'font-size',
  27548. fontSizeAdjust: 'font-size-adjust',
  27549. fontStretch: 'font-stretch',
  27550. fontStyle: 'font-style',
  27551. fontVariant: 'font-variant',
  27552. fontWeight: 'font-weight',
  27553. format: 0,
  27554. from: 0,
  27555. fx: 0,
  27556. fy: 0,
  27557. g1: 0,
  27558. g2: 0,
  27559. glyphName: 'glyph-name',
  27560. glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  27561. glyphOrientationVertical: 'glyph-orientation-vertical',
  27562. glyphRef: 'glyphRef',
  27563. gradientTransform: 'gradientTransform',
  27564. gradientUnits: 'gradientUnits',
  27565. hanging: 0,
  27566. horizAdvX: 'horiz-adv-x',
  27567. horizOriginX: 'horiz-origin-x',
  27568. ideographic: 0,
  27569. imageRendering: 'image-rendering',
  27570. 'in': 0,
  27571. in2: 0,
  27572. intercept: 0,
  27573. k: 0,
  27574. k1: 0,
  27575. k2: 0,
  27576. k3: 0,
  27577. k4: 0,
  27578. kernelMatrix: 'kernelMatrix',
  27579. kernelUnitLength: 'kernelUnitLength',
  27580. kerning: 0,
  27581. keyPoints: 'keyPoints',
  27582. keySplines: 'keySplines',
  27583. keyTimes: 'keyTimes',
  27584. lengthAdjust: 'lengthAdjust',
  27585. letterSpacing: 'letter-spacing',
  27586. lightingColor: 'lighting-color',
  27587. limitingConeAngle: 'limitingConeAngle',
  27588. local: 0,
  27589. markerEnd: 'marker-end',
  27590. markerMid: 'marker-mid',
  27591. markerStart: 'marker-start',
  27592. markerHeight: 'markerHeight',
  27593. markerUnits: 'markerUnits',
  27594. markerWidth: 'markerWidth',
  27595. mask: 0,
  27596. maskContentUnits: 'maskContentUnits',
  27597. maskUnits: 'maskUnits',
  27598. mathematical: 0,
  27599. mode: 0,
  27600. numOctaves: 'numOctaves',
  27601. offset: 0,
  27602. opacity: 0,
  27603. operator: 0,
  27604. order: 0,
  27605. orient: 0,
  27606. orientation: 0,
  27607. origin: 0,
  27608. overflow: 0,
  27609. overlinePosition: 'overline-position',
  27610. overlineThickness: 'overline-thickness',
  27611. paintOrder: 'paint-order',
  27612. panose1: 'panose-1',
  27613. pathLength: 'pathLength',
  27614. patternContentUnits: 'patternContentUnits',
  27615. patternTransform: 'patternTransform',
  27616. patternUnits: 'patternUnits',
  27617. pointerEvents: 'pointer-events',
  27618. points: 0,
  27619. pointsAtX: 'pointsAtX',
  27620. pointsAtY: 'pointsAtY',
  27621. pointsAtZ: 'pointsAtZ',
  27622. preserveAlpha: 'preserveAlpha',
  27623. preserveAspectRatio: 'preserveAspectRatio',
  27624. primitiveUnits: 'primitiveUnits',
  27625. r: 0,
  27626. radius: 0,
  27627. refX: 'refX',
  27628. refY: 'refY',
  27629. renderingIntent: 'rendering-intent',
  27630. repeatCount: 'repeatCount',
  27631. repeatDur: 'repeatDur',
  27632. requiredExtensions: 'requiredExtensions',
  27633. requiredFeatures: 'requiredFeatures',
  27634. restart: 0,
  27635. result: 0,
  27636. rotate: 0,
  27637. rx: 0,
  27638. ry: 0,
  27639. scale: 0,
  27640. seed: 0,
  27641. shapeRendering: 'shape-rendering',
  27642. slope: 0,
  27643. spacing: 0,
  27644. specularConstant: 'specularConstant',
  27645. specularExponent: 'specularExponent',
  27646. speed: 0,
  27647. spreadMethod: 'spreadMethod',
  27648. startOffset: 'startOffset',
  27649. stdDeviation: 'stdDeviation',
  27650. stemh: 0,
  27651. stemv: 0,
  27652. stitchTiles: 'stitchTiles',
  27653. stopColor: 'stop-color',
  27654. stopOpacity: 'stop-opacity',
  27655. strikethroughPosition: 'strikethrough-position',
  27656. strikethroughThickness: 'strikethrough-thickness',
  27657. string: 0,
  27658. stroke: 0,
  27659. strokeDasharray: 'stroke-dasharray',
  27660. strokeDashoffset: 'stroke-dashoffset',
  27661. strokeLinecap: 'stroke-linecap',
  27662. strokeLinejoin: 'stroke-linejoin',
  27663. strokeMiterlimit: 'stroke-miterlimit',
  27664. strokeOpacity: 'stroke-opacity',
  27665. strokeWidth: 'stroke-width',
  27666. surfaceScale: 'surfaceScale',
  27667. systemLanguage: 'systemLanguage',
  27668. tableValues: 'tableValues',
  27669. targetX: 'targetX',
  27670. targetY: 'targetY',
  27671. textAnchor: 'text-anchor',
  27672. textDecoration: 'text-decoration',
  27673. textRendering: 'text-rendering',
  27674. textLength: 'textLength',
  27675. to: 0,
  27676. transform: 0,
  27677. u1: 0,
  27678. u2: 0,
  27679. underlinePosition: 'underline-position',
  27680. underlineThickness: 'underline-thickness',
  27681. unicode: 0,
  27682. unicodeBidi: 'unicode-bidi',
  27683. unicodeRange: 'unicode-range',
  27684. unitsPerEm: 'units-per-em',
  27685. vAlphabetic: 'v-alphabetic',
  27686. vHanging: 'v-hanging',
  27687. vIdeographic: 'v-ideographic',
  27688. vMathematical: 'v-mathematical',
  27689. values: 0,
  27690. vectorEffect: 'vector-effect',
  27691. version: 0,
  27692. vertAdvY: 'vert-adv-y',
  27693. vertOriginX: 'vert-origin-x',
  27694. vertOriginY: 'vert-origin-y',
  27695. viewBox: 'viewBox',
  27696. viewTarget: 'viewTarget',
  27697. visibility: 0,
  27698. widths: 0,
  27699. wordSpacing: 'word-spacing',
  27700. writingMode: 'writing-mode',
  27701. x: 0,
  27702. xHeight: 'x-height',
  27703. x1: 0,
  27704. x2: 0,
  27705. xChannelSelector: 'xChannelSelector',
  27706. xlinkActuate: 'xlink:actuate',
  27707. xlinkArcrole: 'xlink:arcrole',
  27708. xlinkHref: 'xlink:href',
  27709. xlinkRole: 'xlink:role',
  27710. xlinkShow: 'xlink:show',
  27711. xlinkTitle: 'xlink:title',
  27712. xlinkType: 'xlink:type',
  27713. xmlBase: 'xml:base',
  27714. xmlns: 0,
  27715. xmlnsXlink: 'xmlns:xlink',
  27716. xmlLang: 'xml:lang',
  27717. xmlSpace: 'xml:space',
  27718. y: 0,
  27719. y1: 0,
  27720. y2: 0,
  27721. yChannelSelector: 'yChannelSelector',
  27722. z: 0,
  27723. zoomAndPan: 'zoomAndPan'
  27724. };
  27725. var SVGDOMPropertyConfig = {
  27726. Properties: {},
  27727. DOMAttributeNamespaces: {
  27728. xlinkActuate: NS.xlink,
  27729. xlinkArcrole: NS.xlink,
  27730. xlinkHref: NS.xlink,
  27731. xlinkRole: NS.xlink,
  27732. xlinkShow: NS.xlink,
  27733. xlinkTitle: NS.xlink,
  27734. xlinkType: NS.xlink,
  27735. xmlBase: NS.xml,
  27736. xmlLang: NS.xml,
  27737. xmlSpace: NS.xml
  27738. },
  27739. DOMAttributeNames: {}
  27740. };
  27741. Object.keys(ATTRS).forEach(function (key) {
  27742. SVGDOMPropertyConfig.Properties[key] = 0;
  27743. if (ATTRS[key]) {
  27744. SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  27745. }
  27746. });
  27747. module.exports = SVGDOMPropertyConfig;
  27748. /***/ }),
  27749. /* 210 */
  27750. /***/ (function(module, exports, __webpack_require__) {
  27751. "use strict";
  27752. /**
  27753. * Copyright 2013-present, Facebook, Inc.
  27754. * All rights reserved.
  27755. *
  27756. * This source code is licensed under the BSD-style license found in the
  27757. * LICENSE file in the root directory of this source tree. An additional grant
  27758. * of patent rights can be found in the PATENTS file in the same directory.
  27759. *
  27760. */
  27761. var EventPropagators = __webpack_require__(27);
  27762. var ExecutionEnvironment = __webpack_require__(9);
  27763. var ReactDOMComponentTree = __webpack_require__(5);
  27764. var ReactInputSelection = __webpack_require__(86);
  27765. var SyntheticEvent = __webpack_require__(13);
  27766. var getActiveElement = __webpack_require__(76);
  27767. var isTextInputElement = __webpack_require__(95);
  27768. var shallowEqual = __webpack_require__(49);
  27769. var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
  27770. var eventTypes = {
  27771. select: {
  27772. phasedRegistrationNames: {
  27773. bubbled: 'onSelect',
  27774. captured: 'onSelectCapture'
  27775. },
  27776. dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
  27777. }
  27778. };
  27779. var activeElement = null;
  27780. var activeElementInst = null;
  27781. var lastSelection = null;
  27782. var mouseDown = false;
  27783. // Track whether a listener exists for this plugin. If none exist, we do
  27784. // not extract events. See #3639.
  27785. var hasListener = false;
  27786. /**
  27787. * Get an object which is a unique representation of the current selection.
  27788. *
  27789. * The return value will not be consistent across nodes or browsers, but
  27790. * two identical selections on the same node will return identical objects.
  27791. *
  27792. * @param {DOMElement} node
  27793. * @return {object}
  27794. */
  27795. function getSelection(node) {
  27796. if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
  27797. return {
  27798. start: node.selectionStart,
  27799. end: node.selectionEnd
  27800. };
  27801. } else if (window.getSelection) {
  27802. var selection = window.getSelection();
  27803. return {
  27804. anchorNode: selection.anchorNode,
  27805. anchorOffset: selection.anchorOffset,
  27806. focusNode: selection.focusNode,
  27807. focusOffset: selection.focusOffset
  27808. };
  27809. } else if (document.selection) {
  27810. var range = document.selection.createRange();
  27811. return {
  27812. parentElement: range.parentElement(),
  27813. text: range.text,
  27814. top: range.boundingTop,
  27815. left: range.boundingLeft
  27816. };
  27817. }
  27818. }
  27819. /**
  27820. * Poll selection to see whether it's changed.
  27821. *
  27822. * @param {object} nativeEvent
  27823. * @return {?SyntheticEvent}
  27824. */
  27825. function constructSelectEvent(nativeEvent, nativeEventTarget) {
  27826. // Ensure we have the right element, and that the user is not dragging a
  27827. // selection (this matches native `select` event behavior). In HTML5, select
  27828. // fires only on input and textarea thus if there's no focused element we
  27829. // won't dispatch.
  27830. if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
  27831. return null;
  27832. }
  27833. // Only fire when selection has actually changed.
  27834. var currentSelection = getSelection(activeElement);
  27835. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  27836. lastSelection = currentSelection;
  27837. var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
  27838. syntheticEvent.type = 'select';
  27839. syntheticEvent.target = activeElement;
  27840. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  27841. return syntheticEvent;
  27842. }
  27843. return null;
  27844. }
  27845. /**
  27846. * This plugin creates an `onSelect` event that normalizes select events
  27847. * across form elements.
  27848. *
  27849. * Supported elements are:
  27850. * - input (see `isTextInputElement`)
  27851. * - textarea
  27852. * - contentEditable
  27853. *
  27854. * This differs from native browser implementations in the following ways:
  27855. * - Fires on contentEditable fields as well as inputs.
  27856. * - Fires for collapsed selection.
  27857. * - Fires after user input.
  27858. */
  27859. var SelectEventPlugin = {
  27860. eventTypes: eventTypes,
  27861. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  27862. if (!hasListener) {
  27863. return null;
  27864. }
  27865. var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
  27866. switch (topLevelType) {
  27867. // Track the input node that has focus.
  27868. case 'topFocus':
  27869. if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
  27870. activeElement = targetNode;
  27871. activeElementInst = targetInst;
  27872. lastSelection = null;
  27873. }
  27874. break;
  27875. case 'topBlur':
  27876. activeElement = null;
  27877. activeElementInst = null;
  27878. lastSelection = null;
  27879. break;
  27880. // Don't fire the event while the user is dragging. This matches the
  27881. // semantics of the native select event.
  27882. case 'topMouseDown':
  27883. mouseDown = true;
  27884. break;
  27885. case 'topContextMenu':
  27886. case 'topMouseUp':
  27887. mouseDown = false;
  27888. return constructSelectEvent(nativeEvent, nativeEventTarget);
  27889. // Chrome and IE fire non-standard event when selection is changed (and
  27890. // sometimes when it hasn't). IE's event fires out of order with respect
  27891. // to key and input events on deletion, so we discard it.
  27892. //
  27893. // Firefox doesn't support selectionchange, so check selection status
  27894. // after each key entry. The selection changes after keydown and before
  27895. // keyup, but we check on keydown as well in the case of holding down a
  27896. // key, when multiple keydown events are fired but only one keyup is.
  27897. // This is also our approach for IE handling, for the reason above.
  27898. case 'topSelectionChange':
  27899. if (skipSelectionChangeEvent) {
  27900. break;
  27901. }
  27902. // falls through
  27903. case 'topKeyDown':
  27904. case 'topKeyUp':
  27905. return constructSelectEvent(nativeEvent, nativeEventTarget);
  27906. }
  27907. return null;
  27908. },
  27909. didPutListener: function (inst, registrationName, listener) {
  27910. if (registrationName === 'onSelect') {
  27911. hasListener = true;
  27912. }
  27913. }
  27914. };
  27915. module.exports = SelectEventPlugin;
  27916. /***/ }),
  27917. /* 211 */
  27918. /***/ (function(module, exports, __webpack_require__) {
  27919. "use strict";
  27920. /**
  27921. * Copyright 2013-present, Facebook, Inc.
  27922. * All rights reserved.
  27923. *
  27924. * This source code is licensed under the BSD-style license found in the
  27925. * LICENSE file in the root directory of this source tree. An additional grant
  27926. * of patent rights can be found in the PATENTS file in the same directory.
  27927. *
  27928. *
  27929. */
  27930. var _prodInvariant = __webpack_require__(2);
  27931. var EventListener = __webpack_require__(74);
  27932. var EventPropagators = __webpack_require__(27);
  27933. var ReactDOMComponentTree = __webpack_require__(5);
  27934. var SyntheticAnimationEvent = __webpack_require__(212);
  27935. var SyntheticClipboardEvent = __webpack_require__(213);
  27936. var SyntheticEvent = __webpack_require__(13);
  27937. var SyntheticFocusEvent = __webpack_require__(216);
  27938. var SyntheticKeyboardEvent = __webpack_require__(218);
  27939. var SyntheticMouseEvent = __webpack_require__(32);
  27940. var SyntheticDragEvent = __webpack_require__(215);
  27941. var SyntheticTouchEvent = __webpack_require__(219);
  27942. var SyntheticTransitionEvent = __webpack_require__(220);
  27943. var SyntheticUIEvent = __webpack_require__(29);
  27944. var SyntheticWheelEvent = __webpack_require__(221);
  27945. var emptyFunction = __webpack_require__(10);
  27946. var getEventCharCode = __webpack_require__(60);
  27947. var invariant = __webpack_require__(0);
  27948. /**
  27949. * Turns
  27950. * ['abort', ...]
  27951. * into
  27952. * eventTypes = {
  27953. * 'abort': {
  27954. * phasedRegistrationNames: {
  27955. * bubbled: 'onAbort',
  27956. * captured: 'onAbortCapture',
  27957. * },
  27958. * dependencies: ['topAbort'],
  27959. * },
  27960. * ...
  27961. * };
  27962. * topLevelEventsToDispatchConfig = {
  27963. * 'topAbort': { sameConfig }
  27964. * };
  27965. */
  27966. var eventTypes = {};
  27967. var topLevelEventsToDispatchConfig = {};
  27968. ['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) {
  27969. var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
  27970. var onEvent = 'on' + capitalizedEvent;
  27971. var topEvent = 'top' + capitalizedEvent;
  27972. var type = {
  27973. phasedRegistrationNames: {
  27974. bubbled: onEvent,
  27975. captured: onEvent + 'Capture'
  27976. },
  27977. dependencies: [topEvent]
  27978. };
  27979. eventTypes[event] = type;
  27980. topLevelEventsToDispatchConfig[topEvent] = type;
  27981. });
  27982. var onClickListeners = {};
  27983. function getDictionaryKey(inst) {
  27984. // Prevents V8 performance issue:
  27985. // https://github.com/facebook/react/pull/7232
  27986. return '.' + inst._rootNodeID;
  27987. }
  27988. function isInteractive(tag) {
  27989. return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
  27990. }
  27991. var SimpleEventPlugin = {
  27992. eventTypes: eventTypes,
  27993. extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
  27994. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  27995. if (!dispatchConfig) {
  27996. return null;
  27997. }
  27998. var EventConstructor;
  27999. switch (topLevelType) {
  28000. case 'topAbort':
  28001. case 'topCanPlay':
  28002. case 'topCanPlayThrough':
  28003. case 'topDurationChange':
  28004. case 'topEmptied':
  28005. case 'topEncrypted':
  28006. case 'topEnded':
  28007. case 'topError':
  28008. case 'topInput':
  28009. case 'topInvalid':
  28010. case 'topLoad':
  28011. case 'topLoadedData':
  28012. case 'topLoadedMetadata':
  28013. case 'topLoadStart':
  28014. case 'topPause':
  28015. case 'topPlay':
  28016. case 'topPlaying':
  28017. case 'topProgress':
  28018. case 'topRateChange':
  28019. case 'topReset':
  28020. case 'topSeeked':
  28021. case 'topSeeking':
  28022. case 'topStalled':
  28023. case 'topSubmit':
  28024. case 'topSuspend':
  28025. case 'topTimeUpdate':
  28026. case 'topVolumeChange':
  28027. case 'topWaiting':
  28028. // HTML Events
  28029. // @see http://www.w3.org/TR/html5/index.html#events-0
  28030. EventConstructor = SyntheticEvent;
  28031. break;
  28032. case 'topKeyPress':
  28033. // Firefox creates a keypress event for function keys too. This removes
  28034. // the unwanted keypress events. Enter is however both printable and
  28035. // non-printable. One would expect Tab to be as well (but it isn't).
  28036. if (getEventCharCode(nativeEvent) === 0) {
  28037. return null;
  28038. }
  28039. /* falls through */
  28040. case 'topKeyDown':
  28041. case 'topKeyUp':
  28042. EventConstructor = SyntheticKeyboardEvent;
  28043. break;
  28044. case 'topBlur':
  28045. case 'topFocus':
  28046. EventConstructor = SyntheticFocusEvent;
  28047. break;
  28048. case 'topClick':
  28049. // Firefox creates a click event on right mouse clicks. This removes the
  28050. // unwanted click events.
  28051. if (nativeEvent.button === 2) {
  28052. return null;
  28053. }
  28054. /* falls through */
  28055. case 'topDoubleClick':
  28056. case 'topMouseDown':
  28057. case 'topMouseMove':
  28058. case 'topMouseUp':
  28059. // TODO: Disabled elements should not respond to mouse events
  28060. /* falls through */
  28061. case 'topMouseOut':
  28062. case 'topMouseOver':
  28063. case 'topContextMenu':
  28064. EventConstructor = SyntheticMouseEvent;
  28065. break;
  28066. case 'topDrag':
  28067. case 'topDragEnd':
  28068. case 'topDragEnter':
  28069. case 'topDragExit':
  28070. case 'topDragLeave':
  28071. case 'topDragOver':
  28072. case 'topDragStart':
  28073. case 'topDrop':
  28074. EventConstructor = SyntheticDragEvent;
  28075. break;
  28076. case 'topTouchCancel':
  28077. case 'topTouchEnd':
  28078. case 'topTouchMove':
  28079. case 'topTouchStart':
  28080. EventConstructor = SyntheticTouchEvent;
  28081. break;
  28082. case 'topAnimationEnd':
  28083. case 'topAnimationIteration':
  28084. case 'topAnimationStart':
  28085. EventConstructor = SyntheticAnimationEvent;
  28086. break;
  28087. case 'topTransitionEnd':
  28088. EventConstructor = SyntheticTransitionEvent;
  28089. break;
  28090. case 'topScroll':
  28091. EventConstructor = SyntheticUIEvent;
  28092. break;
  28093. case 'topWheel':
  28094. EventConstructor = SyntheticWheelEvent;
  28095. break;
  28096. case 'topCopy':
  28097. case 'topCut':
  28098. case 'topPaste':
  28099. EventConstructor = SyntheticClipboardEvent;
  28100. break;
  28101. }
  28102. !EventConstructor ? false ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
  28103. var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
  28104. EventPropagators.accumulateTwoPhaseDispatches(event);
  28105. return event;
  28106. },
  28107. didPutListener: function (inst, registrationName, listener) {
  28108. // Mobile Safari does not fire properly bubble click events on
  28109. // non-interactive elements, which means delegated click listeners do not
  28110. // fire. The workaround for this bug involves attaching an empty click
  28111. // listener on the target node.
  28112. // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  28113. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  28114. var key = getDictionaryKey(inst);
  28115. var node = ReactDOMComponentTree.getNodeFromInstance(inst);
  28116. if (!onClickListeners[key]) {
  28117. onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
  28118. }
  28119. }
  28120. },
  28121. willDeleteListener: function (inst, registrationName) {
  28122. if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
  28123. var key = getDictionaryKey(inst);
  28124. onClickListeners[key].remove();
  28125. delete onClickListeners[key];
  28126. }
  28127. }
  28128. };
  28129. module.exports = SimpleEventPlugin;
  28130. /***/ }),
  28131. /* 212 */
  28132. /***/ (function(module, exports, __webpack_require__) {
  28133. "use strict";
  28134. /**
  28135. * Copyright 2013-present, Facebook, Inc.
  28136. * All rights reserved.
  28137. *
  28138. * This source code is licensed under the BSD-style license found in the
  28139. * LICENSE file in the root directory of this source tree. An additional grant
  28140. * of patent rights can be found in the PATENTS file in the same directory.
  28141. *
  28142. */
  28143. var SyntheticEvent = __webpack_require__(13);
  28144. /**
  28145. * @interface Event
  28146. * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  28147. * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
  28148. */
  28149. var AnimationEventInterface = {
  28150. animationName: null,
  28151. elapsedTime: null,
  28152. pseudoElement: null
  28153. };
  28154. /**
  28155. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28156. * @param {string} dispatchMarker Marker identifying the event target.
  28157. * @param {object} nativeEvent Native browser event.
  28158. * @extends {SyntheticEvent}
  28159. */
  28160. function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28161. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28162. }
  28163. SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
  28164. module.exports = SyntheticAnimationEvent;
  28165. /***/ }),
  28166. /* 213 */
  28167. /***/ (function(module, exports, __webpack_require__) {
  28168. "use strict";
  28169. /**
  28170. * Copyright 2013-present, Facebook, Inc.
  28171. * All rights reserved.
  28172. *
  28173. * This source code is licensed under the BSD-style license found in the
  28174. * LICENSE file in the root directory of this source tree. An additional grant
  28175. * of patent rights can be found in the PATENTS file in the same directory.
  28176. *
  28177. */
  28178. var SyntheticEvent = __webpack_require__(13);
  28179. /**
  28180. * @interface Event
  28181. * @see http://www.w3.org/TR/clipboard-apis/
  28182. */
  28183. var ClipboardEventInterface = {
  28184. clipboardData: function (event) {
  28185. return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  28186. }
  28187. };
  28188. /**
  28189. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28190. * @param {string} dispatchMarker Marker identifying the event target.
  28191. * @param {object} nativeEvent Native browser event.
  28192. * @extends {SyntheticUIEvent}
  28193. */
  28194. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28195. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28196. }
  28197. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  28198. module.exports = SyntheticClipboardEvent;
  28199. /***/ }),
  28200. /* 214 */
  28201. /***/ (function(module, exports, __webpack_require__) {
  28202. "use strict";
  28203. /**
  28204. * Copyright 2013-present, Facebook, Inc.
  28205. * All rights reserved.
  28206. *
  28207. * This source code is licensed under the BSD-style license found in the
  28208. * LICENSE file in the root directory of this source tree. An additional grant
  28209. * of patent rights can be found in the PATENTS file in the same directory.
  28210. *
  28211. */
  28212. var SyntheticEvent = __webpack_require__(13);
  28213. /**
  28214. * @interface Event
  28215. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  28216. */
  28217. var CompositionEventInterface = {
  28218. data: null
  28219. };
  28220. /**
  28221. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28222. * @param {string} dispatchMarker Marker identifying the event target.
  28223. * @param {object} nativeEvent Native browser event.
  28224. * @extends {SyntheticUIEvent}
  28225. */
  28226. function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28227. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28228. }
  28229. SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
  28230. module.exports = SyntheticCompositionEvent;
  28231. /***/ }),
  28232. /* 215 */
  28233. /***/ (function(module, exports, __webpack_require__) {
  28234. "use strict";
  28235. /**
  28236. * Copyright 2013-present, Facebook, Inc.
  28237. * All rights reserved.
  28238. *
  28239. * This source code is licensed under the BSD-style license found in the
  28240. * LICENSE file in the root directory of this source tree. An additional grant
  28241. * of patent rights can be found in the PATENTS file in the same directory.
  28242. *
  28243. */
  28244. var SyntheticMouseEvent = __webpack_require__(32);
  28245. /**
  28246. * @interface DragEvent
  28247. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28248. */
  28249. var DragEventInterface = {
  28250. dataTransfer: null
  28251. };
  28252. /**
  28253. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28254. * @param {string} dispatchMarker Marker identifying the event target.
  28255. * @param {object} nativeEvent Native browser event.
  28256. * @extends {SyntheticUIEvent}
  28257. */
  28258. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28259. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28260. }
  28261. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  28262. module.exports = SyntheticDragEvent;
  28263. /***/ }),
  28264. /* 216 */
  28265. /***/ (function(module, exports, __webpack_require__) {
  28266. "use strict";
  28267. /**
  28268. * Copyright 2013-present, Facebook, Inc.
  28269. * All rights reserved.
  28270. *
  28271. * This source code is licensed under the BSD-style license found in the
  28272. * LICENSE file in the root directory of this source tree. An additional grant
  28273. * of patent rights can be found in the PATENTS file in the same directory.
  28274. *
  28275. */
  28276. var SyntheticUIEvent = __webpack_require__(29);
  28277. /**
  28278. * @interface FocusEvent
  28279. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28280. */
  28281. var FocusEventInterface = {
  28282. relatedTarget: null
  28283. };
  28284. /**
  28285. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28286. * @param {string} dispatchMarker Marker identifying the event target.
  28287. * @param {object} nativeEvent Native browser event.
  28288. * @extends {SyntheticUIEvent}
  28289. */
  28290. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28291. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28292. }
  28293. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  28294. module.exports = SyntheticFocusEvent;
  28295. /***/ }),
  28296. /* 217 */
  28297. /***/ (function(module, exports, __webpack_require__) {
  28298. "use strict";
  28299. /**
  28300. * Copyright 2013-present, Facebook, Inc.
  28301. * All rights reserved.
  28302. *
  28303. * This source code is licensed under the BSD-style license found in the
  28304. * LICENSE file in the root directory of this source tree. An additional grant
  28305. * of patent rights can be found in the PATENTS file in the same directory.
  28306. *
  28307. */
  28308. var SyntheticEvent = __webpack_require__(13);
  28309. /**
  28310. * @interface Event
  28311. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  28312. * /#events-inputevents
  28313. */
  28314. var InputEventInterface = {
  28315. data: null
  28316. };
  28317. /**
  28318. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28319. * @param {string} dispatchMarker Marker identifying the event target.
  28320. * @param {object} nativeEvent Native browser event.
  28321. * @extends {SyntheticUIEvent}
  28322. */
  28323. function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28324. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28325. }
  28326. SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
  28327. module.exports = SyntheticInputEvent;
  28328. /***/ }),
  28329. /* 218 */
  28330. /***/ (function(module, exports, __webpack_require__) {
  28331. "use strict";
  28332. /**
  28333. * Copyright 2013-present, Facebook, Inc.
  28334. * All rights reserved.
  28335. *
  28336. * This source code is licensed under the BSD-style license found in the
  28337. * LICENSE file in the root directory of this source tree. An additional grant
  28338. * of patent rights can be found in the PATENTS file in the same directory.
  28339. *
  28340. */
  28341. var SyntheticUIEvent = __webpack_require__(29);
  28342. var getEventCharCode = __webpack_require__(60);
  28343. var getEventKey = __webpack_require__(226);
  28344. var getEventModifierState = __webpack_require__(61);
  28345. /**
  28346. * @interface KeyboardEvent
  28347. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28348. */
  28349. var KeyboardEventInterface = {
  28350. key: getEventKey,
  28351. location: null,
  28352. ctrlKey: null,
  28353. shiftKey: null,
  28354. altKey: null,
  28355. metaKey: null,
  28356. repeat: null,
  28357. locale: null,
  28358. getModifierState: getEventModifierState,
  28359. // Legacy Interface
  28360. charCode: function (event) {
  28361. // `charCode` is the result of a KeyPress event and represents the value of
  28362. // the actual printable character.
  28363. // KeyPress is deprecated, but its replacement is not yet final and not
  28364. // implemented in any major browser. Only KeyPress has charCode.
  28365. if (event.type === 'keypress') {
  28366. return getEventCharCode(event);
  28367. }
  28368. return 0;
  28369. },
  28370. keyCode: function (event) {
  28371. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  28372. // physical keyboard key.
  28373. // The actual meaning of the value depends on the users' keyboard layout
  28374. // which cannot be detected. Assuming that it is a US keyboard layout
  28375. // provides a surprisingly accurate mapping for US and European users.
  28376. // Due to this, it is left to the user to implement at this time.
  28377. if (event.type === 'keydown' || event.type === 'keyup') {
  28378. return event.keyCode;
  28379. }
  28380. return 0;
  28381. },
  28382. which: function (event) {
  28383. // `which` is an alias for either `keyCode` or `charCode` depending on the
  28384. // type of the event.
  28385. if (event.type === 'keypress') {
  28386. return getEventCharCode(event);
  28387. }
  28388. if (event.type === 'keydown' || event.type === 'keyup') {
  28389. return event.keyCode;
  28390. }
  28391. return 0;
  28392. }
  28393. };
  28394. /**
  28395. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28396. * @param {string} dispatchMarker Marker identifying the event target.
  28397. * @param {object} nativeEvent Native browser event.
  28398. * @extends {SyntheticUIEvent}
  28399. */
  28400. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28401. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28402. }
  28403. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  28404. module.exports = SyntheticKeyboardEvent;
  28405. /***/ }),
  28406. /* 219 */
  28407. /***/ (function(module, exports, __webpack_require__) {
  28408. "use strict";
  28409. /**
  28410. * Copyright 2013-present, Facebook, Inc.
  28411. * All rights reserved.
  28412. *
  28413. * This source code is licensed under the BSD-style license found in the
  28414. * LICENSE file in the root directory of this source tree. An additional grant
  28415. * of patent rights can be found in the PATENTS file in the same directory.
  28416. *
  28417. */
  28418. var SyntheticUIEvent = __webpack_require__(29);
  28419. var getEventModifierState = __webpack_require__(61);
  28420. /**
  28421. * @interface TouchEvent
  28422. * @see http://www.w3.org/TR/touch-events/
  28423. */
  28424. var TouchEventInterface = {
  28425. touches: null,
  28426. targetTouches: null,
  28427. changedTouches: null,
  28428. altKey: null,
  28429. metaKey: null,
  28430. ctrlKey: null,
  28431. shiftKey: null,
  28432. getModifierState: getEventModifierState
  28433. };
  28434. /**
  28435. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28436. * @param {string} dispatchMarker Marker identifying the event target.
  28437. * @param {object} nativeEvent Native browser event.
  28438. * @extends {SyntheticUIEvent}
  28439. */
  28440. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28441. return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28442. }
  28443. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  28444. module.exports = SyntheticTouchEvent;
  28445. /***/ }),
  28446. /* 220 */
  28447. /***/ (function(module, exports, __webpack_require__) {
  28448. "use strict";
  28449. /**
  28450. * Copyright 2013-present, Facebook, Inc.
  28451. * All rights reserved.
  28452. *
  28453. * This source code is licensed under the BSD-style license found in the
  28454. * LICENSE file in the root directory of this source tree. An additional grant
  28455. * of patent rights can be found in the PATENTS file in the same directory.
  28456. *
  28457. */
  28458. var SyntheticEvent = __webpack_require__(13);
  28459. /**
  28460. * @interface Event
  28461. * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
  28462. * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
  28463. */
  28464. var TransitionEventInterface = {
  28465. propertyName: null,
  28466. elapsedTime: null,
  28467. pseudoElement: null
  28468. };
  28469. /**
  28470. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28471. * @param {string} dispatchMarker Marker identifying the event target.
  28472. * @param {object} nativeEvent Native browser event.
  28473. * @extends {SyntheticEvent}
  28474. */
  28475. function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28476. return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28477. }
  28478. SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
  28479. module.exports = SyntheticTransitionEvent;
  28480. /***/ }),
  28481. /* 221 */
  28482. /***/ (function(module, exports, __webpack_require__) {
  28483. "use strict";
  28484. /**
  28485. * Copyright 2013-present, Facebook, Inc.
  28486. * All rights reserved.
  28487. *
  28488. * This source code is licensed under the BSD-style license found in the
  28489. * LICENSE file in the root directory of this source tree. An additional grant
  28490. * of patent rights can be found in the PATENTS file in the same directory.
  28491. *
  28492. */
  28493. var SyntheticMouseEvent = __webpack_require__(32);
  28494. /**
  28495. * @interface WheelEvent
  28496. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  28497. */
  28498. var WheelEventInterface = {
  28499. deltaX: function (event) {
  28500. return 'deltaX' in event ? event.deltaX :
  28501. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  28502. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
  28503. },
  28504. deltaY: function (event) {
  28505. return 'deltaY' in event ? event.deltaY :
  28506. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  28507. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  28508. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  28509. 'wheelDelta' in event ? -event.wheelDelta : 0;
  28510. },
  28511. deltaZ: null,
  28512. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  28513. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  28514. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  28515. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  28516. deltaMode: null
  28517. };
  28518. /**
  28519. * @param {object} dispatchConfig Configuration used to dispatch this event.
  28520. * @param {string} dispatchMarker Marker identifying the event target.
  28521. * @param {object} nativeEvent Native browser event.
  28522. * @extends {SyntheticMouseEvent}
  28523. */
  28524. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
  28525. return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
  28526. }
  28527. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  28528. module.exports = SyntheticWheelEvent;
  28529. /***/ }),
  28530. /* 222 */
  28531. /***/ (function(module, exports, __webpack_require__) {
  28532. "use strict";
  28533. /**
  28534. * Copyright 2013-present, Facebook, Inc.
  28535. * All rights reserved.
  28536. *
  28537. * This source code is licensed under the BSD-style license found in the
  28538. * LICENSE file in the root directory of this source tree. An additional grant
  28539. * of patent rights can be found in the PATENTS file in the same directory.
  28540. *
  28541. *
  28542. */
  28543. var MOD = 65521;
  28544. // adler32 is not cryptographically strong, and is only used to sanity check that
  28545. // markup generated on the server matches the markup generated on the client.
  28546. // This implementation (a modified version of the SheetJS version) has been optimized
  28547. // for our use case, at the expense of conforming to the adler32 specification
  28548. // for non-ascii inputs.
  28549. function adler32(data) {
  28550. var a = 1;
  28551. var b = 0;
  28552. var i = 0;
  28553. var l = data.length;
  28554. var m = l & ~0x3;
  28555. while (i < m) {
  28556. var n = Math.min(i + 4096, m);
  28557. for (; i < n; i += 4) {
  28558. b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
  28559. }
  28560. a %= MOD;
  28561. b %= MOD;
  28562. }
  28563. for (; i < l; i++) {
  28564. b += a += data.charCodeAt(i);
  28565. }
  28566. a %= MOD;
  28567. b %= MOD;
  28568. return a | b << 16;
  28569. }
  28570. module.exports = adler32;
  28571. /***/ }),
  28572. /* 223 */
  28573. /***/ (function(module, exports, __webpack_require__) {
  28574. "use strict";
  28575. /**
  28576. * Copyright 2013-present, Facebook, Inc.
  28577. * All rights reserved.
  28578. *
  28579. * This source code is licensed under the BSD-style license found in the
  28580. * LICENSE file in the root directory of this source tree. An additional grant
  28581. * of patent rights can be found in the PATENTS file in the same directory.
  28582. *
  28583. */
  28584. var CSSProperty = __webpack_require__(78);
  28585. var warning = __webpack_require__(1);
  28586. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  28587. var styleWarnings = {};
  28588. /**
  28589. * Convert a value into the proper css writable value. The style name `name`
  28590. * should be logical (no hyphens), as specified
  28591. * in `CSSProperty.isUnitlessNumber`.
  28592. *
  28593. * @param {string} name CSS property name such as `topMargin`.
  28594. * @param {*} value CSS property value such as `10px`.
  28595. * @param {ReactDOMComponent} component
  28596. * @return {string} Normalized style value with dimensions applied.
  28597. */
  28598. function dangerousStyleValue(name, value, component) {
  28599. // Note that we've removed escapeTextForBrowser() calls here since the
  28600. // whole string will be escaped when the attribute is injected into
  28601. // the markup. If you provide unsafe user data here they can inject
  28602. // arbitrary CSS which may be problematic (I couldn't repro this):
  28603. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  28604. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  28605. // This is not an XSS hole but instead a potential CSS injection issue
  28606. // which has lead to a greater discussion about how we're going to
  28607. // trust URLs moving forward. See #2115901
  28608. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  28609. if (isEmpty) {
  28610. return '';
  28611. }
  28612. var isNonNumeric = isNaN(value);
  28613. if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  28614. return '' + value; // cast to string
  28615. }
  28616. if (typeof value === 'string') {
  28617. if (false) {
  28618. // Allow '0' to pass through without warning. 0 is already special and
  28619. // doesn't require units, so we don't need to warn about it.
  28620. if (component && value !== '0') {
  28621. var owner = component._currentElement._owner;
  28622. var ownerName = owner ? owner.getName() : null;
  28623. if (ownerName && !styleWarnings[ownerName]) {
  28624. styleWarnings[ownerName] = {};
  28625. }
  28626. var warned = false;
  28627. if (ownerName) {
  28628. var warnings = styleWarnings[ownerName];
  28629. warned = warnings[name];
  28630. if (!warned) {
  28631. warnings[name] = true;
  28632. }
  28633. }
  28634. if (!warned) {
  28635. 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;
  28636. }
  28637. }
  28638. }
  28639. value = value.trim();
  28640. }
  28641. return value + 'px';
  28642. }
  28643. module.exports = dangerousStyleValue;
  28644. /***/ }),
  28645. /* 224 */
  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 _prodInvariant = __webpack_require__(2);
  28658. var ReactCurrentOwner = __webpack_require__(14);
  28659. var ReactDOMComponentTree = __webpack_require__(5);
  28660. var ReactInstanceMap = __webpack_require__(28);
  28661. var getHostComponentFromComposite = __webpack_require__(92);
  28662. var invariant = __webpack_require__(0);
  28663. var warning = __webpack_require__(1);
  28664. /**
  28665. * Returns the DOM node rendered by this element.
  28666. *
  28667. * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
  28668. *
  28669. * @param {ReactComponent|DOMElement} componentOrElement
  28670. * @return {?DOMElement} The root node of this element.
  28671. */
  28672. function findDOMNode(componentOrElement) {
  28673. if (false) {
  28674. var owner = ReactCurrentOwner.current;
  28675. if (owner !== null) {
  28676. 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;
  28677. owner._warnedAboutRefsInRender = true;
  28678. }
  28679. }
  28680. if (componentOrElement == null) {
  28681. return null;
  28682. }
  28683. if (componentOrElement.nodeType === 1) {
  28684. return componentOrElement;
  28685. }
  28686. var inst = ReactInstanceMap.get(componentOrElement);
  28687. if (inst) {
  28688. inst = getHostComponentFromComposite(inst);
  28689. return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
  28690. }
  28691. if (typeof componentOrElement.render === 'function') {
  28692. true ? false ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
  28693. } else {
  28694. true ? false ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
  28695. }
  28696. }
  28697. module.exports = findDOMNode;
  28698. /***/ }),
  28699. /* 225 */
  28700. /***/ (function(module, exports, __webpack_require__) {
  28701. "use strict";
  28702. /* WEBPACK VAR INJECTION */(function(process) {/**
  28703. * Copyright 2013-present, Facebook, Inc.
  28704. * All rights reserved.
  28705. *
  28706. * This source code is licensed under the BSD-style license found in the
  28707. * LICENSE file in the root directory of this source tree. An additional grant
  28708. * of patent rights can be found in the PATENTS file in the same directory.
  28709. *
  28710. *
  28711. */
  28712. var KeyEscapeUtils = __webpack_require__(54);
  28713. var traverseAllChildren = __webpack_require__(97);
  28714. var warning = __webpack_require__(1);
  28715. var ReactComponentTreeHook;
  28716. if (typeof process !== 'undefined' && __webpack_require__.i({"NODE_ENV":"production"}) && "production" === 'test') {
  28717. // Temporary hack.
  28718. // Inline requires don't work well with Jest:
  28719. // https://github.com/facebook/react/issues/7240
  28720. // Remove the inline requires when we don't need them anymore:
  28721. // https://github.com/facebook/react/pull/7178
  28722. ReactComponentTreeHook = __webpack_require__(98);
  28723. }
  28724. /**
  28725. * @param {function} traverseContext Context passed through traversal.
  28726. * @param {?ReactComponent} child React child component.
  28727. * @param {!string} name String name of key path to child.
  28728. * @param {number=} selfDebugID Optional debugID of the current internal instance.
  28729. */
  28730. function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
  28731. // We found a component instance.
  28732. if (traverseContext && typeof traverseContext === 'object') {
  28733. var result = traverseContext;
  28734. var keyUnique = result[name] === undefined;
  28735. if (false) {
  28736. if (!ReactComponentTreeHook) {
  28737. ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
  28738. }
  28739. if (!keyUnique) {
  28740. 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;
  28741. }
  28742. }
  28743. if (keyUnique && child != null) {
  28744. result[name] = child;
  28745. }
  28746. }
  28747. }
  28748. /**
  28749. * Flattens children that are typically specified as `props.children`. Any null
  28750. * children will not be included in the resulting object.
  28751. * @return {!object} flattened children keyed by name.
  28752. */
  28753. function flattenChildren(children, selfDebugID) {
  28754. if (children == null) {
  28755. return children;
  28756. }
  28757. var result = {};
  28758. if (false) {
  28759. traverseAllChildren(children, function (traverseContext, child, name) {
  28760. return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID);
  28761. }, result);
  28762. } else {
  28763. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  28764. }
  28765. return result;
  28766. }
  28767. module.exports = flattenChildren;
  28768. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(69)))
  28769. /***/ }),
  28770. /* 226 */
  28771. /***/ (function(module, exports, __webpack_require__) {
  28772. "use strict";
  28773. /**
  28774. * Copyright 2013-present, Facebook, Inc.
  28775. * All rights reserved.
  28776. *
  28777. * This source code is licensed under the BSD-style license found in the
  28778. * LICENSE file in the root directory of this source tree. An additional grant
  28779. * of patent rights can be found in the PATENTS file in the same directory.
  28780. *
  28781. */
  28782. var getEventCharCode = __webpack_require__(60);
  28783. /**
  28784. * Normalization of deprecated HTML5 `key` values
  28785. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  28786. */
  28787. var normalizeKey = {
  28788. 'Esc': 'Escape',
  28789. 'Spacebar': ' ',
  28790. 'Left': 'ArrowLeft',
  28791. 'Up': 'ArrowUp',
  28792. 'Right': 'ArrowRight',
  28793. 'Down': 'ArrowDown',
  28794. 'Del': 'Delete',
  28795. 'Win': 'OS',
  28796. 'Menu': 'ContextMenu',
  28797. 'Apps': 'ContextMenu',
  28798. 'Scroll': 'ScrollLock',
  28799. 'MozPrintableKey': 'Unidentified'
  28800. };
  28801. /**
  28802. * Translation from legacy `keyCode` to HTML5 `key`
  28803. * Only special keys supported, all others depend on keyboard layout or browser
  28804. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  28805. */
  28806. var translateToKey = {
  28807. 8: 'Backspace',
  28808. 9: 'Tab',
  28809. 12: 'Clear',
  28810. 13: 'Enter',
  28811. 16: 'Shift',
  28812. 17: 'Control',
  28813. 18: 'Alt',
  28814. 19: 'Pause',
  28815. 20: 'CapsLock',
  28816. 27: 'Escape',
  28817. 32: ' ',
  28818. 33: 'PageUp',
  28819. 34: 'PageDown',
  28820. 35: 'End',
  28821. 36: 'Home',
  28822. 37: 'ArrowLeft',
  28823. 38: 'ArrowUp',
  28824. 39: 'ArrowRight',
  28825. 40: 'ArrowDown',
  28826. 45: 'Insert',
  28827. 46: 'Delete',
  28828. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  28829. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  28830. 144: 'NumLock',
  28831. 145: 'ScrollLock',
  28832. 224: 'Meta'
  28833. };
  28834. /**
  28835. * @param {object} nativeEvent Native browser event.
  28836. * @return {string} Normalized `key` property.
  28837. */
  28838. function getEventKey(nativeEvent) {
  28839. if (nativeEvent.key) {
  28840. // Normalize inconsistent values reported by browsers due to
  28841. // implementations of a working draft specification.
  28842. // FireFox implements `key` but returns `MozPrintableKey` for all
  28843. // printable characters (normalized to `Unidentified`), ignore it.
  28844. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  28845. if (key !== 'Unidentified') {
  28846. return key;
  28847. }
  28848. }
  28849. // Browser does not implement `key`, polyfill as much of it as we can.
  28850. if (nativeEvent.type === 'keypress') {
  28851. var charCode = getEventCharCode(nativeEvent);
  28852. // The enter-key is technically both printable and non-printable and can
  28853. // thus be captured by `keypress`, no other non-printable key should.
  28854. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  28855. }
  28856. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  28857. // While user keyboard layout determines the actual meaning of each
  28858. // `keyCode` value, almost all function keys have a universal value.
  28859. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  28860. }
  28861. return '';
  28862. }
  28863. module.exports = getEventKey;
  28864. /***/ }),
  28865. /* 227 */
  28866. /***/ (function(module, exports, __webpack_require__) {
  28867. "use strict";
  28868. /**
  28869. * Copyright 2013-present, Facebook, Inc.
  28870. * All rights reserved.
  28871. *
  28872. * This source code is licensed under the BSD-style license found in the
  28873. * LICENSE file in the root directory of this source tree. An additional grant
  28874. * of patent rights can be found in the PATENTS file in the same directory.
  28875. *
  28876. *
  28877. */
  28878. /* global Symbol */
  28879. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  28880. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  28881. /**
  28882. * Returns the iterator method function contained on the iterable object.
  28883. *
  28884. * Be sure to invoke the function with the iterable as context:
  28885. *
  28886. * var iteratorFn = getIteratorFn(myIterable);
  28887. * if (iteratorFn) {
  28888. * var iterator = iteratorFn.call(myIterable);
  28889. * ...
  28890. * }
  28891. *
  28892. * @param {?object} maybeIterable
  28893. * @return {?function}
  28894. */
  28895. function getIteratorFn(maybeIterable) {
  28896. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  28897. if (typeof iteratorFn === 'function') {
  28898. return iteratorFn;
  28899. }
  28900. }
  28901. module.exports = getIteratorFn;
  28902. /***/ }),
  28903. /* 228 */
  28904. /***/ (function(module, exports, __webpack_require__) {
  28905. "use strict";
  28906. /**
  28907. * Copyright 2013-present, Facebook, Inc.
  28908. * All rights reserved.
  28909. *
  28910. * This source code is licensed under the BSD-style license found in the
  28911. * LICENSE file in the root directory of this source tree. An additional grant
  28912. * of patent rights can be found in the PATENTS file in the same directory.
  28913. *
  28914. *
  28915. */
  28916. var nextDebugID = 1;
  28917. function getNextDebugID() {
  28918. return nextDebugID++;
  28919. }
  28920. module.exports = getNextDebugID;
  28921. /***/ }),
  28922. /* 229 */
  28923. /***/ (function(module, exports, __webpack_require__) {
  28924. "use strict";
  28925. /**
  28926. * Copyright 2013-present, Facebook, Inc.
  28927. * All rights reserved.
  28928. *
  28929. * This source code is licensed under the BSD-style license found in the
  28930. * LICENSE file in the root directory of this source tree. An additional grant
  28931. * of patent rights can be found in the PATENTS file in the same directory.
  28932. *
  28933. */
  28934. /**
  28935. * Given any node return the first leaf node without children.
  28936. *
  28937. * @param {DOMElement|DOMTextNode} node
  28938. * @return {DOMElement|DOMTextNode}
  28939. */
  28940. function getLeafNode(node) {
  28941. while (node && node.firstChild) {
  28942. node = node.firstChild;
  28943. }
  28944. return node;
  28945. }
  28946. /**
  28947. * Get the next sibling within a container. This will walk up the
  28948. * DOM if a node's siblings have been exhausted.
  28949. *
  28950. * @param {DOMElement|DOMTextNode} node
  28951. * @return {?DOMElement|DOMTextNode}
  28952. */
  28953. function getSiblingNode(node) {
  28954. while (node) {
  28955. if (node.nextSibling) {
  28956. return node.nextSibling;
  28957. }
  28958. node = node.parentNode;
  28959. }
  28960. }
  28961. /**
  28962. * Get object describing the nodes which contain characters at offset.
  28963. *
  28964. * @param {DOMElement|DOMTextNode} root
  28965. * @param {number} offset
  28966. * @return {?object}
  28967. */
  28968. function getNodeForCharacterOffset(root, offset) {
  28969. var node = getLeafNode(root);
  28970. var nodeStart = 0;
  28971. var nodeEnd = 0;
  28972. while (node) {
  28973. if (node.nodeType === 3) {
  28974. nodeEnd = nodeStart + node.textContent.length;
  28975. if (nodeStart <= offset && nodeEnd >= offset) {
  28976. return {
  28977. node: node,
  28978. offset: offset - nodeStart
  28979. };
  28980. }
  28981. nodeStart = nodeEnd;
  28982. }
  28983. node = getLeafNode(getSiblingNode(node));
  28984. }
  28985. }
  28986. module.exports = getNodeForCharacterOffset;
  28987. /***/ }),
  28988. /* 230 */
  28989. /***/ (function(module, exports, __webpack_require__) {
  28990. "use strict";
  28991. /**
  28992. * Copyright 2013-present, Facebook, Inc.
  28993. * All rights reserved.
  28994. *
  28995. * This source code is licensed under the BSD-style license found in the
  28996. * LICENSE file in the root directory of this source tree. An additional grant
  28997. * of patent rights can be found in the PATENTS file in the same directory.
  28998. *
  28999. */
  29000. var ExecutionEnvironment = __webpack_require__(9);
  29001. /**
  29002. * Generate a mapping of standard vendor prefixes using the defined style property and event name.
  29003. *
  29004. * @param {string} styleProp
  29005. * @param {string} eventName
  29006. * @returns {object}
  29007. */
  29008. function makePrefixMap(styleProp, eventName) {
  29009. var prefixes = {};
  29010. prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
  29011. prefixes['Webkit' + styleProp] = 'webkit' + eventName;
  29012. prefixes['Moz' + styleProp] = 'moz' + eventName;
  29013. prefixes['ms' + styleProp] = 'MS' + eventName;
  29014. prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
  29015. return prefixes;
  29016. }
  29017. /**
  29018. * A list of event names to a configurable list of vendor prefixes.
  29019. */
  29020. var vendorPrefixes = {
  29021. animationend: makePrefixMap('Animation', 'AnimationEnd'),
  29022. animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
  29023. animationstart: makePrefixMap('Animation', 'AnimationStart'),
  29024. transitionend: makePrefixMap('Transition', 'TransitionEnd')
  29025. };
  29026. /**
  29027. * Event names that have already been detected and prefixed (if applicable).
  29028. */
  29029. var prefixedEventNames = {};
  29030. /**
  29031. * Element to check for prefixes on.
  29032. */
  29033. var style = {};
  29034. /**
  29035. * Bootstrap if a DOM exists.
  29036. */
  29037. if (ExecutionEnvironment.canUseDOM) {
  29038. style = document.createElement('div').style;
  29039. // On some platforms, in particular some releases of Android 4.x,
  29040. // the un-prefixed "animation" and "transition" properties are defined on the
  29041. // style object but the events that fire will still be prefixed, so we need
  29042. // to check if the un-prefixed events are usable, and if not remove them from the map.
  29043. if (!('AnimationEvent' in window)) {
  29044. delete vendorPrefixes.animationend.animation;
  29045. delete vendorPrefixes.animationiteration.animation;
  29046. delete vendorPrefixes.animationstart.animation;
  29047. }
  29048. // Same as above
  29049. if (!('TransitionEvent' in window)) {
  29050. delete vendorPrefixes.transitionend.transition;
  29051. }
  29052. }
  29053. /**
  29054. * Attempts to determine the correct vendor prefixed event name.
  29055. *
  29056. * @param {string} eventName
  29057. * @returns {string}
  29058. */
  29059. function getVendorPrefixedEventName(eventName) {
  29060. if (prefixedEventNames[eventName]) {
  29061. return prefixedEventNames[eventName];
  29062. } else if (!vendorPrefixes[eventName]) {
  29063. return eventName;
  29064. }
  29065. var prefixMap = vendorPrefixes[eventName];
  29066. for (var styleProp in prefixMap) {
  29067. if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
  29068. return prefixedEventNames[eventName] = prefixMap[styleProp];
  29069. }
  29070. }
  29071. return '';
  29072. }
  29073. module.exports = getVendorPrefixedEventName;
  29074. /***/ }),
  29075. /* 231 */
  29076. /***/ (function(module, exports, __webpack_require__) {
  29077. "use strict";
  29078. /**
  29079. * Copyright 2013-present, Facebook, Inc.
  29080. * All rights reserved.
  29081. *
  29082. * This source code is licensed under the BSD-style license found in the
  29083. * LICENSE file in the root directory of this source tree. An additional grant
  29084. * of patent rights can be found in the PATENTS file in the same directory.
  29085. *
  29086. */
  29087. var escapeTextContentForBrowser = __webpack_require__(34);
  29088. /**
  29089. * Escapes attribute value to prevent scripting attacks.
  29090. *
  29091. * @param {*} value Value to escape.
  29092. * @return {string} An escaped string.
  29093. */
  29094. function quoteAttributeValueForBrowser(value) {
  29095. return '"' + escapeTextContentForBrowser(value) + '"';
  29096. }
  29097. module.exports = quoteAttributeValueForBrowser;
  29098. /***/ }),
  29099. /* 232 */
  29100. /***/ (function(module, exports, __webpack_require__) {
  29101. "use strict";
  29102. /**
  29103. * Copyright 2013-present, Facebook, Inc.
  29104. * All rights reserved.
  29105. *
  29106. * This source code is licensed under the BSD-style license found in the
  29107. * LICENSE file in the root directory of this source tree. An additional grant
  29108. * of patent rights can be found in the PATENTS file in the same directory.
  29109. *
  29110. */
  29111. var ReactMount = __webpack_require__(87);
  29112. module.exports = ReactMount.renderSubtreeIntoContainer;
  29113. /***/ }),
  29114. /* 233 */
  29115. /***/ (function(module, exports, __webpack_require__) {
  29116. "use strict";
  29117. /**
  29118. * Copyright 2013-present, Facebook, Inc.
  29119. * All rights reserved.
  29120. *
  29121. * This source code is licensed under the BSD-style license found in the
  29122. * LICENSE file in the root directory of this source tree. An additional grant
  29123. * of patent rights can be found in the PATENTS file in the same directory.
  29124. *
  29125. *
  29126. */
  29127. /**
  29128. * Escape and wrap key so it is safe to use as a reactid
  29129. *
  29130. * @param {string} key to be escaped.
  29131. * @return {string} the escaped key.
  29132. */
  29133. function escape(key) {
  29134. var escapeRegex = /[=:]/g;
  29135. var escaperLookup = {
  29136. '=': '=0',
  29137. ':': '=2'
  29138. };
  29139. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  29140. return escaperLookup[match];
  29141. });
  29142. return '$' + escapedString;
  29143. }
  29144. /**
  29145. * Unescape and unwrap key for human-readable display
  29146. *
  29147. * @param {string} key to unescape.
  29148. * @return {string} the unescaped key.
  29149. */
  29150. function unescape(key) {
  29151. var unescapeRegex = /(=0|=2)/g;
  29152. var unescaperLookup = {
  29153. '=0': '=',
  29154. '=2': ':'
  29155. };
  29156. var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
  29157. return ('' + keySubstring).replace(unescapeRegex, function (match) {
  29158. return unescaperLookup[match];
  29159. });
  29160. }
  29161. var KeyEscapeUtils = {
  29162. escape: escape,
  29163. unescape: unescape
  29164. };
  29165. module.exports = KeyEscapeUtils;
  29166. /***/ }),
  29167. /* 234 */
  29168. /***/ (function(module, exports, __webpack_require__) {
  29169. "use strict";
  29170. /**
  29171. * Copyright 2013-present, Facebook, Inc.
  29172. * All rights reserved.
  29173. *
  29174. * This source code is licensed under the BSD-style license found in the
  29175. * LICENSE file in the root directory of this source tree. An additional grant
  29176. * of patent rights can be found in the PATENTS file in the same directory.
  29177. *
  29178. *
  29179. */
  29180. var _prodInvariant = __webpack_require__(23);
  29181. var invariant = __webpack_require__(0);
  29182. /**
  29183. * Static poolers. Several custom versions for each potential number of
  29184. * arguments. A completely generic pooler is easy to implement, but would
  29185. * require accessing the `arguments` object. In each of these, `this` refers to
  29186. * the Class itself, not an instance. If any others are needed, simply add them
  29187. * here, or in their own files.
  29188. */
  29189. var oneArgumentPooler = function (copyFieldsFrom) {
  29190. var Klass = this;
  29191. if (Klass.instancePool.length) {
  29192. var instance = Klass.instancePool.pop();
  29193. Klass.call(instance, copyFieldsFrom);
  29194. return instance;
  29195. } else {
  29196. return new Klass(copyFieldsFrom);
  29197. }
  29198. };
  29199. var twoArgumentPooler = function (a1, a2) {
  29200. var Klass = this;
  29201. if (Klass.instancePool.length) {
  29202. var instance = Klass.instancePool.pop();
  29203. Klass.call(instance, a1, a2);
  29204. return instance;
  29205. } else {
  29206. return new Klass(a1, a2);
  29207. }
  29208. };
  29209. var threeArgumentPooler = function (a1, a2, a3) {
  29210. var Klass = this;
  29211. if (Klass.instancePool.length) {
  29212. var instance = Klass.instancePool.pop();
  29213. Klass.call(instance, a1, a2, a3);
  29214. return instance;
  29215. } else {
  29216. return new Klass(a1, a2, a3);
  29217. }
  29218. };
  29219. var fourArgumentPooler = function (a1, a2, a3, a4) {
  29220. var Klass = this;
  29221. if (Klass.instancePool.length) {
  29222. var instance = Klass.instancePool.pop();
  29223. Klass.call(instance, a1, a2, a3, a4);
  29224. return instance;
  29225. } else {
  29226. return new Klass(a1, a2, a3, a4);
  29227. }
  29228. };
  29229. var standardReleaser = function (instance) {
  29230. var Klass = this;
  29231. !(instance instanceof Klass) ? false ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
  29232. instance.destructor();
  29233. if (Klass.instancePool.length < Klass.poolSize) {
  29234. Klass.instancePool.push(instance);
  29235. }
  29236. };
  29237. var DEFAULT_POOL_SIZE = 10;
  29238. var DEFAULT_POOLER = oneArgumentPooler;
  29239. /**
  29240. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  29241. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  29242. * you give this may have a `poolSize` property, and will look for a
  29243. * prototypical `destructor` on instances.
  29244. *
  29245. * @param {Function} CopyConstructor Constructor that can be used to reset.
  29246. * @param {Function} pooler Customizable pooler.
  29247. */
  29248. var addPoolingTo = function (CopyConstructor, pooler) {
  29249. // Casting as any so that flow ignores the actual implementation and trusts
  29250. // it to match the type we declared
  29251. var NewKlass = CopyConstructor;
  29252. NewKlass.instancePool = [];
  29253. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  29254. if (!NewKlass.poolSize) {
  29255. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  29256. }
  29257. NewKlass.release = standardReleaser;
  29258. return NewKlass;
  29259. };
  29260. var PooledClass = {
  29261. addPoolingTo: addPoolingTo,
  29262. oneArgumentPooler: oneArgumentPooler,
  29263. twoArgumentPooler: twoArgumentPooler,
  29264. threeArgumentPooler: threeArgumentPooler,
  29265. fourArgumentPooler: fourArgumentPooler
  29266. };
  29267. module.exports = PooledClass;
  29268. /***/ }),
  29269. /* 235 */
  29270. /***/ (function(module, exports, __webpack_require__) {
  29271. "use strict";
  29272. /**
  29273. * Copyright 2013-present, Facebook, Inc.
  29274. * All rights reserved.
  29275. *
  29276. * This source code is licensed under the BSD-style license found in the
  29277. * LICENSE file in the root directory of this source tree. An additional grant
  29278. * of patent rights can be found in the PATENTS file in the same directory.
  29279. *
  29280. */
  29281. var PooledClass = __webpack_require__(234);
  29282. var ReactElement = __webpack_require__(22);
  29283. var emptyFunction = __webpack_require__(10);
  29284. var traverseAllChildren = __webpack_require__(243);
  29285. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  29286. var fourArgumentPooler = PooledClass.fourArgumentPooler;
  29287. var userProvidedKeyEscapeRegex = /\/+/g;
  29288. function escapeUserProvidedKey(text) {
  29289. return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
  29290. }
  29291. /**
  29292. * PooledClass representing the bookkeeping associated with performing a child
  29293. * traversal. Allows avoiding binding callbacks.
  29294. *
  29295. * @constructor ForEachBookKeeping
  29296. * @param {!function} forEachFunction Function to perform traversal with.
  29297. * @param {?*} forEachContext Context to perform context with.
  29298. */
  29299. function ForEachBookKeeping(forEachFunction, forEachContext) {
  29300. this.func = forEachFunction;
  29301. this.context = forEachContext;
  29302. this.count = 0;
  29303. }
  29304. ForEachBookKeeping.prototype.destructor = function () {
  29305. this.func = null;
  29306. this.context = null;
  29307. this.count = 0;
  29308. };
  29309. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  29310. function forEachSingleChild(bookKeeping, child, name) {
  29311. var func = bookKeeping.func,
  29312. context = bookKeeping.context;
  29313. func.call(context, child, bookKeeping.count++);
  29314. }
  29315. /**
  29316. * Iterates through children that are typically specified as `props.children`.
  29317. *
  29318. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
  29319. *
  29320. * The provided forEachFunc(child, index) will be called for each
  29321. * leaf child.
  29322. *
  29323. * @param {?*} children Children tree container.
  29324. * @param {function(*, int)} forEachFunc
  29325. * @param {*} forEachContext Context for forEachContext.
  29326. */
  29327. function forEachChildren(children, forEachFunc, forEachContext) {
  29328. if (children == null) {
  29329. return children;
  29330. }
  29331. var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  29332. traverseAllChildren(children, forEachSingleChild, traverseContext);
  29333. ForEachBookKeeping.release(traverseContext);
  29334. }
  29335. /**
  29336. * PooledClass representing the bookkeeping associated with performing a child
  29337. * mapping. Allows avoiding binding callbacks.
  29338. *
  29339. * @constructor MapBookKeeping
  29340. * @param {!*} mapResult Object containing the ordered map of results.
  29341. * @param {!function} mapFunction Function to perform mapping with.
  29342. * @param {?*} mapContext Context to perform mapping with.
  29343. */
  29344. function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
  29345. this.result = mapResult;
  29346. this.keyPrefix = keyPrefix;
  29347. this.func = mapFunction;
  29348. this.context = mapContext;
  29349. this.count = 0;
  29350. }
  29351. MapBookKeeping.prototype.destructor = function () {
  29352. this.result = null;
  29353. this.keyPrefix = null;
  29354. this.func = null;
  29355. this.context = null;
  29356. this.count = 0;
  29357. };
  29358. PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
  29359. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  29360. var result = bookKeeping.result,
  29361. keyPrefix = bookKeeping.keyPrefix,
  29362. func = bookKeeping.func,
  29363. context = bookKeeping.context;
  29364. var mappedChild = func.call(context, child, bookKeeping.count++);
  29365. if (Array.isArray(mappedChild)) {
  29366. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
  29367. } else if (mappedChild != null) {
  29368. if (ReactElement.isValidElement(mappedChild)) {
  29369. mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
  29370. // Keep both the (mapped) and old keys if they differ, just as
  29371. // traverseAllChildren used to do for objects as children
  29372. keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
  29373. }
  29374. result.push(mappedChild);
  29375. }
  29376. }
  29377. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  29378. var escapedPrefix = '';
  29379. if (prefix != null) {
  29380. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  29381. }
  29382. var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
  29383. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  29384. MapBookKeeping.release(traverseContext);
  29385. }
  29386. /**
  29387. * Maps children that are typically specified as `props.children`.
  29388. *
  29389. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
  29390. *
  29391. * The provided mapFunction(child, key, index) will be called for each
  29392. * leaf child.
  29393. *
  29394. * @param {?*} children Children tree container.
  29395. * @param {function(*, int)} func The map function.
  29396. * @param {*} context Context for mapFunction.
  29397. * @return {object} Object containing the ordered map of results.
  29398. */
  29399. function mapChildren(children, func, context) {
  29400. if (children == null) {
  29401. return children;
  29402. }
  29403. var result = [];
  29404. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  29405. return result;
  29406. }
  29407. function forEachSingleChildDummy(traverseContext, child, name) {
  29408. return null;
  29409. }
  29410. /**
  29411. * Count the number of children that are typically specified as
  29412. * `props.children`.
  29413. *
  29414. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
  29415. *
  29416. * @param {?*} children Children tree container.
  29417. * @return {number} The number of children.
  29418. */
  29419. function countChildren(children, context) {
  29420. return traverseAllChildren(children, forEachSingleChildDummy, null);
  29421. }
  29422. /**
  29423. * Flatten a children object (typically specified as `props.children`) and
  29424. * return an array with appropriately re-keyed children.
  29425. *
  29426. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
  29427. */
  29428. function toArray(children) {
  29429. var result = [];
  29430. mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
  29431. return result;
  29432. }
  29433. var ReactChildren = {
  29434. forEach: forEachChildren,
  29435. map: mapChildren,
  29436. mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
  29437. count: countChildren,
  29438. toArray: toArray
  29439. };
  29440. module.exports = ReactChildren;
  29441. /***/ }),
  29442. /* 236 */
  29443. /***/ (function(module, exports, __webpack_require__) {
  29444. "use strict";
  29445. /**
  29446. * Copyright 2013-present, Facebook, Inc.
  29447. * All rights reserved.
  29448. *
  29449. * This source code is licensed under the BSD-style license found in the
  29450. * LICENSE file in the root directory of this source tree. An additional grant
  29451. * of patent rights can be found in the PATENTS file in the same directory.
  29452. *
  29453. */
  29454. var _prodInvariant = __webpack_require__(23),
  29455. _assign = __webpack_require__(3);
  29456. var ReactComponent = __webpack_require__(66);
  29457. var ReactElement = __webpack_require__(22);
  29458. var ReactPropTypeLocationNames = __webpack_require__(100);
  29459. var ReactNoopUpdateQueue = __webpack_require__(67);
  29460. var emptyObject = __webpack_require__(25);
  29461. var invariant = __webpack_require__(0);
  29462. var warning = __webpack_require__(1);
  29463. var MIXINS_KEY = 'mixins';
  29464. // Helper function to allow the creation of anonymous functions which do not
  29465. // have .name set to the name of the variable being assigned to.
  29466. function identity(fn) {
  29467. return fn;
  29468. }
  29469. /**
  29470. * Policies that describe methods in `ReactClassInterface`.
  29471. */
  29472. var injectedMixins = [];
  29473. /**
  29474. * Composite components are higher-level components that compose other composite
  29475. * or host components.
  29476. *
  29477. * To create a new type of `ReactClass`, pass a specification of
  29478. * your new class to `React.createClass`. The only requirement of your class
  29479. * specification is that you implement a `render` method.
  29480. *
  29481. * var MyComponent = React.createClass({
  29482. * render: function() {
  29483. * return <div>Hello World</div>;
  29484. * }
  29485. * });
  29486. *
  29487. * The class specification supports a specific protocol of methods that have
  29488. * special meaning (e.g. `render`). See `ReactClassInterface` for
  29489. * more the comprehensive protocol. Any other properties and methods in the
  29490. * class specification will be available on the prototype.
  29491. *
  29492. * @interface ReactClassInterface
  29493. * @internal
  29494. */
  29495. var ReactClassInterface = {
  29496. /**
  29497. * An array of Mixin objects to include when defining your component.
  29498. *
  29499. * @type {array}
  29500. * @optional
  29501. */
  29502. mixins: 'DEFINE_MANY',
  29503. /**
  29504. * An object containing properties and methods that should be defined on
  29505. * the component's constructor instead of its prototype (static methods).
  29506. *
  29507. * @type {object}
  29508. * @optional
  29509. */
  29510. statics: 'DEFINE_MANY',
  29511. /**
  29512. * Definition of prop types for this component.
  29513. *
  29514. * @type {object}
  29515. * @optional
  29516. */
  29517. propTypes: 'DEFINE_MANY',
  29518. /**
  29519. * Definition of context types for this component.
  29520. *
  29521. * @type {object}
  29522. * @optional
  29523. */
  29524. contextTypes: 'DEFINE_MANY',
  29525. /**
  29526. * Definition of context types this component sets for its children.
  29527. *
  29528. * @type {object}
  29529. * @optional
  29530. */
  29531. childContextTypes: 'DEFINE_MANY',
  29532. // ==== Definition methods ====
  29533. /**
  29534. * Invoked when the component is mounted. Values in the mapping will be set on
  29535. * `this.props` if that prop is not specified (i.e. using an `in` check).
  29536. *
  29537. * This method is invoked before `getInitialState` and therefore cannot rely
  29538. * on `this.state` or use `this.setState`.
  29539. *
  29540. * @return {object}
  29541. * @optional
  29542. */
  29543. getDefaultProps: 'DEFINE_MANY_MERGED',
  29544. /**
  29545. * Invoked once before the component is mounted. The return value will be used
  29546. * as the initial value of `this.state`.
  29547. *
  29548. * getInitialState: function() {
  29549. * return {
  29550. * isOn: false,
  29551. * fooBaz: new BazFoo()
  29552. * }
  29553. * }
  29554. *
  29555. * @return {object}
  29556. * @optional
  29557. */
  29558. getInitialState: 'DEFINE_MANY_MERGED',
  29559. /**
  29560. * @return {object}
  29561. * @optional
  29562. */
  29563. getChildContext: 'DEFINE_MANY_MERGED',
  29564. /**
  29565. * Uses props from `this.props` and state from `this.state` to render the
  29566. * structure of the component.
  29567. *
  29568. * No guarantees are made about when or how often this method is invoked, so
  29569. * it must not have side effects.
  29570. *
  29571. * render: function() {
  29572. * var name = this.props.name;
  29573. * return <div>Hello, {name}!</div>;
  29574. * }
  29575. *
  29576. * @return {ReactComponent}
  29577. * @nosideeffects
  29578. * @required
  29579. */
  29580. render: 'DEFINE_ONCE',
  29581. // ==== Delegate methods ====
  29582. /**
  29583. * Invoked when the component is initially created and about to be mounted.
  29584. * This may have side effects, but any external subscriptions or data created
  29585. * by this method must be cleaned up in `componentWillUnmount`.
  29586. *
  29587. * @optional
  29588. */
  29589. componentWillMount: 'DEFINE_MANY',
  29590. /**
  29591. * Invoked when the component has been mounted and has a DOM representation.
  29592. * However, there is no guarantee that the DOM node is in the document.
  29593. *
  29594. * Use this as an opportunity to operate on the DOM when the component has
  29595. * been mounted (initialized and rendered) for the first time.
  29596. *
  29597. * @param {DOMElement} rootNode DOM element representing the component.
  29598. * @optional
  29599. */
  29600. componentDidMount: 'DEFINE_MANY',
  29601. /**
  29602. * Invoked before the component receives new props.
  29603. *
  29604. * Use this as an opportunity to react to a prop transition by updating the
  29605. * state using `this.setState`. Current props are accessed via `this.props`.
  29606. *
  29607. * componentWillReceiveProps: function(nextProps, nextContext) {
  29608. * this.setState({
  29609. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  29610. * });
  29611. * }
  29612. *
  29613. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  29614. * transition may cause a state change, but the opposite is not true. If you
  29615. * need it, you are probably looking for `componentWillUpdate`.
  29616. *
  29617. * @param {object} nextProps
  29618. * @optional
  29619. */
  29620. componentWillReceiveProps: 'DEFINE_MANY',
  29621. /**
  29622. * Invoked while deciding if the component should be updated as a result of
  29623. * receiving new props, state and/or context.
  29624. *
  29625. * Use this as an opportunity to `return false` when you're certain that the
  29626. * transition to the new props/state/context will not require a component
  29627. * update.
  29628. *
  29629. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  29630. * return !equal(nextProps, this.props) ||
  29631. * !equal(nextState, this.state) ||
  29632. * !equal(nextContext, this.context);
  29633. * }
  29634. *
  29635. * @param {object} nextProps
  29636. * @param {?object} nextState
  29637. * @param {?object} nextContext
  29638. * @return {boolean} True if the component should update.
  29639. * @optional
  29640. */
  29641. shouldComponentUpdate: 'DEFINE_ONCE',
  29642. /**
  29643. * Invoked when the component is about to update due to a transition from
  29644. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  29645. * and `nextContext`.
  29646. *
  29647. * Use this as an opportunity to perform preparation before an update occurs.
  29648. *
  29649. * NOTE: You **cannot** use `this.setState()` in this method.
  29650. *
  29651. * @param {object} nextProps
  29652. * @param {?object} nextState
  29653. * @param {?object} nextContext
  29654. * @param {ReactReconcileTransaction} transaction
  29655. * @optional
  29656. */
  29657. componentWillUpdate: 'DEFINE_MANY',
  29658. /**
  29659. * Invoked when the component's DOM representation has been updated.
  29660. *
  29661. * Use this as an opportunity to operate on the DOM when the component has
  29662. * been updated.
  29663. *
  29664. * @param {object} prevProps
  29665. * @param {?object} prevState
  29666. * @param {?object} prevContext
  29667. * @param {DOMElement} rootNode DOM element representing the component.
  29668. * @optional
  29669. */
  29670. componentDidUpdate: 'DEFINE_MANY',
  29671. /**
  29672. * Invoked when the component is about to be removed from its parent and have
  29673. * its DOM representation destroyed.
  29674. *
  29675. * Use this as an opportunity to deallocate any external resources.
  29676. *
  29677. * NOTE: There is no `componentDidUnmount` since your component will have been
  29678. * destroyed by that point.
  29679. *
  29680. * @optional
  29681. */
  29682. componentWillUnmount: 'DEFINE_MANY',
  29683. // ==== Advanced methods ====
  29684. /**
  29685. * Updates the component's currently mounted DOM representation.
  29686. *
  29687. * By default, this implements React's rendering and reconciliation algorithm.
  29688. * Sophisticated clients may wish to override this.
  29689. *
  29690. * @param {ReactReconcileTransaction} transaction
  29691. * @internal
  29692. * @overridable
  29693. */
  29694. updateComponent: 'OVERRIDE_BASE'
  29695. };
  29696. /**
  29697. * Mapping from class specification keys to special processing functions.
  29698. *
  29699. * Although these are declared like instance properties in the specification
  29700. * when defining classes using `React.createClass`, they are actually static
  29701. * and are accessible on the constructor instead of the prototype. Despite
  29702. * being static, they must be defined outside of the "statics" key under
  29703. * which all other static methods are defined.
  29704. */
  29705. var RESERVED_SPEC_KEYS = {
  29706. displayName: function (Constructor, displayName) {
  29707. Constructor.displayName = displayName;
  29708. },
  29709. mixins: function (Constructor, mixins) {
  29710. if (mixins) {
  29711. for (var i = 0; i < mixins.length; i++) {
  29712. mixSpecIntoComponent(Constructor, mixins[i]);
  29713. }
  29714. }
  29715. },
  29716. childContextTypes: function (Constructor, childContextTypes) {
  29717. if (false) {
  29718. validateTypeDef(Constructor, childContextTypes, 'childContext');
  29719. }
  29720. Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
  29721. },
  29722. contextTypes: function (Constructor, contextTypes) {
  29723. if (false) {
  29724. validateTypeDef(Constructor, contextTypes, 'context');
  29725. }
  29726. Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
  29727. },
  29728. /**
  29729. * Special case getDefaultProps which should move into statics but requires
  29730. * automatic merging.
  29731. */
  29732. getDefaultProps: function (Constructor, getDefaultProps) {
  29733. if (Constructor.getDefaultProps) {
  29734. Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
  29735. } else {
  29736. Constructor.getDefaultProps = getDefaultProps;
  29737. }
  29738. },
  29739. propTypes: function (Constructor, propTypes) {
  29740. if (false) {
  29741. validateTypeDef(Constructor, propTypes, 'prop');
  29742. }
  29743. Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
  29744. },
  29745. statics: function (Constructor, statics) {
  29746. mixStaticSpecIntoComponent(Constructor, statics);
  29747. },
  29748. autobind: function () {} };
  29749. function validateTypeDef(Constructor, typeDef, location) {
  29750. for (var propName in typeDef) {
  29751. if (typeDef.hasOwnProperty(propName)) {
  29752. // use a warning instead of an invariant so components
  29753. // don't show up in prod but only in __DEV__
  29754. 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;
  29755. }
  29756. }
  29757. }
  29758. function validateMethodOverride(isAlreadyDefined, name) {
  29759. var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
  29760. // Disallow overriding of base class methods unless explicitly allowed.
  29761. if (ReactClassMixin.hasOwnProperty(name)) {
  29762. !(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;
  29763. }
  29764. // Disallow defining methods more than once unless explicitly allowed.
  29765. if (isAlreadyDefined) {
  29766. !(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;
  29767. }
  29768. }
  29769. /**
  29770. * Mixin helper which handles policy validation and reserved
  29771. * specification keys when building React classes.
  29772. */
  29773. function mixSpecIntoComponent(Constructor, spec) {
  29774. if (!spec) {
  29775. if (false) {
  29776. var typeofSpec = typeof spec;
  29777. var isMixinValid = typeofSpec === 'object' && spec !== null;
  29778. 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;
  29779. }
  29780. return;
  29781. }
  29782. !(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;
  29783. !!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;
  29784. var proto = Constructor.prototype;
  29785. var autoBindPairs = proto.__reactAutoBindPairs;
  29786. // By handling mixins before any other properties, we ensure the same
  29787. // chaining order is applied to methods with DEFINE_MANY policy, whether
  29788. // mixins are listed before or after these methods in the spec.
  29789. if (spec.hasOwnProperty(MIXINS_KEY)) {
  29790. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  29791. }
  29792. for (var name in spec) {
  29793. if (!spec.hasOwnProperty(name)) {
  29794. continue;
  29795. }
  29796. if (name === MIXINS_KEY) {
  29797. // We have already handled mixins in a special case above.
  29798. continue;
  29799. }
  29800. var property = spec[name];
  29801. var isAlreadyDefined = proto.hasOwnProperty(name);
  29802. validateMethodOverride(isAlreadyDefined, name);
  29803. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  29804. RESERVED_SPEC_KEYS[name](Constructor, property);
  29805. } else {
  29806. // Setup methods on prototype:
  29807. // The following member methods should not be automatically bound:
  29808. // 1. Expected ReactClass methods (in the "interface").
  29809. // 2. Overridden methods (that were mixed in).
  29810. var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
  29811. var isFunction = typeof property === 'function';
  29812. var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
  29813. if (shouldAutoBind) {
  29814. autoBindPairs.push(name, property);
  29815. proto[name] = property;
  29816. } else {
  29817. if (isAlreadyDefined) {
  29818. var specPolicy = ReactClassInterface[name];
  29819. // These cases should already be caught by validateMethodOverride.
  29820. !(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;
  29821. // For methods which are defined more than once, call the existing
  29822. // methods before calling the new property, merging if appropriate.
  29823. if (specPolicy === 'DEFINE_MANY_MERGED') {
  29824. proto[name] = createMergedResultFunction(proto[name], property);
  29825. } else if (specPolicy === 'DEFINE_MANY') {
  29826. proto[name] = createChainedFunction(proto[name], property);
  29827. }
  29828. } else {
  29829. proto[name] = property;
  29830. if (false) {
  29831. // Add verbose displayName to the function, which helps when looking
  29832. // at profiling tools.
  29833. if (typeof property === 'function' && spec.displayName) {
  29834. proto[name].displayName = spec.displayName + '_' + name;
  29835. }
  29836. }
  29837. }
  29838. }
  29839. }
  29840. }
  29841. }
  29842. function mixStaticSpecIntoComponent(Constructor, statics) {
  29843. if (!statics) {
  29844. return;
  29845. }
  29846. for (var name in statics) {
  29847. var property = statics[name];
  29848. if (!statics.hasOwnProperty(name)) {
  29849. continue;
  29850. }
  29851. var isReserved = name in RESERVED_SPEC_KEYS;
  29852. !!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;
  29853. var isInherited = name in Constructor;
  29854. !!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;
  29855. Constructor[name] = property;
  29856. }
  29857. }
  29858. /**
  29859. * Merge two objects, but throw if both contain the same key.
  29860. *
  29861. * @param {object} one The first object, which is mutated.
  29862. * @param {object} two The second object
  29863. * @return {object} one after it has been mutated to contain everything in two.
  29864. */
  29865. function mergeIntoWithNoDuplicateKeys(one, two) {
  29866. !(one && two && typeof one === 'object' && typeof two === 'object') ? false ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
  29867. for (var key in two) {
  29868. if (two.hasOwnProperty(key)) {
  29869. !(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;
  29870. one[key] = two[key];
  29871. }
  29872. }
  29873. return one;
  29874. }
  29875. /**
  29876. * Creates a function that invokes two functions and merges their return values.
  29877. *
  29878. * @param {function} one Function to invoke first.
  29879. * @param {function} two Function to invoke second.
  29880. * @return {function} Function that invokes the two argument functions.
  29881. * @private
  29882. */
  29883. function createMergedResultFunction(one, two) {
  29884. return function mergedResult() {
  29885. var a = one.apply(this, arguments);
  29886. var b = two.apply(this, arguments);
  29887. if (a == null) {
  29888. return b;
  29889. } else if (b == null) {
  29890. return a;
  29891. }
  29892. var c = {};
  29893. mergeIntoWithNoDuplicateKeys(c, a);
  29894. mergeIntoWithNoDuplicateKeys(c, b);
  29895. return c;
  29896. };
  29897. }
  29898. /**
  29899. * Creates a function that invokes two functions and ignores their return vales.
  29900. *
  29901. * @param {function} one Function to invoke first.
  29902. * @param {function} two Function to invoke second.
  29903. * @return {function} Function that invokes the two argument functions.
  29904. * @private
  29905. */
  29906. function createChainedFunction(one, two) {
  29907. return function chainedFunction() {
  29908. one.apply(this, arguments);
  29909. two.apply(this, arguments);
  29910. };
  29911. }
  29912. /**
  29913. * Binds a method to the component.
  29914. *
  29915. * @param {object} component Component whose method is going to be bound.
  29916. * @param {function} method Method to be bound.
  29917. * @return {function} The bound method.
  29918. */
  29919. function bindAutoBindMethod(component, method) {
  29920. var boundMethod = method.bind(component);
  29921. if (false) {
  29922. boundMethod.__reactBoundContext = component;
  29923. boundMethod.__reactBoundMethod = method;
  29924. boundMethod.__reactBoundArguments = null;
  29925. var componentName = component.constructor.displayName;
  29926. var _bind = boundMethod.bind;
  29927. boundMethod.bind = function (newThis) {
  29928. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  29929. args[_key - 1] = arguments[_key];
  29930. }
  29931. // User is trying to bind() an autobound method; we effectively will
  29932. // ignore the value of "this" that the user is trying to use, so
  29933. // let's warn.
  29934. if (newThis !== component && newThis !== null) {
  29935. process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
  29936. } else if (!args.length) {
  29937. 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;
  29938. return boundMethod;
  29939. }
  29940. var reboundMethod = _bind.apply(boundMethod, arguments);
  29941. reboundMethod.__reactBoundContext = component;
  29942. reboundMethod.__reactBoundMethod = method;
  29943. reboundMethod.__reactBoundArguments = args;
  29944. return reboundMethod;
  29945. };
  29946. }
  29947. return boundMethod;
  29948. }
  29949. /**
  29950. * Binds all auto-bound methods in a component.
  29951. *
  29952. * @param {object} component Component whose method is going to be bound.
  29953. */
  29954. function bindAutoBindMethods(component) {
  29955. var pairs = component.__reactAutoBindPairs;
  29956. for (var i = 0; i < pairs.length; i += 2) {
  29957. var autoBindKey = pairs[i];
  29958. var method = pairs[i + 1];
  29959. component[autoBindKey] = bindAutoBindMethod(component, method);
  29960. }
  29961. }
  29962. /**
  29963. * Add more to the ReactClass base class. These are all legacy features and
  29964. * therefore not already part of the modern ReactComponent.
  29965. */
  29966. var ReactClassMixin = {
  29967. /**
  29968. * TODO: This will be deprecated because state should always keep a consistent
  29969. * type signature and the only use case for this, is to avoid that.
  29970. */
  29971. replaceState: function (newState, callback) {
  29972. this.updater.enqueueReplaceState(this, newState);
  29973. if (callback) {
  29974. this.updater.enqueueCallback(this, callback, 'replaceState');
  29975. }
  29976. },
  29977. /**
  29978. * Checks whether or not this composite component is mounted.
  29979. * @return {boolean} True if mounted, false otherwise.
  29980. * @protected
  29981. * @final
  29982. */
  29983. isMounted: function () {
  29984. return this.updater.isMounted(this);
  29985. }
  29986. };
  29987. var ReactClassComponent = function () {};
  29988. _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
  29989. /**
  29990. * Module for creating composite components.
  29991. *
  29992. * @class ReactClass
  29993. */
  29994. var ReactClass = {
  29995. /**
  29996. * Creates a composite component class given a class specification.
  29997. * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
  29998. *
  29999. * @param {object} spec Class specification (which must define `render`).
  30000. * @return {function} Component constructor function.
  30001. * @public
  30002. */
  30003. createClass: function (spec) {
  30004. // To keep our warnings more understandable, we'll use a little hack here to
  30005. // ensure that Constructor.name !== 'Constructor'. This makes sure we don't
  30006. // unnecessarily identify a class without displayName as 'Constructor'.
  30007. var Constructor = identity(function (props, context, updater) {
  30008. // This constructor gets overridden by mocks. The argument is used
  30009. // by mocks to assert on what gets mounted.
  30010. if (false) {
  30011. 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;
  30012. }
  30013. // Wire up auto-binding
  30014. if (this.__reactAutoBindPairs.length) {
  30015. bindAutoBindMethods(this);
  30016. }
  30017. this.props = props;
  30018. this.context = context;
  30019. this.refs = emptyObject;
  30020. this.updater = updater || ReactNoopUpdateQueue;
  30021. this.state = null;
  30022. // ReactClasses doesn't have constructors. Instead, they use the
  30023. // getInitialState and componentWillMount methods for initialization.
  30024. var initialState = this.getInitialState ? this.getInitialState() : null;
  30025. if (false) {
  30026. // We allow auto-mocks to proceed as if they're returning null.
  30027. if (initialState === undefined && this.getInitialState._isMockFunction) {
  30028. // This is probably bad practice. Consider warning here and
  30029. // deprecating this convenience.
  30030. initialState = null;
  30031. }
  30032. }
  30033. !(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;
  30034. this.state = initialState;
  30035. });
  30036. Constructor.prototype = new ReactClassComponent();
  30037. Constructor.prototype.constructor = Constructor;
  30038. Constructor.prototype.__reactAutoBindPairs = [];
  30039. injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
  30040. mixSpecIntoComponent(Constructor, spec);
  30041. // Initialize the defaultProps property after all mixins have been merged.
  30042. if (Constructor.getDefaultProps) {
  30043. Constructor.defaultProps = Constructor.getDefaultProps();
  30044. }
  30045. if (false) {
  30046. // This is a tag to indicate that the use of these method names is ok,
  30047. // since it's used with createClass. If it's not, then it's likely a
  30048. // mistake so we'll warn you to use the static property, property
  30049. // initializer or constructor respectively.
  30050. if (Constructor.getDefaultProps) {
  30051. Constructor.getDefaultProps.isReactClassApproved = {};
  30052. }
  30053. if (Constructor.prototype.getInitialState) {
  30054. Constructor.prototype.getInitialState.isReactClassApproved = {};
  30055. }
  30056. }
  30057. !Constructor.prototype.render ? false ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
  30058. if (false) {
  30059. 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;
  30060. 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;
  30061. }
  30062. // Reduce time spent doing lookups by setting these on the prototype.
  30063. for (var methodName in ReactClassInterface) {
  30064. if (!Constructor.prototype[methodName]) {
  30065. Constructor.prototype[methodName] = null;
  30066. }
  30067. }
  30068. return Constructor;
  30069. },
  30070. injection: {
  30071. injectMixin: function (mixin) {
  30072. injectedMixins.push(mixin);
  30073. }
  30074. }
  30075. };
  30076. module.exports = ReactClass;
  30077. /***/ }),
  30078. /* 237 */
  30079. /***/ (function(module, exports, __webpack_require__) {
  30080. "use strict";
  30081. /**
  30082. * Copyright 2013-present, Facebook, Inc.
  30083. * All rights reserved.
  30084. *
  30085. * This source code is licensed under the BSD-style license found in the
  30086. * LICENSE file in the root directory of this source tree. An additional grant
  30087. * of patent rights can be found in the PATENTS file in the same directory.
  30088. *
  30089. */
  30090. var ReactElement = __webpack_require__(22);
  30091. /**
  30092. * Create a factory that creates HTML tag elements.
  30093. *
  30094. * @private
  30095. */
  30096. var createDOMFactory = ReactElement.createFactory;
  30097. if (false) {
  30098. var ReactElementValidator = require('./ReactElementValidator');
  30099. createDOMFactory = ReactElementValidator.createFactory;
  30100. }
  30101. /**
  30102. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  30103. * This is also accessible via `React.DOM`.
  30104. *
  30105. * @public
  30106. */
  30107. var ReactDOMFactories = {
  30108. a: createDOMFactory('a'),
  30109. abbr: createDOMFactory('abbr'),
  30110. address: createDOMFactory('address'),
  30111. area: createDOMFactory('area'),
  30112. article: createDOMFactory('article'),
  30113. aside: createDOMFactory('aside'),
  30114. audio: createDOMFactory('audio'),
  30115. b: createDOMFactory('b'),
  30116. base: createDOMFactory('base'),
  30117. bdi: createDOMFactory('bdi'),
  30118. bdo: createDOMFactory('bdo'),
  30119. big: createDOMFactory('big'),
  30120. blockquote: createDOMFactory('blockquote'),
  30121. body: createDOMFactory('body'),
  30122. br: createDOMFactory('br'),
  30123. button: createDOMFactory('button'),
  30124. canvas: createDOMFactory('canvas'),
  30125. caption: createDOMFactory('caption'),
  30126. cite: createDOMFactory('cite'),
  30127. code: createDOMFactory('code'),
  30128. col: createDOMFactory('col'),
  30129. colgroup: createDOMFactory('colgroup'),
  30130. data: createDOMFactory('data'),
  30131. datalist: createDOMFactory('datalist'),
  30132. dd: createDOMFactory('dd'),
  30133. del: createDOMFactory('del'),
  30134. details: createDOMFactory('details'),
  30135. dfn: createDOMFactory('dfn'),
  30136. dialog: createDOMFactory('dialog'),
  30137. div: createDOMFactory('div'),
  30138. dl: createDOMFactory('dl'),
  30139. dt: createDOMFactory('dt'),
  30140. em: createDOMFactory('em'),
  30141. embed: createDOMFactory('embed'),
  30142. fieldset: createDOMFactory('fieldset'),
  30143. figcaption: createDOMFactory('figcaption'),
  30144. figure: createDOMFactory('figure'),
  30145. footer: createDOMFactory('footer'),
  30146. form: createDOMFactory('form'),
  30147. h1: createDOMFactory('h1'),
  30148. h2: createDOMFactory('h2'),
  30149. h3: createDOMFactory('h3'),
  30150. h4: createDOMFactory('h4'),
  30151. h5: createDOMFactory('h5'),
  30152. h6: createDOMFactory('h6'),
  30153. head: createDOMFactory('head'),
  30154. header: createDOMFactory('header'),
  30155. hgroup: createDOMFactory('hgroup'),
  30156. hr: createDOMFactory('hr'),
  30157. html: createDOMFactory('html'),
  30158. i: createDOMFactory('i'),
  30159. iframe: createDOMFactory('iframe'),
  30160. img: createDOMFactory('img'),
  30161. input: createDOMFactory('input'),
  30162. ins: createDOMFactory('ins'),
  30163. kbd: createDOMFactory('kbd'),
  30164. keygen: createDOMFactory('keygen'),
  30165. label: createDOMFactory('label'),
  30166. legend: createDOMFactory('legend'),
  30167. li: createDOMFactory('li'),
  30168. link: createDOMFactory('link'),
  30169. main: createDOMFactory('main'),
  30170. map: createDOMFactory('map'),
  30171. mark: createDOMFactory('mark'),
  30172. menu: createDOMFactory('menu'),
  30173. menuitem: createDOMFactory('menuitem'),
  30174. meta: createDOMFactory('meta'),
  30175. meter: createDOMFactory('meter'),
  30176. nav: createDOMFactory('nav'),
  30177. noscript: createDOMFactory('noscript'),
  30178. object: createDOMFactory('object'),
  30179. ol: createDOMFactory('ol'),
  30180. optgroup: createDOMFactory('optgroup'),
  30181. option: createDOMFactory('option'),
  30182. output: createDOMFactory('output'),
  30183. p: createDOMFactory('p'),
  30184. param: createDOMFactory('param'),
  30185. picture: createDOMFactory('picture'),
  30186. pre: createDOMFactory('pre'),
  30187. progress: createDOMFactory('progress'),
  30188. q: createDOMFactory('q'),
  30189. rp: createDOMFactory('rp'),
  30190. rt: createDOMFactory('rt'),
  30191. ruby: createDOMFactory('ruby'),
  30192. s: createDOMFactory('s'),
  30193. samp: createDOMFactory('samp'),
  30194. script: createDOMFactory('script'),
  30195. section: createDOMFactory('section'),
  30196. select: createDOMFactory('select'),
  30197. small: createDOMFactory('small'),
  30198. source: createDOMFactory('source'),
  30199. span: createDOMFactory('span'),
  30200. strong: createDOMFactory('strong'),
  30201. style: createDOMFactory('style'),
  30202. sub: createDOMFactory('sub'),
  30203. summary: createDOMFactory('summary'),
  30204. sup: createDOMFactory('sup'),
  30205. table: createDOMFactory('table'),
  30206. tbody: createDOMFactory('tbody'),
  30207. td: createDOMFactory('td'),
  30208. textarea: createDOMFactory('textarea'),
  30209. tfoot: createDOMFactory('tfoot'),
  30210. th: createDOMFactory('th'),
  30211. thead: createDOMFactory('thead'),
  30212. time: createDOMFactory('time'),
  30213. title: createDOMFactory('title'),
  30214. tr: createDOMFactory('tr'),
  30215. track: createDOMFactory('track'),
  30216. u: createDOMFactory('u'),
  30217. ul: createDOMFactory('ul'),
  30218. 'var': createDOMFactory('var'),
  30219. video: createDOMFactory('video'),
  30220. wbr: createDOMFactory('wbr'),
  30221. // SVG
  30222. circle: createDOMFactory('circle'),
  30223. clipPath: createDOMFactory('clipPath'),
  30224. defs: createDOMFactory('defs'),
  30225. ellipse: createDOMFactory('ellipse'),
  30226. g: createDOMFactory('g'),
  30227. image: createDOMFactory('image'),
  30228. line: createDOMFactory('line'),
  30229. linearGradient: createDOMFactory('linearGradient'),
  30230. mask: createDOMFactory('mask'),
  30231. path: createDOMFactory('path'),
  30232. pattern: createDOMFactory('pattern'),
  30233. polygon: createDOMFactory('polygon'),
  30234. polyline: createDOMFactory('polyline'),
  30235. radialGradient: createDOMFactory('radialGradient'),
  30236. rect: createDOMFactory('rect'),
  30237. stop: createDOMFactory('stop'),
  30238. svg: createDOMFactory('svg'),
  30239. text: createDOMFactory('text'),
  30240. tspan: createDOMFactory('tspan')
  30241. };
  30242. module.exports = ReactDOMFactories;
  30243. /***/ }),
  30244. /* 238 */
  30245. /***/ (function(module, exports, __webpack_require__) {
  30246. "use strict";
  30247. /**
  30248. * Copyright 2013-present, Facebook, Inc.
  30249. * All rights reserved.
  30250. *
  30251. * This source code is licensed under the BSD-style license found in the
  30252. * LICENSE file in the root directory of this source tree. An additional grant
  30253. * of patent rights can be found in the PATENTS file in the same directory.
  30254. *
  30255. */
  30256. var ReactElement = __webpack_require__(22);
  30257. var ReactPropTypeLocationNames = __webpack_require__(100);
  30258. var ReactPropTypesSecret = __webpack_require__(239);
  30259. var emptyFunction = __webpack_require__(10);
  30260. var getIteratorFn = __webpack_require__(102);
  30261. var warning = __webpack_require__(1);
  30262. /**
  30263. * Collection of methods that allow declaration and validation of props that are
  30264. * supplied to React components. Example usage:
  30265. *
  30266. * var Props = require('ReactPropTypes');
  30267. * var MyArticle = React.createClass({
  30268. * propTypes: {
  30269. * // An optional string prop named "description".
  30270. * description: Props.string,
  30271. *
  30272. * // A required enum prop named "category".
  30273. * category: Props.oneOf(['News','Photos']).isRequired,
  30274. *
  30275. * // A prop named "dialog" that requires an instance of Dialog.
  30276. * dialog: Props.instanceOf(Dialog).isRequired
  30277. * },
  30278. * render: function() { ... }
  30279. * });
  30280. *
  30281. * A more formal specification of how these methods are used:
  30282. *
  30283. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  30284. * decl := ReactPropTypes.{type}(.isRequired)?
  30285. *
  30286. * Each and every declaration produces a function with the same signature. This
  30287. * allows the creation of custom validation functions. For example:
  30288. *
  30289. * var MyLink = React.createClass({
  30290. * propTypes: {
  30291. * // An optional string or URI prop named "href".
  30292. * href: function(props, propName, componentName) {
  30293. * var propValue = props[propName];
  30294. * if (propValue != null && typeof propValue !== 'string' &&
  30295. * !(propValue instanceof URI)) {
  30296. * return new Error(
  30297. * 'Expected a string or an URI for ' + propName + ' in ' +
  30298. * componentName
  30299. * );
  30300. * }
  30301. * }
  30302. * },
  30303. * render: function() {...}
  30304. * });
  30305. *
  30306. * @internal
  30307. */
  30308. var ANONYMOUS = '<<anonymous>>';
  30309. var ReactPropTypes = {
  30310. array: createPrimitiveTypeChecker('array'),
  30311. bool: createPrimitiveTypeChecker('boolean'),
  30312. func: createPrimitiveTypeChecker('function'),
  30313. number: createPrimitiveTypeChecker('number'),
  30314. object: createPrimitiveTypeChecker('object'),
  30315. string: createPrimitiveTypeChecker('string'),
  30316. symbol: createPrimitiveTypeChecker('symbol'),
  30317. any: createAnyTypeChecker(),
  30318. arrayOf: createArrayOfTypeChecker,
  30319. element: createElementTypeChecker(),
  30320. instanceOf: createInstanceTypeChecker,
  30321. node: createNodeChecker(),
  30322. objectOf: createObjectOfTypeChecker,
  30323. oneOf: createEnumTypeChecker,
  30324. oneOfType: createUnionTypeChecker,
  30325. shape: createShapeTypeChecker
  30326. };
  30327. /**
  30328. * inlined Object.is polyfill to avoid requiring consumers ship their own
  30329. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  30330. */
  30331. /*eslint-disable no-self-compare*/
  30332. function is(x, y) {
  30333. // SameValue algorithm
  30334. if (x === y) {
  30335. // Steps 1-5, 7-10
  30336. // Steps 6.b-6.e: +0 != -0
  30337. return x !== 0 || 1 / x === 1 / y;
  30338. } else {
  30339. // Step 6.a: NaN == NaN
  30340. return x !== x && y !== y;
  30341. }
  30342. }
  30343. /*eslint-enable no-self-compare*/
  30344. /**
  30345. * We use an Error-like object for backward compatibility as people may call
  30346. * PropTypes directly and inspect their output. However we don't use real
  30347. * Errors anymore. We don't inspect their stack anyway, and creating them
  30348. * is prohibitively expensive if they are created too often, such as what
  30349. * happens in oneOfType() for any type before the one that matched.
  30350. */
  30351. function PropTypeError(message) {
  30352. this.message = message;
  30353. this.stack = '';
  30354. }
  30355. // Make `instanceof Error` still work for returned errors.
  30356. PropTypeError.prototype = Error.prototype;
  30357. function createChainableTypeChecker(validate) {
  30358. if (false) {
  30359. var manualPropTypeCallCache = {};
  30360. }
  30361. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  30362. componentName = componentName || ANONYMOUS;
  30363. propFullName = propFullName || propName;
  30364. if (false) {
  30365. if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
  30366. var cacheKey = componentName + ':' + propName;
  30367. if (!manualPropTypeCallCache[cacheKey]) {
  30368. process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;
  30369. manualPropTypeCallCache[cacheKey] = true;
  30370. }
  30371. }
  30372. }
  30373. if (props[propName] == null) {
  30374. var locationName = ReactPropTypeLocationNames[location];
  30375. if (isRequired) {
  30376. if (props[propName] === null) {
  30377. return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  30378. }
  30379. return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  30380. }
  30381. return null;
  30382. } else {
  30383. return validate(props, propName, componentName, location, propFullName);
  30384. }
  30385. }
  30386. var chainedCheckType = checkType.bind(null, false);
  30387. chainedCheckType.isRequired = checkType.bind(null, true);
  30388. return chainedCheckType;
  30389. }
  30390. function createPrimitiveTypeChecker(expectedType) {
  30391. function validate(props, propName, componentName, location, propFullName, secret) {
  30392. var propValue = props[propName];
  30393. var propType = getPropType(propValue);
  30394. if (propType !== expectedType) {
  30395. var locationName = ReactPropTypeLocationNames[location];
  30396. // `propValue` being instance of, say, date/regexp, pass the 'object'
  30397. // check, but we can offer a more precise error message here rather than
  30398. // 'of type `object`'.
  30399. var preciseType = getPreciseType(propValue);
  30400. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  30401. }
  30402. return null;
  30403. }
  30404. return createChainableTypeChecker(validate);
  30405. }
  30406. function createAnyTypeChecker() {
  30407. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  30408. }
  30409. function createArrayOfTypeChecker(typeChecker) {
  30410. function validate(props, propName, componentName, location, propFullName) {
  30411. if (typeof typeChecker !== 'function') {
  30412. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  30413. }
  30414. var propValue = props[propName];
  30415. if (!Array.isArray(propValue)) {
  30416. var locationName = ReactPropTypeLocationNames[location];
  30417. var propType = getPropType(propValue);
  30418. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  30419. }
  30420. for (var i = 0; i < propValue.length; i++) {
  30421. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  30422. if (error instanceof Error) {
  30423. return error;
  30424. }
  30425. }
  30426. return null;
  30427. }
  30428. return createChainableTypeChecker(validate);
  30429. }
  30430. function createElementTypeChecker() {
  30431. function validate(props, propName, componentName, location, propFullName) {
  30432. var propValue = props[propName];
  30433. if (!ReactElement.isValidElement(propValue)) {
  30434. var locationName = ReactPropTypeLocationNames[location];
  30435. var propType = getPropType(propValue);
  30436. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  30437. }
  30438. return null;
  30439. }
  30440. return createChainableTypeChecker(validate);
  30441. }
  30442. function createInstanceTypeChecker(expectedClass) {
  30443. function validate(props, propName, componentName, location, propFullName) {
  30444. if (!(props[propName] instanceof expectedClass)) {
  30445. var locationName = ReactPropTypeLocationNames[location];
  30446. var expectedClassName = expectedClass.name || ANONYMOUS;
  30447. var actualClassName = getClassName(props[propName]);
  30448. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  30449. }
  30450. return null;
  30451. }
  30452. return createChainableTypeChecker(validate);
  30453. }
  30454. function createEnumTypeChecker(expectedValues) {
  30455. if (!Array.isArray(expectedValues)) {
  30456. false ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
  30457. return emptyFunction.thatReturnsNull;
  30458. }
  30459. function validate(props, propName, componentName, location, propFullName) {
  30460. var propValue = props[propName];
  30461. for (var i = 0; i < expectedValues.length; i++) {
  30462. if (is(propValue, expectedValues[i])) {
  30463. return null;
  30464. }
  30465. }
  30466. var locationName = ReactPropTypeLocationNames[location];
  30467. var valuesString = JSON.stringify(expectedValues);
  30468. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  30469. }
  30470. return createChainableTypeChecker(validate);
  30471. }
  30472. function createObjectOfTypeChecker(typeChecker) {
  30473. function validate(props, propName, componentName, location, propFullName) {
  30474. if (typeof typeChecker !== 'function') {
  30475. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  30476. }
  30477. var propValue = props[propName];
  30478. var propType = getPropType(propValue);
  30479. if (propType !== 'object') {
  30480. var locationName = ReactPropTypeLocationNames[location];
  30481. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  30482. }
  30483. for (var key in propValue) {
  30484. if (propValue.hasOwnProperty(key)) {
  30485. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  30486. if (error instanceof Error) {
  30487. return error;
  30488. }
  30489. }
  30490. }
  30491. return null;
  30492. }
  30493. return createChainableTypeChecker(validate);
  30494. }
  30495. function createUnionTypeChecker(arrayOfTypeCheckers) {
  30496. if (!Array.isArray(arrayOfTypeCheckers)) {
  30497. false ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  30498. return emptyFunction.thatReturnsNull;
  30499. }
  30500. function validate(props, propName, componentName, location, propFullName) {
  30501. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  30502. var checker = arrayOfTypeCheckers[i];
  30503. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
  30504. return null;
  30505. }
  30506. }
  30507. var locationName = ReactPropTypeLocationNames[location];
  30508. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  30509. }
  30510. return createChainableTypeChecker(validate);
  30511. }
  30512. function createNodeChecker() {
  30513. function validate(props, propName, componentName, location, propFullName) {
  30514. if (!isNode(props[propName])) {
  30515. var locationName = ReactPropTypeLocationNames[location];
  30516. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  30517. }
  30518. return null;
  30519. }
  30520. return createChainableTypeChecker(validate);
  30521. }
  30522. function createShapeTypeChecker(shapeTypes) {
  30523. function validate(props, propName, componentName, location, propFullName) {
  30524. var propValue = props[propName];
  30525. var propType = getPropType(propValue);
  30526. if (propType !== 'object') {
  30527. var locationName = ReactPropTypeLocationNames[location];
  30528. return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  30529. }
  30530. for (var key in shapeTypes) {
  30531. var checker = shapeTypes[key];
  30532. if (!checker) {
  30533. continue;
  30534. }
  30535. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  30536. if (error) {
  30537. return error;
  30538. }
  30539. }
  30540. return null;
  30541. }
  30542. return createChainableTypeChecker(validate);
  30543. }
  30544. function isNode(propValue) {
  30545. switch (typeof propValue) {
  30546. case 'number':
  30547. case 'string':
  30548. case 'undefined':
  30549. return true;
  30550. case 'boolean':
  30551. return !propValue;
  30552. case 'object':
  30553. if (Array.isArray(propValue)) {
  30554. return propValue.every(isNode);
  30555. }
  30556. if (propValue === null || ReactElement.isValidElement(propValue)) {
  30557. return true;
  30558. }
  30559. var iteratorFn = getIteratorFn(propValue);
  30560. if (iteratorFn) {
  30561. var iterator = iteratorFn.call(propValue);
  30562. var step;
  30563. if (iteratorFn !== propValue.entries) {
  30564. while (!(step = iterator.next()).done) {
  30565. if (!isNode(step.value)) {
  30566. return false;
  30567. }
  30568. }
  30569. } else {
  30570. // Iterator will provide entry [k,v] tuples rather than values.
  30571. while (!(step = iterator.next()).done) {
  30572. var entry = step.value;
  30573. if (entry) {
  30574. if (!isNode(entry[1])) {
  30575. return false;
  30576. }
  30577. }
  30578. }
  30579. }
  30580. } else {
  30581. return false;
  30582. }
  30583. return true;
  30584. default:
  30585. return false;
  30586. }
  30587. }
  30588. function isSymbol(propType, propValue) {
  30589. // Native Symbol.
  30590. if (propType === 'symbol') {
  30591. return true;
  30592. }
  30593. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  30594. if (propValue['@@toStringTag'] === 'Symbol') {
  30595. return true;
  30596. }
  30597. // Fallback for non-spec compliant Symbols which are polyfilled.
  30598. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  30599. return true;
  30600. }
  30601. return false;
  30602. }
  30603. // Equivalent of `typeof` but with special handling for array and regexp.
  30604. function getPropType(propValue) {
  30605. var propType = typeof propValue;
  30606. if (Array.isArray(propValue)) {
  30607. return 'array';
  30608. }
  30609. if (propValue instanceof RegExp) {
  30610. // Old webkits (at least until Android 4.0) return 'function' rather than
  30611. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  30612. // passes PropTypes.object.
  30613. return 'object';
  30614. }
  30615. if (isSymbol(propType, propValue)) {
  30616. return 'symbol';
  30617. }
  30618. return propType;
  30619. }
  30620. // This handles more types than `getPropType`. Only used for error messages.
  30621. // See `createPrimitiveTypeChecker`.
  30622. function getPreciseType(propValue) {
  30623. var propType = getPropType(propValue);
  30624. if (propType === 'object') {
  30625. if (propValue instanceof Date) {
  30626. return 'date';
  30627. } else if (propValue instanceof RegExp) {
  30628. return 'regexp';
  30629. }
  30630. }
  30631. return propType;
  30632. }
  30633. // Returns class name of the object, if any.
  30634. function getClassName(propValue) {
  30635. if (!propValue.constructor || !propValue.constructor.name) {
  30636. return ANONYMOUS;
  30637. }
  30638. return propValue.constructor.name;
  30639. }
  30640. module.exports = ReactPropTypes;
  30641. /***/ }),
  30642. /* 239 */
  30643. /***/ (function(module, exports, __webpack_require__) {
  30644. "use strict";
  30645. /**
  30646. * Copyright 2013-present, Facebook, Inc.
  30647. * All rights reserved.
  30648. *
  30649. * This source code is licensed under the BSD-style license found in the
  30650. * LICENSE file in the root directory of this source tree. An additional grant
  30651. * of patent rights can be found in the PATENTS file in the same directory.
  30652. *
  30653. *
  30654. */
  30655. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  30656. module.exports = ReactPropTypesSecret;
  30657. /***/ }),
  30658. /* 240 */
  30659. /***/ (function(module, exports, __webpack_require__) {
  30660. "use strict";
  30661. /**
  30662. * Copyright 2013-present, Facebook, Inc.
  30663. * All rights reserved.
  30664. *
  30665. * This source code is licensed under the BSD-style license found in the
  30666. * LICENSE file in the root directory of this source tree. An additional grant
  30667. * of patent rights can be found in the PATENTS file in the same directory.
  30668. *
  30669. */
  30670. var _assign = __webpack_require__(3);
  30671. var ReactComponent = __webpack_require__(66);
  30672. var ReactNoopUpdateQueue = __webpack_require__(67);
  30673. var emptyObject = __webpack_require__(25);
  30674. /**
  30675. * Base class helpers for the updating state of a component.
  30676. */
  30677. function ReactPureComponent(props, context, updater) {
  30678. // Duplicated from ReactComponent.
  30679. this.props = props;
  30680. this.context = context;
  30681. this.refs = emptyObject;
  30682. // We initialize the default updater but the real one gets injected by the
  30683. // renderer.
  30684. this.updater = updater || ReactNoopUpdateQueue;
  30685. }
  30686. function ComponentDummy() {}
  30687. ComponentDummy.prototype = ReactComponent.prototype;
  30688. ReactPureComponent.prototype = new ComponentDummy();
  30689. ReactPureComponent.prototype.constructor = ReactPureComponent;
  30690. // Avoid an extra prototype jump for these methods.
  30691. _assign(ReactPureComponent.prototype, ReactComponent.prototype);
  30692. ReactPureComponent.prototype.isPureReactComponent = true;
  30693. module.exports = ReactPureComponent;
  30694. /***/ }),
  30695. /* 241 */
  30696. /***/ (function(module, exports, __webpack_require__) {
  30697. "use strict";
  30698. /**
  30699. * Copyright 2013-present, Facebook, Inc.
  30700. * All rights reserved.
  30701. *
  30702. * This source code is licensed under the BSD-style license found in the
  30703. * LICENSE file in the root directory of this source tree. An additional grant
  30704. * of patent rights can be found in the PATENTS file in the same directory.
  30705. *
  30706. */
  30707. module.exports = '15.4.2';
  30708. /***/ }),
  30709. /* 242 */
  30710. /***/ (function(module, exports, __webpack_require__) {
  30711. "use strict";
  30712. /**
  30713. * Copyright 2013-present, Facebook, Inc.
  30714. * All rights reserved.
  30715. *
  30716. * This source code is licensed under the BSD-style license found in the
  30717. * LICENSE file in the root directory of this source tree. An additional grant
  30718. * of patent rights can be found in the PATENTS file in the same directory.
  30719. *
  30720. */
  30721. var _prodInvariant = __webpack_require__(23);
  30722. var ReactElement = __webpack_require__(22);
  30723. var invariant = __webpack_require__(0);
  30724. /**
  30725. * Returns the first child in a collection of children and verifies that there
  30726. * is only one child in the collection.
  30727. *
  30728. * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
  30729. *
  30730. * The current implementation of this function assumes that a single child gets
  30731. * passed without a wrapper, but the purpose of this helper function is to
  30732. * abstract away the particular structure of children.
  30733. *
  30734. * @param {?object} children Child collection structure.
  30735. * @return {ReactElement} The first and only `ReactElement` contained in the
  30736. * structure.
  30737. */
  30738. function onlyChild(children) {
  30739. !ReactElement.isValidElement(children) ? false ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
  30740. return children;
  30741. }
  30742. module.exports = onlyChild;
  30743. /***/ }),
  30744. /* 243 */
  30745. /***/ (function(module, exports, __webpack_require__) {
  30746. "use strict";
  30747. /**
  30748. * Copyright 2013-present, Facebook, Inc.
  30749. * All rights reserved.
  30750. *
  30751. * This source code is licensed under the BSD-style license found in the
  30752. * LICENSE file in the root directory of this source tree. An additional grant
  30753. * of patent rights can be found in the PATENTS file in the same directory.
  30754. *
  30755. */
  30756. var _prodInvariant = __webpack_require__(23);
  30757. var ReactCurrentOwner = __webpack_require__(14);
  30758. var REACT_ELEMENT_TYPE = __webpack_require__(99);
  30759. var getIteratorFn = __webpack_require__(102);
  30760. var invariant = __webpack_require__(0);
  30761. var KeyEscapeUtils = __webpack_require__(233);
  30762. var warning = __webpack_require__(1);
  30763. var SEPARATOR = '.';
  30764. var SUBSEPARATOR = ':';
  30765. /**
  30766. * This is inlined from ReactElement since this file is shared between
  30767. * isomorphic and renderers. We could extract this to a
  30768. *
  30769. */
  30770. /**
  30771. * TODO: Test that a single child and an array with one item have the same key
  30772. * pattern.
  30773. */
  30774. var didWarnAboutMaps = false;
  30775. /**
  30776. * Generate a key string that identifies a component within a set.
  30777. *
  30778. * @param {*} component A component that could contain a manual key.
  30779. * @param {number} index Index that is used if a manual key is not provided.
  30780. * @return {string}
  30781. */
  30782. function getComponentKey(component, index) {
  30783. // Do some typechecking here since we call this blindly. We want to ensure
  30784. // that we don't block potential future ES APIs.
  30785. if (component && typeof component === 'object' && component.key != null) {
  30786. // Explicit key
  30787. return KeyEscapeUtils.escape(component.key);
  30788. }
  30789. // Implicit key determined by the index in the set
  30790. return index.toString(36);
  30791. }
  30792. /**
  30793. * @param {?*} children Children tree container.
  30794. * @param {!string} nameSoFar Name of the key path so far.
  30795. * @param {!function} callback Callback to invoke with each child found.
  30796. * @param {?*} traverseContext Used to pass information throughout the traversal
  30797. * process.
  30798. * @return {!number} The number of children in this subtree.
  30799. */
  30800. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  30801. var type = typeof children;
  30802. if (type === 'undefined' || type === 'boolean') {
  30803. // All of the above are perceived as null.
  30804. children = null;
  30805. }
  30806. if (children === null || type === 'string' || type === 'number' ||
  30807. // The following is inlined from ReactElement. This means we can optimize
  30808. // some checks. React Fiber also inlines this logic for similar purposes.
  30809. type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
  30810. callback(traverseContext, children,
  30811. // If it's the only child, treat the name as if it was wrapped in an array
  30812. // so that it's consistent if the number of children grows.
  30813. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  30814. return 1;
  30815. }
  30816. var child;
  30817. var nextName;
  30818. var subtreeCount = 0; // Count of children found in the current subtree.
  30819. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  30820. if (Array.isArray(children)) {
  30821. for (var i = 0; i < children.length; i++) {
  30822. child = children[i];
  30823. nextName = nextNamePrefix + getComponentKey(child, i);
  30824. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30825. }
  30826. } else {
  30827. var iteratorFn = getIteratorFn(children);
  30828. if (iteratorFn) {
  30829. var iterator = iteratorFn.call(children);
  30830. var step;
  30831. if (iteratorFn !== children.entries) {
  30832. var ii = 0;
  30833. while (!(step = iterator.next()).done) {
  30834. child = step.value;
  30835. nextName = nextNamePrefix + getComponentKey(child, ii++);
  30836. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30837. }
  30838. } else {
  30839. if (false) {
  30840. var mapsAsChildrenAddendum = '';
  30841. if (ReactCurrentOwner.current) {
  30842. var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
  30843. if (mapsAsChildrenOwnerName) {
  30844. mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
  30845. }
  30846. }
  30847. 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;
  30848. didWarnAboutMaps = true;
  30849. }
  30850. // Iterator will provide entry [k,v] tuples rather than values.
  30851. while (!(step = iterator.next()).done) {
  30852. var entry = step.value;
  30853. if (entry) {
  30854. child = entry[1];
  30855. nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
  30856. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  30857. }
  30858. }
  30859. }
  30860. } else if (type === 'object') {
  30861. var addendum = '';
  30862. if (false) {
  30863. 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.';
  30864. if (children._isReactElement) {
  30865. 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.';
  30866. }
  30867. if (ReactCurrentOwner.current) {
  30868. var name = ReactCurrentOwner.current.getName();
  30869. if (name) {
  30870. addendum += ' Check the render method of `' + name + '`.';
  30871. }
  30872. }
  30873. }
  30874. var childrenString = String(children);
  30875. 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;
  30876. }
  30877. }
  30878. return subtreeCount;
  30879. }
  30880. /**
  30881. * Traverses children that are typically specified as `props.children`, but
  30882. * might also be specified through attributes:
  30883. *
  30884. * - `traverseAllChildren(this.props.children, ...)`
  30885. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  30886. *
  30887. * The `traverseContext` is an optional argument that is passed through the
  30888. * entire traversal. It can be used to store accumulations or anything else that
  30889. * the callback might find relevant.
  30890. *
  30891. * @param {?*} children Children tree object.
  30892. * @param {!function} callback To invoke upon traversing each child.
  30893. * @param {?*} traverseContext Context for traversal.
  30894. * @return {!number} The number of children in this subtree.
  30895. */
  30896. function traverseAllChildren(children, callback, traverseContext) {
  30897. if (children == null) {
  30898. return 0;
  30899. }
  30900. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  30901. }
  30902. module.exports = traverseAllChildren;
  30903. /***/ }),
  30904. /* 244 */
  30905. /***/ (function(module, exports, __webpack_require__) {
  30906. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  30907. // Distributed under an MIT license: http://codemirror.net/LICENSE
  30908. (function(mod) {
  30909. if (true) // CommonJS
  30910. mod(__webpack_require__(68));
  30911. else if (typeof define == "function" && define.amd) // AMD
  30912. define(["../../lib/codemirror"], mod);
  30913. else // Plain browser env
  30914. mod(CodeMirror);
  30915. })(function(CodeMirror) {
  30916. "use strict";
  30917. var noOptions = {};
  30918. var nonWS = /[^\s\u00a0]/;
  30919. var Pos = CodeMirror.Pos;
  30920. function firstNonWS(str) {
  30921. var found = str.search(nonWS);
  30922. return found == -1 ? 0 : found;
  30923. }
  30924. CodeMirror.commands.toggleComment = function(cm) {
  30925. cm.toggleComment();
  30926. };
  30927. CodeMirror.defineExtension("toggleComment", function(options) {
  30928. if (!options) options = noOptions;
  30929. var cm = this;
  30930. var minLine = Infinity, ranges = this.listSelections(), mode = null;
  30931. for (var i = ranges.length - 1; i >= 0; i--) {
  30932. var from = ranges[i].from(), to = ranges[i].to();
  30933. if (from.line >= minLine) continue;
  30934. if (to.line >= minLine) to = Pos(minLine, 0);
  30935. minLine = from.line;
  30936. if (mode == null) {
  30937. if (cm.uncomment(from, to, options)) mode = "un";
  30938. else { cm.lineComment(from, to, options); mode = "line"; }
  30939. } else if (mode == "un") {
  30940. cm.uncomment(from, to, options);
  30941. } else {
  30942. cm.lineComment(from, to, options);
  30943. }
  30944. }
  30945. });
  30946. // Rough heuristic to try and detect lines that are part of multi-line string
  30947. function probablyInsideString(cm, pos, line) {
  30948. return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
  30949. }
  30950. function getMode(cm, pos) {
  30951. var mode = cm.getMode()
  30952. return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
  30953. }
  30954. CodeMirror.defineExtension("lineComment", function(from, to, options) {
  30955. if (!options) options = noOptions;
  30956. var self = this, mode = getMode(self, from);
  30957. var firstLine = self.getLine(from.line);
  30958. if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
  30959. var commentString = options.lineComment || mode.lineComment;
  30960. if (!commentString) {
  30961. if (options.blockCommentStart || mode.blockCommentStart) {
  30962. options.fullLines = true;
  30963. self.blockComment(from, to, options);
  30964. }
  30965. return;
  30966. }
  30967. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
  30968. var pad = options.padding == null ? " " : options.padding;
  30969. var blankLines = options.commentBlankLines || from.line == to.line;
  30970. self.operation(function() {
  30971. if (options.indent) {
  30972. var baseString = null;
  30973. for (var i = from.line; i < end; ++i) {
  30974. var line = self.getLine(i);
  30975. var whitespace = line.slice(0, firstNonWS(line));
  30976. if (baseString == null || baseString.length > whitespace.length) {
  30977. baseString = whitespace;
  30978. }
  30979. }
  30980. for (var i = from.line; i < end; ++i) {
  30981. var line = self.getLine(i), cut = baseString.length;
  30982. if (!blankLines && !nonWS.test(line)) continue;
  30983. if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
  30984. self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
  30985. }
  30986. } else {
  30987. for (var i = from.line; i < end; ++i) {
  30988. if (blankLines || nonWS.test(self.getLine(i)))
  30989. self.replaceRange(commentString + pad, Pos(i, 0));
  30990. }
  30991. }
  30992. });
  30993. });
  30994. CodeMirror.defineExtension("blockComment", function(from, to, options) {
  30995. if (!options) options = noOptions;
  30996. var self = this, mode = getMode(self, from);
  30997. var startString = options.blockCommentStart || mode.blockCommentStart;
  30998. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  30999. if (!startString || !endString) {
  31000. if ((options.lineComment || mode.lineComment) && options.fullLines != false)
  31001. self.lineComment(from, to, options);
  31002. return;
  31003. }
  31004. if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
  31005. var end = Math.min(to.line, self.lastLine());
  31006. if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
  31007. var pad = options.padding == null ? " " : options.padding;
  31008. if (from.line > end) return;
  31009. self.operation(function() {
  31010. if (options.fullLines != false) {
  31011. var lastLineHasText = nonWS.test(self.getLine(end));
  31012. self.replaceRange(pad + endString, Pos(end));
  31013. self.replaceRange(startString + pad, Pos(from.line, 0));
  31014. var lead = options.blockCommentLead || mode.blockCommentLead;
  31015. if (lead != null) for (var i = from.line + 1; i <= end; ++i)
  31016. if (i != end || lastLineHasText)
  31017. self.replaceRange(lead + pad, Pos(i, 0));
  31018. } else {
  31019. self.replaceRange(endString, to);
  31020. self.replaceRange(startString, from);
  31021. }
  31022. });
  31023. });
  31024. CodeMirror.defineExtension("uncomment", function(from, to, options) {
  31025. if (!options) options = noOptions;
  31026. var self = this, mode = getMode(self, from);
  31027. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
  31028. // Try finding line comments
  31029. var lineString = options.lineComment || mode.lineComment, lines = [];
  31030. var pad = options.padding == null ? " " : options.padding, didSomething;
  31031. lineComment: {
  31032. if (!lineString) break lineComment;
  31033. for (var i = start; i <= end; ++i) {
  31034. var line = self.getLine(i);
  31035. var found = line.indexOf(lineString);
  31036. if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
  31037. if (found == -1 && nonWS.test(line)) break lineComment;
  31038. if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
  31039. lines.push(line);
  31040. }
  31041. self.operation(function() {
  31042. for (var i = start; i <= end; ++i) {
  31043. var line = lines[i - start];
  31044. var pos = line.indexOf(lineString), endPos = pos + lineString.length;
  31045. if (pos < 0) continue;
  31046. if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
  31047. didSomething = true;
  31048. self.replaceRange("", Pos(i, pos), Pos(i, endPos));
  31049. }
  31050. });
  31051. if (didSomething) return true;
  31052. }
  31053. // Try block comments
  31054. var startString = options.blockCommentStart || mode.blockCommentStart;
  31055. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  31056. if (!startString || !endString) return false;
  31057. var lead = options.blockCommentLead || mode.blockCommentLead;
  31058. var startLine = self.getLine(start), open = startLine.indexOf(startString)
  31059. if (open == -1) return false
  31060. var endLine = end == start ? startLine : self.getLine(end)
  31061. var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
  31062. if (close == -1 && start != end) {
  31063. endLine = self.getLine(--end);
  31064. close = endLine.indexOf(endString);
  31065. }
  31066. var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
  31067. if (close == -1 ||
  31068. !/comment/.test(self.getTokenTypeAt(insideStart)) ||
  31069. !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
  31070. self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
  31071. return false;
  31072. // Avoid killing block comments completely outside the selection.
  31073. // Positions of the last startString before the start of the selection, and the first endString after it.
  31074. var lastStart = startLine.lastIndexOf(startString, from.ch);
  31075. var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
  31076. if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
  31077. // Positions of the first endString after the end of the selection, and the last startString before it.
  31078. firstEnd = endLine.indexOf(endString, to.ch);
  31079. var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
  31080. lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
  31081. if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
  31082. self.operation(function() {
  31083. self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
  31084. Pos(end, close + endString.length));
  31085. var openEnd = open + startString.length;
  31086. if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
  31087. self.replaceRange("", Pos(start, open), Pos(start, openEnd));
  31088. if (lead) for (var i = start + 1; i <= end; ++i) {
  31089. var line = self.getLine(i), found = line.indexOf(lead);
  31090. if (found == -1 || nonWS.test(line.slice(0, found))) continue;
  31091. var foundEnd = found + lead.length;
  31092. if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
  31093. self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
  31094. }
  31095. });
  31096. return true;
  31097. });
  31098. });
  31099. /***/ })
  31100. /******/ ]);
  31101. //# sourceMappingURL=bundle.js.map