blockly_compressed.js 903 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326
  1. // Do not edit this file; automatically generated by build.py.
  2. 'use strict';
  3. var $jscomp = $jscomp || {};
  4. $jscomp.scope = {};
  5. var COMPILED = !0
  6. , goog = goog || {};
  7. goog.global = this || self;
  8. goog.isDef = function (a) {
  9. return void 0 !== a
  10. }
  11. ;
  12. goog.isString = function (a) {
  13. return "string" == typeof a
  14. }
  15. ;
  16. goog.isBoolean = function (a) {
  17. return "boolean" == typeof a
  18. }
  19. ;
  20. goog.isNumber = function (a) {
  21. return "number" == typeof a
  22. }
  23. ;
  24. goog.exportPath_ = function (a, b, c) {
  25. a = a.split(".");
  26. c = c || goog.global;
  27. a[0] in c || "undefined" == typeof c.execScript || c.execScript("var " + a[0]);
  28. for (var d; a.length && (d = a.shift());)
  29. a.length || void 0 === b ? c = c[d] && c[d] !== Object.prototype[d] ? c[d] : c[d] = {} : c[d] = b
  30. }
  31. ;
  32. goog.define = function (a, b) {
  33. var c = b;
  34. if (!COMPILED) {
  35. var d = goog.global.CLOSURE_UNCOMPILED_DEFINES
  36. , e = goog.global.CLOSURE_DEFINES;
  37. d && void 0 === d.nodeType && Object.prototype.hasOwnProperty.call(d, a) ? c = d[a] : e && void 0 === e.nodeType && Object.prototype.hasOwnProperty.call(e, a) && (c = e[a])
  38. }
  39. return c
  40. }
  41. ;
  42. goog.FEATURESET_YEAR = 2012;
  43. goog.DEBUG = !1;
  44. goog.LOCALE = "en";
  45. goog.TRUSTED_SITE = !0;
  46. goog.STRICT_MODE_COMPATIBLE = !1;
  47. goog.DISALLOW_TEST_ONLY_CODE = COMPILED && !goog.DEBUG;
  48. goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1;
  49. goog.provide = function (a) {
  50. if (goog.isInModuleLoader_())
  51. throw Error("goog.provide cannot be used within a module.");
  52. if (!COMPILED && goog.isProvided_(a))
  53. throw Error('Namespace "' + a + '" already declared.');
  54. goog.constructNamespace_(a)
  55. }
  56. ;
  57. goog.constructNamespace_ = function (a, b) {
  58. if (!COMPILED) {
  59. delete goog.implicitNamespaces_[a];
  60. for (var c = a; (c = c.substring(0, c.lastIndexOf("."))) && !goog.getObjectByName(c);)
  61. goog.implicitNamespaces_[c] = !0
  62. }
  63. goog.exportPath_(a, b)
  64. }
  65. ;
  66. goog.getScriptNonce = function (a) {
  67. if (a && a != goog.global)
  68. return goog.getScriptNonce_(a.document);
  69. null === goog.cspNonce_ && (goog.cspNonce_ = goog.getScriptNonce_(goog.global.document));
  70. return goog.cspNonce_
  71. }
  72. ;
  73. goog.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/;
  74. goog.cspNonce_ = null;
  75. goog.getScriptNonce_ = function (a) {
  76. return (a = a.querySelector && a.querySelector("script[nonce]")) && (a = a.nonce || a.getAttribute("nonce")) && goog.NONCE_PATTERN_.test(a) ? a : ""
  77. }
  78. ;
  79. goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
  80. goog.module = function (a) {
  81. if ("string" !== typeof a || !a || -1 == a.search(goog.VALID_MODULE_RE_))
  82. throw Error("Invalid module identifier");
  83. if (!goog.isInGoogModuleLoader_())
  84. throw Error("Module " + a + " has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");
  85. if (goog.moduleLoaderState_.moduleName)
  86. throw Error("goog.module may only be called once per module.");
  87. goog.moduleLoaderState_.moduleName = a;
  88. if (!COMPILED) {
  89. if (goog.isProvided_(a))
  90. throw Error('Namespace "' + a + '" already declared.');
  91. delete goog.implicitNamespaces_[a]
  92. }
  93. }
  94. ;
  95. goog.module.get = function (a) {
  96. return goog.module.getInternal_(a)
  97. }
  98. ;
  99. goog.module.getInternal_ = function (a) {
  100. if (!COMPILED) {
  101. if (a in goog.loadedModules_)
  102. return goog.loadedModules_[a].exports;
  103. if (!goog.implicitNamespaces_[a])
  104. return a = goog.getObjectByName(a),
  105. null != a ? a : null
  106. }
  107. return null
  108. }
  109. ;
  110. goog.ModuleType = {
  111. ES6: "es6",
  112. GOOG: "goog"
  113. };
  114. goog.moduleLoaderState_ = null;
  115. goog.isInModuleLoader_ = function () {
  116. return goog.isInGoogModuleLoader_() || goog.isInEs6ModuleLoader_()
  117. }
  118. ;
  119. goog.isInGoogModuleLoader_ = function () {
  120. return !!goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.GOOG
  121. }
  122. ;
  123. goog.isInEs6ModuleLoader_ = function () {
  124. if (goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.ES6)
  125. return !0;
  126. var a = goog.global.$jscomp;
  127. return a ? "function" != typeof a.getCurrentModulePath ? !1 : !!a.getCurrentModulePath() : !1
  128. }
  129. ;
  130. goog.module.declareLegacyNamespace = function () {
  131. if (!COMPILED && !goog.isInGoogModuleLoader_())
  132. throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");
  133. if (!COMPILED && !goog.moduleLoaderState_.moduleName)
  134. throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");
  135. goog.moduleLoaderState_.declareLegacyNamespace = !0
  136. }
  137. ;
  138. goog.declareModuleId = function (a) {
  139. if (!COMPILED) {
  140. if (!goog.isInEs6ModuleLoader_())
  141. throw Error("goog.declareModuleId may only be called from within an ES6 module");
  142. if (goog.moduleLoaderState_ && goog.moduleLoaderState_.moduleName)
  143. throw Error("goog.declareModuleId may only be called once per module.");
  144. if (a in goog.loadedModules_)
  145. throw Error('Module with namespace "' + a + '" already exists.');
  146. }
  147. if (goog.moduleLoaderState_)
  148. goog.moduleLoaderState_.moduleName = a;
  149. else {
  150. var b = goog.global.$jscomp;
  151. if (!b || "function" != typeof b.getCurrentModulePath)
  152. throw Error('Module with namespace "' + a + '" has been loaded incorrectly.');
  153. b = b.require(b.getCurrentModulePath());
  154. goog.loadedModules_[a] = {
  155. exports: b,
  156. type: goog.ModuleType.ES6,
  157. moduleId: a
  158. }
  159. }
  160. }
  161. ;
  162. goog.setTestOnly = function (a) {
  163. if (goog.DISALLOW_TEST_ONLY_CODE)
  164. throw a = a || "",
  165. Error("Importing test-only code into non-debug environment" + (a ? ": " + a : "."));
  166. }
  167. ;
  168. goog.forwardDeclare = function (a) { }
  169. ;
  170. COMPILED || (goog.isProvided_ = function (a) {
  171. return a in goog.loadedModules_ || !goog.implicitNamespaces_[a] && null != goog.getObjectByName(a)
  172. }
  173. ,
  174. goog.implicitNamespaces_ = {
  175. "goog.module": !0
  176. });
  177. goog.getObjectByName = function (a, b) {
  178. for (var c = a.split("."), d = b || goog.global, e = 0; e < c.length; e++)
  179. if (d = d[c[e]],
  180. null == d)
  181. return null;
  182. return d
  183. }
  184. ;
  185. goog.globalize = function (a, b) {
  186. var c = b || goog.global, d;
  187. for (d in a)
  188. c[d] = a[d]
  189. }
  190. ;
  191. goog.addDependency = function (a, b, c, d) {
  192. !COMPILED && goog.DEPENDENCIES_ENABLED && goog.debugLoader_.addDependency(a, b, c, d)
  193. }
  194. ;
  195. goog.ENABLE_DEBUG_LOADER = !0;
  196. goog.logToConsole_ = function (a) {
  197. goog.global.console && goog.global.console.error(a)
  198. }
  199. ;
  200. goog.require = function (a) {
  201. if (!COMPILED) {
  202. goog.ENABLE_DEBUG_LOADER && goog.debugLoader_.requested(a);
  203. if (goog.isProvided_(a)) {
  204. if (goog.isInModuleLoader_())
  205. return goog.module.getInternal_(a)
  206. } else if (goog.ENABLE_DEBUG_LOADER) {
  207. var b = goog.moduleLoaderState_;
  208. goog.moduleLoaderState_ = null;
  209. try {
  210. goog.debugLoader_.load_(a)
  211. } finally {
  212. goog.moduleLoaderState_ = b
  213. }
  214. }
  215. return null
  216. }
  217. }
  218. ;
  219. goog.requireType = function (a) {
  220. return {}
  221. }
  222. ;
  223. goog.basePath = "";
  224. goog.nullFunction = function () { }
  225. ;
  226. goog.abstractMethod = function () {
  227. throw Error("unimplemented abstract method");
  228. }
  229. ;
  230. goog.addSingletonGetter = function (a) {
  231. a.instance_ = void 0;
  232. a.getInstance = function () {
  233. if (a.instance_)
  234. return a.instance_;
  235. goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a);
  236. return a.instance_ = new a
  237. }
  238. }
  239. ;
  240. goog.instantiatedSingletons_ = [];
  241. goog.LOAD_MODULE_USING_EVAL = !0;
  242. goog.SEAL_MODULE_EXPORTS = goog.DEBUG;
  243. goog.loadedModules_ = {};
  244. goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
  245. goog.TRANSPILE = "detect";
  246. goog.ASSUME_ES_MODULES_TRANSPILED = !1;
  247. goog.TRANSPILE_TO_LANGUAGE = "";
  248. goog.TRANSPILER = "transpile.js";
  249. goog.hasBadLetScoping = null;
  250. goog.useSafari10Workaround = function () {
  251. if (null == goog.hasBadLetScoping) {
  252. try {
  253. var a = !eval('"use strict";let x = 1; function f() { return typeof x; };f() == "number";')
  254. } catch (b) {
  255. a = !1
  256. }
  257. goog.hasBadLetScoping = a
  258. }
  259. return goog.hasBadLetScoping
  260. }
  261. ;
  262. goog.workaroundSafari10EvalBug = function (a) {
  263. return "(function(){" + a + "\n;})();\n"
  264. }
  265. ;
  266. goog.loadModule = function (a) {
  267. var b = goog.moduleLoaderState_;
  268. try {
  269. goog.moduleLoaderState_ = {
  270. moduleName: "",
  271. declareLegacyNamespace: !1,
  272. type: goog.ModuleType.GOOG
  273. };
  274. if (goog.isFunction(a))
  275. var c = a.call(void 0, {});
  276. else if ("string" === typeof a)
  277. goog.useSafari10Workaround() && (a = goog.workaroundSafari10EvalBug(a)),
  278. c = goog.loadModuleFromSource_.call(void 0, a);
  279. else
  280. throw Error("Invalid module definition");
  281. var d = goog.moduleLoaderState_.moduleName;
  282. if ("string" === typeof d && d)
  283. goog.moduleLoaderState_.declareLegacyNamespace ? goog.constructNamespace_(d, c) : goog.SEAL_MODULE_EXPORTS && Object.seal && "object" == typeof c && null != c && Object.seal(c),
  284. goog.loadedModules_[d] = {
  285. exports: c,
  286. type: goog.ModuleType.GOOG,
  287. moduleId: goog.moduleLoaderState_.moduleName
  288. };
  289. else
  290. throw Error('Invalid module name "' + d + '"');
  291. } finally {
  292. goog.moduleLoaderState_ = b
  293. }
  294. }
  295. ;
  296. goog.loadModuleFromSource_ = function (a) {
  297. eval(a);
  298. return {}
  299. }
  300. ;
  301. goog.normalizePath_ = function (a) {
  302. a = a.split("/");
  303. for (var b = 0; b < a.length;)
  304. "." == a[b] ? a.splice(b, 1) : b && ".." == a[b] && a[b - 1] && ".." != a[b - 1] ? a.splice(--b, 2) : b++;
  305. return a.join("/")
  306. }
  307. ;
  308. goog.loadFileSync_ = function (a) {
  309. if (goog.global.CLOSURE_LOAD_FILE_SYNC)
  310. return goog.global.CLOSURE_LOAD_FILE_SYNC(a);
  311. try {
  312. var b = new goog.global.XMLHttpRequest;
  313. b.open("get", a, !1);
  314. b.send();
  315. return 0 == b.status || 200 == b.status ? b.responseText : null
  316. } catch (c) {
  317. return null
  318. }
  319. }
  320. ;
  321. goog.transpile_ = function (a, b, c) {
  322. var d = goog.global.$jscomp;
  323. d || (goog.global.$jscomp = d = {});
  324. var e = d.transpile;
  325. if (!e) {
  326. var f = goog.basePath + goog.TRANSPILER
  327. , g = goog.loadFileSync_(f);
  328. if (g) {
  329. (function () {
  330. (0,
  331. eval)(g + "\n//# sourceURL=" + f)
  332. }
  333. ).call(goog.global);
  334. if (goog.global.$gwtExport && goog.global.$gwtExport.$jscomp && !goog.global.$gwtExport.$jscomp.transpile)
  335. throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: ' + JSON.stringify(goog.global.$gwtExport));
  336. goog.global.$jscomp.transpile = goog.global.$gwtExport.$jscomp.transpile;
  337. d = goog.global.$jscomp;
  338. e = d.transpile
  339. }
  340. }
  341. e || (e = d.transpile = function (a, b) {
  342. goog.logToConsole_(b + " requires transpilation but no transpiler was found.");
  343. return a
  344. }
  345. );
  346. return e(a, b, c)
  347. }
  348. ;
  349. goog.typeOf = function (a) {
  350. var b = typeof a;
  351. if ("object" == b)
  352. if (a) {
  353. if (a instanceof Array)
  354. return "array";
  355. if (a instanceof Object)
  356. return b;
  357. var c = Object.prototype.toString.call(a);
  358. if ("[object Window]" == c)
  359. return "object";
  360. if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice"))
  361. return "array";
  362. if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call"))
  363. return "function"
  364. } else
  365. return "null";
  366. else if ("function" == b && "undefined" == typeof a.call)
  367. return "object";
  368. return b
  369. }
  370. ;
  371. goog.isNull = function (a) {
  372. return null === a
  373. }
  374. ;
  375. goog.isDefAndNotNull = function (a) {
  376. return null != a
  377. }
  378. ;
  379. goog.isArray = function (a) {
  380. return "array" == goog.typeOf(a)
  381. }
  382. ;
  383. goog.isArrayLike = function (a) {
  384. var b = goog.typeOf(a);
  385. return "array" == b || "object" == b && "number" == typeof a.length
  386. }
  387. ;
  388. goog.isDateLike = function (a) {
  389. return goog.isObject(a) && "function" == typeof a.getFullYear
  390. }
  391. ;
  392. goog.isFunction = function (a) {
  393. return "function" == goog.typeOf(a)
  394. }
  395. ;
  396. goog.isObject = function (a) {
  397. var b = typeof a;
  398. return "object" == b && null != a || "function" == b
  399. }
  400. ;
  401. goog.getUid = function (a) {
  402. return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_)
  403. }
  404. ;
  405. goog.hasUid = function (a) {
  406. return !!a[goog.UID_PROPERTY_]
  407. }
  408. ;
  409. goog.removeUid = function (a) {
  410. null !== a && "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_);
  411. try {
  412. delete a[goog.UID_PROPERTY_]
  413. } catch (b) { }
  414. }
  415. ;
  416. goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0);
  417. goog.uidCounter_ = 0;
  418. goog.getHashCode = goog.getUid;
  419. goog.removeHashCode = goog.removeUid;
  420. goog.cloneObject = function (a) {
  421. var b = goog.typeOf(a);
  422. if ("object" == b || "array" == b) {
  423. if ("function" === typeof a.clone)
  424. return a.clone();
  425. b = "array" == b ? [] : {};
  426. for (var c in a)
  427. b[c] = goog.cloneObject(a[c]);
  428. return b
  429. }
  430. return a
  431. }
  432. ;
  433. goog.bindNative_ = function (a, b, c) {
  434. return a.call.apply(a.bind, arguments)
  435. }
  436. ;
  437. goog.bindJs_ = function (a, b, c) {
  438. if (!a)
  439. throw Error();
  440. if (2 < arguments.length) {
  441. var d = Array.prototype.slice.call(arguments, 2);
  442. return function () {
  443. var c = Array.prototype.slice.call(arguments);
  444. Array.prototype.unshift.apply(c, d);
  445. return a.apply(b, c)
  446. }
  447. }
  448. return function () {
  449. return a.apply(b, arguments)
  450. }
  451. }
  452. ;
  453. goog.bind = function (a, b, c) {
  454. Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_;
  455. return goog.bind.apply(null, arguments)
  456. }
  457. ;
  458. goog.partial = function (a, b) {
  459. var c = Array.prototype.slice.call(arguments, 1);
  460. return function () {
  461. var b = c.slice();
  462. b.push.apply(b, arguments);
  463. return a.apply(this, b)
  464. }
  465. }
  466. ;
  467. goog.mixin = function (a, b) {
  468. for (var c in b)
  469. a[c] = b[c]
  470. }
  471. ;
  472. goog.now = goog.TRUSTED_SITE && Date.now || function () {
  473. return +new Date
  474. }
  475. ;
  476. goog.globalEval = function (a) {
  477. if (goog.global.execScript)
  478. goog.global.execScript(a, "JavaScript");
  479. else if (goog.global.eval) {
  480. if (null == goog.evalWorksForGlobals_) {
  481. try {
  482. goog.global.eval("var _evalTest_ = 1;")
  483. } catch (d) { }
  484. if ("undefined" != typeof goog.global._evalTest_) {
  485. try {
  486. delete goog.global._evalTest_
  487. } catch (d) { }
  488. goog.evalWorksForGlobals_ = !0
  489. } else
  490. goog.evalWorksForGlobals_ = !1
  491. }
  492. if (goog.evalWorksForGlobals_)
  493. goog.global.eval(a);
  494. else {
  495. var b = goog.global.document
  496. , c = b.createElement("script");
  497. c.type = "text/javascript";
  498. c.defer = !1;
  499. c.appendChild(b.createTextNode(a));
  500. b.head.appendChild(c);
  501. b.head.removeChild(c)
  502. }
  503. } else
  504. throw Error("goog.globalEval not available");
  505. }
  506. ;
  507. goog.evalWorksForGlobals_ = null;
  508. goog.getCssName = function (a, b) {
  509. if ("." == String(a).charAt(0))
  510. throw Error('className passed in goog.getCssName must not start with ".". You passed: ' + a);
  511. var c = function (a) {
  512. return goog.cssNameMapping_[a] || a
  513. }
  514. , d = function (a) {
  515. a = a.split("-");
  516. for (var b = [], d = 0; d < a.length; d++)
  517. b.push(c(a[d]));
  518. return b.join("-")
  519. };
  520. d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function (a) {
  521. return a
  522. }
  523. ;
  524. d = b ? a + "-" + d(b) : d(a);
  525. return goog.global.CLOSURE_CSS_NAME_MAP_FN ? goog.global.CLOSURE_CSS_NAME_MAP_FN(d) : d
  526. }
  527. ;
  528. goog.setCssNameMapping = function (a, b) {
  529. goog.cssNameMapping_ = a;
  530. goog.cssNameMappingStyle_ = b
  531. }
  532. ;
  533. !COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING);
  534. goog.getMsg = function (a, b, c) {
  535. c && c.html && (a = a.replace(/</g, "&lt;"));
  536. b && (a = a.replace(/\{\$([^}]+)}/g, function (a, c) {
  537. return null != b && c in b ? b[c] : a
  538. }));
  539. return a
  540. }
  541. ;
  542. goog.getMsgWithFallback = function (a, b) {
  543. return a
  544. }
  545. ;
  546. goog.exportSymbol = function (a, b, c) {
  547. goog.exportPath_(a, b, c)
  548. }
  549. ;
  550. goog.exportProperty = function (a, b, c) {
  551. a[b] = c
  552. }
  553. ;
  554. goog.inherits = function (a, b) {
  555. function c() { }
  556. c.prototype = b.prototype;
  557. a.superClass_ = b.prototype;
  558. a.prototype = new c;
  559. a.prototype.constructor = a;
  560. a.base = function (a, c, f) {
  561. for (var d = Array(arguments.length - 2), e = 2; e < arguments.length; e++)
  562. d[e - 2] = arguments[e];
  563. return b.prototype[c].apply(a, d)
  564. }
  565. }
  566. ;
  567. goog.base = function (a, b, c) {
  568. var d = arguments.callee.caller;
  569. if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !d)
  570. throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");
  571. if ("undefined" !== typeof d.superClass_) {
  572. for (var e = Array(arguments.length - 1), f = 1; f < arguments.length; f++)
  573. e[f - 1] = arguments[f];
  574. return d.superClass_.constructor.apply(a, e)
  575. }
  576. if ("string" != typeof b && "symbol" != typeof b)
  577. throw Error("method names provided to goog.base must be a string or a symbol");
  578. e = Array(arguments.length - 2);
  579. for (f = 2; f < arguments.length; f++)
  580. e[f - 2] = arguments[f];
  581. f = !1;
  582. for (var g = a.constructor.prototype; g; g = Object.getPrototypeOf(g))
  583. if (g[b] === d)
  584. f = !0;
  585. else if (f)
  586. return g[b].apply(a, e);
  587. if (a[b] === d)
  588. return a.constructor.prototype[b].apply(a, e);
  589. throw Error("goog.base called from a method of one name to a method of a different name");
  590. }
  591. ;
  592. goog.scope = function (a) {
  593. if (goog.isInModuleLoader_())
  594. throw Error("goog.scope is not supported within a module.");
  595. a.call(goog.global)
  596. }
  597. ;
  598. COMPILED || (goog.global.COMPILED = COMPILED);
  599. goog.defineClass = function (a, b) {
  600. var c = b.constructor
  601. , d = b.statics;
  602. c && c != Object.prototype.constructor || (c = function () {
  603. throw Error("cannot instantiate an interface (no constructor defined).");
  604. }
  605. );
  606. c = goog.defineClass.createSealingConstructor_(c, a);
  607. a && goog.inherits(c, a);
  608. delete b.constructor;
  609. delete b.statics;
  610. goog.defineClass.applyProperties_(c.prototype, b);
  611. null != d && (d instanceof Function ? d(c) : goog.defineClass.applyProperties_(c, d));
  612. return c
  613. }
  614. ;
  615. goog.defineClass.SEAL_CLASS_INSTANCES = goog.DEBUG;
  616. goog.defineClass.createSealingConstructor_ = function (a, b) {
  617. if (!goog.defineClass.SEAL_CLASS_INSTANCES)
  618. return a;
  619. var c = !goog.defineClass.isUnsealable_(b)
  620. , d = function () {
  621. var b = a.apply(this, arguments) || this;
  622. b[goog.UID_PROPERTY_] = b[goog.UID_PROPERTY_];
  623. this.constructor === d && c && Object.seal instanceof Function && Object.seal(b);
  624. return b
  625. };
  626. return d
  627. }
  628. ;
  629. goog.defineClass.isUnsealable_ = function (a) {
  630. return a && a.prototype && a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]
  631. }
  632. ;
  633. goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
  634. goog.defineClass.applyProperties_ = function (a, b) {
  635. for (var c in b)
  636. Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]);
  637. for (var d = 0; d < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; d++)
  638. c = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d],
  639. Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c])
  640. }
  641. ;
  642. goog.tagUnsealableClass = function (a) {
  643. !COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES && (a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = !0)
  644. }
  645. ;
  646. goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = "goog_defineClass_legacy_unsealable";
  647. !COMPILED && goog.DEPENDENCIES_ENABLED && (goog.inHtmlDocument_ = function () {
  648. var a = goog.global.document;
  649. return null != a && "write" in a
  650. }
  651. ,
  652. goog.isDocumentLoading_ = function () {
  653. var a = goog.global.document;
  654. return a.attachEvent ? "complete" != a.readyState : "loading" == a.readyState
  655. }
  656. ,
  657. goog.findBasePath_ = function () {
  658. if (void 0 != goog.global.CLOSURE_BASE_PATH && "string" === typeof goog.global.CLOSURE_BASE_PATH)
  659. goog.basePath = goog.global.CLOSURE_BASE_PATH;
  660. else if (goog.inHtmlDocument_()) {
  661. var a = goog.global.document
  662. , b = a.currentScript;
  663. a = b ? [b] : a.getElementsByTagName("SCRIPT");
  664. for (b = a.length - 1; 0 <= b; --b) {
  665. var c = a[b].src
  666. , d = c.lastIndexOf("?");
  667. d = -1 == d ? c.length : d;
  668. if ("base.js" == c.substr(d - 7, 7)) {
  669. goog.basePath = c.substr(0, d - 7);
  670. break
  671. }
  672. }
  673. }
  674. }
  675. ,
  676. goog.findBasePath_(),
  677. goog.Transpiler = function () {
  678. this.requiresTranspilation_ = null;
  679. this.transpilationTarget_ = goog.TRANSPILE_TO_LANGUAGE
  680. }
  681. ,
  682. goog.Transpiler.prototype.createRequiresTranspilation_ = function () {
  683. function a(a, b) {
  684. e ? d[a] = !0 : b() ? (c = a,
  685. d[a] = !1) : e = d[a] = !0
  686. }
  687. function b(a) {
  688. try {
  689. return !!eval(a)
  690. } catch (h) {
  691. return !1
  692. }
  693. }
  694. var c = "es3"
  695. , d = {
  696. es3: !1
  697. }
  698. , e = !1
  699. , f = goog.global.navigator && goog.global.navigator.userAgent ? goog.global.navigator.userAgent : "";
  700. a("es5", function () {
  701. return b("[1,].length==1")
  702. });
  703. a("es6", function () {
  704. return f.match(/Edge\/(\d+)(\.\d)*/i) ? !1 : b('(()=>{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')
  705. });
  706. a("es7", function () {
  707. return b("2 ** 2 == 4")
  708. });
  709. a("es8", function () {
  710. return b("async () => 1, true")
  711. });
  712. a("es9", function () {
  713. return b("({...rest} = {}), true")
  714. });
  715. a("es_next", function () {
  716. return !1
  717. });
  718. return {
  719. target: c,
  720. map: d
  721. }
  722. }
  723. ,
  724. goog.Transpiler.prototype.needsTranspile = function (a, b) {
  725. if ("always" == goog.TRANSPILE)
  726. return !0;
  727. if ("never" == goog.TRANSPILE)
  728. return !1;
  729. if (!this.requiresTranspilation_) {
  730. var c = this.createRequiresTranspilation_();
  731. this.requiresTranspilation_ = c.map;
  732. this.transpilationTarget_ = this.transpilationTarget_ || c.target
  733. }
  734. if (a in this.requiresTranspilation_)
  735. return this.requiresTranspilation_[a] ? !0 : !goog.inHtmlDocument_() || "es6" != b || "noModule" in goog.global.document.createElement("script") ? !1 : !0;
  736. throw Error("Unknown language mode: " + a);
  737. }
  738. ,
  739. goog.Transpiler.prototype.transpile = function (a, b) {
  740. return goog.transpile_(a, b, this.transpilationTarget_)
  741. }
  742. ,
  743. goog.transpiler_ = new goog.Transpiler,
  744. goog.protectScriptTag_ = function (a) {
  745. return a.replace(/<\/(SCRIPT)/ig, "\\x3c/$1")
  746. }
  747. ,
  748. goog.DebugLoader_ = function () {
  749. this.dependencies_ = {};
  750. this.idToPath_ = {};
  751. this.written_ = {};
  752. this.loadingDeps_ = [];
  753. this.depsToLoad_ = [];
  754. this.paused_ = !1;
  755. this.factory_ = new goog.DependencyFactory(goog.transpiler_);
  756. this.deferredCallbacks_ = {};
  757. this.deferredQueue_ = []
  758. }
  759. ,
  760. goog.DebugLoader_.prototype.bootstrap = function (a, b) {
  761. function c() {
  762. d && (goog.global.setTimeout(d, 0),
  763. d = null)
  764. }
  765. var d = b;
  766. if (a.length) {
  767. for (var e = [], f = 0; f < a.length; f++) {
  768. var g = this.getPathFromDeps_(a[f]);
  769. if (!g)
  770. throw Error("Unregonized namespace: " + a[f]);
  771. e.push(this.dependencies_[g])
  772. }
  773. g = goog.require;
  774. var h = 0;
  775. for (f = 0; f < a.length; f++)
  776. g(a[f]),
  777. e[f].onLoad(function () {
  778. ++h == a.length && c()
  779. })
  780. } else
  781. c()
  782. }
  783. ,
  784. goog.DebugLoader_.prototype.loadClosureDeps = function () {
  785. this.depsToLoad_.push(this.factory_.createDependency(goog.normalizePath_(goog.basePath + "deps.js"), "deps.js", [], [], {}, !1));
  786. this.loadDeps_()
  787. }
  788. ,
  789. goog.DebugLoader_.prototype.requested = function (a, b) {
  790. var c = this.getPathFromDeps_(a);
  791. if (c && (b || this.areDepsLoaded_(this.dependencies_[c].requires))) {
  792. var d = this.deferredCallbacks_[c];
  793. d && (delete this.deferredCallbacks_[c],
  794. d())
  795. }
  796. }
  797. ,
  798. goog.DebugLoader_.prototype.setDependencyFactory = function (a) {
  799. this.factory_ = a
  800. }
  801. ,
  802. goog.DebugLoader_.prototype.load_ = function (a) {
  803. if (this.getPathFromDeps_(a)) {
  804. var b = this
  805. , c = []
  806. , d = function (a) {
  807. var e = b.getPathFromDeps_(a);
  808. if (!e)
  809. throw Error("Bad dependency path or symbol: " + a);
  810. if (!b.written_[e]) {
  811. b.written_[e] = !0;
  812. a = b.dependencies_[e];
  813. for (e = 0; e < a.requires.length; e++)
  814. goog.isProvided_(a.requires[e]) || d(a.requires[e]);
  815. c.push(a)
  816. }
  817. };
  818. d(a);
  819. a = !!this.depsToLoad_.length;
  820. this.depsToLoad_ = this.depsToLoad_.concat(c);
  821. this.paused_ || a || this.loadDeps_()
  822. } else
  823. throw a = "goog.require could not find: " + a,
  824. goog.logToConsole_(a),
  825. Error(a);
  826. }
  827. ,
  828. goog.DebugLoader_.prototype.loadDeps_ = function () {
  829. for (var a = this, b = this.paused_; this.depsToLoad_.length && !b;)
  830. (function () {
  831. var c = !1
  832. , d = a.depsToLoad_.shift()
  833. , e = !1;
  834. a.loading_(d);
  835. var f = {
  836. pause: function () {
  837. if (c)
  838. throw Error("Cannot call pause after the call to load.");
  839. b = !0
  840. },
  841. resume: function () {
  842. c ? a.resume_() : b = !1
  843. },
  844. loaded: function () {
  845. if (e)
  846. throw Error("Double call to loaded.");
  847. e = !0;
  848. a.loaded_(d)
  849. },
  850. pending: function () {
  851. for (var b = [], c = 0; c < a.loadingDeps_.length; c++)
  852. b.push(a.loadingDeps_[c]);
  853. return b
  854. },
  855. setModuleState: function (a) {
  856. goog.moduleLoaderState_ = {
  857. type: a,
  858. moduleName: "",
  859. declareLegacyNamespace: !1
  860. }
  861. },
  862. registerEs6ModuleExports: function (a, b, c) {
  863. c && (goog.loadedModules_[c] = {
  864. exports: b,
  865. type: goog.ModuleType.ES6,
  866. moduleId: c || ""
  867. })
  868. },
  869. registerGoogModuleExports: function (a, b) {
  870. goog.loadedModules_[a] = {
  871. exports: b,
  872. type: goog.ModuleType.GOOG,
  873. moduleId: a
  874. }
  875. },
  876. clearModuleState: function () {
  877. goog.moduleLoaderState_ = null
  878. },
  879. defer: function (b) {
  880. if (c)
  881. throw Error("Cannot register with defer after the call to load.");
  882. a.defer_(d, b)
  883. },
  884. areDepsLoaded: function () {
  885. return a.areDepsLoaded_(d.requires)
  886. }
  887. };
  888. try {
  889. d.load(f)
  890. } finally {
  891. c = !0
  892. }
  893. }
  894. )();
  895. b && this.pause_()
  896. }
  897. ,
  898. goog.DebugLoader_.prototype.pause_ = function () {
  899. this.paused_ = !0
  900. }
  901. ,
  902. goog.DebugLoader_.prototype.resume_ = function () {
  903. this.paused_ && (this.paused_ = !1,
  904. this.loadDeps_())
  905. }
  906. ,
  907. goog.DebugLoader_.prototype.loading_ = function (a) {
  908. this.loadingDeps_.push(a)
  909. }
  910. ,
  911. goog.DebugLoader_.prototype.loaded_ = function (a) {
  912. for (var b = 0; b < this.loadingDeps_.length; b++)
  913. if (this.loadingDeps_[b] == a) {
  914. this.loadingDeps_.splice(b, 1);
  915. break
  916. }
  917. for (b = 0; b < this.deferredQueue_.length; b++)
  918. if (this.deferredQueue_[b] == a.path) {
  919. this.deferredQueue_.splice(b, 1);
  920. break
  921. }
  922. if (this.loadingDeps_.length == this.deferredQueue_.length && !this.depsToLoad_.length)
  923. for (; this.deferredQueue_.length;)
  924. this.requested(this.deferredQueue_.shift(), !0);
  925. a.loaded()
  926. }
  927. ,
  928. goog.DebugLoader_.prototype.areDepsLoaded_ = function (a) {
  929. for (var b = 0; b < a.length; b++) {
  930. var c = this.getPathFromDeps_(a[b]);
  931. if (!c || !(c in this.deferredCallbacks_ || goog.isProvided_(a[b])))
  932. return !1
  933. }
  934. return !0
  935. }
  936. ,
  937. goog.DebugLoader_.prototype.getPathFromDeps_ = function (a) {
  938. return a in this.idToPath_ ? this.idToPath_[a] : a in this.dependencies_ ? a : null
  939. }
  940. ,
  941. goog.DebugLoader_.prototype.defer_ = function (a, b) {
  942. this.deferredCallbacks_[a.path] = b;
  943. this.deferredQueue_.push(a.path)
  944. }
  945. ,
  946. goog.LoadController = function () { }
  947. ,
  948. goog.LoadController.prototype.pause = function () { }
  949. ,
  950. goog.LoadController.prototype.resume = function () { }
  951. ,
  952. goog.LoadController.prototype.loaded = function () { }
  953. ,
  954. goog.LoadController.prototype.pending = function () { }
  955. ,
  956. goog.LoadController.prototype.registerEs6ModuleExports = function (a, b, c) { }
  957. ,
  958. goog.LoadController.prototype.setModuleState = function (a) { }
  959. ,
  960. goog.LoadController.prototype.clearModuleState = function () { }
  961. ,
  962. goog.LoadController.prototype.defer = function (a) { }
  963. ,
  964. goog.LoadController.prototype.areDepsLoaded = function () { }
  965. ,
  966. goog.Dependency = function (a, b, c, d, e) {
  967. this.path = a;
  968. this.relativePath = b;
  969. this.provides = c;
  970. this.requires = d;
  971. this.loadFlags = e;
  972. this.loaded_ = !1;
  973. this.loadCallbacks_ = []
  974. }
  975. ,
  976. goog.Dependency.prototype.getPathName = function () {
  977. var a = this.path
  978. , b = a.indexOf("://");
  979. 0 <= b && (a = a.substring(b + 3),
  980. b = a.indexOf("/"),
  981. 0 <= b && (a = a.substring(b + 1)));
  982. return a
  983. }
  984. ,
  985. goog.Dependency.prototype.onLoad = function (a) {
  986. this.loaded_ ? a() : this.loadCallbacks_.push(a)
  987. }
  988. ,
  989. goog.Dependency.prototype.loaded = function () {
  990. this.loaded_ = !0;
  991. var a = this.loadCallbacks_;
  992. this.loadCallbacks_ = [];
  993. for (var b = 0; b < a.length; b++)
  994. a[b]()
  995. }
  996. ,
  997. goog.Dependency.defer_ = !1,
  998. goog.Dependency.callbackMap_ = {},
  999. goog.Dependency.registerCallback_ = function (a) {
  1000. var b = Math.random().toString(32);
  1001. goog.Dependency.callbackMap_[b] = a;
  1002. return b
  1003. }
  1004. ,
  1005. goog.Dependency.unregisterCallback_ = function (a) {
  1006. delete goog.Dependency.callbackMap_[a]
  1007. }
  1008. ,
  1009. goog.Dependency.callback_ = function (a, b) {
  1010. if (a in goog.Dependency.callbackMap_) {
  1011. for (var c = goog.Dependency.callbackMap_[a], d = [], e = 1; e < arguments.length; e++)
  1012. d.push(arguments[e]);
  1013. c.apply(void 0, d)
  1014. } else
  1015. throw Error("Callback key " + a + " does not exist (was base.js loaded more than once?).");
  1016. }
  1017. ,
  1018. goog.Dependency.prototype.load = function (a) {
  1019. if (goog.global.CLOSURE_IMPORT_SCRIPT)
  1020. goog.global.CLOSURE_IMPORT_SCRIPT(this.path) ? a.loaded() : a.pause();
  1021. else if (goog.inHtmlDocument_()) {
  1022. var b = goog.global.document;
  1023. if ("complete" == b.readyState && !goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING) {
  1024. if (/\bdeps.js$/.test(this.path)) {
  1025. a.loaded();
  1026. return
  1027. }
  1028. throw Error('Cannot write "' + this.path + '" after document load');
  1029. }
  1030. if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && goog.isDocumentLoading_()) {
  1031. var c = goog.Dependency.registerCallback_(function (b) {
  1032. goog.DebugLoader_.IS_OLD_IE_ && "complete" != b.readyState || (goog.Dependency.unregisterCallback_(c),
  1033. a.loaded())
  1034. })
  1035. , d = !goog.DebugLoader_.IS_OLD_IE_ && goog.getScriptNonce() ? ' nonce="' + goog.getScriptNonce() + '"' : "";
  1036. d = '<script src="' + this.path + '" ' + (goog.DebugLoader_.IS_OLD_IE_ ? "onreadystatechange" : "onload") + "=\"goog.Dependency.callback_('" + c + '\', this)" type="text/javascript" ' + (goog.Dependency.defer_ ? "defer" : "") + d + ">\x3c/script>";
  1037. b.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(d) : d)
  1038. } else {
  1039. var e = b.createElement("script");
  1040. e.defer = goog.Dependency.defer_;
  1041. e.async = !1;
  1042. e.type = "text/javascript";
  1043. (d = goog.getScriptNonce()) && e.setAttribute("nonce", d);
  1044. goog.DebugLoader_.IS_OLD_IE_ ? (a.pause(),
  1045. e.onreadystatechange = function () {
  1046. if ("loaded" == e.readyState || "complete" == e.readyState)
  1047. a.loaded(),
  1048. a.resume()
  1049. }
  1050. ) : e.onload = function () {
  1051. e.onload = null;
  1052. a.loaded()
  1053. }
  1054. ;
  1055. e.src = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path) : this.path;
  1056. b.head.appendChild(e)
  1057. }
  1058. } else
  1059. goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),
  1060. "deps.js" == this.relativePath ? (goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."),
  1061. a.loaded()) : a.pause()
  1062. }
  1063. ,
  1064. goog.Es6ModuleDependency = function (a, b, c, d, e) {
  1065. goog.Dependency.call(this, a, b, c, d, e)
  1066. }
  1067. ,
  1068. goog.inherits(goog.Es6ModuleDependency, goog.Dependency),
  1069. goog.Es6ModuleDependency.prototype.load = function (a) {
  1070. function b(a, b) {
  1071. var c = b ? '<script type="module" crossorigin>' + b + "\x3c/script>" : '<script type="module" crossorigin src="' + a + '">\x3c/script>';
  1072. d.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(c) : c)
  1073. }
  1074. function c(a, b) {
  1075. var c = d.createElement("script");
  1076. c.defer = !0;
  1077. c.async = !1;
  1078. c.type = "module";
  1079. c.setAttribute("crossorigin", !0);
  1080. var e = goog.getScriptNonce();
  1081. e && c.setAttribute("nonce", e);
  1082. b ? c.textContent = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScript(b) : b : c.src = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScriptURL(a) : a;
  1083. d.head.appendChild(c)
  1084. }
  1085. if (goog.global.CLOSURE_IMPORT_SCRIPT)
  1086. goog.global.CLOSURE_IMPORT_SCRIPT(this.path) ? a.loaded() : a.pause();
  1087. else if (goog.inHtmlDocument_()) {
  1088. var d = goog.global.document
  1089. , e = this;
  1090. if (goog.isDocumentLoading_()) {
  1091. var f = b;
  1092. goog.Dependency.defer_ = !0
  1093. } else
  1094. f = c;
  1095. var g = goog.Dependency.registerCallback_(function () {
  1096. goog.Dependency.unregisterCallback_(g);
  1097. a.setModuleState(goog.ModuleType.ES6)
  1098. });
  1099. f(void 0, 'goog.Dependency.callback_("' + g + '")');
  1100. f(this.path, void 0);
  1101. var h = goog.Dependency.registerCallback_(function (b) {
  1102. goog.Dependency.unregisterCallback_(h);
  1103. a.registerEs6ModuleExports(e.path, b, goog.moduleLoaderState_.moduleName)
  1104. });
  1105. f(void 0, 'import * as m from "' + this.path + '"; goog.Dependency.callback_("' + h + '", m)');
  1106. var k = goog.Dependency.registerCallback_(function () {
  1107. goog.Dependency.unregisterCallback_(k);
  1108. a.clearModuleState();
  1109. a.loaded()
  1110. });
  1111. f(void 0, 'goog.Dependency.callback_("' + k + '")')
  1112. } else
  1113. goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),
  1114. a.pause()
  1115. }
  1116. ,
  1117. goog.TransformedDependency = function (a, b, c, d, e) {
  1118. goog.Dependency.call(this, a, b, c, d, e);
  1119. this.contents_ = null;
  1120. this.lazyFetch_ = !goog.inHtmlDocument_() || !("noModule" in goog.global.document.createElement("script"))
  1121. }
  1122. ,
  1123. goog.inherits(goog.TransformedDependency, goog.Dependency),
  1124. goog.TransformedDependency.prototype.load = function (a) {
  1125. function b() {
  1126. e.contents_ = goog.loadFileSync_(e.path);
  1127. e.contents_ && (e.contents_ = e.transform(e.contents_),
  1128. e.contents_ && (e.contents_ += "\n//# sourceURL=" + e.path))
  1129. }
  1130. function c() {
  1131. e.lazyFetch_ && b();
  1132. if (e.contents_) {
  1133. f && a.setModuleState(goog.ModuleType.ES6);
  1134. try {
  1135. var c = e.contents_;
  1136. e.contents_ = null;
  1137. goog.globalEval(c);
  1138. if (f)
  1139. var d = goog.moduleLoaderState_.moduleName
  1140. } finally {
  1141. f && a.clearModuleState()
  1142. }
  1143. f && goog.global.$jscomp.require.ensure([e.getPathName()], function () {
  1144. a.registerEs6ModuleExports(e.path, goog.global.$jscomp.require(e.getPathName()), d)
  1145. });
  1146. a.loaded()
  1147. }
  1148. }
  1149. function d() {
  1150. var a = goog.global.document
  1151. , b = goog.Dependency.registerCallback_(function () {
  1152. goog.Dependency.unregisterCallback_(b);
  1153. c()
  1154. })
  1155. , d = '<script type="text/javascript">' + goog.protectScriptTag_('goog.Dependency.callback_("' + b + '");') + "\x3c/script>";
  1156. a.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(d) : d)
  1157. }
  1158. var e = this;
  1159. if (goog.global.CLOSURE_IMPORT_SCRIPT)
  1160. b(),
  1161. this.contents_ && goog.global.CLOSURE_IMPORT_SCRIPT("", this.contents_) ? (this.contents_ = null,
  1162. a.loaded()) : a.pause();
  1163. else {
  1164. var f = this.loadFlags.module == goog.ModuleType.ES6;
  1165. this.lazyFetch_ || b();
  1166. var g = 1 < a.pending().length
  1167. , h = g && goog.DebugLoader_.IS_OLD_IE_;
  1168. g = goog.Dependency.defer_ && (g || goog.isDocumentLoading_());
  1169. if (h || g)
  1170. a.defer(function () {
  1171. c()
  1172. });
  1173. else {
  1174. var k = goog.global.document;
  1175. h = goog.inHtmlDocument_() && "ActiveXObject" in goog.global;
  1176. if (f && goog.inHtmlDocument_() && goog.isDocumentLoading_() && !h) {
  1177. goog.Dependency.defer_ = !0;
  1178. a.pause();
  1179. var m = k.onreadystatechange;
  1180. k.onreadystatechange = function () {
  1181. "interactive" == k.readyState && (k.onreadystatechange = m,
  1182. c(),
  1183. a.resume());
  1184. goog.isFunction(m) && m.apply(void 0, arguments)
  1185. }
  1186. } else
  1187. !goog.DebugLoader_.IS_OLD_IE_ && goog.inHtmlDocument_() && goog.isDocumentLoading_() ? d() : c()
  1188. }
  1189. }
  1190. }
  1191. ,
  1192. goog.TransformedDependency.prototype.transform = function (a) { }
  1193. ,
  1194. goog.TranspiledDependency = function (a, b, c, d, e, f) {
  1195. goog.TransformedDependency.call(this, a, b, c, d, e);
  1196. this.transpiler = f
  1197. }
  1198. ,
  1199. goog.inherits(goog.TranspiledDependency, goog.TransformedDependency),
  1200. goog.TranspiledDependency.prototype.transform = function (a) {
  1201. return this.transpiler.transpile(a, this.getPathName())
  1202. }
  1203. ,
  1204. goog.PreTranspiledEs6ModuleDependency = function (a, b, c, d, e) {
  1205. goog.TransformedDependency.call(this, a, b, c, d, e)
  1206. }
  1207. ,
  1208. goog.inherits(goog.PreTranspiledEs6ModuleDependency, goog.TransformedDependency),
  1209. goog.PreTranspiledEs6ModuleDependency.prototype.transform = function (a) {
  1210. return a
  1211. }
  1212. ,
  1213. goog.GoogModuleDependency = function (a, b, c, d, e, f, g) {
  1214. goog.TransformedDependency.call(this, a, b, c, d, e);
  1215. this.needsTranspile_ = f;
  1216. this.transpiler_ = g
  1217. }
  1218. ,
  1219. goog.inherits(goog.GoogModuleDependency, goog.TransformedDependency),
  1220. goog.GoogModuleDependency.prototype.transform = function (a) {
  1221. this.needsTranspile_ && (a = this.transpiler_.transpile(a, this.getPathName()));
  1222. return goog.LOAD_MODULE_USING_EVAL && void 0 !== goog.global.JSON ? "goog.loadModule(" + goog.global.JSON.stringify(a + "\n//# sourceURL=" + this.path + "\n") + ");" : 'goog.loadModule(function(exports) {"use strict";' + a + "\n;return exports});\n//# sourceURL=" + this.path + "\n"
  1223. }
  1224. ,
  1225. goog.DebugLoader_.IS_OLD_IE_ = !(goog.global.atob || !goog.global.document || !goog.global.document.all),
  1226. goog.DebugLoader_.prototype.addDependency = function (a, b, c, d) {
  1227. b = b || [];
  1228. a = a.replace(/\\/g, "/");
  1229. var e = goog.normalizePath_(goog.basePath + a);
  1230. d && "boolean" !== typeof d || (d = d ? {
  1231. module: goog.ModuleType.GOOG
  1232. } : {});
  1233. c = this.factory_.createDependency(e, a, b, c, d, goog.transpiler_.needsTranspile(d.lang || "es3", d.module));
  1234. this.dependencies_[e] = c;
  1235. for (c = 0; c < b.length; c++)
  1236. this.idToPath_[b[c]] = e;
  1237. this.idToPath_[a] = e
  1238. }
  1239. ,
  1240. goog.DependencyFactory = function (a) {
  1241. this.transpiler = a
  1242. }
  1243. ,
  1244. goog.DependencyFactory.prototype.createDependency = function (a, b, c, d, e, f) {
  1245. return e.module == goog.ModuleType.GOOG ? new goog.GoogModuleDependency(a, b, c, d, e, f, this.transpiler) : f ? new goog.TranspiledDependency(a, b, c, d, e, this.transpiler) : e.module == goog.ModuleType.ES6 ? "never" == goog.TRANSPILE && goog.ASSUME_ES_MODULES_TRANSPILED ? new goog.PreTranspiledEs6ModuleDependency(a, b, c, d, e) : new goog.Es6ModuleDependency(a, b, c, d, e) : new goog.Dependency(a, b, c, d, e)
  1246. }
  1247. ,
  1248. goog.debugLoader_ = new goog.DebugLoader_,
  1249. goog.loadClosureDeps = function () {
  1250. goog.debugLoader_.loadClosureDeps()
  1251. }
  1252. ,
  1253. goog.setDependencyFactory = function (a) {
  1254. goog.debugLoader_.setDependencyFactory(a)
  1255. }
  1256. ,
  1257. goog.global.CLOSURE_NO_DEPS || goog.debugLoader_.loadClosureDeps(),
  1258. goog.bootstrap = function (a, b) {
  1259. goog.debugLoader_.bootstrap(a, b)
  1260. }
  1261. );
  1262. goog.TRUSTED_TYPES_POLICY_NAME = "";
  1263. goog.identity_ = function (a) {
  1264. return a
  1265. }
  1266. ;
  1267. goog.createTrustedTypesPolicy = function (a) {
  1268. var b = null
  1269. , c = goog.global.trustedTypes || goog.global.TrustedTypes;
  1270. if (!c || !c.createPolicy)
  1271. return b;
  1272. try {
  1273. b = c.createPolicy(a, {
  1274. createHTML: goog.identity_,
  1275. createScript: goog.identity_,
  1276. createScriptURL: goog.identity_,
  1277. createURL: goog.identity_
  1278. })
  1279. } catch (d) {
  1280. goog.logToConsole_(d.message)
  1281. }
  1282. return b
  1283. }
  1284. ;
  1285. goog.TRUSTED_TYPES_POLICY_ = goog.TRUSTED_TYPES_POLICY_NAME ? goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + "#base") : null;
  1286. goog.debug = {};
  1287. goog.debug.Error = function (a) {
  1288. if (Error.captureStackTrace)
  1289. Error.captureStackTrace(this, goog.debug.Error);
  1290. else {
  1291. var b = Error().stack;
  1292. b && (this.stack = b)
  1293. }
  1294. a && (this.message = String(a));
  1295. this.reportErrorToServer = !0
  1296. }
  1297. ;
  1298. goog.inherits(goog.debug.Error, Error);
  1299. goog.debug.Error.prototype.name = "CustomError";
  1300. goog.dom = {};
  1301. goog.dom.NodeType = {
  1302. ELEMENT: 1,
  1303. ATTRIBUTE: 2,
  1304. TEXT: 3,
  1305. CDATA_SECTION: 4,
  1306. ENTITY_REFERENCE: 5,
  1307. ENTITY: 6,
  1308. PROCESSING_INSTRUCTION: 7,
  1309. COMMENT: 8,
  1310. DOCUMENT: 9,
  1311. DOCUMENT_TYPE: 10,
  1312. DOCUMENT_FRAGMENT: 11,
  1313. NOTATION: 12
  1314. };
  1315. goog.asserts = {};
  1316. goog.asserts.ENABLE_ASSERTS = goog.DEBUG;
  1317. goog.asserts.AssertionError = function (a, b) {
  1318. goog.debug.Error.call(this, goog.asserts.subs_(a, b));
  1319. this.messagePattern = a
  1320. }
  1321. ;
  1322. goog.inherits(goog.asserts.AssertionError, goog.debug.Error);
  1323. goog.asserts.AssertionError.prototype.name = "AssertionError";
  1324. goog.asserts.DEFAULT_ERROR_HANDLER = function (a) {
  1325. throw a;
  1326. }
  1327. ;
  1328. goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;
  1329. goog.asserts.subs_ = function (a, b) {
  1330. for (var c = a.split("%s"), d = "", e = c.length - 1, f = 0; f < e; f++)
  1331. d += c[f] + (f < b.length ? b[f] : "%s");
  1332. return d + c[e]
  1333. }
  1334. ;
  1335. goog.asserts.doAssertFailure_ = function (a, b, c, d) {
  1336. var e = "Assertion failed";
  1337. if (c) {
  1338. e += ": " + c;
  1339. var f = d
  1340. } else
  1341. a && (e += ": " + a,
  1342. f = b);
  1343. a = new goog.asserts.AssertionError("" + e, f || []);
  1344. goog.asserts.errorHandler_(a)
  1345. }
  1346. ;
  1347. goog.asserts.setErrorHandler = function (a) {
  1348. goog.asserts.ENABLE_ASSERTS && (goog.asserts.errorHandler_ = a)
  1349. }
  1350. ;
  1351. goog.asserts.assert = function (a, b, c) {
  1352. goog.asserts.ENABLE_ASSERTS && !a && goog.asserts.doAssertFailure_("", null, b, Array.prototype.slice.call(arguments, 2));
  1353. return a
  1354. }
  1355. ;
  1356. goog.asserts.assertExists = function (a, b, c) {
  1357. goog.asserts.ENABLE_ASSERTS && null == a && goog.asserts.doAssertFailure_("Expected to exist: %s.", [a], b, Array.prototype.slice.call(arguments, 2));
  1358. return a
  1359. }
  1360. ;
  1361. goog.asserts.fail = function (a, b) {
  1362. goog.asserts.ENABLE_ASSERTS && goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure" + (a ? ": " + a : ""), Array.prototype.slice.call(arguments, 1)))
  1363. }
  1364. ;
  1365. goog.asserts.assertNumber = function (a, b, c) {
  1366. goog.asserts.ENABLE_ASSERTS && "number" !== typeof a && goog.asserts.doAssertFailure_("Expected number but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1367. return a
  1368. }
  1369. ;
  1370. goog.asserts.assertString = function (a, b, c) {
  1371. goog.asserts.ENABLE_ASSERTS && "string" !== typeof a && goog.asserts.doAssertFailure_("Expected string but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1372. return a
  1373. }
  1374. ;
  1375. goog.asserts.assertFunction = function (a, b, c) {
  1376. goog.asserts.ENABLE_ASSERTS && !goog.isFunction(a) && goog.asserts.doAssertFailure_("Expected function but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1377. return a
  1378. }
  1379. ;
  1380. goog.asserts.assertObject = function (a, b, c) {
  1381. goog.asserts.ENABLE_ASSERTS && !goog.isObject(a) && goog.asserts.doAssertFailure_("Expected object but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1382. return a
  1383. }
  1384. ;
  1385. goog.asserts.assertArray = function (a, b, c) {
  1386. goog.asserts.ENABLE_ASSERTS && !goog.isArray(a) && goog.asserts.doAssertFailure_("Expected array but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1387. return a
  1388. }
  1389. ;
  1390. goog.asserts.assertBoolean = function (a, b, c) {
  1391. goog.asserts.ENABLE_ASSERTS && "boolean" !== typeof a && goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1392. return a
  1393. }
  1394. ;
  1395. goog.asserts.assertElement = function (a, b, c) {
  1396. !goog.asserts.ENABLE_ASSERTS || goog.isObject(a) && a.nodeType == goog.dom.NodeType.ELEMENT || goog.asserts.doAssertFailure_("Expected Element but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1397. return a
  1398. }
  1399. ;
  1400. goog.asserts.assertInstanceof = function (a, b, c, d) {
  1401. !goog.asserts.ENABLE_ASSERTS || a instanceof b || goog.asserts.doAssertFailure_("Expected instanceof %s but got %s.", [goog.asserts.getType_(b), goog.asserts.getType_(a)], c, Array.prototype.slice.call(arguments, 3));
  1402. return a
  1403. }
  1404. ;
  1405. goog.asserts.assertFinite = function (a, b, c) {
  1406. !goog.asserts.ENABLE_ASSERTS || "number" == typeof a && isFinite(a) || goog.asserts.doAssertFailure_("Expected %s to be a finite number but it is not.", [a], b, Array.prototype.slice.call(arguments, 2));
  1407. return a
  1408. }
  1409. ;
  1410. goog.asserts.assertObjectPrototypeIsIntact = function () {
  1411. for (var a in Object.prototype)
  1412. goog.asserts.fail(a + " should not be enumerable in Object.prototype.")
  1413. }
  1414. ;
  1415. goog.asserts.getType_ = function (a) {
  1416. return a instanceof Function ? a.displayName || a.name || "unknown type name" : a instanceof Object ? a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a) : null === a ? "null" : typeof a
  1417. }
  1418. ;
  1419. goog.array = {};
  1420. goog.NATIVE_ARRAY_PROTOTYPES = goog.TRUSTED_SITE;
  1421. goog.array.ASSUME_NATIVE_FUNCTIONS = 2012 < goog.FEATURESET_YEAR;
  1422. goog.array.peek = function (a) {
  1423. return a[a.length - 1]
  1424. }
  1425. ;
  1426. goog.array.last = goog.array.peek;
  1427. goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ? function (a, b, c) {
  1428. goog.asserts.assert(null != a.length);
  1429. return Array.prototype.indexOf.call(a, b, c)
  1430. }
  1431. : function (a, b, c) {
  1432. c = null == c ? 0 : 0 > c ? Math.max(0, a.length + c) : c;
  1433. if ("string" === typeof a)
  1434. return "string" !== typeof b || 1 != b.length ? -1 : a.indexOf(b, c);
  1435. for (; c < a.length; c++)
  1436. if (c in a && a[c] === b)
  1437. return c;
  1438. return -1
  1439. }
  1440. ;
  1441. goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ? function (a, b, c) {
  1442. goog.asserts.assert(null != a.length);
  1443. return Array.prototype.lastIndexOf.call(a, b, null == c ? a.length - 1 : c)
  1444. }
  1445. : function (a, b, c) {
  1446. c = null == c ? a.length - 1 : c;
  1447. 0 > c && (c = Math.max(0, a.length + c));
  1448. if ("string" === typeof a)
  1449. return "string" !== typeof b || 1 != b.length ? -1 : a.lastIndexOf(b, c);
  1450. for (; 0 <= c; c--)
  1451. if (c in a && a[c] === b)
  1452. return c;
  1453. return -1
  1454. }
  1455. ;
  1456. goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ? function (a, b, c) {
  1457. goog.asserts.assert(null != a.length);
  1458. Array.prototype.forEach.call(a, b, c)
  1459. }
  1460. : function (a, b, c) {
  1461. for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++)
  1462. f in e && b.call(c, e[f], f, a)
  1463. }
  1464. ;
  1465. goog.array.forEachRight = function (a, b, c) {
  1466. var d = a.length
  1467. , e = "string" === typeof a ? a.split("") : a;
  1468. for (--d; 0 <= d; --d)
  1469. d in e && b.call(c, e[d], d, a)
  1470. }
  1471. ;
  1472. goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ? function (a, b, c) {
  1473. goog.asserts.assert(null != a.length);
  1474. return Array.prototype.filter.call(a, b, c)
  1475. }
  1476. : function (a, b, c) {
  1477. for (var d = a.length, e = [], f = 0, g = "string" === typeof a ? a.split("") : a, h = 0; h < d; h++)
  1478. if (h in g) {
  1479. var k = g[h];
  1480. b.call(c, k, h, a) && (e[f++] = k)
  1481. }
  1482. return e
  1483. }
  1484. ;
  1485. goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ? function (a, b, c) {
  1486. goog.asserts.assert(null != a.length);
  1487. return Array.prototype.map.call(a, b, c)
  1488. }
  1489. : function (a, b, c) {
  1490. for (var d = a.length, e = Array(d), f = "string" === typeof a ? a.split("") : a, g = 0; g < d; g++)
  1491. g in f && (e[g] = b.call(c, f[g], g, a));
  1492. return e
  1493. }
  1494. ;
  1495. goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ? function (a, b, c, d) {
  1496. goog.asserts.assert(null != a.length);
  1497. d && (b = goog.bind(b, d));
  1498. return Array.prototype.reduce.call(a, b, c)
  1499. }
  1500. : function (a, b, c, d) {
  1501. var e = c;
  1502. goog.array.forEach(a, function (c, g) {
  1503. e = b.call(d, e, c, g, a)
  1504. });
  1505. return e
  1506. }
  1507. ;
  1508. goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ? function (a, b, c, d) {
  1509. goog.asserts.assert(null != a.length);
  1510. goog.asserts.assert(null != b);
  1511. d && (b = goog.bind(b, d));
  1512. return Array.prototype.reduceRight.call(a, b, c)
  1513. }
  1514. : function (a, b, c, d) {
  1515. var e = c;
  1516. goog.array.forEachRight(a, function (c, g) {
  1517. e = b.call(d, e, c, g, a)
  1518. });
  1519. return e
  1520. }
  1521. ;
  1522. goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ? function (a, b, c) {
  1523. goog.asserts.assert(null != a.length);
  1524. return Array.prototype.some.call(a, b, c)
  1525. }
  1526. : function (a, b, c) {
  1527. for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++)
  1528. if (f in e && b.call(c, e[f], f, a))
  1529. return !0;
  1530. return !1
  1531. }
  1532. ;
  1533. goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ? function (a, b, c) {
  1534. goog.asserts.assert(null != a.length);
  1535. return Array.prototype.every.call(a, b, c)
  1536. }
  1537. : function (a, b, c) {
  1538. for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++)
  1539. if (f in e && !b.call(c, e[f], f, a))
  1540. return !1;
  1541. return !0
  1542. }
  1543. ;
  1544. goog.array.count = function (a, b, c) {
  1545. var d = 0;
  1546. goog.array.forEach(a, function (a, f, g) {
  1547. b.call(c, a, f, g) && ++d
  1548. }, c);
  1549. return d
  1550. }
  1551. ;
  1552. goog.array.find = function (a, b, c) {
  1553. b = goog.array.findIndex(a, b, c);
  1554. return 0 > b ? null : "string" === typeof a ? a.charAt(b) : a[b]
  1555. }
  1556. ;
  1557. goog.array.findIndex = function (a, b, c) {
  1558. for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++)
  1559. if (f in e && b.call(c, e[f], f, a))
  1560. return f;
  1561. return -1
  1562. }
  1563. ;
  1564. goog.array.findRight = function (a, b, c) {
  1565. b = goog.array.findIndexRight(a, b, c);
  1566. return 0 > b ? null : "string" === typeof a ? a.charAt(b) : a[b]
  1567. }
  1568. ;
  1569. goog.array.findIndexRight = function (a, b, c) {
  1570. var d = a.length
  1571. , e = "string" === typeof a ? a.split("") : a;
  1572. for (--d; 0 <= d; d--)
  1573. if (d in e && b.call(c, e[d], d, a))
  1574. return d;
  1575. return -1
  1576. }
  1577. ;
  1578. goog.array.contains = function (a, b) {
  1579. return 0 <= goog.array.indexOf(a, b)
  1580. }
  1581. ;
  1582. goog.array.isEmpty = function (a) {
  1583. return 0 == a.length
  1584. }
  1585. ;
  1586. goog.array.clear = function (a) {
  1587. if (!goog.isArray(a))
  1588. for (var b = a.length - 1; 0 <= b; b--)
  1589. delete a[b];
  1590. a.length = 0
  1591. }
  1592. ;
  1593. goog.array.insert = function (a, b) {
  1594. goog.array.contains(a, b) || a.push(b)
  1595. }
  1596. ;
  1597. goog.array.insertAt = function (a, b, c) {
  1598. goog.array.splice(a, c, 0, b)
  1599. }
  1600. ;
  1601. goog.array.insertArrayAt = function (a, b, c) {
  1602. goog.partial(goog.array.splice, a, c, 0).apply(null, b)
  1603. }
  1604. ;
  1605. goog.array.insertBefore = function (a, b, c) {
  1606. var d;
  1607. 2 == arguments.length || 0 > (d = goog.array.indexOf(a, c)) ? a.push(b) : goog.array.insertAt(a, b, d)
  1608. }
  1609. ;
  1610. goog.array.remove = function (a, b) {
  1611. var c = goog.array.indexOf(a, b), d;
  1612. (d = 0 <= c) && goog.array.removeAt(a, c);
  1613. return d
  1614. }
  1615. ;
  1616. goog.array.removeLast = function (a, b) {
  1617. var c = goog.array.lastIndexOf(a, b);
  1618. return 0 <= c ? (goog.array.removeAt(a, c),
  1619. !0) : !1
  1620. }
  1621. ;
  1622. goog.array.removeAt = function (a, b) {
  1623. goog.asserts.assert(null != a.length);
  1624. return 1 == Array.prototype.splice.call(a, b, 1).length
  1625. }
  1626. ;
  1627. goog.array.removeIf = function (a, b, c) {
  1628. b = goog.array.findIndex(a, b, c);
  1629. return 0 <= b ? (goog.array.removeAt(a, b),
  1630. !0) : !1
  1631. }
  1632. ;
  1633. goog.array.removeAllIf = function (a, b, c) {
  1634. var d = 0;
  1635. goog.array.forEachRight(a, function (e, f) {
  1636. b.call(c, e, f, a) && goog.array.removeAt(a, f) && d++
  1637. });
  1638. return d
  1639. }
  1640. ;
  1641. goog.array.concat = function (a) {
  1642. return Array.prototype.concat.apply([], arguments)
  1643. }
  1644. ;
  1645. goog.array.join = function (a) {
  1646. return Array.prototype.concat.apply([], arguments)
  1647. }
  1648. ;
  1649. goog.array.toArray = function (a) {
  1650. var b = a.length;
  1651. if (0 < b) {
  1652. for (var c = Array(b), d = 0; d < b; d++)
  1653. c[d] = a[d];
  1654. return c
  1655. }
  1656. return []
  1657. }
  1658. ;
  1659. goog.array.clone = goog.array.toArray;
  1660. goog.array.extend = function (a, b) {
  1661. for (var c = 1; c < arguments.length; c++) {
  1662. var d = arguments[c];
  1663. if (goog.isArrayLike(d)) {
  1664. var e = a.length || 0
  1665. , f = d.length || 0;
  1666. a.length = e + f;
  1667. for (var g = 0; g < f; g++)
  1668. a[e + g] = d[g]
  1669. } else
  1670. a.push(d)
  1671. }
  1672. }
  1673. ;
  1674. goog.array.splice = function (a, b, c, d) {
  1675. goog.asserts.assert(null != a.length);
  1676. return Array.prototype.splice.apply(a, goog.array.slice(arguments, 1))
  1677. }
  1678. ;
  1679. goog.array.slice = function (a, b, c) {
  1680. goog.asserts.assert(null != a.length);
  1681. return 2 >= arguments.length ? Array.prototype.slice.call(a, b) : Array.prototype.slice.call(a, b, c)
  1682. }
  1683. ;
  1684. goog.array.removeDuplicates = function (a, b, c) {
  1685. b = b || a;
  1686. var d = function (a) {
  1687. return goog.isObject(a) ? "o" + goog.getUid(a) : (typeof a).charAt(0) + a
  1688. };
  1689. c = c || d;
  1690. d = {};
  1691. for (var e = 0, f = 0; f < a.length;) {
  1692. var g = a[f++]
  1693. , h = c(g);
  1694. Object.prototype.hasOwnProperty.call(d, h) || (d[h] = !0,
  1695. b[e++] = g)
  1696. }
  1697. b.length = e
  1698. }
  1699. ;
  1700. goog.array.binarySearch = function (a, b, c) {
  1701. return goog.array.binarySearch_(a, c || goog.array.defaultCompare, !1, b)
  1702. }
  1703. ;
  1704. goog.array.binarySelect = function (a, b, c) {
  1705. return goog.array.binarySearch_(a, b, !0, void 0, c)
  1706. }
  1707. ;
  1708. goog.array.binarySearch_ = function (a, b, c, d, e) {
  1709. for (var f = 0, g = a.length, h; f < g;) {
  1710. var k = f + (g - f >>> 1);
  1711. var m = c ? b.call(e, a[k], k, a) : b(d, a[k]);
  1712. 0 < m ? f = k + 1 : (g = k,
  1713. h = !m)
  1714. }
  1715. return h ? f : -f - 1
  1716. }
  1717. ;
  1718. goog.array.sort = function (a, b) {
  1719. a.sort(b || goog.array.defaultCompare)
  1720. }
  1721. ;
  1722. goog.array.stableSort = function (a, b) {
  1723. for (var c = Array(a.length), d = 0; d < a.length; d++)
  1724. c[d] = {
  1725. index: d,
  1726. value: a[d]
  1727. };
  1728. var e = b || goog.array.defaultCompare;
  1729. goog.array.sort(c, function (a, b) {
  1730. return e(a.value, b.value) || a.index - b.index
  1731. });
  1732. for (d = 0; d < a.length; d++)
  1733. a[d] = c[d].value
  1734. }
  1735. ;
  1736. goog.array.sortByKey = function (a, b, c) {
  1737. var d = c || goog.array.defaultCompare;
  1738. goog.array.sort(a, function (a, c) {
  1739. return d(b(a), b(c))
  1740. })
  1741. }
  1742. ;
  1743. goog.array.sortObjectsByKey = function (a, b, c) {
  1744. goog.array.sortByKey(a, function (a) {
  1745. return a[b]
  1746. }, c)
  1747. }
  1748. ;
  1749. goog.array.isSorted = function (a, b, c) {
  1750. b = b || goog.array.defaultCompare;
  1751. for (var d = 1; d < a.length; d++) {
  1752. var e = b(a[d - 1], a[d]);
  1753. if (0 < e || 0 == e && c)
  1754. return !1
  1755. }
  1756. return !0
  1757. }
  1758. ;
  1759. goog.array.equals = function (a, b, c) {
  1760. if (!goog.isArrayLike(a) || !goog.isArrayLike(b) || a.length != b.length)
  1761. return !1;
  1762. var d = a.length;
  1763. c = c || goog.array.defaultCompareEquality;
  1764. for (var e = 0; e < d; e++)
  1765. if (!c(a[e], b[e]))
  1766. return !1;
  1767. return !0
  1768. }
  1769. ;
  1770. goog.array.compare3 = function (a, b, c) {
  1771. c = c || goog.array.defaultCompare;
  1772. for (var d = Math.min(a.length, b.length), e = 0; e < d; e++) {
  1773. var f = c(a[e], b[e]);
  1774. if (0 != f)
  1775. return f
  1776. }
  1777. return goog.array.defaultCompare(a.length, b.length)
  1778. }
  1779. ;
  1780. goog.array.defaultCompare = function (a, b) {
  1781. return a > b ? 1 : a < b ? -1 : 0
  1782. }
  1783. ;
  1784. goog.array.inverseDefaultCompare = function (a, b) {
  1785. return -goog.array.defaultCompare(a, b)
  1786. }
  1787. ;
  1788. goog.array.defaultCompareEquality = function (a, b) {
  1789. return a === b
  1790. }
  1791. ;
  1792. goog.array.binaryInsert = function (a, b, c) {
  1793. c = goog.array.binarySearch(a, b, c);
  1794. return 0 > c ? (goog.array.insertAt(a, b, -(c + 1)),
  1795. !0) : !1
  1796. }
  1797. ;
  1798. goog.array.binaryRemove = function (a, b, c) {
  1799. b = goog.array.binarySearch(a, b, c);
  1800. return 0 <= b ? goog.array.removeAt(a, b) : !1
  1801. }
  1802. ;
  1803. goog.array.bucket = function (a, b, c) {
  1804. for (var d = {}, e = 0; e < a.length; e++) {
  1805. var f = a[e]
  1806. , g = b.call(c, f, e, a);
  1807. void 0 !== g && (d[g] || (d[g] = [])).push(f)
  1808. }
  1809. return d
  1810. }
  1811. ;
  1812. goog.array.toObject = function (a, b, c) {
  1813. var d = {};
  1814. goog.array.forEach(a, function (e, f) {
  1815. d[b.call(c, e, f, a)] = e
  1816. });
  1817. return d
  1818. }
  1819. ;
  1820. goog.array.range = function (a, b, c) {
  1821. var d = []
  1822. , e = 0
  1823. , f = a;
  1824. c = c || 1;
  1825. void 0 !== b && (e = a,
  1826. f = b);
  1827. if (0 > c * (f - e))
  1828. return [];
  1829. if (0 < c)
  1830. for (a = e; a < f; a += c)
  1831. d.push(a);
  1832. else
  1833. for (a = e; a > f; a += c)
  1834. d.push(a);
  1835. return d
  1836. }
  1837. ;
  1838. goog.array.repeat = function (a, b) {
  1839. for (var c = [], d = 0; d < b; d++)
  1840. c[d] = a;
  1841. return c
  1842. }
  1843. ;
  1844. goog.array.flatten = function (a) {
  1845. for (var b = [], c = 0; c < arguments.length; c++) {
  1846. var d = arguments[c];
  1847. if (goog.isArray(d))
  1848. for (var e = 0; e < d.length; e += 8192) {
  1849. var f = goog.array.slice(d, e, e + 8192);
  1850. f = goog.array.flatten.apply(null, f);
  1851. for (var g = 0; g < f.length; g++)
  1852. b.push(f[g])
  1853. }
  1854. else
  1855. b.push(d)
  1856. }
  1857. return b
  1858. }
  1859. ;
  1860. goog.array.rotate = function (a, b) {
  1861. goog.asserts.assert(null != a.length);
  1862. a.length && (b %= a.length,
  1863. 0 < b ? Array.prototype.unshift.apply(a, a.splice(-b, b)) : 0 > b && Array.prototype.push.apply(a, a.splice(0, -b)));
  1864. return a
  1865. }
  1866. ;
  1867. goog.array.moveItem = function (a, b, c) {
  1868. goog.asserts.assert(0 <= b && b < a.length);
  1869. goog.asserts.assert(0 <= c && c < a.length);
  1870. b = Array.prototype.splice.call(a, b, 1);
  1871. Array.prototype.splice.call(a, c, 0, b[0])
  1872. }
  1873. ;
  1874. goog.array.zip = function (a) {
  1875. if (!arguments.length)
  1876. return [];
  1877. for (var b = [], c = arguments[0].length, d = 1; d < arguments.length; d++)
  1878. arguments[d].length < c && (c = arguments[d].length);
  1879. for (d = 0; d < c; d++) {
  1880. for (var e = [], f = 0; f < arguments.length; f++)
  1881. e.push(arguments[f][d]);
  1882. b.push(e)
  1883. }
  1884. return b
  1885. }
  1886. ;
  1887. goog.array.shuffle = function (a, b) {
  1888. for (var c = b || Math.random, d = a.length - 1; 0 < d; d--) {
  1889. var e = Math.floor(c() * (d + 1))
  1890. , f = a[d];
  1891. a[d] = a[e];
  1892. a[e] = f
  1893. }
  1894. }
  1895. ;
  1896. goog.array.copyByIndex = function (a, b) {
  1897. var c = [];
  1898. goog.array.forEach(b, function (b) {
  1899. c.push(a[b])
  1900. });
  1901. return c
  1902. }
  1903. ;
  1904. goog.array.concatMap = function (a, b, c) {
  1905. return goog.array.concat.apply([], goog.array.map(a, b, c))
  1906. }
  1907. ;
  1908. goog.math = {};
  1909. goog.math.randomInt = function (a) {
  1910. return Math.floor(Math.random() * a)
  1911. }
  1912. ;
  1913. goog.math.uniformRandom = function (a, b) {
  1914. return a + Math.random() * (b - a)
  1915. }
  1916. ;
  1917. goog.math.clamp = function (a, b, c) {
  1918. return Math.min(Math.max(a, b), c)
  1919. }
  1920. ;
  1921. goog.math.modulo = function (a, b) {
  1922. var c = a % b;
  1923. return 0 > c * b ? c + b : c
  1924. }
  1925. ;
  1926. goog.math.lerp = function (a, b, c) {
  1927. return a + c * (b - a)
  1928. }
  1929. ;
  1930. goog.math.nearlyEquals = function (a, b, c) {
  1931. return Math.abs(a - b) <= (c || 1E-6)
  1932. }
  1933. ;
  1934. goog.math.standardAngle = function (a) {
  1935. return goog.math.modulo(a, 360)
  1936. }
  1937. ;
  1938. goog.math.standardAngleInRadians = function (a) {
  1939. return goog.math.modulo(a, 2 * Math.PI)
  1940. }
  1941. ;
  1942. goog.math.toRadians = function (a) {
  1943. return a * Math.PI / 180
  1944. }
  1945. ;
  1946. goog.math.toDegrees = function (a) {
  1947. return 180 * a / Math.PI
  1948. }
  1949. ;
  1950. goog.math.angleDx = function (a, b) {
  1951. return b * Math.cos(goog.math.toRadians(a))
  1952. }
  1953. ;
  1954. goog.math.angleDy = function (a, b) {
  1955. return b * Math.sin(goog.math.toRadians(a))
  1956. }
  1957. ;
  1958. goog.math.angle = function (a, b, c, d) {
  1959. return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(d - b, c - a)))
  1960. }
  1961. ;
  1962. goog.math.angleDifference = function (a, b) {
  1963. var c = goog.math.standardAngle(b) - goog.math.standardAngle(a);
  1964. 180 < c ? c -= 360 : -180 >= c && (c = 360 + c);
  1965. return c
  1966. }
  1967. ;
  1968. goog.math.sign = function (a) {
  1969. return 0 < a ? 1 : 0 > a ? -1 : a
  1970. }
  1971. ;
  1972. goog.math.longestCommonSubsequence = function (a, b, c, d) {
  1973. c = c || function (a, b) {
  1974. return a == b
  1975. }
  1976. ;
  1977. d = d || function (b, c) {
  1978. return a[b]
  1979. }
  1980. ;
  1981. for (var e = a.length, f = b.length, g = [], h = 0; h < e + 1; h++)
  1982. g[h] = [],
  1983. g[h][0] = 0;
  1984. for (var k = 0; k < f + 1; k++)
  1985. g[0][k] = 0;
  1986. for (h = 1; h <= e; h++)
  1987. for (k = 1; k <= f; k++)
  1988. c(a[h - 1], b[k - 1]) ? g[h][k] = g[h - 1][k - 1] + 1 : g[h][k] = Math.max(g[h - 1][k], g[h][k - 1]);
  1989. var m = [];
  1990. h = e;
  1991. for (k = f; 0 < h && 0 < k;)
  1992. c(a[h - 1], b[k - 1]) ? (m.unshift(d(h - 1, k - 1)),
  1993. h--,
  1994. k--) : g[h - 1][k] > g[h][k - 1] ? h-- : k--;
  1995. return m
  1996. }
  1997. ;
  1998. goog.math.sum = function (a) {
  1999. return goog.array.reduce(arguments, function (a, c) {
  2000. return a + c
  2001. }, 0)
  2002. }
  2003. ;
  2004. goog.math.average = function (a) {
  2005. return goog.math.sum.apply(null, arguments) / arguments.length
  2006. }
  2007. ;
  2008. goog.math.sampleVariance = function (a) {
  2009. var b = arguments.length;
  2010. if (2 > b)
  2011. return 0;
  2012. var c = goog.math.average.apply(null, arguments);
  2013. return goog.math.sum.apply(null, goog.array.map(arguments, function (a) {
  2014. return Math.pow(a - c, 2)
  2015. })) / (b - 1)
  2016. }
  2017. ;
  2018. goog.math.standardDeviation = function (a) {
  2019. return Math.sqrt(goog.math.sampleVariance.apply(null, arguments))
  2020. }
  2021. ;
  2022. goog.math.isInt = function (a) {
  2023. return isFinite(a) && 0 == a % 1
  2024. }
  2025. ;
  2026. goog.math.isFiniteNumber = function (a) {
  2027. return isFinite(a)
  2028. }
  2029. ;
  2030. goog.math.isNegativeZero = function (a) {
  2031. return 0 == a && 0 > 1 / a
  2032. }
  2033. ;
  2034. goog.math.log10Floor = function (a) {
  2035. if (0 < a) {
  2036. var b = Math.round(Math.log(a) * Math.LOG10E);
  2037. return b - (parseFloat("1e" + b) > a ? 1 : 0)
  2038. }
  2039. return 0 == a ? -Infinity : NaN
  2040. }
  2041. ;
  2042. goog.math.safeFloor = function (a, b) {
  2043. goog.asserts.assert(void 0 === b || 0 < b);
  2044. return Math.floor(a + (b || 2E-15))
  2045. }
  2046. ;
  2047. goog.math.safeCeil = function (a, b) {
  2048. goog.asserts.assert(void 0 === b || 0 < b);
  2049. return Math.ceil(a - (b || 2E-15))
  2050. }
  2051. ;
  2052. goog.math.Coordinate = function (a, b) {
  2053. this.x = void 0 !== a ? a : 0;
  2054. this.y = void 0 !== b ? b : 0
  2055. }
  2056. ;
  2057. goog.math.Coordinate.prototype.clone = function () {
  2058. return new goog.math.Coordinate(this.x, this.y)
  2059. }
  2060. ;
  2061. goog.DEBUG && (goog.math.Coordinate.prototype.toString = function () {
  2062. return "(" + this.x + ", " + this.y + ")"
  2063. }
  2064. );
  2065. goog.math.Coordinate.prototype.equals = function (a) {
  2066. return a instanceof goog.math.Coordinate && goog.math.Coordinate.equals(this, a)
  2067. }
  2068. ;
  2069. goog.math.Coordinate.equals = function (a, b) {
  2070. return a == b ? !0 : a && b ? a.x == b.x && a.y == b.y : !1
  2071. }
  2072. ;
  2073. goog.math.Coordinate.distance = function (a, b) {
  2074. var c = a.x - b.x
  2075. , d = a.y - b.y;
  2076. return Math.sqrt(c * c + d * d)
  2077. }
  2078. ;
  2079. goog.math.Coordinate.magnitude = function (a) {
  2080. return Math.sqrt(a.x * a.x + a.y * a.y)
  2081. }
  2082. ;
  2083. goog.math.Coordinate.azimuth = function (a) {
  2084. return goog.math.angle(0, 0, a.x, a.y)
  2085. }
  2086. ;
  2087. goog.math.Coordinate.squaredDistance = function (a, b) {
  2088. var c = a.x - b.x
  2089. , d = a.y - b.y;
  2090. return c * c + d * d
  2091. }
  2092. ;
  2093. goog.math.Coordinate.difference = function (a, b) {
  2094. return new goog.math.Coordinate(a.x - b.x, a.y - b.y)
  2095. }
  2096. ;
  2097. goog.math.Coordinate.sum = function (a, b) {
  2098. return new goog.math.Coordinate(a.x + b.x, a.y + b.y)
  2099. }
  2100. ;
  2101. goog.math.Coordinate.prototype.ceil = function () {
  2102. this.x = Math.ceil(this.x);
  2103. this.y = Math.ceil(this.y);
  2104. return this
  2105. }
  2106. ;
  2107. goog.math.Coordinate.prototype.floor = function () {
  2108. this.x = Math.floor(this.x);
  2109. this.y = Math.floor(this.y);
  2110. return this
  2111. }
  2112. ;
  2113. goog.math.Coordinate.prototype.round = function () {
  2114. this.x = Math.round(this.x);
  2115. this.y = Math.round(this.y);
  2116. return this
  2117. }
  2118. ;
  2119. goog.math.Coordinate.prototype.translate = function (a, b) {
  2120. a instanceof goog.math.Coordinate ? (this.x += a.x,
  2121. this.y += a.y) : (this.x += Number(a),
  2122. "number" === typeof b && (this.y += b));
  2123. return this
  2124. }
  2125. ;
  2126. goog.math.Coordinate.prototype.scale = function (a, b) {
  2127. this.x *= a;
  2128. this.y *= "number" === typeof b ? b : a;
  2129. return this
  2130. }
  2131. ;
  2132. goog.math.Coordinate.prototype.rotateRadians = function (a, b) {
  2133. var c = b || new goog.math.Coordinate(0, 0)
  2134. , d = this.x
  2135. , e = this.y
  2136. , f = Math.cos(a)
  2137. , g = Math.sin(a);
  2138. this.x = (d - c.x) * f - (e - c.y) * g + c.x;
  2139. this.y = (d - c.x) * g + (e - c.y) * f + c.y
  2140. }
  2141. ;
  2142. goog.math.Coordinate.prototype.rotateDegrees = function (a, b) {
  2143. this.rotateRadians(goog.math.toRadians(a), b)
  2144. }
  2145. ;
  2146. goog.dom.asserts = {};
  2147. goog.dom.asserts.assertIsLocation = function (a) {
  2148. if (goog.asserts.ENABLE_ASSERTS) {
  2149. var b = goog.dom.asserts.getWindow_(a);
  2150. b && (!a || !(a instanceof b.Location) && a instanceof b.Element) && goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s", goog.dom.asserts.debugStringForType_(a))
  2151. }
  2152. return a
  2153. }
  2154. ;
  2155. goog.dom.asserts.assertIsElementType_ = function (a, b) {
  2156. if (goog.asserts.ENABLE_ASSERTS) {
  2157. var c = goog.dom.asserts.getWindow_(a);
  2158. c && "undefined" != typeof c[b] && (a && (a instanceof c[b] || !(a instanceof c.Location || a instanceof c.Element)) || goog.asserts.fail("Argument is not a %s (or a non-Element, non-Location mock); got: %s", b, goog.dom.asserts.debugStringForType_(a)))
  2159. }
  2160. return a
  2161. }
  2162. ;
  2163. goog.dom.asserts.assertIsHTMLAnchorElement = function (a) {
  2164. return goog.dom.asserts.assertIsElementType_(a, "HTMLAnchorElement")
  2165. }
  2166. ;
  2167. goog.dom.asserts.assertIsHTMLButtonElement = function (a) {
  2168. return goog.dom.asserts.assertIsElementType_(a, "HTMLButtonElement")
  2169. }
  2170. ;
  2171. goog.dom.asserts.assertIsHTMLLinkElement = function (a) {
  2172. return goog.dom.asserts.assertIsElementType_(a, "HTMLLinkElement")
  2173. }
  2174. ;
  2175. goog.dom.asserts.assertIsHTMLImageElement = function (a) {
  2176. return goog.dom.asserts.assertIsElementType_(a, "HTMLImageElement")
  2177. }
  2178. ;
  2179. goog.dom.asserts.assertIsHTMLAudioElement = function (a) {
  2180. return goog.dom.asserts.assertIsElementType_(a, "HTMLAudioElement")
  2181. }
  2182. ;
  2183. goog.dom.asserts.assertIsHTMLVideoElement = function (a) {
  2184. return goog.dom.asserts.assertIsElementType_(a, "HTMLVideoElement")
  2185. }
  2186. ;
  2187. goog.dom.asserts.assertIsHTMLInputElement = function (a) {
  2188. return goog.dom.asserts.assertIsElementType_(a, "HTMLInputElement")
  2189. }
  2190. ;
  2191. goog.dom.asserts.assertIsHTMLTextAreaElement = function (a) {
  2192. return goog.dom.asserts.assertIsElementType_(a, "HTMLTextAreaElement")
  2193. }
  2194. ;
  2195. goog.dom.asserts.assertIsHTMLCanvasElement = function (a) {
  2196. return goog.dom.asserts.assertIsElementType_(a, "HTMLCanvasElement")
  2197. }
  2198. ;
  2199. goog.dom.asserts.assertIsHTMLEmbedElement = function (a) {
  2200. return goog.dom.asserts.assertIsElementType_(a, "HTMLEmbedElement")
  2201. }
  2202. ;
  2203. goog.dom.asserts.assertIsHTMLFormElement = function (a) {
  2204. return goog.dom.asserts.assertIsElementType_(a, "HTMLFormElement")
  2205. }
  2206. ;
  2207. goog.dom.asserts.assertIsHTMLFrameElement = function (a) {
  2208. return goog.dom.asserts.assertIsElementType_(a, "HTMLFrameElement")
  2209. }
  2210. ;
  2211. goog.dom.asserts.assertIsHTMLIFrameElement = function (a) {
  2212. return goog.dom.asserts.assertIsElementType_(a, "HTMLIFrameElement")
  2213. }
  2214. ;
  2215. goog.dom.asserts.assertIsHTMLObjectElement = function (a) {
  2216. return goog.dom.asserts.assertIsElementType_(a, "HTMLObjectElement")
  2217. }
  2218. ;
  2219. goog.dom.asserts.assertIsHTMLScriptElement = function (a) {
  2220. return goog.dom.asserts.assertIsElementType_(a, "HTMLScriptElement")
  2221. }
  2222. ;
  2223. goog.dom.asserts.debugStringForType_ = function (a) {
  2224. if (goog.isObject(a))
  2225. try {
  2226. return a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a)
  2227. } catch (b) {
  2228. return "<object could not be stringified>"
  2229. }
  2230. else
  2231. return void 0 === a ? "undefined" : null === a ? "null" : typeof a
  2232. }
  2233. ;
  2234. goog.dom.asserts.getWindow_ = function (a) {
  2235. try {
  2236. var b = a && a.ownerDocument
  2237. , c = b && (b.defaultView || b.parentWindow);
  2238. c = c || goog.global;
  2239. if (c.Element && c.Location)
  2240. return c
  2241. } catch (d) { }
  2242. return null
  2243. }
  2244. ;
  2245. goog.functions = {};
  2246. goog.functions.constant = function (a) {
  2247. return function () {
  2248. return a
  2249. }
  2250. }
  2251. ;
  2252. goog.functions.FALSE = function () {
  2253. return !1
  2254. }
  2255. ;
  2256. goog.functions.TRUE = function () {
  2257. return !0
  2258. }
  2259. ;
  2260. goog.functions.NULL = function () {
  2261. return null
  2262. }
  2263. ;
  2264. goog.functions.identity = function (a, b) {
  2265. return a
  2266. }
  2267. ;
  2268. goog.functions.error = function (a) {
  2269. return function () {
  2270. throw Error(a);
  2271. }
  2272. }
  2273. ;
  2274. goog.functions.fail = function (a) {
  2275. return function () {
  2276. throw a;
  2277. }
  2278. }
  2279. ;
  2280. goog.functions.lock = function (a, b) {
  2281. b = b || 0;
  2282. return function () {
  2283. return a.apply(this, Array.prototype.slice.call(arguments, 0, b))
  2284. }
  2285. }
  2286. ;
  2287. goog.functions.nth = function (a) {
  2288. return function () {
  2289. return arguments[a]
  2290. }
  2291. }
  2292. ;
  2293. goog.functions.partialRight = function (a, b) {
  2294. var c = Array.prototype.slice.call(arguments, 1);
  2295. return function () {
  2296. var b = Array.prototype.slice.call(arguments);
  2297. b.push.apply(b, c);
  2298. return a.apply(this, b)
  2299. }
  2300. }
  2301. ;
  2302. goog.functions.withReturnValue = function (a, b) {
  2303. return goog.functions.sequence(a, goog.functions.constant(b))
  2304. }
  2305. ;
  2306. goog.functions.equalTo = function (a, b) {
  2307. return function (c) {
  2308. return b ? a == c : a === c
  2309. }
  2310. }
  2311. ;
  2312. goog.functions.compose = function (a, b) {
  2313. var c = arguments
  2314. , d = c.length;
  2315. return function () {
  2316. var a;
  2317. d && (a = c[d - 1].apply(this, arguments));
  2318. for (var b = d - 2; 0 <= b; b--)
  2319. a = c[b].call(this, a);
  2320. return a
  2321. }
  2322. }
  2323. ;
  2324. goog.functions.sequence = function (a) {
  2325. var b = arguments
  2326. , c = b.length;
  2327. return function () {
  2328. for (var a, e = 0; e < c; e++)
  2329. a = b[e].apply(this, arguments);
  2330. return a
  2331. }
  2332. }
  2333. ;
  2334. goog.functions.and = function (a) {
  2335. var b = arguments
  2336. , c = b.length;
  2337. return function () {
  2338. for (var a = 0; a < c; a++)
  2339. if (!b[a].apply(this, arguments))
  2340. return !1;
  2341. return !0
  2342. }
  2343. }
  2344. ;
  2345. goog.functions.or = function (a) {
  2346. var b = arguments
  2347. , c = b.length;
  2348. return function () {
  2349. for (var a = 0; a < c; a++)
  2350. if (b[a].apply(this, arguments))
  2351. return !0;
  2352. return !1
  2353. }
  2354. }
  2355. ;
  2356. goog.functions.not = function (a) {
  2357. return function () {
  2358. return !a.apply(this, arguments)
  2359. }
  2360. }
  2361. ;
  2362. goog.functions.create = function (a, b) {
  2363. var c = function () { };
  2364. c.prototype = a.prototype;
  2365. c = new c;
  2366. a.apply(c, Array.prototype.slice.call(arguments, 1));
  2367. return c
  2368. }
  2369. ;
  2370. goog.functions.CACHE_RETURN_VALUE = !0;
  2371. goog.functions.cacheReturnValue = function (a) {
  2372. var b = !1, c;
  2373. return function () {
  2374. if (!goog.functions.CACHE_RETURN_VALUE)
  2375. return a();
  2376. b || (c = a(),
  2377. b = !0);
  2378. return c
  2379. }
  2380. }
  2381. ;
  2382. goog.functions.once = function (a) {
  2383. var b = a;
  2384. return function () {
  2385. if (b) {
  2386. var a = b;
  2387. b = null;
  2388. a()
  2389. }
  2390. }
  2391. }
  2392. ;
  2393. goog.functions.debounce = function (a, b, c) {
  2394. var d = 0;
  2395. return function (e) {
  2396. goog.global.clearTimeout(d);
  2397. var f = arguments;
  2398. d = goog.global.setTimeout(function () {
  2399. a.apply(c, f)
  2400. }, b)
  2401. }
  2402. }
  2403. ;
  2404. goog.functions.throttle = function (a, b, c) {
  2405. var d = 0
  2406. , e = !1
  2407. , f = []
  2408. , g = function () {
  2409. d = 0;
  2410. e && (e = !1,
  2411. h())
  2412. }
  2413. , h = function () {
  2414. d = goog.global.setTimeout(g, b);
  2415. a.apply(c, f)
  2416. };
  2417. return function (a) {
  2418. f = arguments;
  2419. d ? e = !0 : h()
  2420. }
  2421. }
  2422. ;
  2423. goog.functions.rateLimit = function (a, b, c) {
  2424. var d = 0
  2425. , e = function () {
  2426. d = 0
  2427. };
  2428. return function (f) {
  2429. d || (d = goog.global.setTimeout(e, b),
  2430. a.apply(c, arguments))
  2431. }
  2432. }
  2433. ;
  2434. goog.dom.HtmlElement = function () { }
  2435. ;
  2436. goog.dom.TagName = function (a) {
  2437. this.tagName_ = a
  2438. }
  2439. ;
  2440. goog.dom.TagName.prototype.toString = function () {
  2441. return this.tagName_
  2442. }
  2443. ;
  2444. goog.dom.TagName.A = new goog.dom.TagName("A");
  2445. goog.dom.TagName.ABBR = new goog.dom.TagName("ABBR");
  2446. goog.dom.TagName.ACRONYM = new goog.dom.TagName("ACRONYM");
  2447. goog.dom.TagName.ADDRESS = new goog.dom.TagName("ADDRESS");
  2448. goog.dom.TagName.APPLET = new goog.dom.TagName("APPLET");
  2449. goog.dom.TagName.AREA = new goog.dom.TagName("AREA");
  2450. goog.dom.TagName.ARTICLE = new goog.dom.TagName("ARTICLE");
  2451. goog.dom.TagName.ASIDE = new goog.dom.TagName("ASIDE");
  2452. goog.dom.TagName.AUDIO = new goog.dom.TagName("AUDIO");
  2453. goog.dom.TagName.B = new goog.dom.TagName("B");
  2454. goog.dom.TagName.BASE = new goog.dom.TagName("BASE");
  2455. goog.dom.TagName.BASEFONT = new goog.dom.TagName("BASEFONT");
  2456. goog.dom.TagName.BDI = new goog.dom.TagName("BDI");
  2457. goog.dom.TagName.BDO = new goog.dom.TagName("BDO");
  2458. goog.dom.TagName.BIG = new goog.dom.TagName("BIG");
  2459. goog.dom.TagName.BLOCKQUOTE = new goog.dom.TagName("BLOCKQUOTE");
  2460. goog.dom.TagName.BODY = new goog.dom.TagName("BODY");
  2461. goog.dom.TagName.BR = new goog.dom.TagName("BR");
  2462. goog.dom.TagName.BUTTON = new goog.dom.TagName("BUTTON");
  2463. goog.dom.TagName.CANVAS = new goog.dom.TagName("CANVAS");
  2464. goog.dom.TagName.CAPTION = new goog.dom.TagName("CAPTION");
  2465. goog.dom.TagName.CENTER = new goog.dom.TagName("CENTER");
  2466. goog.dom.TagName.CITE = new goog.dom.TagName("CITE");
  2467. goog.dom.TagName.CODE = new goog.dom.TagName("CODE");
  2468. goog.dom.TagName.COL = new goog.dom.TagName("COL");
  2469. goog.dom.TagName.COLGROUP = new goog.dom.TagName("COLGROUP");
  2470. goog.dom.TagName.COMMAND = new goog.dom.TagName("COMMAND");
  2471. goog.dom.TagName.DATA = new goog.dom.TagName("DATA");
  2472. goog.dom.TagName.DATALIST = new goog.dom.TagName("DATALIST");
  2473. goog.dom.TagName.DD = new goog.dom.TagName("DD");
  2474. goog.dom.TagName.DEL = new goog.dom.TagName("DEL");
  2475. goog.dom.TagName.DETAILS = new goog.dom.TagName("DETAILS");
  2476. goog.dom.TagName.DFN = new goog.dom.TagName("DFN");
  2477. goog.dom.TagName.DIALOG = new goog.dom.TagName("DIALOG");
  2478. goog.dom.TagName.DIR = new goog.dom.TagName("DIR");
  2479. goog.dom.TagName.DIV = new goog.dom.TagName("DIV");
  2480. goog.dom.TagName.DL = new goog.dom.TagName("DL");
  2481. goog.dom.TagName.DT = new goog.dom.TagName("DT");
  2482. goog.dom.TagName.EM = new goog.dom.TagName("EM");
  2483. goog.dom.TagName.EMBED = new goog.dom.TagName("EMBED");
  2484. goog.dom.TagName.FIELDSET = new goog.dom.TagName("FIELDSET");
  2485. goog.dom.TagName.FIGCAPTION = new goog.dom.TagName("FIGCAPTION");
  2486. goog.dom.TagName.FIGURE = new goog.dom.TagName("FIGURE");
  2487. goog.dom.TagName.FONT = new goog.dom.TagName("FONT");
  2488. goog.dom.TagName.FOOTER = new goog.dom.TagName("FOOTER");
  2489. goog.dom.TagName.FORM = new goog.dom.TagName("FORM");
  2490. goog.dom.TagName.FRAME = new goog.dom.TagName("FRAME");
  2491. goog.dom.TagName.FRAMESET = new goog.dom.TagName("FRAMESET");
  2492. goog.dom.TagName.H1 = new goog.dom.TagName("H1");
  2493. goog.dom.TagName.H2 = new goog.dom.TagName("H2");
  2494. goog.dom.TagName.H3 = new goog.dom.TagName("H3");
  2495. goog.dom.TagName.H4 = new goog.dom.TagName("H4");
  2496. goog.dom.TagName.H5 = new goog.dom.TagName("H5");
  2497. goog.dom.TagName.H6 = new goog.dom.TagName("H6");
  2498. goog.dom.TagName.HEAD = new goog.dom.TagName("HEAD");
  2499. goog.dom.TagName.HEADER = new goog.dom.TagName("HEADER");
  2500. goog.dom.TagName.HGROUP = new goog.dom.TagName("HGROUP");
  2501. goog.dom.TagName.HR = new goog.dom.TagName("HR");
  2502. goog.dom.TagName.HTML = new goog.dom.TagName("HTML");
  2503. goog.dom.TagName.I = new goog.dom.TagName("I");
  2504. goog.dom.TagName.IFRAME = new goog.dom.TagName("IFRAME");
  2505. goog.dom.TagName.IMG = new goog.dom.TagName("IMG");
  2506. goog.dom.TagName.INPUT = new goog.dom.TagName("INPUT");
  2507. goog.dom.TagName.INS = new goog.dom.TagName("INS");
  2508. goog.dom.TagName.ISINDEX = new goog.dom.TagName("ISINDEX");
  2509. goog.dom.TagName.KBD = new goog.dom.TagName("KBD");
  2510. goog.dom.TagName.KEYGEN = new goog.dom.TagName("KEYGEN");
  2511. goog.dom.TagName.LABEL = new goog.dom.TagName("LABEL");
  2512. goog.dom.TagName.LEGEND = new goog.dom.TagName("LEGEND");
  2513. goog.dom.TagName.LI = new goog.dom.TagName("LI");
  2514. goog.dom.TagName.LINK = new goog.dom.TagName("LINK");
  2515. goog.dom.TagName.MAIN = new goog.dom.TagName("MAIN");
  2516. goog.dom.TagName.MAP = new goog.dom.TagName("MAP");
  2517. goog.dom.TagName.MARK = new goog.dom.TagName("MARK");
  2518. goog.dom.TagName.MATH = new goog.dom.TagName("MATH");
  2519. goog.dom.TagName.MENU = new goog.dom.TagName("MENU");
  2520. goog.dom.TagName.MENUITEM = new goog.dom.TagName("MENUITEM");
  2521. goog.dom.TagName.META = new goog.dom.TagName("META");
  2522. goog.dom.TagName.METER = new goog.dom.TagName("METER");
  2523. goog.dom.TagName.NAV = new goog.dom.TagName("NAV");
  2524. goog.dom.TagName.NOFRAMES = new goog.dom.TagName("NOFRAMES");
  2525. goog.dom.TagName.NOSCRIPT = new goog.dom.TagName("NOSCRIPT");
  2526. goog.dom.TagName.OBJECT = new goog.dom.TagName("OBJECT");
  2527. goog.dom.TagName.OL = new goog.dom.TagName("OL");
  2528. goog.dom.TagName.OPTGROUP = new goog.dom.TagName("OPTGROUP");
  2529. goog.dom.TagName.OPTION = new goog.dom.TagName("OPTION");
  2530. goog.dom.TagName.OUTPUT = new goog.dom.TagName("OUTPUT");
  2531. goog.dom.TagName.P = new goog.dom.TagName("P");
  2532. goog.dom.TagName.PARAM = new goog.dom.TagName("PARAM");
  2533. goog.dom.TagName.PICTURE = new goog.dom.TagName("PICTURE");
  2534. goog.dom.TagName.PRE = new goog.dom.TagName("PRE");
  2535. goog.dom.TagName.PROGRESS = new goog.dom.TagName("PROGRESS");
  2536. goog.dom.TagName.Q = new goog.dom.TagName("Q");
  2537. goog.dom.TagName.RP = new goog.dom.TagName("RP");
  2538. goog.dom.TagName.RT = new goog.dom.TagName("RT");
  2539. goog.dom.TagName.RTC = new goog.dom.TagName("RTC");
  2540. goog.dom.TagName.RUBY = new goog.dom.TagName("RUBY");
  2541. goog.dom.TagName.S = new goog.dom.TagName("S");
  2542. goog.dom.TagName.SAMP = new goog.dom.TagName("SAMP");
  2543. goog.dom.TagName.SCRIPT = new goog.dom.TagName("SCRIPT");
  2544. goog.dom.TagName.SECTION = new goog.dom.TagName("SECTION");
  2545. goog.dom.TagName.SELECT = new goog.dom.TagName("SELECT");
  2546. goog.dom.TagName.SMALL = new goog.dom.TagName("SMALL");
  2547. goog.dom.TagName.SOURCE = new goog.dom.TagName("SOURCE");
  2548. goog.dom.TagName.SPAN = new goog.dom.TagName("SPAN");
  2549. goog.dom.TagName.STRIKE = new goog.dom.TagName("STRIKE");
  2550. goog.dom.TagName.STRONG = new goog.dom.TagName("STRONG");
  2551. goog.dom.TagName.STYLE = new goog.dom.TagName("STYLE");
  2552. goog.dom.TagName.SUB = new goog.dom.TagName("SUB");
  2553. goog.dom.TagName.SUMMARY = new goog.dom.TagName("SUMMARY");
  2554. goog.dom.TagName.SUP = new goog.dom.TagName("SUP");
  2555. goog.dom.TagName.SVG = new goog.dom.TagName("SVG");
  2556. goog.dom.TagName.TABLE = new goog.dom.TagName("TABLE");
  2557. goog.dom.TagName.TBODY = new goog.dom.TagName("TBODY");
  2558. goog.dom.TagName.TD = new goog.dom.TagName("TD");
  2559. goog.dom.TagName.TEMPLATE = new goog.dom.TagName("TEMPLATE");
  2560. goog.dom.TagName.TEXTAREA = new goog.dom.TagName("TEXTAREA");
  2561. goog.dom.TagName.TFOOT = new goog.dom.TagName("TFOOT");
  2562. goog.dom.TagName.TH = new goog.dom.TagName("TH");
  2563. goog.dom.TagName.THEAD = new goog.dom.TagName("THEAD");
  2564. goog.dom.TagName.TIME = new goog.dom.TagName("TIME");
  2565. goog.dom.TagName.TITLE = new goog.dom.TagName("TITLE");
  2566. goog.dom.TagName.TR = new goog.dom.TagName("TR");
  2567. goog.dom.TagName.TRACK = new goog.dom.TagName("TRACK");
  2568. goog.dom.TagName.TT = new goog.dom.TagName("TT");
  2569. goog.dom.TagName.U = new goog.dom.TagName("U");
  2570. goog.dom.TagName.UL = new goog.dom.TagName("UL");
  2571. goog.dom.TagName.VAR = new goog.dom.TagName("VAR");
  2572. goog.dom.TagName.VIDEO = new goog.dom.TagName("VIDEO");
  2573. goog.dom.TagName.WBR = new goog.dom.TagName("WBR");
  2574. goog.object = {};
  2575. goog.object.is = function (a, b) {
  2576. return a === b ? 0 !== a || 1 / a === 1 / b : a !== a && b !== b
  2577. }
  2578. ;
  2579. goog.object.forEach = function (a, b, c) {
  2580. for (var d in a)
  2581. b.call(c, a[d], d, a)
  2582. }
  2583. ;
  2584. goog.object.filter = function (a, b, c) {
  2585. var d = {}, e;
  2586. for (e in a)
  2587. b.call(c, a[e], e, a) && (d[e] = a[e]);
  2588. return d
  2589. }
  2590. ;
  2591. goog.object.map = function (a, b, c) {
  2592. var d = {}, e;
  2593. for (e in a)
  2594. d[e] = b.call(c, a[e], e, a);
  2595. return d
  2596. }
  2597. ;
  2598. goog.object.some = function (a, b, c) {
  2599. for (var d in a)
  2600. if (b.call(c, a[d], d, a))
  2601. return !0;
  2602. return !1
  2603. }
  2604. ;
  2605. goog.object.every = function (a, b, c) {
  2606. for (var d in a)
  2607. if (!b.call(c, a[d], d, a))
  2608. return !1;
  2609. return !0
  2610. }
  2611. ;
  2612. goog.object.getCount = function (a) {
  2613. var b = 0, c;
  2614. for (c in a)
  2615. b++;
  2616. return b
  2617. }
  2618. ;
  2619. goog.object.getAnyKey = function (a) {
  2620. for (var b in a)
  2621. return b
  2622. }
  2623. ;
  2624. goog.object.getAnyValue = function (a) {
  2625. for (var b in a)
  2626. return a[b]
  2627. }
  2628. ;
  2629. goog.object.contains = function (a, b) {
  2630. return goog.object.containsValue(a, b)
  2631. }
  2632. ;
  2633. goog.object.getValues = function (a) {
  2634. var b = [], c = 0, d;
  2635. for (d in a)
  2636. b[c++] = a[d];
  2637. return b
  2638. }
  2639. ;
  2640. goog.object.getKeys = function (a) {
  2641. var b = [], c = 0, d;
  2642. for (d in a)
  2643. b[c++] = d;
  2644. return b
  2645. }
  2646. ;
  2647. goog.object.getValueByKeys = function (a, b) {
  2648. var c = goog.isArrayLike(b)
  2649. , d = c ? b : arguments;
  2650. for (c = c ? 0 : 1; c < d.length; c++) {
  2651. if (null == a)
  2652. return;
  2653. a = a[d[c]]
  2654. }
  2655. return a
  2656. }
  2657. ;
  2658. goog.object.containsKey = function (a, b) {
  2659. return null !== a && b in a
  2660. }
  2661. ;
  2662. goog.object.containsValue = function (a, b) {
  2663. for (var c in a)
  2664. if (a[c] == b)
  2665. return !0;
  2666. return !1
  2667. }
  2668. ;
  2669. goog.object.findKey = function (a, b, c) {
  2670. for (var d in a)
  2671. if (b.call(c, a[d], d, a))
  2672. return d
  2673. }
  2674. ;
  2675. goog.object.findValue = function (a, b, c) {
  2676. return (b = goog.object.findKey(a, b, c)) && a[b]
  2677. }
  2678. ;
  2679. goog.object.isEmpty = function (a) {
  2680. for (var b in a)
  2681. return !1;
  2682. return !0
  2683. }
  2684. ;
  2685. goog.object.clear = function (a) {
  2686. for (var b in a)
  2687. delete a[b]
  2688. }
  2689. ;
  2690. goog.object.remove = function (a, b) {
  2691. var c;
  2692. (c = b in a) && delete a[b];
  2693. return c
  2694. }
  2695. ;
  2696. goog.object.add = function (a, b, c) {
  2697. if (null !== a && b in a)
  2698. throw Error('The object already contains the key "' + b + '"');
  2699. goog.object.set(a, b, c)
  2700. }
  2701. ;
  2702. goog.object.get = function (a, b, c) {
  2703. return null !== a && b in a ? a[b] : c
  2704. }
  2705. ;
  2706. goog.object.set = function (a, b, c) {
  2707. a[b] = c
  2708. }
  2709. ;
  2710. goog.object.setIfUndefined = function (a, b, c) {
  2711. return b in a ? a[b] : a[b] = c
  2712. }
  2713. ;
  2714. goog.object.setWithReturnValueIfNotSet = function (a, b, c) {
  2715. if (b in a)
  2716. return a[b];
  2717. c = c();
  2718. return a[b] = c
  2719. }
  2720. ;
  2721. goog.object.equals = function (a, b) {
  2722. for (var c in a)
  2723. if (!(c in b) || a[c] !== b[c])
  2724. return !1;
  2725. for (var d in b)
  2726. if (!(d in a))
  2727. return !1;
  2728. return !0
  2729. }
  2730. ;
  2731. goog.object.clone = function (a) {
  2732. var b = {}, c;
  2733. for (c in a)
  2734. b[c] = a[c];
  2735. return b
  2736. }
  2737. ;
  2738. goog.object.unsafeClone = function (a) {
  2739. var b = goog.typeOf(a);
  2740. if ("object" == b || "array" == b) {
  2741. if (goog.isFunction(a.clone))
  2742. return a.clone();
  2743. b = "array" == b ? [] : {};
  2744. for (var c in a)
  2745. b[c] = goog.object.unsafeClone(a[c]);
  2746. return b
  2747. }
  2748. return a
  2749. }
  2750. ;
  2751. goog.object.transpose = function (a) {
  2752. var b = {}, c;
  2753. for (c in a)
  2754. b[a[c]] = c;
  2755. return b
  2756. }
  2757. ;
  2758. goog.object.PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
  2759. goog.object.extend = function (a, b) {
  2760. for (var c, d, e = 1; e < arguments.length; e++) {
  2761. d = arguments[e];
  2762. for (c in d)
  2763. a[c] = d[c];
  2764. for (var f = 0; f < goog.object.PROTOTYPE_FIELDS_.length; f++)
  2765. c = goog.object.PROTOTYPE_FIELDS_[f],
  2766. Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c])
  2767. }
  2768. }
  2769. ;
  2770. goog.object.create = function (a) {
  2771. var b = arguments.length;
  2772. if (1 == b && goog.isArray(arguments[0]))
  2773. return goog.object.create.apply(null, arguments[0]);
  2774. if (b % 2)
  2775. throw Error("Uneven number of arguments");
  2776. for (var c = {}, d = 0; d < b; d += 2)
  2777. c[arguments[d]] = arguments[d + 1];
  2778. return c
  2779. }
  2780. ;
  2781. goog.object.createSet = function (a) {
  2782. var b = arguments.length;
  2783. if (1 == b && goog.isArray(arguments[0]))
  2784. return goog.object.createSet.apply(null, arguments[0]);
  2785. for (var c = {}, d = 0; d < b; d++)
  2786. c[arguments[d]] = !0;
  2787. return c
  2788. }
  2789. ;
  2790. goog.object.createImmutableView = function (a) {
  2791. var b = a;
  2792. Object.isFrozen && !Object.isFrozen(a) && (b = Object.create(a),
  2793. Object.freeze(b));
  2794. return b
  2795. }
  2796. ;
  2797. goog.object.isImmutableView = function (a) {
  2798. return !!Object.isFrozen && Object.isFrozen(a)
  2799. }
  2800. ;
  2801. goog.object.getAllPropertyNames = function (a, b, c) {
  2802. if (!a)
  2803. return [];
  2804. if (!Object.getOwnPropertyNames || !Object.getPrototypeOf)
  2805. return goog.object.getKeys(a);
  2806. for (var d = {}; a && (a !== Object.prototype || b) && (a !== Function.prototype || c);) {
  2807. for (var e = Object.getOwnPropertyNames(a), f = 0; f < e.length; f++)
  2808. d[e[f]] = !0;
  2809. a = Object.getPrototypeOf(a)
  2810. }
  2811. return goog.object.getKeys(d)
  2812. }
  2813. ;
  2814. goog.object.getSuperClass = function (a) {
  2815. return (a = Object.getPrototypeOf(a.prototype)) && a.constructor
  2816. }
  2817. ;
  2818. goog.dom.tags = {};
  2819. goog.dom.tags.VOID_TAGS_ = {
  2820. area: !0,
  2821. base: !0,
  2822. br: !0,
  2823. col: !0,
  2824. command: !0,
  2825. embed: !0,
  2826. hr: !0,
  2827. img: !0,
  2828. input: !0,
  2829. keygen: !0,
  2830. link: !0,
  2831. meta: !0,
  2832. param: !0,
  2833. source: !0,
  2834. track: !0,
  2835. wbr: !0
  2836. };
  2837. goog.dom.tags.isVoidTag = function (a) {
  2838. return !0 === goog.dom.tags.VOID_TAGS_[a]
  2839. }
  2840. ;
  2841. goog.html = {};
  2842. goog.html.trustedtypes = {};
  2843. goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY = goog.TRUSTED_TYPES_POLICY_NAME ? goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + "#html") : null;
  2844. goog.string = {};
  2845. goog.string.TypedString = function () { }
  2846. ;
  2847. goog.string.Const = function (a, b) {
  2848. this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ = a === goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_ && b || "";
  2849. this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ = goog.string.Const.TYPE_MARKER_
  2850. }
  2851. ;
  2852. goog.string.Const.prototype.implementsGoogStringTypedString = !0;
  2853. goog.string.Const.prototype.getTypedStringValue = function () {
  2854. return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_
  2855. }
  2856. ;
  2857. goog.DEBUG && (goog.string.Const.prototype.toString = function () {
  2858. return "Const{" + this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ + "}"
  2859. }
  2860. );
  2861. goog.string.Const.unwrap = function (a) {
  2862. if (a instanceof goog.string.Const && a.constructor === goog.string.Const && a.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ === goog.string.Const.TYPE_MARKER_)
  2863. return a.stringConstValueWithSecurityContract__googStringSecurityPrivate_;
  2864. goog.asserts.fail("expected object of type Const, got '" + a + "'");
  2865. return "type_error:Const"
  2866. }
  2867. ;
  2868. goog.string.Const.from = function (a) {
  2869. return new goog.string.Const(goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_, a)
  2870. }
  2871. ;
  2872. goog.string.Const.TYPE_MARKER_ = {};
  2873. goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_ = {};
  2874. goog.string.Const.EMPTY = goog.string.Const.from("");
  2875. goog.html.SafeScript = function () {
  2876. this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = "";
  2877. this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  2878. }
  2879. ;
  2880. goog.html.SafeScript.prototype.implementsGoogStringTypedString = !0;
  2881. goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  2882. goog.html.SafeScript.fromConstant = function (a) {
  2883. a = goog.string.Const.unwrap(a);
  2884. return 0 === a.length ? goog.html.SafeScript.EMPTY : goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(a)
  2885. }
  2886. ;
  2887. goog.html.SafeScript.fromConstantAndArgs = function (a, b) {
  2888. for (var c = [], d = 1; d < arguments.length; d++)
  2889. c.push(goog.html.SafeScript.stringify_(arguments[d]));
  2890. return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("(" + goog.string.Const.unwrap(a) + ")(" + c.join(", ") + ");")
  2891. }
  2892. ;
  2893. goog.html.SafeScript.fromJson = function (a) {
  2894. return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(goog.html.SafeScript.stringify_(a))
  2895. }
  2896. ;
  2897. goog.html.SafeScript.prototype.getTypedStringValue = function () {
  2898. return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString()
  2899. }
  2900. ;
  2901. goog.DEBUG && (goog.html.SafeScript.prototype.toString = function () {
  2902. return "SafeScript{" + this.privateDoNotAccessOrElseSafeScriptWrappedValue_ + "}"
  2903. }
  2904. );
  2905. goog.html.SafeScript.unwrap = function (a) {
  2906. return goog.html.SafeScript.unwrapTrustedScript(a).toString()
  2907. }
  2908. ;
  2909. goog.html.SafeScript.unwrapTrustedScript = function (a) {
  2910. if (a instanceof goog.html.SafeScript && a.constructor === goog.html.SafeScript && a.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  2911. return a.privateDoNotAccessOrElseSafeScriptWrappedValue_;
  2912. goog.asserts.fail("expected object of type SafeScript, got '" + a + "' of type " + goog.typeOf(a));
  2913. return "type_error:SafeScript"
  2914. }
  2915. ;
  2916. goog.html.SafeScript.stringify_ = function (a) {
  2917. return JSON.stringify(a).replace(/</g, "\\x3c")
  2918. }
  2919. ;
  2920. goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse = function (a) {
  2921. return (new goog.html.SafeScript).initSecurityPrivateDoNotAccessOrElse_(a)
  2922. }
  2923. ;
  2924. goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) {
  2925. this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScript(a) : a;
  2926. return this
  2927. }
  2928. ;
  2929. goog.html.SafeScript.EMPTY = goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("");
  2930. goog.fs = {};
  2931. goog.fs.url = {};
  2932. goog.fs.url.createObjectUrl = function (a) {
  2933. return goog.fs.url.getUrlObject_().createObjectURL(a)
  2934. }
  2935. ;
  2936. goog.fs.url.revokeObjectUrl = function (a) {
  2937. goog.fs.url.getUrlObject_().revokeObjectURL(a)
  2938. }
  2939. ;
  2940. goog.fs.url.getUrlObject_ = function () {
  2941. var a = goog.fs.url.findUrlObject_();
  2942. if (null != a)
  2943. return a;
  2944. throw Error("This browser doesn't seem to support blob URLs");
  2945. }
  2946. ;
  2947. goog.fs.url.findUrlObject_ = function () {
  2948. return void 0 !== goog.global.URL && void 0 !== goog.global.URL.createObjectURL ? goog.global.URL : void 0 !== goog.global.webkitURL && void 0 !== goog.global.webkitURL.createObjectURL ? goog.global.webkitURL : void 0 !== goog.global.createObjectURL ? goog.global : null
  2949. }
  2950. ;
  2951. goog.fs.url.browserSupportsObjectUrls = function () {
  2952. return null != goog.fs.url.findUrlObject_()
  2953. }
  2954. ;
  2955. goog.i18n = {};
  2956. goog.i18n.bidi = {};
  2957. goog.i18n.bidi.FORCE_RTL = !1;
  2958. goog.i18n.bidi.IS_RTL = goog.i18n.bidi.FORCE_RTL || ("ar" == goog.LOCALE.substring(0, 2).toLowerCase() || "fa" == goog.LOCALE.substring(0, 2).toLowerCase() || "he" == goog.LOCALE.substring(0, 2).toLowerCase() || "iw" == goog.LOCALE.substring(0, 2).toLowerCase() || "ps" == goog.LOCALE.substring(0, 2).toLowerCase() || "sd" == goog.LOCALE.substring(0, 2).toLowerCase() || "ug" == goog.LOCALE.substring(0, 2).toLowerCase() || "ur" == goog.LOCALE.substring(0, 2).toLowerCase() || "yi" == goog.LOCALE.substring(0, 2).toLowerCase()) && (2 == goog.LOCALE.length || "-" == goog.LOCALE.substring(2, 3) || "_" == goog.LOCALE.substring(2, 3)) || 3 <= goog.LOCALE.length && "ckb" == goog.LOCALE.substring(0, 3).toLowerCase() && (3 == goog.LOCALE.length || "-" == goog.LOCALE.substring(3, 4) || "_" == goog.LOCALE.substring(3, 4)) || 7 <= goog.LOCALE.length && ("-" == goog.LOCALE.substring(2, 3) || "_" == goog.LOCALE.substring(2, 3)) && ("adlm" == goog.LOCALE.substring(3, 7).toLowerCase() || "arab" == goog.LOCALE.substring(3, 7).toLowerCase() || "hebr" == goog.LOCALE.substring(3, 7).toLowerCase() || "nkoo" == goog.LOCALE.substring(3, 7).toLowerCase() || "rohg" == goog.LOCALE.substring(3, 7).toLowerCase() || "thaa" == goog.LOCALE.substring(3, 7).toLowerCase()) || 8 <= goog.LOCALE.length && ("-" == goog.LOCALE.substring(3, 4) || "_" == goog.LOCALE.substring(3, 4)) && ("adlm" == goog.LOCALE.substring(4, 8).toLowerCase() || "arab" == goog.LOCALE.substring(4, 8).toLowerCase() || "hebr" == goog.LOCALE.substring(4, 8).toLowerCase() || "nkoo" == goog.LOCALE.substring(4, 8).toLowerCase() || "rohg" == goog.LOCALE.substring(4, 8).toLowerCase() || "thaa" == goog.LOCALE.substring(4, 8).toLowerCase());
  2959. goog.i18n.bidi.Format = {
  2960. LRE: "\u202a",
  2961. RLE: "\u202b",
  2962. PDF: "\u202c",
  2963. LRM: "\u200e",
  2964. RLM: "\u200f"
  2965. };
  2966. goog.i18n.bidi.Dir = {
  2967. LTR: 1,
  2968. RTL: -1,
  2969. NEUTRAL: 0
  2970. };
  2971. goog.i18n.bidi.RIGHT = "right";
  2972. goog.i18n.bidi.LEFT = "left";
  2973. goog.i18n.bidi.I18N_RIGHT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.LEFT : goog.i18n.bidi.RIGHT;
  2974. goog.i18n.bidi.I18N_LEFT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT;
  2975. goog.i18n.bidi.toDir = function (a, b) {
  2976. return "number" == typeof a ? 0 < a ? goog.i18n.bidi.Dir.LTR : 0 > a ? goog.i18n.bidi.Dir.RTL : b ? null : goog.i18n.bidi.Dir.NEUTRAL : null == a ? null : a ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR
  2977. }
  2978. ;
  2979. goog.i18n.bidi.ltrChars_ = "A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0900-\u1fff\u200e\u2c00-\ud801\ud804-\ud839\ud83c-\udbff\uf900-\ufb1c\ufe00-\ufe6f\ufefd-\uffff";
  2980. goog.i18n.bidi.rtlChars_ = "\u0591-\u06ef\u06fa-\u08ff\u200f\ud802-\ud803\ud83a-\ud83b\ufb1d-\ufdff\ufe70-\ufefc";
  2981. goog.i18n.bidi.htmlSkipReg_ = /<[^>]*>|&[^;]+;/g;
  2982. goog.i18n.bidi.stripHtmlIfNeeded_ = function (a, b) {
  2983. return b ? a.replace(goog.i18n.bidi.htmlSkipReg_, "") : a
  2984. }
  2985. ;
  2986. goog.i18n.bidi.rtlCharReg_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "]");
  2987. goog.i18n.bidi.ltrCharReg_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "]");
  2988. goog.i18n.bidi.hasAnyRtl = function (a, b) {
  2989. return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  2990. }
  2991. ;
  2992. goog.i18n.bidi.hasRtlChar = goog.i18n.bidi.hasAnyRtl;
  2993. goog.i18n.bidi.hasAnyLtr = function (a, b) {
  2994. return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  2995. }
  2996. ;
  2997. goog.i18n.bidi.ltrRe_ = new RegExp("^[" + goog.i18n.bidi.ltrChars_ + "]");
  2998. goog.i18n.bidi.rtlRe_ = new RegExp("^[" + goog.i18n.bidi.rtlChars_ + "]");
  2999. goog.i18n.bidi.isRtlChar = function (a) {
  3000. return goog.i18n.bidi.rtlRe_.test(a)
  3001. }
  3002. ;
  3003. goog.i18n.bidi.isLtrChar = function (a) {
  3004. return goog.i18n.bidi.ltrRe_.test(a)
  3005. }
  3006. ;
  3007. goog.i18n.bidi.isNeutralChar = function (a) {
  3008. return !goog.i18n.bidi.isLtrChar(a) && !goog.i18n.bidi.isRtlChar(a)
  3009. }
  3010. ;
  3011. goog.i18n.bidi.ltrDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.rtlChars_ + "]*[" + goog.i18n.bidi.ltrChars_ + "]");
  3012. goog.i18n.bidi.rtlDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.ltrChars_ + "]*[" + goog.i18n.bidi.rtlChars_ + "]");
  3013. goog.i18n.bidi.startsWithRtl = function (a, b) {
  3014. return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  3015. }
  3016. ;
  3017. goog.i18n.bidi.isRtlText = goog.i18n.bidi.startsWithRtl;
  3018. goog.i18n.bidi.startsWithLtr = function (a, b) {
  3019. return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  3020. }
  3021. ;
  3022. goog.i18n.bidi.isLtrText = goog.i18n.bidi.startsWithLtr;
  3023. goog.i18n.bidi.isRequiredLtrRe_ = /^http:\/\/.*/;
  3024. goog.i18n.bidi.isNeutralText = function (a, b) {
  3025. a = goog.i18n.bidi.stripHtmlIfNeeded_(a, b);
  3026. return goog.i18n.bidi.isRequiredLtrRe_.test(a) || !goog.i18n.bidi.hasAnyLtr(a) && !goog.i18n.bidi.hasAnyRtl(a)
  3027. }
  3028. ;
  3029. goog.i18n.bidi.ltrExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "][^" + goog.i18n.bidi.rtlChars_ + "]*$");
  3030. goog.i18n.bidi.rtlExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "][^" + goog.i18n.bidi.ltrChars_ + "]*$");
  3031. goog.i18n.bidi.endsWithLtr = function (a, b) {
  3032. return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  3033. }
  3034. ;
  3035. goog.i18n.bidi.isLtrExitText = goog.i18n.bidi.endsWithLtr;
  3036. goog.i18n.bidi.endsWithRtl = function (a, b) {
  3037. return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  3038. }
  3039. ;
  3040. goog.i18n.bidi.isRtlExitText = goog.i18n.bidi.endsWithRtl;
  3041. goog.i18n.bidi.rtlLocalesRe_ = /^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;
  3042. goog.i18n.bidi.isRtlLanguage = function (a) {
  3043. return goog.i18n.bidi.rtlLocalesRe_.test(a)
  3044. }
  3045. ;
  3046. goog.i18n.bidi.bracketGuardTextRe_ = /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g;
  3047. goog.i18n.bidi.guardBracketInText = function (a, b) {
  3048. var c = (void 0 === b ? goog.i18n.bidi.hasAnyRtl(a) : b) ? goog.i18n.bidi.Format.RLM : goog.i18n.bidi.Format.LRM;
  3049. return a.replace(goog.i18n.bidi.bracketGuardTextRe_, c + "$&" + c)
  3050. }
  3051. ;
  3052. goog.i18n.bidi.enforceRtlInHtml = function (a) {
  3053. return "<" == a.charAt(0) ? a.replace(/<\w+/, "$& dir=rtl") : "\n<span dir=rtl>" + a + "</span>"
  3054. }
  3055. ;
  3056. goog.i18n.bidi.enforceRtlInText = function (a) {
  3057. return goog.i18n.bidi.Format.RLE + a + goog.i18n.bidi.Format.PDF
  3058. }
  3059. ;
  3060. goog.i18n.bidi.enforceLtrInHtml = function (a) {
  3061. return "<" == a.charAt(0) ? a.replace(/<\w+/, "$& dir=ltr") : "\n<span dir=ltr>" + a + "</span>"
  3062. }
  3063. ;
  3064. goog.i18n.bidi.enforceLtrInText = function (a) {
  3065. return goog.i18n.bidi.Format.LRE + a + goog.i18n.bidi.Format.PDF
  3066. }
  3067. ;
  3068. goog.i18n.bidi.dimensionsRe_ = /:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g;
  3069. goog.i18n.bidi.leftRe_ = /left/gi;
  3070. goog.i18n.bidi.rightRe_ = /right/gi;
  3071. goog.i18n.bidi.tempRe_ = /%%%%/g;
  3072. goog.i18n.bidi.mirrorCSS = function (a) {
  3073. return a.replace(goog.i18n.bidi.dimensionsRe_, ":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_, "%%%%").replace(goog.i18n.bidi.rightRe_, goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_, goog.i18n.bidi.RIGHT)
  3074. }
  3075. ;
  3076. goog.i18n.bidi.doubleQuoteSubstituteRe_ = /([\u0591-\u05f2])"/g;
  3077. goog.i18n.bidi.singleQuoteSubstituteRe_ = /([\u0591-\u05f2])'/g;
  3078. goog.i18n.bidi.normalizeHebrewQuote = function (a) {
  3079. return a.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_, "$1\u05f4").replace(goog.i18n.bidi.singleQuoteSubstituteRe_, "$1\u05f3")
  3080. }
  3081. ;
  3082. goog.i18n.bidi.wordSeparatorRe_ = /\s+/;
  3083. goog.i18n.bidi.hasNumeralsRe_ = /[\d\u06f0-\u06f9]/;
  3084. goog.i18n.bidi.rtlDetectionThreshold_ = .4;
  3085. goog.i18n.bidi.estimateDirection = function (a, b) {
  3086. for (var c = 0, d = 0, e = !1, f = goog.i18n.bidi.stripHtmlIfNeeded_(a, b).split(goog.i18n.bidi.wordSeparatorRe_), g = 0; g < f.length; g++) {
  3087. var h = f[g];
  3088. goog.i18n.bidi.startsWithRtl(h) ? (c++,
  3089. d++) : goog.i18n.bidi.isRequiredLtrRe_.test(h) ? e = !0 : goog.i18n.bidi.hasAnyLtr(h) ? d++ : goog.i18n.bidi.hasNumeralsRe_.test(h) && (e = !0)
  3090. }
  3091. return 0 == d ? e ? goog.i18n.bidi.Dir.LTR : goog.i18n.bidi.Dir.NEUTRAL : c / d > goog.i18n.bidi.rtlDetectionThreshold_ ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR
  3092. }
  3093. ;
  3094. goog.i18n.bidi.detectRtlDirectionality = function (a, b) {
  3095. return goog.i18n.bidi.estimateDirection(a, b) == goog.i18n.bidi.Dir.RTL
  3096. }
  3097. ;
  3098. goog.i18n.bidi.setElementDirAndAlign = function (a, b) {
  3099. a && (b = goog.i18n.bidi.toDir(b)) && (a.style.textAlign = b == goog.i18n.bidi.Dir.RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT,
  3100. a.dir = b == goog.i18n.bidi.Dir.RTL ? "rtl" : "ltr")
  3101. }
  3102. ;
  3103. goog.i18n.bidi.setElementDirByTextDirectionality = function (a, b) {
  3104. switch (goog.i18n.bidi.estimateDirection(b)) {
  3105. case goog.i18n.bidi.Dir.LTR:
  3106. a.dir = "ltr";
  3107. break;
  3108. case goog.i18n.bidi.Dir.RTL:
  3109. a.dir = "rtl";
  3110. break;
  3111. default:
  3112. a.removeAttribute("dir")
  3113. }
  3114. }
  3115. ;
  3116. goog.i18n.bidi.DirectionalString = function () { }
  3117. ;
  3118. goog.html.TrustedResourceUrl = function (a, b) {
  3119. this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ = a === goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_ && b || "";
  3120. this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  3121. }
  3122. ;
  3123. goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString = !0;
  3124. goog.html.TrustedResourceUrl.prototype.getTypedStringValue = function () {
  3125. return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()
  3126. }
  3127. ;
  3128. goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString = !0;
  3129. goog.html.TrustedResourceUrl.prototype.getDirection = function () {
  3130. return goog.i18n.bidi.Dir.LTR
  3131. }
  3132. ;
  3133. goog.html.TrustedResourceUrl.prototype.cloneWithParams = function (a, b) {
  3134. var c = goog.html.TrustedResourceUrl.unwrap(this);
  3135. c = goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(c);
  3136. var d = c[3] || "";
  3137. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(c[1] + goog.html.TrustedResourceUrl.stringifyParams_("?", c[2] || "", a) + goog.html.TrustedResourceUrl.stringifyParams_("#", d, b))
  3138. }
  3139. ;
  3140. goog.DEBUG && (goog.html.TrustedResourceUrl.prototype.toString = function () {
  3141. return "TrustedResourceUrl{" + this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ + "}"
  3142. }
  3143. );
  3144. goog.html.TrustedResourceUrl.unwrap = function (a) {
  3145. return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(a).toString()
  3146. }
  3147. ;
  3148. goog.html.TrustedResourceUrl.unwrapTrustedScriptURL = function (a) {
  3149. if (a instanceof goog.html.TrustedResourceUrl && a.constructor === goog.html.TrustedResourceUrl && a.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3150. return a.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_;
  3151. goog.asserts.fail("expected object of type TrustedResourceUrl, got '" + a + "' of type " + goog.typeOf(a));
  3152. return "type_error:TrustedResourceUrl"
  3153. }
  3154. ;
  3155. goog.html.TrustedResourceUrl.format = function (a, b) {
  3156. var c = goog.string.Const.unwrap(a);
  3157. if (!goog.html.TrustedResourceUrl.BASE_URL_.test(c))
  3158. throw Error("Invalid TrustedResourceUrl format: " + c);
  3159. var d = c.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_, function (a, d) {
  3160. if (!Object.prototype.hasOwnProperty.call(b, d))
  3161. throw Error('Found marker, "' + d + '", in format string, "' + c + '", but no valid label mapping found in args: ' + JSON.stringify(b));
  3162. var e = b[d];
  3163. return e instanceof goog.string.Const ? goog.string.Const.unwrap(e) : encodeURIComponent(String(e))
  3164. });
  3165. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(d)
  3166. }
  3167. ;
  3168. goog.html.TrustedResourceUrl.FORMAT_MARKER_ = /%{(\w+)}/g;
  3169. goog.html.TrustedResourceUrl.BASE_URL_ = /^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i;
  3170. goog.html.TrustedResourceUrl.URL_PARAM_PARSER_ = /^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/;
  3171. goog.html.TrustedResourceUrl.formatWithParams = function (a, b, c, d) {
  3172. return goog.html.TrustedResourceUrl.format(a, b).cloneWithParams(c, d)
  3173. }
  3174. ;
  3175. goog.html.TrustedResourceUrl.fromConstant = function (a) {
  3176. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a))
  3177. }
  3178. ;
  3179. goog.html.TrustedResourceUrl.fromConstants = function (a) {
  3180. for (var b = "", c = 0; c < a.length; c++)
  3181. b += goog.string.Const.unwrap(a[c]);
  3182. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b)
  3183. }
  3184. ;
  3185. goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  3186. goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse = function (a) {
  3187. a = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScriptURL(a) : a;
  3188. return new goog.html.TrustedResourceUrl(goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_, a)
  3189. }
  3190. ;
  3191. goog.html.TrustedResourceUrl.stringifyParams_ = function (a, b, c) {
  3192. if (null == c)
  3193. return b;
  3194. if ("string" === typeof c)
  3195. return c ? a + encodeURIComponent(c) : "";
  3196. for (var d in c) {
  3197. var e = c[d];
  3198. e = goog.isArray(e) ? e : [e];
  3199. for (var f = 0; f < e.length; f++) {
  3200. var g = e[f];
  3201. null != g && (b || (b = a),
  3202. b += (b.length > a.length ? "&" : "") + encodeURIComponent(d) + "=" + encodeURIComponent(String(g)))
  3203. }
  3204. }
  3205. return b
  3206. }
  3207. ;
  3208. goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_ = {};
  3209. goog.string.internal = {};
  3210. goog.string.internal.startsWith = function (a, b) {
  3211. return 0 == a.lastIndexOf(b, 0)
  3212. }
  3213. ;
  3214. goog.string.internal.endsWith = function (a, b) {
  3215. var c = a.length - b.length;
  3216. return 0 <= c && a.indexOf(b, c) == c
  3217. }
  3218. ;
  3219. goog.string.internal.caseInsensitiveStartsWith = function (a, b) {
  3220. return 0 == goog.string.internal.caseInsensitiveCompare(b, a.substr(0, b.length))
  3221. }
  3222. ;
  3223. goog.string.internal.caseInsensitiveEndsWith = function (a, b) {
  3224. return 0 == goog.string.internal.caseInsensitiveCompare(b, a.substr(a.length - b.length, b.length))
  3225. }
  3226. ;
  3227. goog.string.internal.caseInsensitiveEquals = function (a, b) {
  3228. return a.toLowerCase() == b.toLowerCase()
  3229. }
  3230. ;
  3231. goog.string.internal.isEmptyOrWhitespace = function (a) {
  3232. return /^[\s\xa0]*$/.test(a)
  3233. }
  3234. ;
  3235. goog.string.internal.trim = goog.TRUSTED_SITE && String.prototype.trim ? function (a) {
  3236. return a.trim()
  3237. }
  3238. : function (a) {
  3239. return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]
  3240. }
  3241. ;
  3242. goog.string.internal.caseInsensitiveCompare = function (a, b) {
  3243. var c = String(a).toLowerCase()
  3244. , d = String(b).toLowerCase();
  3245. return c < d ? -1 : c == d ? 0 : 1
  3246. }
  3247. ;
  3248. goog.string.internal.newLineToBr = function (a, b) {
  3249. return a.replace(/(\r\n|\r|\n)/g, b ? "<br />" : "<br>")
  3250. }
  3251. ;
  3252. goog.string.internal.htmlEscape = function (a, b) {
  3253. if (b)
  3254. a = a.replace(goog.string.internal.AMP_RE_, "&amp;").replace(goog.string.internal.LT_RE_, "&lt;").replace(goog.string.internal.GT_RE_, "&gt;").replace(goog.string.internal.QUOT_RE_, "&quot;").replace(goog.string.internal.SINGLE_QUOTE_RE_, "&#39;").replace(goog.string.internal.NULL_RE_, "&#0;");
  3255. else {
  3256. if (!goog.string.internal.ALL_RE_.test(a))
  3257. return a;
  3258. -1 != a.indexOf("&") && (a = a.replace(goog.string.internal.AMP_RE_, "&amp;"));
  3259. -1 != a.indexOf("<") && (a = a.replace(goog.string.internal.LT_RE_, "&lt;"));
  3260. -1 != a.indexOf(">") && (a = a.replace(goog.string.internal.GT_RE_, "&gt;"));
  3261. -1 != a.indexOf('"') && (a = a.replace(goog.string.internal.QUOT_RE_, "&quot;"));
  3262. -1 != a.indexOf("'") && (a = a.replace(goog.string.internal.SINGLE_QUOTE_RE_, "&#39;"));
  3263. -1 != a.indexOf("\x00") && (a = a.replace(goog.string.internal.NULL_RE_, "&#0;"))
  3264. }
  3265. return a
  3266. }
  3267. ;
  3268. goog.string.internal.AMP_RE_ = /&/g;
  3269. goog.string.internal.LT_RE_ = /</g;
  3270. goog.string.internal.GT_RE_ = />/g;
  3271. goog.string.internal.QUOT_RE_ = /"/g;
  3272. goog.string.internal.SINGLE_QUOTE_RE_ = /'/g;
  3273. goog.string.internal.NULL_RE_ = /\x00/g;
  3274. goog.string.internal.ALL_RE_ = /[\x00&<>"']/;
  3275. goog.string.internal.whitespaceEscape = function (a, b) {
  3276. return goog.string.internal.newLineToBr(a.replace(/ /g, " &#160;"), b)
  3277. }
  3278. ;
  3279. goog.string.internal.contains = function (a, b) {
  3280. return -1 != a.indexOf(b)
  3281. }
  3282. ;
  3283. goog.string.internal.caseInsensitiveContains = function (a, b) {
  3284. return goog.string.internal.contains(a.toLowerCase(), b.toLowerCase())
  3285. }
  3286. ;
  3287. goog.string.internal.compareVersions = function (a, b) {
  3288. for (var c = 0, d = goog.string.internal.trim(String(a)).split("."), e = goog.string.internal.trim(String(b)).split("."), f = Math.max(d.length, e.length), g = 0; 0 == c && g < f; g++) {
  3289. var h = d[g] || ""
  3290. , k = e[g] || "";
  3291. do {
  3292. h = /(\d*)(\D*)(.*)/.exec(h) || ["", "", "", ""];
  3293. k = /(\d*)(\D*)(.*)/.exec(k) || ["", "", "", ""];
  3294. if (0 == h[0].length && 0 == k[0].length)
  3295. break;
  3296. c = 0 == h[1].length ? 0 : parseInt(h[1], 10);
  3297. var m = 0 == k[1].length ? 0 : parseInt(k[1], 10);
  3298. c = goog.string.internal.compareElements_(c, m) || goog.string.internal.compareElements_(0 == h[2].length, 0 == k[2].length) || goog.string.internal.compareElements_(h[2], k[2]);
  3299. h = h[3];
  3300. k = k[3]
  3301. } while (0 == c)
  3302. }
  3303. return c
  3304. }
  3305. ;
  3306. goog.string.internal.compareElements_ = function (a, b) {
  3307. return a < b ? -1 : a > b ? 1 : 0
  3308. }
  3309. ;
  3310. goog.html.SafeUrl = function (a, b) {
  3311. this.privateDoNotAccessOrElseSafeUrlWrappedValue_ = a === goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_ && b || "";
  3312. this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  3313. }
  3314. ;
  3315. goog.html.SafeUrl.INNOCUOUS_STRING = "about:invalid#zClosurez";
  3316. goog.html.SafeUrl.prototype.implementsGoogStringTypedString = !0;
  3317. goog.html.SafeUrl.prototype.getTypedStringValue = function () {
  3318. return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()
  3319. }
  3320. ;
  3321. goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString = !0;
  3322. goog.html.SafeUrl.prototype.getDirection = function () {
  3323. return goog.i18n.bidi.Dir.LTR
  3324. }
  3325. ;
  3326. goog.DEBUG && (goog.html.SafeUrl.prototype.toString = function () {
  3327. return "SafeUrl{" + this.privateDoNotAccessOrElseSafeUrlWrappedValue_ + "}"
  3328. }
  3329. );
  3330. goog.html.SafeUrl.unwrap = function (a) {
  3331. if (a instanceof goog.html.SafeUrl && a.constructor === goog.html.SafeUrl && a.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3332. return a.privateDoNotAccessOrElseSafeUrlWrappedValue_;
  3333. goog.asserts.fail("expected object of type SafeUrl, got '" + a + "' of type " + goog.typeOf(a));
  3334. return "type_error:SafeUrl"
  3335. }
  3336. ;
  3337. goog.html.SafeUrl.fromConstant = function (a) {
  3338. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a))
  3339. }
  3340. ;
  3341. goog.html.SAFE_MIME_TYPE_PATTERN_ = /^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime))(?:;\w+=(?:\w+|"[\w;=]+"))*$/i;
  3342. goog.html.SafeUrl.isSafeMimeType = function (a) {
  3343. return goog.html.SAFE_MIME_TYPE_PATTERN_.test(a)
  3344. }
  3345. ;
  3346. goog.html.SafeUrl.fromBlob = function (a) {
  3347. a = goog.html.SAFE_MIME_TYPE_PATTERN_.test(a.type) ? goog.fs.url.createObjectUrl(a) : goog.html.SafeUrl.INNOCUOUS_STRING;
  3348. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3349. }
  3350. ;
  3351. goog.html.DATA_URL_PATTERN_ = /^data:([^,]*);base64,[a-z0-9+\/]+=*$/i;
  3352. goog.html.SafeUrl.fromDataUrl = function (a) {
  3353. a = a.replace(/(%0A|%0D)/g, "");
  3354. var b = a.match(goog.html.DATA_URL_PATTERN_);
  3355. b = b && goog.html.SAFE_MIME_TYPE_PATTERN_.test(b[1]);
  3356. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b ? a : goog.html.SafeUrl.INNOCUOUS_STRING)
  3357. }
  3358. ;
  3359. goog.html.SafeUrl.fromTelUrl = function (a) {
  3360. goog.string.internal.caseInsensitiveStartsWith(a, "tel:") || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3361. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3362. }
  3363. ;
  3364. goog.html.SIP_URL_PATTERN_ = /^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i;
  3365. goog.html.SafeUrl.fromSipUrl = function (a) {
  3366. goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(a)) || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3367. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3368. }
  3369. ;
  3370. goog.html.SafeUrl.fromFacebookMessengerUrl = function (a) {
  3371. goog.string.internal.caseInsensitiveStartsWith(a, "fb-messenger://share") || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3372. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3373. }
  3374. ;
  3375. goog.html.SafeUrl.fromWhatsAppUrl = function (a) {
  3376. goog.string.internal.caseInsensitiveStartsWith(a, "whatsapp://send") || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3377. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3378. }
  3379. ;
  3380. goog.html.SafeUrl.fromSmsUrl = function (a) {
  3381. goog.string.internal.caseInsensitiveStartsWith(a, "sms:") && goog.html.SafeUrl.isSmsUrlBodyValid_(a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3382. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3383. }
  3384. ;
  3385. goog.html.SafeUrl.isSmsUrlBodyValid_ = function (a) {
  3386. var b = a.indexOf("#");
  3387. 0 < b && (a = a.substring(0, b));
  3388. b = a.match(/[?&]body=/gi);
  3389. if (!b)
  3390. return !0;
  3391. if (1 < b.length)
  3392. return !1;
  3393. a = a.match(/[?&]body=([^&]*)/)[1];
  3394. if (!a)
  3395. return !0;
  3396. try {
  3397. decodeURIComponent(a)
  3398. } catch (c) {
  3399. return !1
  3400. }
  3401. return /^(?:[a-z0-9\-_.~]|%[0-9a-f]{2})+$/i.test(a)
  3402. }
  3403. ;
  3404. goog.html.SafeUrl.fromSshUrl = function (a) {
  3405. goog.string.internal.caseInsensitiveStartsWith(a, "ssh://") || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3406. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3407. }
  3408. ;
  3409. goog.html.SafeUrl.sanitizeChromeExtensionUrl = function (a, b) {
  3410. return goog.html.SafeUrl.sanitizeExtensionUrl_(/^chrome-extension:\/\/([^\/]+)\//, a, b)
  3411. }
  3412. ;
  3413. goog.html.SafeUrl.sanitizeFirefoxExtensionUrl = function (a, b) {
  3414. return goog.html.SafeUrl.sanitizeExtensionUrl_(/^moz-extension:\/\/([^\/]+)\//, a, b)
  3415. }
  3416. ;
  3417. goog.html.SafeUrl.sanitizeEdgeExtensionUrl = function (a, b) {
  3418. return goog.html.SafeUrl.sanitizeExtensionUrl_(/^ms-browser-extension:\/\/([^\/]+)\//, a, b)
  3419. }
  3420. ;
  3421. goog.html.SafeUrl.sanitizeExtensionUrl_ = function (a, b, c) {
  3422. (a = a.exec(b)) ? (a = a[1],
  3423. -1 == (c instanceof goog.string.Const ? [goog.string.Const.unwrap(c)] : c.map(function (a) {
  3424. return goog.string.Const.unwrap(a)
  3425. })).indexOf(a) && (b = goog.html.SafeUrl.INNOCUOUS_STRING)) : b = goog.html.SafeUrl.INNOCUOUS_STRING;
  3426. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b)
  3427. }
  3428. ;
  3429. goog.html.SafeUrl.fromTrustedResourceUrl = function (a) {
  3430. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.html.TrustedResourceUrl.unwrap(a))
  3431. }
  3432. ;
  3433. goog.html.SAFE_URL_PATTERN_ = /^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;
  3434. goog.html.SafeUrl.SAFE_URL_PATTERN = goog.html.SAFE_URL_PATTERN_;
  3435. goog.html.SafeUrl.sanitize = function (a) {
  3436. if (a instanceof goog.html.SafeUrl)
  3437. return a;
  3438. a = "object" == typeof a && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a);
  3439. goog.html.SAFE_URL_PATTERN_.test(a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3440. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3441. }
  3442. ;
  3443. goog.html.SafeUrl.sanitizeAssertUnchanged = function (a, b) {
  3444. if (a instanceof goog.html.SafeUrl)
  3445. return a;
  3446. a = "object" == typeof a && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a);
  3447. if (b && /^data:/i.test(a)) {
  3448. var c = goog.html.SafeUrl.fromDataUrl(a);
  3449. if (c.getTypedStringValue() == a)
  3450. return c
  3451. }
  3452. goog.asserts.assert(goog.html.SAFE_URL_PATTERN_.test(a), "%s does not match the safe URL pattern", a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3453. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3454. }
  3455. ;
  3456. goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  3457. goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse = function (a) {
  3458. return new goog.html.SafeUrl(goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_, a)
  3459. }
  3460. ;
  3461. goog.html.SafeUrl.ABOUT_BLANK = goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank");
  3462. goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_ = {};
  3463. goog.html.SafeStyle = function () {
  3464. this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = "";
  3465. this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  3466. }
  3467. ;
  3468. goog.html.SafeStyle.prototype.implementsGoogStringTypedString = !0;
  3469. goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  3470. goog.html.SafeStyle.fromConstant = function (a) {
  3471. a = goog.string.Const.unwrap(a);
  3472. if (0 === a.length)
  3473. return goog.html.SafeStyle.EMPTY;
  3474. goog.asserts.assert(goog.string.internal.endsWith(a, ";"), "Last character of style string is not ';': " + a);
  3475. goog.asserts.assert(goog.string.internal.contains(a, ":"), "Style string must contain at least one ':', to specify a \"name: value\" pair: " + a);
  3476. return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(a)
  3477. }
  3478. ;
  3479. goog.html.SafeStyle.prototype.getTypedStringValue = function () {
  3480. return this.privateDoNotAccessOrElseSafeStyleWrappedValue_
  3481. }
  3482. ;
  3483. goog.DEBUG && (goog.html.SafeStyle.prototype.toString = function () {
  3484. return "SafeStyle{" + this.privateDoNotAccessOrElseSafeStyleWrappedValue_ + "}"
  3485. }
  3486. );
  3487. goog.html.SafeStyle.unwrap = function (a) {
  3488. if (a instanceof goog.html.SafeStyle && a.constructor === goog.html.SafeStyle && a.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3489. return a.privateDoNotAccessOrElseSafeStyleWrappedValue_;
  3490. goog.asserts.fail("expected object of type SafeStyle, got '" + a + "' of type " + goog.typeOf(a));
  3491. return "type_error:SafeStyle"
  3492. }
  3493. ;
  3494. goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse = function (a) {
  3495. return (new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(a)
  3496. }
  3497. ;
  3498. goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) {
  3499. this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = a;
  3500. return this
  3501. }
  3502. ;
  3503. goog.html.SafeStyle.EMPTY = goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse("");
  3504. goog.html.SafeStyle.INNOCUOUS_STRING = "zClosurez";
  3505. goog.html.SafeStyle.create = function (a) {
  3506. var b = "", c;
  3507. for (c in a) {
  3508. if (!/^[-_a-zA-Z0-9]+$/.test(c))
  3509. throw Error("Name allows only [-_a-zA-Z0-9], got: " + c);
  3510. var d = a[c];
  3511. null != d && (d = goog.isArray(d) ? goog.array.map(d, goog.html.SafeStyle.sanitizePropertyValue_).join(" ") : goog.html.SafeStyle.sanitizePropertyValue_(d),
  3512. b += c + ":" + d + ";")
  3513. }
  3514. return b ? goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b) : goog.html.SafeStyle.EMPTY
  3515. }
  3516. ;
  3517. goog.html.SafeStyle.sanitizePropertyValue_ = function (a) {
  3518. if (a instanceof goog.html.SafeUrl)
  3519. return 'url("' + goog.html.SafeUrl.unwrap(a).replace(/</g, "%3c").replace(/[\\"]/g, "\\$&") + '")';
  3520. a = a instanceof goog.string.Const ? goog.string.Const.unwrap(a) : goog.html.SafeStyle.sanitizePropertyValueString_(String(a));
  3521. if (/[{;}]/.test(a))
  3522. throw new goog.asserts.AssertionError("Value does not allow [{;}], got: %s.", [a]);
  3523. return a
  3524. }
  3525. ;
  3526. goog.html.SafeStyle.sanitizePropertyValueString_ = function (a) {
  3527. var b = a.replace(goog.html.SafeStyle.FUNCTIONS_RE_, "$1").replace(goog.html.SafeStyle.FUNCTIONS_RE_, "$1").replace(goog.html.SafeStyle.URL_RE_, "url");
  3528. if (goog.html.SafeStyle.VALUE_RE_.test(b)) {
  3529. if (goog.html.SafeStyle.COMMENT_RE_.test(a))
  3530. return goog.asserts.fail("String value disallows comments, got: " + a),
  3531. goog.html.SafeStyle.INNOCUOUS_STRING;
  3532. if (!goog.html.SafeStyle.hasBalancedQuotes_(a))
  3533. return goog.asserts.fail("String value requires balanced quotes, got: " + a),
  3534. goog.html.SafeStyle.INNOCUOUS_STRING;
  3535. if (!goog.html.SafeStyle.hasBalancedSquareBrackets_(a))
  3536. return goog.asserts.fail("String value requires balanced square brackets and one identifier per pair of brackets, got: " + a),
  3537. goog.html.SafeStyle.INNOCUOUS_STRING
  3538. } else
  3539. return goog.asserts.fail("String value allows only " + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + " and simple functions, got: " + a),
  3540. goog.html.SafeStyle.INNOCUOUS_STRING;
  3541. return goog.html.SafeStyle.sanitizeUrl_(a)
  3542. }
  3543. ;
  3544. goog.html.SafeStyle.hasBalancedQuotes_ = function (a) {
  3545. for (var b = !0, c = !0, d = 0; d < a.length; d++) {
  3546. var e = a.charAt(d);
  3547. "'" == e && c ? b = !b : '"' == e && b && (c = !c)
  3548. }
  3549. return b && c
  3550. }
  3551. ;
  3552. goog.html.SafeStyle.hasBalancedSquareBrackets_ = function (a) {
  3553. for (var b = !0, c = /^[-_a-zA-Z0-9]$/, d = 0; d < a.length; d++) {
  3554. var e = a.charAt(d);
  3555. if ("]" == e) {
  3556. if (b)
  3557. return !1;
  3558. b = !0
  3559. } else if ("[" == e) {
  3560. if (!b)
  3561. return !1;
  3562. b = !1
  3563. } else if (!b && !c.test(e))
  3564. return !1
  3565. }
  3566. return b
  3567. }
  3568. ;
  3569. goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ = "[-,.\"'%_!# a-zA-Z0-9\\[\\]]";
  3570. goog.html.SafeStyle.VALUE_RE_ = new RegExp("^" + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + "+$");
  3571. goog.html.SafeStyle.URL_RE_ = RegExp("\\b(url\\([ \t\n]*)('[ -&(-\\[\\]-~]*'|\"[ !#-\\[\\]-~]*\"|[!#-&*-\\[\\]-~]*)([ \t\n]*\\))", "g");
  3572. goog.html.SafeStyle.ALLOWED_FUNCTIONS_ = "calc cubic-bezier fit-content hsl hsla matrix minmax repeat rgb rgba (rotate|scale|translate)(X|Y|Z|3d)?".split(" ");
  3573. goog.html.SafeStyle.FUNCTIONS_RE_ = new RegExp("\\b(" + goog.html.SafeStyle.ALLOWED_FUNCTIONS_.join("|") + ")\\([-+*/0-9a-z.%\\[\\], ]+\\)", "g");
  3574. goog.html.SafeStyle.COMMENT_RE_ = /\/\*/;
  3575. goog.html.SafeStyle.sanitizeUrl_ = function (a) {
  3576. return a.replace(goog.html.SafeStyle.URL_RE_, function (a, c, d, e) {
  3577. var b = "";
  3578. d = d.replace(/^(['"])(.*)\1$/, function (a, c, d) {
  3579. b = c;
  3580. return d
  3581. });
  3582. a = goog.html.SafeUrl.sanitize(d).getTypedStringValue();
  3583. return c + b + a + b + e
  3584. })
  3585. }
  3586. ;
  3587. goog.html.SafeStyle.concat = function (a) {
  3588. var b = ""
  3589. , c = function (a) {
  3590. goog.isArray(a) ? goog.array.forEach(a, c) : b += goog.html.SafeStyle.unwrap(a)
  3591. };
  3592. goog.array.forEach(arguments, c);
  3593. return b ? goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b) : goog.html.SafeStyle.EMPTY
  3594. }
  3595. ;
  3596. goog.html.SafeStyleSheet = function () {
  3597. this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = "";
  3598. this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  3599. }
  3600. ;
  3601. goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString = !0;
  3602. goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  3603. goog.html.SafeStyleSheet.createRule = function (a, b) {
  3604. if (goog.string.internal.contains(a, "<"))
  3605. throw Error("Selector does not allow '<', got: " + a);
  3606. var c = a.replace(/('|")((?!\1)[^\r\n\f\\]|\\[\s\S])*\1/g, "");
  3607. if (!/^[-_a-zA-Z0-9#.:* ,>+~[\]()=^$|]+$/.test(c))
  3608. throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: " + a);
  3609. if (!goog.html.SafeStyleSheet.hasBalancedBrackets_(c))
  3610. throw Error("() and [] in selector must be balanced, got: " + a);
  3611. b instanceof goog.html.SafeStyle || (b = goog.html.SafeStyle.create(b));
  3612. c = a + "{" + goog.html.SafeStyle.unwrap(b).replace(/</g, "\\3C ") + "}";
  3613. return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(c)
  3614. }
  3615. ;
  3616. goog.html.SafeStyleSheet.hasBalancedBrackets_ = function (a) {
  3617. for (var b = {
  3618. "(": ")",
  3619. "[": "]"
  3620. }, c = [], d = 0; d < a.length; d++) {
  3621. var e = a[d];
  3622. if (b[e])
  3623. c.push(b[e]);
  3624. else if (goog.object.contains(b, e) && c.pop() != e)
  3625. return !1
  3626. }
  3627. return 0 == c.length
  3628. }
  3629. ;
  3630. goog.html.SafeStyleSheet.concat = function (a) {
  3631. var b = ""
  3632. , c = function (a) {
  3633. goog.isArray(a) ? goog.array.forEach(a, c) : b += goog.html.SafeStyleSheet.unwrap(a)
  3634. };
  3635. goog.array.forEach(arguments, c);
  3636. return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b)
  3637. }
  3638. ;
  3639. goog.html.SafeStyleSheet.fromConstant = function (a) {
  3640. a = goog.string.Const.unwrap(a);
  3641. if (0 === a.length)
  3642. return goog.html.SafeStyleSheet.EMPTY;
  3643. goog.asserts.assert(!goog.string.internal.contains(a, "<"), "Forbidden '<' character in style sheet string: " + a);
  3644. return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(a)
  3645. }
  3646. ;
  3647. goog.html.SafeStyleSheet.prototype.getTypedStringValue = function () {
  3648. return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_
  3649. }
  3650. ;
  3651. goog.DEBUG && (goog.html.SafeStyleSheet.prototype.toString = function () {
  3652. return "SafeStyleSheet{" + this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ + "}"
  3653. }
  3654. );
  3655. goog.html.SafeStyleSheet.unwrap = function (a) {
  3656. if (a instanceof goog.html.SafeStyleSheet && a.constructor === goog.html.SafeStyleSheet && a.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3657. return a.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_;
  3658. goog.asserts.fail("expected object of type SafeStyleSheet, got '" + a + "' of type " + goog.typeOf(a));
  3659. return "type_error:SafeStyleSheet"
  3660. }
  3661. ;
  3662. goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse = function (a) {
  3663. return (new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(a)
  3664. }
  3665. ;
  3666. goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) {
  3667. this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = a;
  3668. return this
  3669. }
  3670. ;
  3671. goog.html.SafeStyleSheet.EMPTY = goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse("");
  3672. goog.labs = {};
  3673. goog.labs.userAgent = {};
  3674. goog.labs.userAgent.util = {};
  3675. goog.labs.userAgent.util.getNativeUserAgentString_ = function () {
  3676. var a = goog.labs.userAgent.util.getNavigator_();
  3677. return a && (a = a.userAgent) ? a : ""
  3678. }
  3679. ;
  3680. goog.labs.userAgent.util.getNavigator_ = function () {
  3681. return goog.global.navigator
  3682. }
  3683. ;
  3684. goog.labs.userAgent.util.userAgent_ = goog.labs.userAgent.util.getNativeUserAgentString_();
  3685. goog.labs.userAgent.util.setUserAgent = function (a) {
  3686. goog.labs.userAgent.util.userAgent_ = a || goog.labs.userAgent.util.getNativeUserAgentString_()
  3687. }
  3688. ;
  3689. goog.labs.userAgent.util.getUserAgent = function () {
  3690. return goog.labs.userAgent.util.userAgent_
  3691. }
  3692. ;
  3693. goog.labs.userAgent.util.matchUserAgent = function (a) {
  3694. var b = goog.labs.userAgent.util.getUserAgent();
  3695. return goog.string.internal.contains(b, a)
  3696. }
  3697. ;
  3698. goog.labs.userAgent.util.matchUserAgentIgnoreCase = function (a) {
  3699. var b = goog.labs.userAgent.util.getUserAgent();
  3700. return goog.string.internal.caseInsensitiveContains(b, a)
  3701. }
  3702. ;
  3703. goog.labs.userAgent.util.extractVersionTuples = function (a) {
  3704. for (var b = RegExp("(\\w[\\w ]+)/([^\\s]+)\\s*(?:\\((.*?)\\))?", "g"), c = [], d; d = b.exec(a);)
  3705. c.push([d[1], d[2], d[3] || void 0]);
  3706. return c
  3707. }
  3708. ;
  3709. goog.labs.userAgent.browser = {};
  3710. goog.labs.userAgent.browser.matchOpera_ = function () {
  3711. return goog.labs.userAgent.util.matchUserAgent("Opera")
  3712. }
  3713. ;
  3714. goog.labs.userAgent.browser.matchIE_ = function () {
  3715. return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE")
  3716. }
  3717. ;
  3718. goog.labs.userAgent.browser.matchEdgeHtml_ = function () {
  3719. return goog.labs.userAgent.util.matchUserAgent("Edge")
  3720. }
  3721. ;
  3722. goog.labs.userAgent.browser.matchEdgeChromium_ = function () {
  3723. return goog.labs.userAgent.util.matchUserAgent("Edg/")
  3724. }
  3725. ;
  3726. goog.labs.userAgent.browser.matchOperaChromium_ = function () {
  3727. return goog.labs.userAgent.util.matchUserAgent("OPR")
  3728. }
  3729. ;
  3730. goog.labs.userAgent.browser.matchFirefox_ = function () {
  3731. return goog.labs.userAgent.util.matchUserAgent("Firefox") || goog.labs.userAgent.util.matchUserAgent("FxiOS")
  3732. }
  3733. ;
  3734. goog.labs.userAgent.browser.matchSafari_ = function () {
  3735. return goog.labs.userAgent.util.matchUserAgent("Safari") && !(goog.labs.userAgent.browser.matchChrome_() || goog.labs.userAgent.browser.matchCoast_() || goog.labs.userAgent.browser.matchOpera_() || goog.labs.userAgent.browser.matchEdgeHtml_() || goog.labs.userAgent.browser.matchEdgeChromium_() || goog.labs.userAgent.browser.matchOperaChromium_() || goog.labs.userAgent.browser.matchFirefox_() || goog.labs.userAgent.browser.isSilk() || goog.labs.userAgent.util.matchUserAgent("Android"))
  3736. }
  3737. ;
  3738. goog.labs.userAgent.browser.matchCoast_ = function () {
  3739. return goog.labs.userAgent.util.matchUserAgent("Coast")
  3740. }
  3741. ;
  3742. goog.labs.userAgent.browser.matchIosWebview_ = function () {
  3743. return (goog.labs.userAgent.util.matchUserAgent("iPad") || goog.labs.userAgent.util.matchUserAgent("iPhone")) && !goog.labs.userAgent.browser.matchSafari_() && !goog.labs.userAgent.browser.matchChrome_() && !goog.labs.userAgent.browser.matchCoast_() && !goog.labs.userAgent.browser.matchFirefox_() && goog.labs.userAgent.util.matchUserAgent("AppleWebKit")
  3744. }
  3745. ;
  3746. goog.labs.userAgent.browser.matchChrome_ = function () {
  3747. return (goog.labs.userAgent.util.matchUserAgent("Chrome") || goog.labs.userAgent.util.matchUserAgent("CriOS")) && !goog.labs.userAgent.browser.matchEdgeHtml_()
  3748. }
  3749. ;
  3750. goog.labs.userAgent.browser.matchAndroidBrowser_ = function () {
  3751. return goog.labs.userAgent.util.matchUserAgent("Android") && !(goog.labs.userAgent.browser.isChrome() || goog.labs.userAgent.browser.isFirefox() || goog.labs.userAgent.browser.isOpera() || goog.labs.userAgent.browser.isSilk())
  3752. }
  3753. ;
  3754. goog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_;
  3755. goog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_;
  3756. goog.labs.userAgent.browser.isEdge = goog.labs.userAgent.browser.matchEdgeHtml_;
  3757. goog.labs.userAgent.browser.isEdgeChromium = goog.labs.userAgent.browser.matchEdgeChromium_;
  3758. goog.labs.userAgent.browser.isOperaChromium = goog.labs.userAgent.browser.matchOperaChromium_;
  3759. goog.labs.userAgent.browser.isFirefox = goog.labs.userAgent.browser.matchFirefox_;
  3760. goog.labs.userAgent.browser.isSafari = goog.labs.userAgent.browser.matchSafari_;
  3761. goog.labs.userAgent.browser.isCoast = goog.labs.userAgent.browser.matchCoast_;
  3762. goog.labs.userAgent.browser.isIosWebview = goog.labs.userAgent.browser.matchIosWebview_;
  3763. goog.labs.userAgent.browser.isChrome = goog.labs.userAgent.browser.matchChrome_;
  3764. goog.labs.userAgent.browser.isAndroidBrowser = goog.labs.userAgent.browser.matchAndroidBrowser_;
  3765. goog.labs.userAgent.browser.isSilk = function () {
  3766. return goog.labs.userAgent.util.matchUserAgent("Silk")
  3767. }
  3768. ;
  3769. goog.labs.userAgent.browser.getVersion = function () {
  3770. function a(a) {
  3771. a = goog.array.find(a, d);
  3772. return c[a] || ""
  3773. }
  3774. var b = goog.labs.userAgent.util.getUserAgent();
  3775. if (goog.labs.userAgent.browser.isIE())
  3776. return goog.labs.userAgent.browser.getIEVersion_(b);
  3777. b = goog.labs.userAgent.util.extractVersionTuples(b);
  3778. var c = {};
  3779. goog.array.forEach(b, function (a) {
  3780. c[a[0]] = a[1]
  3781. });
  3782. var d = goog.partial(goog.object.containsKey, c);
  3783. return goog.labs.userAgent.browser.isOpera() ? a(["Version", "Opera"]) : goog.labs.userAgent.browser.isEdge() ? a(["Edge"]) : goog.labs.userAgent.browser.isEdgeChromium() ? a(["Edg"]) : goog.labs.userAgent.browser.isChrome() ? a(["Chrome", "CriOS"]) : (b = b[2]) && b[1] || ""
  3784. }
  3785. ;
  3786. goog.labs.userAgent.browser.isVersionOrHigher = function (a) {
  3787. return 0 <= goog.string.internal.compareVersions(goog.labs.userAgent.browser.getVersion(), a)
  3788. }
  3789. ;
  3790. goog.labs.userAgent.browser.getIEVersion_ = function (a) {
  3791. var b = /rv: *([\d\.]*)/.exec(a);
  3792. if (b && b[1])
  3793. return b[1];
  3794. b = "";
  3795. var c = /MSIE +([\d\.]+)/.exec(a);
  3796. if (c && c[1])
  3797. if (a = /Trident\/(\d.\d)/.exec(a),
  3798. "7.0" == c[1])
  3799. if (a && a[1])
  3800. switch (a[1]) {
  3801. case "4.0":
  3802. b = "8.0";
  3803. break;
  3804. case "5.0":
  3805. b = "9.0";
  3806. break;
  3807. case "6.0":
  3808. b = "10.0";
  3809. break;
  3810. case "7.0":
  3811. b = "11.0"
  3812. }
  3813. else
  3814. b = "7.0";
  3815. else
  3816. b = c[1];
  3817. return b
  3818. }
  3819. ;
  3820. goog.html.SafeHtml = function () {
  3821. this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = "";
  3822. this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;
  3823. this.dir_ = null
  3824. }
  3825. ;
  3826. goog.html.SafeHtml.ENABLE_ERROR_MESSAGES = goog.DEBUG;
  3827. goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE = !0;
  3828. goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString = !0;
  3829. goog.html.SafeHtml.prototype.getDirection = function () {
  3830. return this.dir_
  3831. }
  3832. ;
  3833. goog.html.SafeHtml.prototype.implementsGoogStringTypedString = !0;
  3834. goog.html.SafeHtml.prototype.getTypedStringValue = function () {
  3835. return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString()
  3836. }
  3837. ;
  3838. goog.DEBUG && (goog.html.SafeHtml.prototype.toString = function () {
  3839. return "SafeHtml{" + this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ + "}"
  3840. }
  3841. );
  3842. goog.html.SafeHtml.unwrap = function (a) {
  3843. return goog.html.SafeHtml.unwrapTrustedHTML(a).toString()
  3844. }
  3845. ;
  3846. goog.html.SafeHtml.unwrapTrustedHTML = function (a) {
  3847. if (a instanceof goog.html.SafeHtml && a.constructor === goog.html.SafeHtml && a.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3848. return a.privateDoNotAccessOrElseSafeHtmlWrappedValue_;
  3849. goog.asserts.fail("expected object of type SafeHtml, got '" + a + "' of type " + goog.typeOf(a));
  3850. return "type_error:SafeHtml"
  3851. }
  3852. ;
  3853. goog.html.SafeHtml.htmlEscape = function (a) {
  3854. if (a instanceof goog.html.SafeHtml)
  3855. return a;
  3856. var b = "object" == typeof a
  3857. , c = null;
  3858. b && a.implementsGoogI18nBidiDirectionalString && (c = a.getDirection());
  3859. a = b && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a);
  3860. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.htmlEscape(a), c)
  3861. }
  3862. ;
  3863. goog.html.SafeHtml.htmlEscapePreservingNewlines = function (a) {
  3864. if (a instanceof goog.html.SafeHtml)
  3865. return a;
  3866. a = goog.html.SafeHtml.htmlEscape(a);
  3867. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.newLineToBr(goog.html.SafeHtml.unwrap(a)), a.getDirection())
  3868. }
  3869. ;
  3870. goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces = function (a) {
  3871. if (a instanceof goog.html.SafeHtml)
  3872. return a;
  3873. a = goog.html.SafeHtml.htmlEscape(a);
  3874. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.whitespaceEscape(goog.html.SafeHtml.unwrap(a)), a.getDirection())
  3875. }
  3876. ;
  3877. goog.html.SafeHtml.from = goog.html.SafeHtml.htmlEscape;
  3878. goog.html.SafeHtml.VALID_NAMES_IN_TAG_ = /^[a-zA-Z0-9-]+$/;
  3879. goog.html.SafeHtml.URL_ATTRIBUTES_ = {
  3880. action: !0,
  3881. cite: !0,
  3882. data: !0,
  3883. formaction: !0,
  3884. href: !0,
  3885. manifest: !0,
  3886. poster: !0,
  3887. src: !0
  3888. };
  3889. goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_ = {
  3890. APPLET: !0,
  3891. BASE: !0,
  3892. EMBED: !0,
  3893. IFRAME: !0,
  3894. LINK: !0,
  3895. MATH: !0,
  3896. META: !0,
  3897. OBJECT: !0,
  3898. SCRIPT: !0,
  3899. STYLE: !0,
  3900. SVG: !0,
  3901. TEMPLATE: !0
  3902. };
  3903. goog.html.SafeHtml.create = function (a, b, c) {
  3904. goog.html.SafeHtml.verifyTagName(String(a));
  3905. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(a), b, c)
  3906. }
  3907. ;
  3908. goog.html.SafeHtml.verifyTagName = function (a) {
  3909. if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(a))
  3910. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? "Invalid tag name <" + a + ">." : "");
  3911. if (a.toUpperCase() in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)
  3912. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? "Tag name <" + a + "> is not allowed for SafeHtml." : "");
  3913. }
  3914. ;
  3915. goog.html.SafeHtml.createIframe = function (a, b, c, d) {
  3916. a && goog.html.TrustedResourceUrl.unwrap(a);
  3917. var e = {};
  3918. e.src = a || null;
  3919. e.srcdoc = b && goog.html.SafeHtml.unwrap(b);
  3920. a = goog.html.SafeHtml.combineAttributes(e, {
  3921. sandbox: ""
  3922. }, c);
  3923. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe", a, d)
  3924. }
  3925. ;
  3926. goog.html.SafeHtml.createSandboxIframe = function (a, b, c, d) {
  3927. if (!goog.html.SafeHtml.canUseSandboxIframe())
  3928. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? "The browser does not support sandboxed iframes." : "");
  3929. var e = {};
  3930. e.src = a ? goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a)) : null;
  3931. e.srcdoc = b || null;
  3932. e.sandbox = "";
  3933. a = goog.html.SafeHtml.combineAttributes(e, {}, c);
  3934. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe", a, d)
  3935. }
  3936. ;
  3937. goog.html.SafeHtml.canUseSandboxIframe = function () {
  3938. return goog.global.HTMLIFrameElement && "sandbox" in goog.global.HTMLIFrameElement.prototype
  3939. }
  3940. ;
  3941. goog.html.SafeHtml.createScriptSrc = function (a, b) {
  3942. goog.html.TrustedResourceUrl.unwrap(a);
  3943. var c = goog.html.SafeHtml.combineAttributes({
  3944. src: a
  3945. }, {}, b);
  3946. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script", c)
  3947. }
  3948. ;
  3949. goog.html.SafeHtml.createScript = function (a, b) {
  3950. for (var c in b) {
  3951. var d = c.toLowerCase();
  3952. if ("language" == d || "src" == d || "text" == d || "type" == d)
  3953. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Cannot set "' + d + '" attribute' : "");
  3954. }
  3955. c = "";
  3956. a = goog.array.concat(a);
  3957. for (d = 0; d < a.length; d++)
  3958. c += goog.html.SafeScript.unwrap(a[d]);
  3959. c = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(c, goog.i18n.bidi.Dir.NEUTRAL);
  3960. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script", b, c)
  3961. }
  3962. ;
  3963. goog.html.SafeHtml.createStyle = function (a, b) {
  3964. var c = goog.html.SafeHtml.combineAttributes({
  3965. type: "text/css"
  3966. }, {}, b)
  3967. , d = "";
  3968. a = goog.array.concat(a);
  3969. for (var e = 0; e < a.length; e++)
  3970. d += goog.html.SafeStyleSheet.unwrap(a[e]);
  3971. d = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(d, goog.i18n.bidi.Dir.NEUTRAL);
  3972. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style", c, d)
  3973. }
  3974. ;
  3975. goog.html.SafeHtml.createMetaRefresh = function (a, b) {
  3976. var c = goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a));
  3977. (goog.labs.userAgent.browser.isIE() || goog.labs.userAgent.browser.isEdge()) && goog.string.internal.contains(c, ";") && (c = "'" + c.replace(/'/g, "%27") + "'");
  3978. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta", {
  3979. "http-equiv": "refresh",
  3980. content: (b || 0) + "; url=" + c
  3981. })
  3982. }
  3983. ;
  3984. goog.html.SafeHtml.getAttrNameAndValue_ = function (a, b, c) {
  3985. if (c instanceof goog.string.Const)
  3986. c = goog.string.Const.unwrap(c);
  3987. else if ("style" == b.toLowerCase())
  3988. if (goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE)
  3989. c = goog.html.SafeHtml.getStyleValue_(c);
  3990. else
  3991. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Attribute "style" not supported.' : "");
  3992. else {
  3993. if (/^on/i.test(b))
  3994. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Attribute "' + b + '" requires goog.string.Const value, "' + c + '" given.' : "");
  3995. if (b.toLowerCase() in goog.html.SafeHtml.URL_ATTRIBUTES_)
  3996. if (c instanceof goog.html.TrustedResourceUrl)
  3997. c = goog.html.TrustedResourceUrl.unwrap(c);
  3998. else if (c instanceof goog.html.SafeUrl)
  3999. c = goog.html.SafeUrl.unwrap(c);
  4000. else if ("string" === typeof c)
  4001. c = goog.html.SafeUrl.sanitize(c).getTypedStringValue();
  4002. else
  4003. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Attribute "' + b + '" on tag "' + a + '" requires goog.html.SafeUrl, goog.string.Const, or string, value "' + c + '" given.' : "");
  4004. }
  4005. c.implementsGoogStringTypedString && (c = c.getTypedStringValue());
  4006. goog.asserts.assert("string" === typeof c || "number" === typeof c, "String or number value expected, got " + typeof c + " with value: " + c);
  4007. return b + '="' + goog.string.internal.htmlEscape(String(c)) + '"'
  4008. }
  4009. ;
  4010. goog.html.SafeHtml.getStyleValue_ = function (a) {
  4011. if (!goog.isObject(a))
  4012. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'The "style" attribute requires goog.html.SafeStyle or map of style properties, ' + typeof a + " given: " + a : "");
  4013. a instanceof goog.html.SafeStyle || (a = goog.html.SafeStyle.create(a));
  4014. return goog.html.SafeStyle.unwrap(a)
  4015. }
  4016. ;
  4017. goog.html.SafeHtml.createWithDir = function (a, b, c, d) {
  4018. b = goog.html.SafeHtml.create(b, c, d);
  4019. b.dir_ = a;
  4020. return b
  4021. }
  4022. ;
  4023. goog.html.SafeHtml.join = function (a, b) {
  4024. var c = goog.html.SafeHtml.htmlEscape(a)
  4025. , d = c.getDirection()
  4026. , e = []
  4027. , f = function (a) {
  4028. goog.isArray(a) ? goog.array.forEach(a, f) : (a = goog.html.SafeHtml.htmlEscape(a),
  4029. e.push(goog.html.SafeHtml.unwrap(a)),
  4030. a = a.getDirection(),
  4031. d == goog.i18n.bidi.Dir.NEUTRAL ? d = a : a != goog.i18n.bidi.Dir.NEUTRAL && d != a && (d = null))
  4032. };
  4033. goog.array.forEach(b, f);
  4034. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e.join(goog.html.SafeHtml.unwrap(c)), d)
  4035. }
  4036. ;
  4037. goog.html.SafeHtml.concat = function (a) {
  4038. return goog.html.SafeHtml.join(goog.html.SafeHtml.EMPTY, Array.prototype.slice.call(arguments))
  4039. }
  4040. ;
  4041. goog.html.SafeHtml.concatWithDir = function (a, b) {
  4042. var c = goog.html.SafeHtml.concat(goog.array.slice(arguments, 1));
  4043. c.dir_ = a;
  4044. return c
  4045. }
  4046. ;
  4047. goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  4048. goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse = function (a, b) {
  4049. return (new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(a, b)
  4050. }
  4051. ;
  4052. goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a, b) {
  4053. this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createHTML(a) : a;
  4054. this.dir_ = b;
  4055. return this
  4056. }
  4057. ;
  4058. goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse = function (a, b, c) {
  4059. var d = null;
  4060. var e = "<" + a + goog.html.SafeHtml.stringifyAttributes(a, b);
  4061. null == c ? c = [] : goog.isArray(c) || (c = [c]);
  4062. goog.dom.tags.isVoidTag(a.toLowerCase()) ? (goog.asserts.assert(!c.length, "Void tag <" + a + "> does not allow content."),
  4063. e += ">") : (d = goog.html.SafeHtml.concat(c),
  4064. e += ">" + goog.html.SafeHtml.unwrap(d) + "</" + a + ">",
  4065. d = d.getDirection());
  4066. (a = b && b.dir) && (d = /^(ltr|rtl|auto)$/i.test(a) ? goog.i18n.bidi.Dir.NEUTRAL : null);
  4067. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e, d)
  4068. }
  4069. ;
  4070. goog.html.SafeHtml.stringifyAttributes = function (a, b) {
  4071. var c = "";
  4072. if (b)
  4073. for (var d in b) {
  4074. if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(d))
  4075. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Invalid attribute name "' + d + '".' : "");
  4076. var e = b[d];
  4077. null != e && (c += " " + goog.html.SafeHtml.getAttrNameAndValue_(a, d, e))
  4078. }
  4079. return c
  4080. }
  4081. ;
  4082. goog.html.SafeHtml.combineAttributes = function (a, b, c) {
  4083. var d = {}, e;
  4084. for (e in a)
  4085. goog.asserts.assert(e.toLowerCase() == e, "Must be lower case"),
  4086. d[e] = a[e];
  4087. for (e in b)
  4088. goog.asserts.assert(e.toLowerCase() == e, "Must be lower case"),
  4089. d[e] = b[e];
  4090. if (c)
  4091. for (e in c) {
  4092. var f = e.toLowerCase();
  4093. if (f in a)
  4094. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Cannot override "' + f + '" attribute, got "' + e + '" with value "' + c[e] + '"' : "");
  4095. f in b && delete d[f];
  4096. d[e] = c[e]
  4097. }
  4098. return d
  4099. }
  4100. ;
  4101. goog.html.SafeHtml.DOCTYPE_HTML = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<!DOCTYPE html>", goog.i18n.bidi.Dir.NEUTRAL);
  4102. goog.html.SafeHtml.EMPTY = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("", goog.i18n.bidi.Dir.NEUTRAL);
  4103. goog.html.SafeHtml.BR = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<br>", goog.i18n.bidi.Dir.NEUTRAL);
  4104. goog.html.uncheckedconversions = {};
  4105. goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract = function (a, b, c) {
  4106. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4107. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4108. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(b, c || null)
  4109. }
  4110. ;
  4111. goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract = function (a, b) {
  4112. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4113. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4114. return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(b)
  4115. }
  4116. ;
  4117. goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract = function (a, b) {
  4118. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4119. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4120. return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b)
  4121. }
  4122. ;
  4123. goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract = function (a, b) {
  4124. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4125. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4126. return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b)
  4127. }
  4128. ;
  4129. goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract = function (a, b) {
  4130. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4131. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4132. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b)
  4133. }
  4134. ;
  4135. goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract = function (a, b) {
  4136. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4137. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4138. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b)
  4139. }
  4140. ;
  4141. goog.dom.safe = {};
  4142. goog.dom.safe.InsertAdjacentHtmlPosition = {
  4143. AFTERBEGIN: "afterbegin",
  4144. AFTEREND: "afterend",
  4145. BEFOREBEGIN: "beforebegin",
  4146. BEFOREEND: "beforeend"
  4147. };
  4148. goog.dom.safe.insertAdjacentHtml = function (a, b, c) {
  4149. a.insertAdjacentHTML(b, goog.html.SafeHtml.unwrapTrustedHTML(c))
  4150. }
  4151. ;
  4152. goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_ = {
  4153. MATH: !0,
  4154. SCRIPT: !0,
  4155. STYLE: !0,
  4156. SVG: !0,
  4157. TEMPLATE: !0
  4158. };
  4159. goog.dom.safe.isInnerHtmlCleanupRecursive_ = goog.functions.cacheReturnValue(function () {
  4160. if (goog.DEBUG && "undefined" === typeof document)
  4161. return !1;
  4162. var a = document.createElement("div")
  4163. , b = document.createElement("div");
  4164. b.appendChild(document.createElement("div"));
  4165. a.appendChild(b);
  4166. if (goog.DEBUG && !a.firstChild)
  4167. return !1;
  4168. b = a.firstChild.firstChild;
  4169. a.innerHTML = goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY);
  4170. return !b.parentElement
  4171. });
  4172. goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse = function (a, b) {
  4173. if (goog.dom.safe.isInnerHtmlCleanupRecursive_())
  4174. for (; a.lastChild;)
  4175. a.removeChild(a.lastChild);
  4176. a.innerHTML = goog.html.SafeHtml.unwrapTrustedHTML(b)
  4177. }
  4178. ;
  4179. goog.dom.safe.setInnerHtml = function (a, b) {
  4180. if (goog.asserts.ENABLE_ASSERTS) {
  4181. var c = a.tagName.toUpperCase();
  4182. if (goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[c])
  4183. throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of " + a.tagName + ".");
  4184. }
  4185. goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(a, b)
  4186. }
  4187. ;
  4188. goog.dom.safe.setOuterHtml = function (a, b) {
  4189. a.outerHTML = goog.html.SafeHtml.unwrapTrustedHTML(b)
  4190. }
  4191. ;
  4192. goog.dom.safe.setFormElementAction = function (a, b) {
  4193. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4194. goog.dom.asserts.assertIsHTMLFormElement(a).action = goog.html.SafeUrl.unwrap(c)
  4195. }
  4196. ;
  4197. goog.dom.safe.setButtonFormAction = function (a, b) {
  4198. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4199. goog.dom.asserts.assertIsHTMLButtonElement(a).formAction = goog.html.SafeUrl.unwrap(c)
  4200. }
  4201. ;
  4202. goog.dom.safe.setInputFormAction = function (a, b) {
  4203. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4204. goog.dom.asserts.assertIsHTMLInputElement(a).formAction = goog.html.SafeUrl.unwrap(c)
  4205. }
  4206. ;
  4207. goog.dom.safe.setStyle = function (a, b) {
  4208. a.style.cssText = goog.html.SafeStyle.unwrap(b)
  4209. }
  4210. ;
  4211. goog.dom.safe.documentWrite = function (a, b) {
  4212. a.write(goog.html.SafeHtml.unwrapTrustedHTML(b))
  4213. }
  4214. ;
  4215. goog.dom.safe.setAnchorHref = function (a, b) {
  4216. goog.dom.asserts.assertIsHTMLAnchorElement(a);
  4217. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4218. a.href = goog.html.SafeUrl.unwrap(c)
  4219. }
  4220. ;
  4221. goog.dom.safe.setImageSrc = function (a, b) {
  4222. goog.dom.asserts.assertIsHTMLImageElement(a);
  4223. if (b instanceof goog.html.SafeUrl)
  4224. var c = b;
  4225. else
  4226. c = /^data:image\//i.test(b),
  4227. c = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c);
  4228. a.src = goog.html.SafeUrl.unwrap(c)
  4229. }
  4230. ;
  4231. goog.dom.safe.setAudioSrc = function (a, b) {
  4232. goog.dom.asserts.assertIsHTMLAudioElement(a);
  4233. if (b instanceof goog.html.SafeUrl)
  4234. var c = b;
  4235. else
  4236. c = /^data:audio\//i.test(b),
  4237. c = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c);
  4238. a.src = goog.html.SafeUrl.unwrap(c)
  4239. }
  4240. ;
  4241. goog.dom.safe.setVideoSrc = function (a, b) {
  4242. goog.dom.asserts.assertIsHTMLVideoElement(a);
  4243. if (b instanceof goog.html.SafeUrl)
  4244. var c = b;
  4245. else
  4246. c = /^data:video\//i.test(b),
  4247. c = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c);
  4248. a.src = goog.html.SafeUrl.unwrap(c)
  4249. }
  4250. ;
  4251. goog.dom.safe.setEmbedSrc = function (a, b) {
  4252. goog.dom.asserts.assertIsHTMLEmbedElement(a);
  4253. a.src = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b)
  4254. }
  4255. ;
  4256. goog.dom.safe.setFrameSrc = function (a, b) {
  4257. goog.dom.asserts.assertIsHTMLFrameElement(a);
  4258. a.src = goog.html.TrustedResourceUrl.unwrap(b)
  4259. }
  4260. ;
  4261. goog.dom.safe.setIframeSrc = function (a, b) {
  4262. goog.dom.asserts.assertIsHTMLIFrameElement(a);
  4263. a.src = goog.html.TrustedResourceUrl.unwrap(b)
  4264. }
  4265. ;
  4266. goog.dom.safe.setIframeSrcdoc = function (a, b) {
  4267. goog.dom.asserts.assertIsHTMLIFrameElement(a);
  4268. a.srcdoc = goog.html.SafeHtml.unwrapTrustedHTML(b)
  4269. }
  4270. ;
  4271. goog.dom.safe.setLinkHrefAndRel = function (a, b, c) {
  4272. goog.dom.asserts.assertIsHTMLLinkElement(a);
  4273. a.rel = c;
  4274. goog.string.internal.caseInsensitiveContains(c, "stylesheet") ? (goog.asserts.assert(b instanceof goog.html.TrustedResourceUrl, 'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),
  4275. a.href = goog.html.TrustedResourceUrl.unwrap(b)) : a.href = b instanceof goog.html.TrustedResourceUrl ? goog.html.TrustedResourceUrl.unwrap(b) : b instanceof goog.html.SafeUrl ? goog.html.SafeUrl.unwrap(b) : goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitizeAssertUnchanged(b))
  4276. }
  4277. ;
  4278. goog.dom.safe.setObjectData = function (a, b) {
  4279. goog.dom.asserts.assertIsHTMLObjectElement(a);
  4280. a.data = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b)
  4281. }
  4282. ;
  4283. goog.dom.safe.setScriptSrc = function (a, b) {
  4284. goog.dom.asserts.assertIsHTMLScriptElement(a);
  4285. a.src = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b);
  4286. var c = goog.getScriptNonce();
  4287. c && a.setAttribute("nonce", c)
  4288. }
  4289. ;
  4290. goog.dom.safe.setScriptContent = function (a, b) {
  4291. goog.dom.asserts.assertIsHTMLScriptElement(a);
  4292. a.text = goog.html.SafeScript.unwrapTrustedScript(b);
  4293. var c = goog.getScriptNonce();
  4294. c && a.setAttribute("nonce", c)
  4295. }
  4296. ;
  4297. goog.dom.safe.setLocationHref = function (a, b) {
  4298. goog.dom.asserts.assertIsLocation(a);
  4299. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4300. a.href = goog.html.SafeUrl.unwrap(c)
  4301. }
  4302. ;
  4303. goog.dom.safe.assignLocation = function (a, b) {
  4304. goog.dom.asserts.assertIsLocation(a);
  4305. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4306. a.assign(goog.html.SafeUrl.unwrap(c))
  4307. }
  4308. ;
  4309. goog.dom.safe.replaceLocation = function (a, b) {
  4310. goog.dom.asserts.assertIsLocation(a);
  4311. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4312. a.replace(goog.html.SafeUrl.unwrap(c))
  4313. }
  4314. ;
  4315. goog.dom.safe.openInWindow = function (a, b, c, d, e) {
  4316. a = a instanceof goog.html.SafeUrl ? a : goog.html.SafeUrl.sanitizeAssertUnchanged(a);
  4317. return (b || goog.global).open(goog.html.SafeUrl.unwrap(a), c ? goog.string.Const.unwrap(c) : "", d, e)
  4318. }
  4319. ;
  4320. goog.dom.safe.parseFromStringHtml = function (a, b) {
  4321. return goog.dom.safe.parseFromString(a, b, "text/html")
  4322. }
  4323. ;
  4324. goog.dom.safe.parseFromString = function (a, b, c) {
  4325. return a.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(b), c)
  4326. }
  4327. ;
  4328. goog.dom.safe.createImageFromBlob = function (a) {
  4329. if (!/^image\/.*/g.test(a.type))
  4330. throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");
  4331. var b = goog.global.URL.createObjectURL(a);
  4332. a = new goog.global.Image;
  4333. a.onload = function () {
  4334. goog.global.URL.revokeObjectURL(b)
  4335. }
  4336. ;
  4337. goog.dom.safe.setImageSrc(a, goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."), b));
  4338. return a
  4339. }
  4340. ;
  4341. goog.string.DETECT_DOUBLE_ESCAPING = !1;
  4342. goog.string.FORCE_NON_DOM_HTML_UNESCAPING = !1;
  4343. goog.string.Unicode = {
  4344. NBSP: "\u00a0"
  4345. };
  4346. goog.string.startsWith = goog.string.internal.startsWith;
  4347. goog.string.endsWith = goog.string.internal.endsWith;
  4348. goog.string.caseInsensitiveStartsWith = goog.string.internal.caseInsensitiveStartsWith;
  4349. goog.string.caseInsensitiveEndsWith = goog.string.internal.caseInsensitiveEndsWith;
  4350. goog.string.caseInsensitiveEquals = goog.string.internal.caseInsensitiveEquals;
  4351. goog.string.subs = function (a, b) {
  4352. for (var c = a.split("%s"), d = "", e = Array.prototype.slice.call(arguments, 1); e.length && 1 < c.length;)
  4353. d += c.shift() + e.shift();
  4354. return d + c.join("%s")
  4355. }
  4356. ;
  4357. goog.string.collapseWhitespace = function (a) {
  4358. return a.replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, "")
  4359. }
  4360. ;
  4361. goog.string.isEmptyOrWhitespace = goog.string.internal.isEmptyOrWhitespace;
  4362. goog.string.isEmptyString = function (a) {
  4363. return 0 == a.length
  4364. }
  4365. ;
  4366. goog.string.isEmpty = goog.string.isEmptyOrWhitespace;
  4367. goog.string.isEmptyOrWhitespaceSafe = function (a) {
  4368. return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(a))
  4369. }
  4370. ;
  4371. goog.string.isEmptySafe = goog.string.isEmptyOrWhitespaceSafe;
  4372. goog.string.isBreakingWhitespace = function (a) {
  4373. return !/[^\t\n\r ]/.test(a)
  4374. }
  4375. ;
  4376. goog.string.isAlpha = function (a) {
  4377. return !/[^a-zA-Z]/.test(a)
  4378. }
  4379. ;
  4380. goog.string.isNumeric = function (a) {
  4381. return !/[^0-9]/.test(a)
  4382. }
  4383. ;
  4384. goog.string.isAlphaNumeric = function (a) {
  4385. return !/[^a-zA-Z0-9]/.test(a)
  4386. }
  4387. ;
  4388. goog.string.isSpace = function (a) {
  4389. return " " == a
  4390. }
  4391. ;
  4392. goog.string.isUnicodeChar = function (a) {
  4393. return 1 == a.length && " " <= a && "~" >= a || "\u0080" <= a && "\ufffd" >= a
  4394. }
  4395. ;
  4396. goog.string.stripNewlines = function (a) {
  4397. return a.replace(/(\r\n|\r|\n)+/g, " ")
  4398. }
  4399. ;
  4400. goog.string.canonicalizeNewlines = function (a) {
  4401. return a.replace(/(\r\n|\r|\n)/g, "\n")
  4402. }
  4403. ;
  4404. goog.string.normalizeWhitespace = function (a) {
  4405. return a.replace(/\xa0|\s/g, " ")
  4406. }
  4407. ;
  4408. goog.string.normalizeSpaces = function (a) {
  4409. return a.replace(/\xa0|[ \t]+/g, " ")
  4410. }
  4411. ;
  4412. goog.string.collapseBreakingSpaces = function (a) {
  4413. return a.replace(/[\t\r\n ]+/g, " ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, "")
  4414. }
  4415. ;
  4416. goog.string.trim = goog.string.internal.trim;
  4417. goog.string.trimLeft = function (a) {
  4418. return a.replace(/^[\s\xa0]+/, "")
  4419. }
  4420. ;
  4421. goog.string.trimRight = function (a) {
  4422. return a.replace(/[\s\xa0]+$/, "")
  4423. }
  4424. ;
  4425. goog.string.caseInsensitiveCompare = goog.string.internal.caseInsensitiveCompare;
  4426. goog.string.numberAwareCompare_ = function (a, b, c) {
  4427. if (a == b)
  4428. return 0;
  4429. if (!a)
  4430. return -1;
  4431. if (!b)
  4432. return 1;
  4433. for (var d = a.toLowerCase().match(c), e = b.toLowerCase().match(c), f = Math.min(d.length, e.length), g = 0; g < f; g++) {
  4434. c = d[g];
  4435. var h = e[g];
  4436. if (c != h)
  4437. return a = parseInt(c, 10),
  4438. !isNaN(a) && (b = parseInt(h, 10),
  4439. !isNaN(b) && a - b) ? a - b : c < h ? -1 : 1
  4440. }
  4441. return d.length != e.length ? d.length - e.length : a < b ? -1 : 1
  4442. }
  4443. ;
  4444. goog.string.intAwareCompare = function (a, b) {
  4445. return goog.string.numberAwareCompare_(a, b, /\d+|\D+/g)
  4446. }
  4447. ;
  4448. goog.string.floatAwareCompare = function (a, b) {
  4449. return goog.string.numberAwareCompare_(a, b, /\d+|\.\d+|\D+/g)
  4450. }
  4451. ;
  4452. goog.string.numerateCompare = goog.string.floatAwareCompare;
  4453. goog.string.urlEncode = function (a) {
  4454. return encodeURIComponent(String(a))
  4455. }
  4456. ;
  4457. goog.string.urlDecode = function (a) {
  4458. return decodeURIComponent(a.replace(/\+/g, " "))
  4459. }
  4460. ;
  4461. goog.string.newLineToBr = goog.string.internal.newLineToBr;
  4462. goog.string.htmlEscape = function (a, b) {
  4463. a = goog.string.internal.htmlEscape(a, b);
  4464. goog.string.DETECT_DOUBLE_ESCAPING && (a = a.replace(goog.string.E_RE_, "&#101;"));
  4465. return a
  4466. }
  4467. ;
  4468. goog.string.E_RE_ = /e/g;
  4469. goog.string.unescapeEntities = function (a) {
  4470. return goog.string.contains(a, "&") ? !goog.string.FORCE_NON_DOM_HTML_UNESCAPING && "document" in goog.global ? goog.string.unescapeEntitiesUsingDom_(a) : goog.string.unescapePureXmlEntities_(a) : a
  4471. }
  4472. ;
  4473. goog.string.unescapeEntitiesWithDocument = function (a, b) {
  4474. return goog.string.contains(a, "&") ? goog.string.unescapeEntitiesUsingDom_(a, b) : a
  4475. }
  4476. ;
  4477. goog.string.unescapeEntitiesUsingDom_ = function (a, b) {
  4478. var c = {
  4479. "&amp;": "&",
  4480. "&lt;": "<",
  4481. "&gt;": ">",
  4482. "&quot;": '"'
  4483. };
  4484. var d = b ? b.createElement("div") : goog.global.document.createElement("div");
  4485. return a.replace(goog.string.HTML_ENTITY_PATTERN_, function (a, b) {
  4486. var e = c[a];
  4487. if (e)
  4488. return e;
  4489. if ("#" == b.charAt(0)) {
  4490. var f = Number("0" + b.substr(1));
  4491. isNaN(f) || (e = String.fromCharCode(f))
  4492. }
  4493. e || (goog.dom.safe.setInnerHtml(d, goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."), a + " ")),
  4494. e = d.firstChild.nodeValue.slice(0, -1));
  4495. return c[a] = e
  4496. })
  4497. }
  4498. ;
  4499. goog.string.unescapePureXmlEntities_ = function (a) {
  4500. return a.replace(/&([^;]+);/g, function (a, c) {
  4501. switch (c) {
  4502. case "amp":
  4503. return "&";
  4504. case "lt":
  4505. return "<";
  4506. case "gt":
  4507. return ">";
  4508. case "quot":
  4509. return '"';
  4510. default:
  4511. if ("#" == c.charAt(0)) {
  4512. var b = Number("0" + c.substr(1));
  4513. if (!isNaN(b))
  4514. return String.fromCharCode(b)
  4515. }
  4516. return a
  4517. }
  4518. })
  4519. }
  4520. ;
  4521. goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g;
  4522. goog.string.whitespaceEscape = function (a, b) {
  4523. return goog.string.newLineToBr(a.replace(/ /g, " &#160;"), b)
  4524. }
  4525. ;
  4526. goog.string.preserveSpaces = function (a) {
  4527. return a.replace(/(^|[\n ]) /g, "$1" + goog.string.Unicode.NBSP)
  4528. }
  4529. ;
  4530. goog.string.stripQuotes = function (a, b) {
  4531. for (var c = b.length, d = 0; d < c; d++) {
  4532. var e = 1 == c ? b : b.charAt(d);
  4533. if (a.charAt(0) == e && a.charAt(a.length - 1) == e)
  4534. return a.substring(1, a.length - 1)
  4535. }
  4536. return a
  4537. }
  4538. ;
  4539. goog.string.truncate = function (a, b, c) {
  4540. c && (a = goog.string.unescapeEntities(a));
  4541. a.length > b && (a = a.substring(0, b - 3) + "...");
  4542. c && (a = goog.string.htmlEscape(a));
  4543. return a
  4544. }
  4545. ;
  4546. goog.string.truncateMiddle = function (a, b, c, d) {
  4547. c && (a = goog.string.unescapeEntities(a));
  4548. if (d && a.length > b) {
  4549. d > b && (d = b);
  4550. var e = a.length - d;
  4551. a = a.substring(0, b - d) + "..." + a.substring(e)
  4552. } else
  4553. a.length > b && (d = Math.floor(b / 2),
  4554. e = a.length - d,
  4555. a = a.substring(0, d + b % 2) + "..." + a.substring(e));
  4556. c && (a = goog.string.htmlEscape(a));
  4557. return a
  4558. }
  4559. ;
  4560. goog.string.specialEscapeChars_ = {
  4561. "\x00": "\\0",
  4562. "\b": "\\b",
  4563. "\f": "\\f",
  4564. "\n": "\\n",
  4565. "\r": "\\r",
  4566. "\t": "\\t",
  4567. "\x0B": "\\x0B",
  4568. '"': '\\"',
  4569. "\\": "\\\\",
  4570. "<": "\\u003C"
  4571. };
  4572. goog.string.jsEscapeCache_ = {
  4573. "'": "\\'"
  4574. };
  4575. goog.string.quote = function (a) {
  4576. a = String(a);
  4577. for (var b = ['"'], c = 0; c < a.length; c++) {
  4578. var d = a.charAt(c)
  4579. , e = d.charCodeAt(0);
  4580. b[c + 1] = goog.string.specialEscapeChars_[d] || (31 < e && 127 > e ? d : goog.string.escapeChar(d))
  4581. }
  4582. b.push('"');
  4583. return b.join("")
  4584. }
  4585. ;
  4586. goog.string.escapeString = function (a) {
  4587. for (var b = [], c = 0; c < a.length; c++)
  4588. b[c] = goog.string.escapeChar(a.charAt(c));
  4589. return b.join("")
  4590. }
  4591. ;
  4592. goog.string.escapeChar = function (a) {
  4593. if (a in goog.string.jsEscapeCache_)
  4594. return goog.string.jsEscapeCache_[a];
  4595. if (a in goog.string.specialEscapeChars_)
  4596. return goog.string.jsEscapeCache_[a] = goog.string.specialEscapeChars_[a];
  4597. var b = a.charCodeAt(0);
  4598. if (31 < b && 127 > b)
  4599. var c = a;
  4600. else {
  4601. if (256 > b) {
  4602. if (c = "\\x",
  4603. 16 > b || 256 < b)
  4604. c += "0"
  4605. } else
  4606. c = "\\u",
  4607. 4096 > b && (c += "0");
  4608. c += b.toString(16).toUpperCase()
  4609. }
  4610. return goog.string.jsEscapeCache_[a] = c
  4611. }
  4612. ;
  4613. goog.string.contains = goog.string.internal.contains;
  4614. goog.string.caseInsensitiveContains = goog.string.internal.caseInsensitiveContains;
  4615. goog.string.countOf = function (a, b) {
  4616. return a && b ? a.split(b).length - 1 : 0
  4617. }
  4618. ;
  4619. goog.string.removeAt = function (a, b, c) {
  4620. var d = a;
  4621. 0 <= b && b < a.length && 0 < c && (d = a.substr(0, b) + a.substr(b + c, a.length - b - c));
  4622. return d
  4623. }
  4624. ;
  4625. goog.string.remove = function (a, b) {
  4626. return a.replace(b, "")
  4627. }
  4628. ;
  4629. goog.string.removeAll = function (a, b) {
  4630. var c = new RegExp(goog.string.regExpEscape(b), "g");
  4631. return a.replace(c, "")
  4632. }
  4633. ;
  4634. goog.string.replaceAll = function (a, b, c) {
  4635. b = new RegExp(goog.string.regExpEscape(b), "g");
  4636. return a.replace(b, c.replace(/\$/g, "$$$$"))
  4637. }
  4638. ;
  4639. goog.string.regExpEscape = function (a) {
  4640. return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08")
  4641. }
  4642. ;
  4643. goog.string.repeat = String.prototype.repeat ? function (a, b) {
  4644. return a.repeat(b)
  4645. }
  4646. : function (a, b) {
  4647. return Array(b + 1).join(a)
  4648. }
  4649. ;
  4650. goog.string.padNumber = function (a, b, c) {
  4651. a = void 0 !== c ? a.toFixed(c) : String(a);
  4652. c = a.indexOf(".");
  4653. -1 == c && (c = a.length);
  4654. return goog.string.repeat("0", Math.max(0, b - c)) + a
  4655. }
  4656. ;
  4657. goog.string.makeSafe = function (a) {
  4658. return null == a ? "" : String(a)
  4659. }
  4660. ;
  4661. goog.string.buildString = function (a) {
  4662. return Array.prototype.join.call(arguments, "")
  4663. }
  4664. ;
  4665. goog.string.getRandomString = function () {
  4666. return Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ goog.now()).toString(36)
  4667. }
  4668. ;
  4669. goog.string.compareVersions = goog.string.internal.compareVersions;
  4670. goog.string.hashCode = function (a) {
  4671. for (var b = 0, c = 0; c < a.length; ++c)
  4672. b = 31 * b + a.charCodeAt(c) >>> 0;
  4673. return b
  4674. }
  4675. ;
  4676. goog.string.uniqueStringCounter_ = 2147483648 * Math.random() | 0;
  4677. goog.string.createUniqueString = function () {
  4678. return "goog_" + goog.string.uniqueStringCounter_++
  4679. }
  4680. ;
  4681. goog.string.toNumber = function (a) {
  4682. var b = Number(a);
  4683. return 0 == b && goog.string.isEmptyOrWhitespace(a) ? NaN : b
  4684. }
  4685. ;
  4686. goog.string.isLowerCamelCase = function (a) {
  4687. return /^[a-z]+([A-Z][a-z]*)*$/.test(a)
  4688. }
  4689. ;
  4690. goog.string.isUpperCamelCase = function (a) {
  4691. return /^([A-Z][a-z]*)+$/.test(a)
  4692. }
  4693. ;
  4694. goog.string.toCamelCase = function (a) {
  4695. return String(a).replace(/\-([a-z])/g, function (a, c) {
  4696. return c.toUpperCase()
  4697. })
  4698. }
  4699. ;
  4700. goog.string.toSelectorCase = function (a) {
  4701. return String(a).replace(/([A-Z])/g, "-$1").toLowerCase()
  4702. }
  4703. ;
  4704. goog.string.toTitleCase = function (a, b) {
  4705. var c = "string" === typeof b ? goog.string.regExpEscape(b) : "\\s";
  4706. return a.replace(new RegExp("(^" + (c ? "|[" + c + "]+" : "") + ")([a-z])", "g"), function (a, b, c) {
  4707. return b + c.toUpperCase()
  4708. })
  4709. }
  4710. ;
  4711. goog.string.capitalize = function (a) {
  4712. return String(a.charAt(0)).toUpperCase() + String(a.substr(1)).toLowerCase()
  4713. }
  4714. ;
  4715. goog.string.parseInt = function (a) {
  4716. isFinite(a) && (a = String(a));
  4717. return "string" === typeof a ? /^\s*-?0x/i.test(a) ? parseInt(a, 16) : parseInt(a, 10) : NaN
  4718. }
  4719. ;
  4720. goog.string.splitLimit = function (a, b, c) {
  4721. a = a.split(b);
  4722. for (var d = []; 0 < c && a.length;)
  4723. d.push(a.shift()),
  4724. c--;
  4725. a.length && d.push(a.join(b));
  4726. return d
  4727. }
  4728. ;
  4729. goog.string.lastComponent = function (a, b) {
  4730. if (b)
  4731. "string" == typeof b && (b = [b]);
  4732. else
  4733. return a;
  4734. for (var c = -1, d = 0; d < b.length; d++)
  4735. if ("" != b[d]) {
  4736. var e = a.lastIndexOf(b[d]);
  4737. e > c && (c = e)
  4738. }
  4739. return -1 == c ? a : a.slice(c + 1)
  4740. }
  4741. ;
  4742. goog.string.editDistance = function (a, b) {
  4743. var c = []
  4744. , d = [];
  4745. if (a == b)
  4746. return 0;
  4747. if (!a.length || !b.length)
  4748. return Math.max(a.length, b.length);
  4749. for (var e = 0; e < b.length + 1; e++)
  4750. c[e] = e;
  4751. for (e = 0; e < a.length; e++) {
  4752. d[0] = e + 1;
  4753. for (var f = 0; f < b.length; f++)
  4754. d[f + 1] = Math.min(d[f] + 1, c[f + 1] + 1, c[f] + Number(a[e] != b[f]));
  4755. for (f = 0; f < c.length; f++)
  4756. c[f] = d[f]
  4757. }
  4758. return d[b.length]
  4759. }
  4760. ;
  4761. goog.Thenable = function () { }
  4762. ;
  4763. goog.Thenable.prototype.then = function (a, b, c) { }
  4764. ;
  4765. goog.Thenable.IMPLEMENTED_BY_PROP = "$goog_Thenable";
  4766. goog.Thenable.addImplementation = function (a) {
  4767. COMPILED ? a.prototype[goog.Thenable.IMPLEMENTED_BY_PROP] = !0 : a.prototype.$goog_Thenable = !0
  4768. }
  4769. ;
  4770. goog.Thenable.isImplementedBy = function (a) {
  4771. if (!a)
  4772. return !1;
  4773. try {
  4774. return COMPILED ? !!a[goog.Thenable.IMPLEMENTED_BY_PROP] : !!a.$goog_Thenable
  4775. } catch (b) {
  4776. return !1
  4777. }
  4778. }
  4779. ;
  4780. goog.async = {};
  4781. goog.async.FreeList = function (a, b, c) {
  4782. this.limit_ = c;
  4783. this.create_ = a;
  4784. this.reset_ = b;
  4785. this.occupants_ = 0;
  4786. this.head_ = null
  4787. }
  4788. ;
  4789. goog.async.FreeList.prototype.get = function () {
  4790. if (0 < this.occupants_) {
  4791. this.occupants_--;
  4792. var a = this.head_;
  4793. this.head_ = a.next;
  4794. a.next = null
  4795. } else
  4796. a = this.create_();
  4797. return a
  4798. }
  4799. ;
  4800. goog.async.FreeList.prototype.put = function (a) {
  4801. this.reset_(a);
  4802. this.occupants_ < this.limit_ && (this.occupants_++,
  4803. a.next = this.head_,
  4804. this.head_ = a)
  4805. }
  4806. ;
  4807. goog.async.FreeList.prototype.occupants = function () {
  4808. return this.occupants_
  4809. }
  4810. ;
  4811. goog.async.WorkQueue = function () {
  4812. this.workTail_ = this.workHead_ = null
  4813. }
  4814. ;
  4815. goog.async.WorkQueue.DEFAULT_MAX_UNUSED = 100;
  4816. goog.async.WorkQueue.freelist_ = new goog.async.FreeList(function () {
  4817. return new goog.async.WorkItem
  4818. }
  4819. , function (a) {
  4820. a.reset()
  4821. }
  4822. , goog.async.WorkQueue.DEFAULT_MAX_UNUSED);
  4823. goog.async.WorkQueue.prototype.add = function (a, b) {
  4824. var c = this.getUnusedItem_();
  4825. c.set(a, b);
  4826. this.workTail_ ? this.workTail_.next = c : (goog.asserts.assert(!this.workHead_),
  4827. this.workHead_ = c);
  4828. this.workTail_ = c
  4829. }
  4830. ;
  4831. goog.async.WorkQueue.prototype.remove = function () {
  4832. var a = null;
  4833. this.workHead_ && (a = this.workHead_,
  4834. this.workHead_ = this.workHead_.next,
  4835. this.workHead_ || (this.workTail_ = null),
  4836. a.next = null);
  4837. return a
  4838. }
  4839. ;
  4840. goog.async.WorkQueue.prototype.returnUnused = function (a) {
  4841. goog.async.WorkQueue.freelist_.put(a)
  4842. }
  4843. ;
  4844. goog.async.WorkQueue.prototype.getUnusedItem_ = function () {
  4845. return goog.async.WorkQueue.freelist_.get()
  4846. }
  4847. ;
  4848. goog.async.WorkItem = function () {
  4849. this.next = this.scope = this.fn = null
  4850. }
  4851. ;
  4852. goog.async.WorkItem.prototype.set = function (a, b) {
  4853. this.fn = a;
  4854. this.scope = b;
  4855. this.next = null
  4856. }
  4857. ;
  4858. goog.async.WorkItem.prototype.reset = function () {
  4859. this.next = this.scope = this.fn = null
  4860. }
  4861. ;
  4862. goog.debug.entryPointRegistry = {};
  4863. goog.debug.EntryPointMonitor = function () { }
  4864. ;
  4865. goog.debug.entryPointRegistry.refList_ = [];
  4866. goog.debug.entryPointRegistry.monitors_ = [];
  4867. goog.debug.entryPointRegistry.monitorsMayExist_ = !1;
  4868. goog.debug.entryPointRegistry.register = function (a) {
  4869. goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length] = a;
  4870. if (goog.debug.entryPointRegistry.monitorsMayExist_)
  4871. for (var b = goog.debug.entryPointRegistry.monitors_, c = 0; c < b.length; c++)
  4872. a(goog.bind(b[c].wrap, b[c]))
  4873. }
  4874. ;
  4875. goog.debug.entryPointRegistry.monitorAll = function (a) {
  4876. goog.debug.entryPointRegistry.monitorsMayExist_ = !0;
  4877. for (var b = goog.bind(a.wrap, a), c = 0; c < goog.debug.entryPointRegistry.refList_.length; c++)
  4878. goog.debug.entryPointRegistry.refList_[c](b);
  4879. goog.debug.entryPointRegistry.monitors_.push(a)
  4880. }
  4881. ;
  4882. goog.debug.entryPointRegistry.unmonitorAllIfPossible = function (a) {
  4883. var b = goog.debug.entryPointRegistry.monitors_;
  4884. goog.asserts.assert(a == b[b.length - 1], "Only the most recent monitor can be unwrapped.");
  4885. a = goog.bind(a.unwrap, a);
  4886. for (var c = 0; c < goog.debug.entryPointRegistry.refList_.length; c++)
  4887. goog.debug.entryPointRegistry.refList_[c](a);
  4888. b.length--
  4889. }
  4890. ;
  4891. goog.labs.userAgent.engine = {};
  4892. goog.labs.userAgent.engine.isPresto = function () {
  4893. return goog.labs.userAgent.util.matchUserAgent("Presto")
  4894. }
  4895. ;
  4896. goog.labs.userAgent.engine.isTrident = function () {
  4897. return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE")
  4898. }
  4899. ;
  4900. goog.labs.userAgent.engine.isEdge = function () {
  4901. return goog.labs.userAgent.util.matchUserAgent("Edge")
  4902. }
  4903. ;
  4904. goog.labs.userAgent.engine.isWebKit = function () {
  4905. return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit") && !goog.labs.userAgent.engine.isEdge()
  4906. }
  4907. ;
  4908. goog.labs.userAgent.engine.isGecko = function () {
  4909. return goog.labs.userAgent.util.matchUserAgent("Gecko") && !goog.labs.userAgent.engine.isWebKit() && !goog.labs.userAgent.engine.isTrident() && !goog.labs.userAgent.engine.isEdge()
  4910. }
  4911. ;
  4912. goog.labs.userAgent.engine.getVersion = function () {
  4913. var a = goog.labs.userAgent.util.getUserAgent();
  4914. if (a) {
  4915. a = goog.labs.userAgent.util.extractVersionTuples(a);
  4916. var b = goog.labs.userAgent.engine.getEngineTuple_(a);
  4917. if (b)
  4918. return "Gecko" == b[0] ? goog.labs.userAgent.engine.getVersionForKey_(a, "Firefox") : b[1];
  4919. a = a[0];
  4920. var c;
  4921. if (a && (c = a[2]) && (c = /Trident\/([^\s;]+)/.exec(c)))
  4922. return c[1]
  4923. }
  4924. return ""
  4925. }
  4926. ;
  4927. goog.labs.userAgent.engine.getEngineTuple_ = function (a) {
  4928. if (!goog.labs.userAgent.engine.isEdge())
  4929. return a[1];
  4930. for (var b = 0; b < a.length; b++) {
  4931. var c = a[b];
  4932. if ("Edge" == c[0])
  4933. return c
  4934. }
  4935. }
  4936. ;
  4937. goog.labs.userAgent.engine.isVersionOrHigher = function (a) {
  4938. return 0 <= goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(), a)
  4939. }
  4940. ;
  4941. goog.labs.userAgent.engine.getVersionForKey_ = function (a, b) {
  4942. var c = goog.array.find(a, function (a) {
  4943. return b == a[0]
  4944. });
  4945. return c && c[1] || ""
  4946. }
  4947. ;
  4948. goog.labs.userAgent.platform = {};
  4949. goog.labs.userAgent.platform.isAndroid = function () {
  4950. return goog.labs.userAgent.util.matchUserAgent("Android")
  4951. }
  4952. ;
  4953. goog.labs.userAgent.platform.isIpod = function () {
  4954. return goog.labs.userAgent.util.matchUserAgent("iPod")
  4955. }
  4956. ;
  4957. goog.labs.userAgent.platform.isIphone = function () {
  4958. return goog.labs.userAgent.util.matchUserAgent("iPhone") && !goog.labs.userAgent.util.matchUserAgent("iPod") && !goog.labs.userAgent.util.matchUserAgent("iPad")
  4959. }
  4960. ;
  4961. goog.labs.userAgent.platform.isIpad = function () {
  4962. return goog.labs.userAgent.util.matchUserAgent("iPad")
  4963. }
  4964. ;
  4965. goog.labs.userAgent.platform.isIos = function () {
  4966. return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpad() || goog.labs.userAgent.platform.isIpod()
  4967. }
  4968. ;
  4969. goog.labs.userAgent.platform.isMacintosh = function () {
  4970. return goog.labs.userAgent.util.matchUserAgent("Macintosh")
  4971. }
  4972. ;
  4973. goog.labs.userAgent.platform.isLinux = function () {
  4974. return goog.labs.userAgent.util.matchUserAgent("Linux")
  4975. }
  4976. ;
  4977. goog.labs.userAgent.platform.isWindows = function () {
  4978. return goog.labs.userAgent.util.matchUserAgent("Windows")
  4979. }
  4980. ;
  4981. goog.labs.userAgent.platform.isChromeOS = function () {
  4982. return goog.labs.userAgent.util.matchUserAgent("CrOS")
  4983. }
  4984. ;
  4985. goog.labs.userAgent.platform.isChromecast = function () {
  4986. return goog.labs.userAgent.util.matchUserAgent("CrKey")
  4987. }
  4988. ;
  4989. goog.labs.userAgent.platform.isKaiOS = function () {
  4990. return goog.labs.userAgent.util.matchUserAgentIgnoreCase("KaiOS")
  4991. }
  4992. ;
  4993. goog.labs.userAgent.platform.isGo2Phone = function () {
  4994. return goog.labs.userAgent.util.matchUserAgentIgnoreCase("GAFP")
  4995. }
  4996. ;
  4997. goog.labs.userAgent.platform.getVersion = function () {
  4998. var a = goog.labs.userAgent.util.getUserAgent()
  4999. , b = "";
  5000. goog.labs.userAgent.platform.isWindows() ? (b = /Windows (?:NT|Phone) ([0-9.]+)/,
  5001. b = (a = b.exec(a)) ? a[1] : "0.0") : goog.labs.userAgent.platform.isIos() ? (b = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/,
  5002. b = (a = b.exec(a)) && a[1].replace(/_/g, ".")) : goog.labs.userAgent.platform.isMacintosh() ? (b = /Mac OS X ([0-9_.]+)/,
  5003. b = (a = b.exec(a)) ? a[1].replace(/_/g, ".") : "10") : goog.labs.userAgent.platform.isKaiOS() ? (b = /(?:KaiOS)\/(\S+)/i,
  5004. b = (a = b.exec(a)) && a[1]) : goog.labs.userAgent.platform.isAndroid() ? (b = /Android\s+([^\);]+)(\)|;)/,
  5005. b = (a = b.exec(a)) && a[1]) : goog.labs.userAgent.platform.isChromeOS() && (b = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/,
  5006. b = (a = b.exec(a)) && a[1]);
  5007. return b || ""
  5008. }
  5009. ;
  5010. goog.labs.userAgent.platform.isVersionOrHigher = function (a) {
  5011. return 0 <= goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(), a)
  5012. }
  5013. ;
  5014. goog.reflect = {};
  5015. goog.reflect.object = function (a, b) {
  5016. return b
  5017. }
  5018. ;
  5019. goog.reflect.objectProperty = function (a, b) {
  5020. return a
  5021. }
  5022. ;
  5023. goog.reflect.sinkValue = function (a) {
  5024. goog.reflect.sinkValue[" "](a);
  5025. return a
  5026. }
  5027. ;
  5028. goog.reflect.sinkValue[" "] = goog.nullFunction;
  5029. goog.reflect.canAccessProperty = function (a, b) {
  5030. try {
  5031. return goog.reflect.sinkValue(a[b]),
  5032. !0
  5033. } catch (c) { }
  5034. return !1
  5035. }
  5036. ;
  5037. goog.reflect.cache = function (a, b, c, d) {
  5038. d = d ? d(b) : b;
  5039. return Object.prototype.hasOwnProperty.call(a, d) ? a[d] : a[d] = c(b)
  5040. }
  5041. ;
  5042. goog.userAgent = {};
  5043. goog.userAgent.ASSUME_IE = !1;
  5044. goog.userAgent.ASSUME_EDGE = !1;
  5045. goog.userAgent.ASSUME_GECKO = !1;
  5046. goog.userAgent.ASSUME_WEBKIT = !1;
  5047. goog.userAgent.ASSUME_MOBILE_WEBKIT = !1;
  5048. goog.userAgent.ASSUME_OPERA = !1;
  5049. goog.userAgent.ASSUME_ANY_VERSION = !1;
  5050. goog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_GECKO || goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_OPERA;
  5051. goog.userAgent.getUserAgentString = function () {
  5052. return goog.labs.userAgent.util.getUserAgent()
  5053. }
  5054. ;
  5055. goog.userAgent.getNavigatorTyped = function () {
  5056. return goog.global.navigator || null
  5057. }
  5058. ;
  5059. goog.userAgent.getNavigator = function () {
  5060. return goog.userAgent.getNavigatorTyped()
  5061. }
  5062. ;
  5063. goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_OPERA : goog.labs.userAgent.browser.isOpera();
  5064. goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_IE : goog.labs.userAgent.browser.isIE();
  5065. goog.userAgent.EDGE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_EDGE : goog.labs.userAgent.engine.isEdge();
  5066. goog.userAgent.EDGE_OR_IE = goog.userAgent.EDGE || goog.userAgent.IE;
  5067. goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_GECKO : goog.labs.userAgent.engine.isGecko();
  5068. goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : goog.labs.userAgent.engine.isWebKit();
  5069. goog.userAgent.isMobile_ = function () {
  5070. return goog.userAgent.WEBKIT && goog.labs.userAgent.util.matchUserAgent("Mobile")
  5071. }
  5072. ;
  5073. goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.isMobile_();
  5074. goog.userAgent.SAFARI = goog.userAgent.WEBKIT;
  5075. goog.userAgent.determinePlatform_ = function () {
  5076. var a = goog.userAgent.getNavigatorTyped();
  5077. return a && a.platform || ""
  5078. }
  5079. ;
  5080. goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();
  5081. goog.userAgent.ASSUME_MAC = !1;
  5082. goog.userAgent.ASSUME_WINDOWS = !1;
  5083. goog.userAgent.ASSUME_LINUX = !1;
  5084. goog.userAgent.ASSUME_X11 = !1;
  5085. goog.userAgent.ASSUME_ANDROID = !1;
  5086. goog.userAgent.ASSUME_IPHONE = !1;
  5087. goog.userAgent.ASSUME_IPAD = !1;
  5088. goog.userAgent.ASSUME_IPOD = !1;
  5089. goog.userAgent.ASSUME_KAIOS = !1;
  5090. goog.userAgent.ASSUME_GO2PHONE = !1;
  5091. goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX || goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID || goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD;
  5092. goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_MAC : goog.labs.userAgent.platform.isMacintosh();
  5093. goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_WINDOWS : goog.labs.userAgent.platform.isWindows();
  5094. goog.userAgent.isLegacyLinux_ = function () {
  5095. return goog.labs.userAgent.platform.isLinux() || goog.labs.userAgent.platform.isChromeOS()
  5096. }
  5097. ;
  5098. goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_LINUX : goog.userAgent.isLegacyLinux_();
  5099. goog.userAgent.isX11_ = function () {
  5100. var a = goog.userAgent.getNavigatorTyped();
  5101. return !!a && goog.string.contains(a.appVersion || "", "X11")
  5102. }
  5103. ;
  5104. goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_X11 : goog.userAgent.isX11_();
  5105. goog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_ANDROID : goog.labs.userAgent.platform.isAndroid();
  5106. goog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE : goog.labs.userAgent.platform.isIphone();
  5107. goog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad();
  5108. goog.userAgent.IPOD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIpod();
  5109. goog.userAgent.IOS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIos();
  5110. goog.userAgent.KAIOS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_KAIOS : goog.labs.userAgent.platform.isKaiOS();
  5111. goog.userAgent.GO2PHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_GO2PHONE : goog.labs.userAgent.platform.isGo2Phone();
  5112. goog.userAgent.determineVersion_ = function () {
  5113. var a = ""
  5114. , b = goog.userAgent.getVersionRegexResult_();
  5115. b && (a = b ? b[1] : "");
  5116. return goog.userAgent.IE && (b = goog.userAgent.getDocumentMode_(),
  5117. null != b && b > parseFloat(a)) ? String(b) : a
  5118. }
  5119. ;
  5120. goog.userAgent.getVersionRegexResult_ = function () {
  5121. var a = goog.userAgent.getUserAgentString();
  5122. if (goog.userAgent.GECKO)
  5123. return /rv:([^\);]+)(\)|;)/.exec(a);
  5124. if (goog.userAgent.EDGE)
  5125. return /Edge\/([\d\.]+)/.exec(a);
  5126. if (goog.userAgent.IE)
  5127. return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);
  5128. if (goog.userAgent.WEBKIT)
  5129. return /WebKit\/(\S+)/.exec(a);
  5130. if (goog.userAgent.OPERA)
  5131. return /(?:Version)[ \/]?(\S+)/.exec(a)
  5132. }
  5133. ;
  5134. goog.userAgent.getDocumentMode_ = function () {
  5135. var a = goog.global.document;
  5136. return a ? a.documentMode : void 0
  5137. }
  5138. ;
  5139. goog.userAgent.VERSION = goog.userAgent.determineVersion_();
  5140. goog.userAgent.compare = function (a, b) {
  5141. return goog.string.compareVersions(a, b)
  5142. }
  5143. ;
  5144. goog.userAgent.isVersionOrHigherCache_ = {};
  5145. goog.userAgent.isVersionOrHigher = function (a) {
  5146. return goog.userAgent.ASSUME_ANY_VERSION || goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_, a, function () {
  5147. return 0 <= goog.string.compareVersions(goog.userAgent.VERSION, a)
  5148. })
  5149. }
  5150. ;
  5151. goog.userAgent.isVersion = goog.userAgent.isVersionOrHigher;
  5152. goog.userAgent.isDocumentModeOrHigher = function (a) {
  5153. return Number(goog.userAgent.DOCUMENT_MODE) >= a
  5154. }
  5155. ;
  5156. goog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher;
  5157. goog.userAgent.DOCUMENT_MODE = function () {
  5158. if (goog.global.document && goog.userAgent.IE)
  5159. return goog.userAgent.getDocumentMode_()
  5160. }();
  5161. goog.dom.BrowserFeature = {};
  5162. goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS = !1;
  5163. goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS = !1;
  5164. goog.dom.BrowserFeature.detectOffscreenCanvas_ = function (a) {
  5165. try {
  5166. return !!(new self.OffscreenCanvas(0, 0)).getContext(a)
  5167. } catch (b) { }
  5168. return !1
  5169. }
  5170. ;
  5171. goog.dom.BrowserFeature.OFFSCREEN_CANVAS_2D = !goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS && (goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS || goog.dom.BrowserFeature.detectOffscreenCanvas_("2d"));
  5172. goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES = !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9);
  5173. goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE = !goog.userAgent.GECKO && !goog.userAgent.IE || goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) || goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9.1");
  5174. goog.dom.BrowserFeature.CAN_USE_INNER_TEXT = goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9");
  5175. goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY = goog.userAgent.IE || goog.userAgent.OPERA || goog.userAgent.WEBKIT;
  5176. goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT = goog.userAgent.IE;
  5177. goog.dom.BrowserFeature.LEGACY_IE_RANGES = goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9);
  5178. goog.math.Size = function (a, b) {
  5179. this.width = a;
  5180. this.height = b
  5181. }
  5182. ;
  5183. goog.math.Size.equals = function (a, b) {
  5184. return a == b ? !0 : a && b ? a.width == b.width && a.height == b.height : !1
  5185. }
  5186. ;
  5187. goog.math.Size.prototype.clone = function () {
  5188. return new goog.math.Size(this.width, this.height)
  5189. }
  5190. ;
  5191. goog.DEBUG && (goog.math.Size.prototype.toString = function () {
  5192. return "(" + this.width + " x " + this.height + ")"
  5193. }
  5194. );
  5195. goog.math.Size.prototype.getLongest = function () {
  5196. return Math.max(this.width, this.height)
  5197. }
  5198. ;
  5199. goog.math.Size.prototype.getShortest = function () {
  5200. return Math.min(this.width, this.height)
  5201. }
  5202. ;
  5203. goog.math.Size.prototype.area = function () {
  5204. return this.width * this.height
  5205. }
  5206. ;
  5207. goog.math.Size.prototype.perimeter = function () {
  5208. return 2 * (this.width + this.height)
  5209. }
  5210. ;
  5211. goog.math.Size.prototype.aspectRatio = function () {
  5212. return this.width / this.height
  5213. }
  5214. ;
  5215. goog.math.Size.prototype.isEmpty = function () {
  5216. return !this.area()
  5217. }
  5218. ;
  5219. goog.math.Size.prototype.ceil = function () {
  5220. this.width = Math.ceil(this.width);
  5221. this.height = Math.ceil(this.height);
  5222. return this
  5223. }
  5224. ;
  5225. goog.math.Size.prototype.fitsInside = function (a) {
  5226. return this.width <= a.width && this.height <= a.height
  5227. }
  5228. ;
  5229. goog.math.Size.prototype.floor = function () {
  5230. this.width = Math.floor(this.width);
  5231. this.height = Math.floor(this.height);
  5232. return this
  5233. }
  5234. ;
  5235. goog.math.Size.prototype.round = function () {
  5236. this.width = Math.round(this.width);
  5237. this.height = Math.round(this.height);
  5238. return this
  5239. }
  5240. ;
  5241. goog.math.Size.prototype.scale = function (a, b) {
  5242. this.width *= a;
  5243. this.height *= "number" === typeof b ? b : a;
  5244. return this
  5245. }
  5246. ;
  5247. goog.math.Size.prototype.scaleToCover = function (a) {
  5248. a = this.aspectRatio() <= a.aspectRatio() ? a.width / this.width : a.height / this.height;
  5249. return this.scale(a)
  5250. }
  5251. ;
  5252. goog.math.Size.prototype.scaleToFit = function (a) {
  5253. a = this.aspectRatio() > a.aspectRatio() ? a.width / this.width : a.height / this.height;
  5254. return this.scale(a)
  5255. }
  5256. ;
  5257. goog.dom.ASSUME_QUIRKS_MODE = !1;
  5258. goog.dom.ASSUME_STANDARDS_MODE = !1;
  5259. goog.dom.COMPAT_MODE_KNOWN_ = goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STANDARDS_MODE;
  5260. goog.dom.getDomHelper = function (a) {
  5261. return a ? new goog.dom.DomHelper(goog.dom.getOwnerDocument(a)) : goog.dom.defaultDomHelper_ || (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper)
  5262. }
  5263. ;
  5264. goog.dom.getDocument = function () {
  5265. return document
  5266. }
  5267. ;
  5268. goog.dom.getElement = function (a) {
  5269. return goog.dom.getElementHelper_(document, a)
  5270. }
  5271. ;
  5272. goog.dom.getElementHelper_ = function (a, b) {
  5273. return "string" === typeof b ? a.getElementById(b) : b
  5274. }
  5275. ;
  5276. goog.dom.getRequiredElement = function (a) {
  5277. return goog.dom.getRequiredElementHelper_(document, a)
  5278. }
  5279. ;
  5280. goog.dom.getRequiredElementHelper_ = function (a, b) {
  5281. goog.asserts.assertString(b);
  5282. var c = goog.dom.getElementHelper_(a, b);
  5283. return c = goog.asserts.assertElement(c, "No element found with id: " + b)
  5284. }
  5285. ;
  5286. goog.dom.$ = goog.dom.getElement;
  5287. goog.dom.getElementsByTagName = function (a, b) {
  5288. return (b || document).getElementsByTagName(String(a))
  5289. }
  5290. ;
  5291. goog.dom.getElementsByTagNameAndClass = function (a, b, c) {
  5292. return goog.dom.getElementsByTagNameAndClass_(document, a, b, c)
  5293. }
  5294. ;
  5295. goog.dom.getElementByTagNameAndClass = function (a, b, c) {
  5296. return goog.dom.getElementByTagNameAndClass_(document, a, b, c)
  5297. }
  5298. ;
  5299. goog.dom.getElementsByClass = function (a, b) {
  5300. var c = b || document;
  5301. return goog.dom.canUseQuerySelector_(c) ? c.querySelectorAll("." + a) : goog.dom.getElementsByTagNameAndClass_(document, "*", a, b)
  5302. }
  5303. ;
  5304. goog.dom.getElementByClass = function (a, b) {
  5305. var c = b || document;
  5306. return (c.getElementsByClassName ? c.getElementsByClassName(a)[0] : goog.dom.getElementByTagNameAndClass_(document, "*", a, b)) || null
  5307. }
  5308. ;
  5309. goog.dom.getRequiredElementByClass = function (a, b) {
  5310. var c = goog.dom.getElementByClass(a, b);
  5311. return goog.asserts.assert(c, "No element found with className: " + a)
  5312. }
  5313. ;
  5314. goog.dom.canUseQuerySelector_ = function (a) {
  5315. return !(!a.querySelectorAll || !a.querySelector)
  5316. }
  5317. ;
  5318. goog.dom.getElementsByTagNameAndClass_ = function (a, b, c, d) {
  5319. a = d || a;
  5320. b = b && "*" != b ? String(b).toUpperCase() : "";
  5321. if (goog.dom.canUseQuerySelector_(a) && (b || c))
  5322. return a.querySelectorAll(b + (c ? "." + c : ""));
  5323. if (c && a.getElementsByClassName) {
  5324. a = a.getElementsByClassName(c);
  5325. if (b) {
  5326. d = {};
  5327. for (var e = 0, f = 0, g; g = a[f]; f++)
  5328. b == g.nodeName && (d[e++] = g);
  5329. d.length = e;
  5330. return d
  5331. }
  5332. return a
  5333. }
  5334. a = a.getElementsByTagName(b || "*");
  5335. if (c) {
  5336. d = {};
  5337. for (f = e = 0; g = a[f]; f++)
  5338. b = g.className,
  5339. "function" == typeof b.split && goog.array.contains(b.split(/\s+/), c) && (d[e++] = g);
  5340. d.length = e;
  5341. return d
  5342. }
  5343. return a
  5344. }
  5345. ;
  5346. goog.dom.getElementByTagNameAndClass_ = function (a, b, c, d) {
  5347. var e = d || a
  5348. , f = b && "*" != b ? String(b).toUpperCase() : "";
  5349. return goog.dom.canUseQuerySelector_(e) && (f || c) ? e.querySelector(f + (c ? "." + c : "")) : goog.dom.getElementsByTagNameAndClass_(a, b, c, d)[0] || null
  5350. }
  5351. ;
  5352. goog.dom.$$ = goog.dom.getElementsByTagNameAndClass;
  5353. goog.dom.setProperties = function (a, b) {
  5354. goog.object.forEach(b, function (b, d) {
  5355. b && "object" == typeof b && b.implementsGoogStringTypedString && (b = b.getTypedStringValue());
  5356. "style" == d ? a.style.cssText = b : "class" == d ? a.className = b : "for" == d ? a.htmlFor = b : goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(d) ? a.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[d], b) : goog.string.startsWith(d, "aria-") || goog.string.startsWith(d, "data-") ? a.setAttribute(d, b) : a[d] = b
  5357. })
  5358. }
  5359. ;
  5360. goog.dom.DIRECT_ATTRIBUTE_MAP_ = {
  5361. cellpadding: "cellPadding",
  5362. cellspacing: "cellSpacing",
  5363. colspan: "colSpan",
  5364. frameborder: "frameBorder",
  5365. height: "height",
  5366. maxlength: "maxLength",
  5367. nonce: "nonce",
  5368. role: "role",
  5369. rowspan: "rowSpan",
  5370. type: "type",
  5371. usemap: "useMap",
  5372. valign: "vAlign",
  5373. width: "width"
  5374. };
  5375. goog.dom.getViewportSize = function (a) {
  5376. return goog.dom.getViewportSize_(a || window)
  5377. }
  5378. ;
  5379. goog.dom.getViewportSize_ = function (a) {
  5380. a = a.document;
  5381. a = goog.dom.isCss1CompatMode_(a) ? a.documentElement : a.body;
  5382. return new goog.math.Size(a.clientWidth, a.clientHeight)
  5383. }
  5384. ;
  5385. goog.dom.getDocumentHeight = function () {
  5386. return goog.dom.getDocumentHeight_(window)
  5387. }
  5388. ;
  5389. goog.dom.getDocumentHeightForWindow = function (a) {
  5390. return goog.dom.getDocumentHeight_(a)
  5391. }
  5392. ;
  5393. goog.dom.getDocumentHeight_ = function (a) {
  5394. var b = a.document
  5395. , c = 0;
  5396. if (b) {
  5397. c = b.body;
  5398. var d = b.documentElement;
  5399. if (!d || !c)
  5400. return 0;
  5401. a = goog.dom.getViewportSize_(a).height;
  5402. if (goog.dom.isCss1CompatMode_(b) && d.scrollHeight)
  5403. c = d.scrollHeight != a ? d.scrollHeight : d.offsetHeight;
  5404. else {
  5405. b = d.scrollHeight;
  5406. var e = d.offsetHeight;
  5407. d.clientHeight != e && (b = c.scrollHeight,
  5408. e = c.offsetHeight);
  5409. c = b > a ? b > e ? b : e : b < e ? b : e
  5410. }
  5411. }
  5412. return c
  5413. }
  5414. ;
  5415. goog.dom.getPageScroll = function (a) {
  5416. return goog.dom.getDomHelper((a || goog.global || window).document).getDocumentScroll()
  5417. }
  5418. ;
  5419. goog.dom.getDocumentScroll = function () {
  5420. return goog.dom.getDocumentScroll_(document)
  5421. }
  5422. ;
  5423. goog.dom.getDocumentScroll_ = function (a) {
  5424. var b = goog.dom.getDocumentScrollElement_(a);
  5425. a = goog.dom.getWindow_(a);
  5426. return goog.userAgent.IE && goog.userAgent.isVersionOrHigher("10") && a.pageYOffset != b.scrollTop ? new goog.math.Coordinate(b.scrollLeft, b.scrollTop) : new goog.math.Coordinate(a.pageXOffset || b.scrollLeft, a.pageYOffset || b.scrollTop)
  5427. }
  5428. ;
  5429. goog.dom.getDocumentScrollElement = function () {
  5430. return goog.dom.getDocumentScrollElement_(document)
  5431. }
  5432. ;
  5433. goog.dom.getDocumentScrollElement_ = function (a) {
  5434. return a.scrollingElement ? a.scrollingElement : !goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(a) ? a.documentElement : a.body || a.documentElement
  5435. }
  5436. ;
  5437. goog.dom.getWindow = function (a) {
  5438. return a ? goog.dom.getWindow_(a) : window
  5439. }
  5440. ;
  5441. goog.dom.getWindow_ = function (a) {
  5442. return a.parentWindow || a.defaultView
  5443. }
  5444. ;
  5445. goog.dom.createDom = function (a, b, c) {
  5446. return goog.dom.createDom_(document, arguments)
  5447. }
  5448. ;
  5449. goog.dom.createDom_ = function (a, b) {
  5450. var c = String(b[0])
  5451. , d = b[1];
  5452. if (!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES && d && (d.name || d.type)) {
  5453. c = ["<", c];
  5454. d.name && c.push(' name="', goog.string.htmlEscape(d.name), '"');
  5455. if (d.type) {
  5456. c.push(' type="', goog.string.htmlEscape(d.type), '"');
  5457. var e = {};
  5458. goog.object.extend(e, d);
  5459. delete e.type;
  5460. d = e
  5461. }
  5462. c.push(">");
  5463. c = c.join("")
  5464. }
  5465. c = goog.dom.createElement_(a, c);
  5466. d && ("string" === typeof d ? c.className = d : goog.isArray(d) ? c.className = d.join(" ") : goog.dom.setProperties(c, d));
  5467. 2 < b.length && goog.dom.append_(a, c, b, 2);
  5468. return c
  5469. }
  5470. ;
  5471. goog.dom.append_ = function (a, b, c, d) {
  5472. function e(c) {
  5473. c && b.appendChild("string" === typeof c ? a.createTextNode(c) : c)
  5474. }
  5475. for (; d < c.length; d++) {
  5476. var f = c[d];
  5477. goog.isArrayLike(f) && !goog.dom.isNodeLike(f) ? goog.array.forEach(goog.dom.isNodeList(f) ? goog.array.toArray(f) : f, e) : e(f)
  5478. }
  5479. }
  5480. ;
  5481. goog.dom.$dom = goog.dom.createDom;
  5482. goog.dom.createElement = function (a) {
  5483. return goog.dom.createElement_(document, a)
  5484. }
  5485. ;
  5486. goog.dom.createElement_ = function (a, b) {
  5487. b = String(b);
  5488. "application/xhtml+xml" === a.contentType && (b = b.toLowerCase());
  5489. return a.createElement(b)
  5490. }
  5491. ;
  5492. goog.dom.createTextNode = function (a) {
  5493. return document.createTextNode(String(a))
  5494. }
  5495. ;
  5496. goog.dom.createTable = function (a, b, c) {
  5497. return goog.dom.createTable_(document, a, b, !!c)
  5498. }
  5499. ;
  5500. goog.dom.createTable_ = function (a, b, c, d) {
  5501. for (var e = goog.dom.createElement_(a, "TABLE"), f = e.appendChild(goog.dom.createElement_(a, "TBODY")), g = 0; g < b; g++) {
  5502. for (var h = goog.dom.createElement_(a, "TR"), k = 0; k < c; k++) {
  5503. var m = goog.dom.createElement_(a, "TD");
  5504. d && goog.dom.setTextContent(m, goog.string.Unicode.NBSP);
  5505. h.appendChild(m)
  5506. }
  5507. f.appendChild(h)
  5508. }
  5509. return e
  5510. }
  5511. ;
  5512. goog.dom.constHtmlToNode = function (a) {
  5513. var b = goog.array.map(arguments, goog.string.Const.unwrap);
  5514. b = goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Constant HTML string, that gets turned into a Node later, so it will be automatically balanced."), b.join(""));
  5515. return goog.dom.safeHtmlToNode(b)
  5516. }
  5517. ;
  5518. goog.dom.safeHtmlToNode = function (a) {
  5519. return goog.dom.safeHtmlToNode_(document, a)
  5520. }
  5521. ;
  5522. goog.dom.safeHtmlToNode_ = function (a, b) {
  5523. var c = goog.dom.createElement_(a, "DIV");
  5524. goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT ? (goog.dom.safe.setInnerHtml(c, goog.html.SafeHtml.concat(goog.html.SafeHtml.BR, b)),
  5525. c.removeChild(goog.asserts.assert(c.firstChild))) : goog.dom.safe.setInnerHtml(c, b);
  5526. return goog.dom.childrenToNode_(a, c)
  5527. }
  5528. ;
  5529. goog.dom.childrenToNode_ = function (a, b) {
  5530. if (1 == b.childNodes.length)
  5531. return b.removeChild(goog.asserts.assert(b.firstChild));
  5532. for (var c = a.createDocumentFragment(); b.firstChild;)
  5533. c.appendChild(b.firstChild);
  5534. return c
  5535. }
  5536. ;
  5537. goog.dom.isCss1CompatMode = function () {
  5538. return goog.dom.isCss1CompatMode_(document)
  5539. }
  5540. ;
  5541. goog.dom.isCss1CompatMode_ = function (a) {
  5542. return goog.dom.COMPAT_MODE_KNOWN_ ? goog.dom.ASSUME_STANDARDS_MODE : "CSS1Compat" == a.compatMode
  5543. }
  5544. ;
  5545. goog.dom.canHaveChildren = function (a) {
  5546. if (a.nodeType != goog.dom.NodeType.ELEMENT)
  5547. return !1;
  5548. switch (a.tagName) {
  5549. case "APPLET":
  5550. case "AREA":
  5551. case "BASE":
  5552. case "BR":
  5553. case "COL":
  5554. case "COMMAND":
  5555. case "EMBED":
  5556. case "FRAME":
  5557. case "HR":
  5558. case "IMG":
  5559. case "INPUT":
  5560. case "IFRAME":
  5561. case "ISINDEX":
  5562. case "KEYGEN":
  5563. case "LINK":
  5564. case "NOFRAMES":
  5565. case "NOSCRIPT":
  5566. case "META":
  5567. case "OBJECT":
  5568. case "PARAM":
  5569. case "SCRIPT":
  5570. case "SOURCE":
  5571. case "STYLE":
  5572. case "TRACK":
  5573. case "WBR":
  5574. return !1
  5575. }
  5576. return !0
  5577. }
  5578. ;
  5579. goog.dom.appendChild = function (a, b) {
  5580. goog.asserts.assert(null != a && null != b, "goog.dom.appendChild expects non-null arguments");
  5581. a.appendChild(b)
  5582. }
  5583. ;
  5584. goog.dom.append = function (a, b) {
  5585. goog.dom.append_(goog.dom.getOwnerDocument(a), a, arguments, 1)
  5586. }
  5587. ;
  5588. goog.dom.removeChildren = function (a) {
  5589. for (var b; b = a.firstChild;)
  5590. a.removeChild(b)
  5591. }
  5592. ;
  5593. goog.dom.insertSiblingBefore = function (a, b) {
  5594. goog.asserts.assert(null != a && null != b, "goog.dom.insertSiblingBefore expects non-null arguments");
  5595. b.parentNode && b.parentNode.insertBefore(a, b)
  5596. }
  5597. ;
  5598. goog.dom.insertSiblingAfter = function (a, b) {
  5599. goog.asserts.assert(null != a && null != b, "goog.dom.insertSiblingAfter expects non-null arguments");
  5600. b.parentNode && b.parentNode.insertBefore(a, b.nextSibling)
  5601. }
  5602. ;
  5603. goog.dom.insertChildAt = function (a, b, c) {
  5604. goog.asserts.assert(null != a, "goog.dom.insertChildAt expects a non-null parent");
  5605. a.insertBefore(b, a.childNodes[c] || null)
  5606. }
  5607. ;
  5608. goog.dom.removeNode = function (a) {
  5609. return a && a.parentNode ? a.parentNode.removeChild(a) : null
  5610. }
  5611. ;
  5612. goog.dom.replaceNode = function (a, b) {
  5613. goog.asserts.assert(null != a && null != b, "goog.dom.replaceNode expects non-null arguments");
  5614. var c = b.parentNode;
  5615. c && c.replaceChild(a, b)
  5616. }
  5617. ;
  5618. goog.dom.flattenElement = function (a) {
  5619. var b, c = a.parentNode;
  5620. if (c && c.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) {
  5621. if (a.removeNode)
  5622. return a.removeNode(!1);
  5623. for (; b = a.firstChild;)
  5624. c.insertBefore(b, a);
  5625. return goog.dom.removeNode(a)
  5626. }
  5627. }
  5628. ;
  5629. goog.dom.getChildren = function (a) {
  5630. return goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE && void 0 != a.children ? a.children : goog.array.filter(a.childNodes, function (a) {
  5631. return a.nodeType == goog.dom.NodeType.ELEMENT
  5632. })
  5633. }
  5634. ;
  5635. goog.dom.getFirstElementChild = function (a) {
  5636. return void 0 !== a.firstElementChild ? a.firstElementChild : goog.dom.getNextElementNode_(a.firstChild, !0)
  5637. }
  5638. ;
  5639. goog.dom.getLastElementChild = function (a) {
  5640. return void 0 !== a.lastElementChild ? a.lastElementChild : goog.dom.getNextElementNode_(a.lastChild, !1)
  5641. }
  5642. ;
  5643. goog.dom.getNextElementSibling = function (a) {
  5644. return void 0 !== a.nextElementSibling ? a.nextElementSibling : goog.dom.getNextElementNode_(a.nextSibling, !0)
  5645. }
  5646. ;
  5647. goog.dom.getPreviousElementSibling = function (a) {
  5648. return void 0 !== a.previousElementSibling ? a.previousElementSibling : goog.dom.getNextElementNode_(a.previousSibling, !1)
  5649. }
  5650. ;
  5651. goog.dom.getNextElementNode_ = function (a, b) {
  5652. for (; a && a.nodeType != goog.dom.NodeType.ELEMENT;)
  5653. a = b ? a.nextSibling : a.previousSibling;
  5654. return a
  5655. }
  5656. ;
  5657. goog.dom.getNextNode = function (a) {
  5658. if (!a)
  5659. return null;
  5660. if (a.firstChild)
  5661. return a.firstChild;
  5662. for (; a && !a.nextSibling;)
  5663. a = a.parentNode;
  5664. return a ? a.nextSibling : null
  5665. }
  5666. ;
  5667. goog.dom.getPreviousNode = function (a) {
  5668. if (!a)
  5669. return null;
  5670. if (!a.previousSibling)
  5671. return a.parentNode;
  5672. for (a = a.previousSibling; a && a.lastChild;)
  5673. a = a.lastChild;
  5674. return a
  5675. }
  5676. ;
  5677. goog.dom.isNodeLike = function (a) {
  5678. return goog.isObject(a) && 0 < a.nodeType
  5679. }
  5680. ;
  5681. goog.dom.isElement = function (a) {
  5682. return goog.isObject(a) && a.nodeType == goog.dom.NodeType.ELEMENT
  5683. }
  5684. ;
  5685. goog.dom.isWindow = function (a) {
  5686. return goog.isObject(a) && a.window == a
  5687. }
  5688. ;
  5689. goog.dom.getParentElement = function (a) {
  5690. var b;
  5691. if (goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY && !(goog.userAgent.IE && goog.userAgent.isVersionOrHigher("9") && !goog.userAgent.isVersionOrHigher("10") && goog.global.SVGElement && a instanceof goog.global.SVGElement) && (b = a.parentElement))
  5692. return b;
  5693. b = a.parentNode;
  5694. return goog.dom.isElement(b) ? b : null
  5695. }
  5696. ;
  5697. goog.dom.contains = function (a, b) {
  5698. if (!a || !b)
  5699. return !1;
  5700. if (a.contains && b.nodeType == goog.dom.NodeType.ELEMENT)
  5701. return a == b || a.contains(b);
  5702. if ("undefined" != typeof a.compareDocumentPosition)
  5703. return a == b || !!(a.compareDocumentPosition(b) & 16);
  5704. for (; b && a != b;)
  5705. b = b.parentNode;
  5706. return b == a
  5707. }
  5708. ;
  5709. goog.dom.compareNodeOrder = function (a, b) {
  5710. if (a == b)
  5711. return 0;
  5712. if (a.compareDocumentPosition)
  5713. return a.compareDocumentPosition(b) & 2 ? 1 : -1;
  5714. if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
  5715. if (a.nodeType == goog.dom.NodeType.DOCUMENT)
  5716. return -1;
  5717. if (b.nodeType == goog.dom.NodeType.DOCUMENT)
  5718. return 1
  5719. }
  5720. if ("sourceIndex" in a || a.parentNode && "sourceIndex" in a.parentNode) {
  5721. var c = a.nodeType == goog.dom.NodeType.ELEMENT
  5722. , d = b.nodeType == goog.dom.NodeType.ELEMENT;
  5723. if (c && d)
  5724. return a.sourceIndex - b.sourceIndex;
  5725. var e = a.parentNode
  5726. , f = b.parentNode;
  5727. return e == f ? goog.dom.compareSiblingOrder_(a, b) : !c && goog.dom.contains(e, b) ? -1 * goog.dom.compareParentsDescendantNodeIe_(a, b) : !d && goog.dom.contains(f, a) ? goog.dom.compareParentsDescendantNodeIe_(b, a) : (c ? a.sourceIndex : e.sourceIndex) - (d ? b.sourceIndex : f.sourceIndex)
  5728. }
  5729. d = goog.dom.getOwnerDocument(a);
  5730. c = d.createRange();
  5731. c.selectNode(a);
  5732. c.collapse(!0);
  5733. d = d.createRange();
  5734. d.selectNode(b);
  5735. d.collapse(!0);
  5736. return c.compareBoundaryPoints(goog.global.Range.START_TO_END, d)
  5737. }
  5738. ;
  5739. goog.dom.compareParentsDescendantNodeIe_ = function (a, b) {
  5740. var c = a.parentNode;
  5741. if (c == b)
  5742. return -1;
  5743. for (var d = b; d.parentNode != c;)
  5744. d = d.parentNode;
  5745. return goog.dom.compareSiblingOrder_(d, a)
  5746. }
  5747. ;
  5748. goog.dom.compareSiblingOrder_ = function (a, b) {
  5749. for (var c = b; c = c.previousSibling;)
  5750. if (c == a)
  5751. return -1;
  5752. return 1
  5753. }
  5754. ;
  5755. goog.dom.findCommonAncestor = function (a) {
  5756. var b, c = arguments.length;
  5757. if (!c)
  5758. return null;
  5759. if (1 == c)
  5760. return arguments[0];
  5761. var d = []
  5762. , e = Infinity;
  5763. for (b = 0; b < c; b++) {
  5764. for (var f = [], g = arguments[b]; g;)
  5765. f.unshift(g),
  5766. g = g.parentNode;
  5767. d.push(f);
  5768. e = Math.min(e, f.length)
  5769. }
  5770. f = null;
  5771. for (b = 0; b < e; b++) {
  5772. g = d[0][b];
  5773. for (var h = 1; h < c; h++)
  5774. if (g != d[h][b])
  5775. return f;
  5776. f = g
  5777. }
  5778. return f
  5779. }
  5780. ;
  5781. goog.dom.isInDocument = function (a) {
  5782. return 16 == (a.ownerDocument.compareDocumentPosition(a) & 16)
  5783. }
  5784. ;
  5785. goog.dom.getOwnerDocument = function (a) {
  5786. goog.asserts.assert(a, "Node cannot be null or undefined.");
  5787. return a.nodeType == goog.dom.NodeType.DOCUMENT ? a : a.ownerDocument || a.document
  5788. }
  5789. ;
  5790. goog.dom.getFrameContentDocument = function (a) {
  5791. return a.contentDocument || a.contentWindow.document
  5792. }
  5793. ;
  5794. goog.dom.getFrameContentWindow = function (a) {
  5795. try {
  5796. return a.contentWindow || (a.contentDocument ? goog.dom.getWindow(a.contentDocument) : null)
  5797. } catch (b) { }
  5798. return null
  5799. }
  5800. ;
  5801. goog.dom.setTextContent = function (a, b) {
  5802. goog.asserts.assert(null != a, "goog.dom.setTextContent expects a non-null value for node");
  5803. if ("textContent" in a)
  5804. a.textContent = b;
  5805. else if (a.nodeType == goog.dom.NodeType.TEXT)
  5806. a.data = String(b);
  5807. else if (a.firstChild && a.firstChild.nodeType == goog.dom.NodeType.TEXT) {
  5808. for (; a.lastChild != a.firstChild;)
  5809. a.removeChild(goog.asserts.assert(a.lastChild));
  5810. a.firstChild.data = String(b)
  5811. } else {
  5812. goog.dom.removeChildren(a);
  5813. var c = goog.dom.getOwnerDocument(a);
  5814. a.appendChild(c.createTextNode(String(b)))
  5815. }
  5816. }
  5817. ;
  5818. goog.dom.getOuterHtml = function (a) {
  5819. goog.asserts.assert(null !== a, "goog.dom.getOuterHtml expects a non-null value for element");
  5820. if ("outerHTML" in a)
  5821. return a.outerHTML;
  5822. var b = goog.dom.getOwnerDocument(a);
  5823. b = goog.dom.createElement_(b, "DIV");
  5824. b.appendChild(a.cloneNode(!0));
  5825. return b.innerHTML
  5826. }
  5827. ;
  5828. goog.dom.findNode = function (a, b) {
  5829. var c = [];
  5830. return goog.dom.findNodes_(a, b, c, !0) ? c[0] : void 0
  5831. }
  5832. ;
  5833. goog.dom.findNodes = function (a, b) {
  5834. var c = [];
  5835. goog.dom.findNodes_(a, b, c, !1);
  5836. return c
  5837. }
  5838. ;
  5839. goog.dom.findNodes_ = function (a, b, c, d) {
  5840. if (null != a)
  5841. for (a = a.firstChild; a;) {
  5842. if (b(a) && (c.push(a),
  5843. d) || goog.dom.findNodes_(a, b, c, d))
  5844. return !0;
  5845. a = a.nextSibling
  5846. }
  5847. return !1
  5848. }
  5849. ;
  5850. goog.dom.findElement = function (a, b) {
  5851. for (var c = goog.dom.getChildrenReverse_(a); 0 < c.length;) {
  5852. var d = c.pop();
  5853. if (b(d))
  5854. return d;
  5855. for (d = d.lastElementChild; d; d = d.previousElementSibling)
  5856. c.push(d)
  5857. }
  5858. return null
  5859. }
  5860. ;
  5861. goog.dom.findElements = function (a, b) {
  5862. for (var c = [], d = goog.dom.getChildrenReverse_(a); 0 < d.length;) {
  5863. var e = d.pop();
  5864. b(e) && c.push(e);
  5865. for (e = e.lastElementChild; e; e = e.previousElementSibling)
  5866. d.push(e)
  5867. }
  5868. return c
  5869. }
  5870. ;
  5871. goog.dom.getChildrenReverse_ = function (a) {
  5872. if (a.nodeType == goog.dom.NodeType.DOCUMENT)
  5873. return [a.documentElement];
  5874. var b = [];
  5875. for (a = a.lastElementChild; a; a = a.previousElementSibling)
  5876. b.push(a);
  5877. return b
  5878. }
  5879. ;
  5880. goog.dom.TAGS_TO_IGNORE_ = {
  5881. SCRIPT: 1,
  5882. STYLE: 1,
  5883. HEAD: 1,
  5884. IFRAME: 1,
  5885. OBJECT: 1
  5886. };
  5887. goog.dom.PREDEFINED_TAG_VALUES_ = {
  5888. IMG: " ",
  5889. BR: "\n"
  5890. };
  5891. goog.dom.isFocusableTabIndex = function (a) {
  5892. return goog.dom.hasSpecifiedTabIndex_(a) && goog.dom.isTabIndexFocusable_(a)
  5893. }
  5894. ;
  5895. goog.dom.setFocusableTabIndex = function (a, b) {
  5896. b ? a.tabIndex = 0 : (a.tabIndex = -1,
  5897. a.removeAttribute("tabIndex"))
  5898. }
  5899. ;
  5900. goog.dom.isFocusable = function (a) {
  5901. var b;
  5902. return (b = goog.dom.nativelySupportsFocus_(a) ? !a.disabled && (!goog.dom.hasSpecifiedTabIndex_(a) || goog.dom.isTabIndexFocusable_(a)) : goog.dom.isFocusableTabIndex(a)) && goog.userAgent.IE ? goog.dom.hasNonZeroBoundingRect_(a) : b
  5903. }
  5904. ;
  5905. goog.dom.hasSpecifiedTabIndex_ = function (a) {
  5906. return goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9") ? (a = a.getAttributeNode("tabindex"),
  5907. null != a && a.specified) : a.hasAttribute("tabindex")
  5908. }
  5909. ;
  5910. goog.dom.isTabIndexFocusable_ = function (a) {
  5911. a = a.tabIndex;
  5912. return "number" === typeof a && 0 <= a && 32768 > a
  5913. }
  5914. ;
  5915. goog.dom.nativelySupportsFocus_ = function (a) {
  5916. return "A" == a.tagName && a.hasAttribute("href") || "INPUT" == a.tagName || "TEXTAREA" == a.tagName || "SELECT" == a.tagName || "BUTTON" == a.tagName
  5917. }
  5918. ;
  5919. goog.dom.hasNonZeroBoundingRect_ = function (a) {
  5920. a = !goog.isFunction(a.getBoundingClientRect) || goog.userAgent.IE && null == a.parentElement ? {
  5921. height: a.offsetHeight,
  5922. width: a.offsetWidth
  5923. } : a.getBoundingClientRect();
  5924. return null != a && 0 < a.height && 0 < a.width
  5925. }
  5926. ;
  5927. goog.dom.getTextContent = function (a) {
  5928. if (goog.dom.BrowserFeature.CAN_USE_INNER_TEXT && null !== a && "innerText" in a)
  5929. a = goog.string.canonicalizeNewlines(a.innerText);
  5930. else {
  5931. var b = [];
  5932. goog.dom.getTextContent_(a, b, !0);
  5933. a = b.join("")
  5934. }
  5935. a = a.replace(/ \xAD /g, " ").replace(/\xAD/g, "");
  5936. a = a.replace(/\u200B/g, "");
  5937. goog.dom.BrowserFeature.CAN_USE_INNER_TEXT || (a = a.replace(/ +/g, " "));
  5938. " " != a && (a = a.replace(/^\s*/, ""));
  5939. return a
  5940. }
  5941. ;
  5942. goog.dom.getRawTextContent = function (a) {
  5943. var b = [];
  5944. goog.dom.getTextContent_(a, b, !1);
  5945. return b.join("")
  5946. }
  5947. ;
  5948. goog.dom.getTextContent_ = function (a, b, c) {
  5949. if (!(a.nodeName in goog.dom.TAGS_TO_IGNORE_))
  5950. if (a.nodeType == goog.dom.NodeType.TEXT)
  5951. c ? b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g, "")) : b.push(a.nodeValue);
  5952. else if (a.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)
  5953. b.push(goog.dom.PREDEFINED_TAG_VALUES_[a.nodeName]);
  5954. else
  5955. for (a = a.firstChild; a;)
  5956. goog.dom.getTextContent_(a, b, c),
  5957. a = a.nextSibling
  5958. }
  5959. ;
  5960. goog.dom.getNodeTextLength = function (a) {
  5961. return goog.dom.getTextContent(a).length
  5962. }
  5963. ;
  5964. goog.dom.getNodeTextOffset = function (a, b) {
  5965. for (var c = b || goog.dom.getOwnerDocument(a).body, d = []; a && a != c;) {
  5966. for (var e = a; e = e.previousSibling;)
  5967. d.unshift(goog.dom.getTextContent(e));
  5968. a = a.parentNode
  5969. }
  5970. return goog.string.trimLeft(d.join("")).replace(/ +/g, " ").length
  5971. }
  5972. ;
  5973. goog.dom.getNodeAtOffset = function (a, b, c) {
  5974. a = [a];
  5975. for (var d = 0, e = null; 0 < a.length && d < b;)
  5976. if (e = a.pop(),
  5977. !(e.nodeName in goog.dom.TAGS_TO_IGNORE_))
  5978. if (e.nodeType == goog.dom.NodeType.TEXT) {
  5979. var f = e.nodeValue.replace(/(\r\n|\r|\n)/g, "").replace(/ +/g, " ");
  5980. d += f.length
  5981. } else if (e.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)
  5982. d += goog.dom.PREDEFINED_TAG_VALUES_[e.nodeName].length;
  5983. else
  5984. for (f = e.childNodes.length - 1; 0 <= f; f--)
  5985. a.push(e.childNodes[f]);
  5986. goog.isObject(c) && (c.remainder = e ? e.nodeValue.length + b - d - 1 : 0,
  5987. c.node = e);
  5988. return e
  5989. }
  5990. ;
  5991. goog.dom.isNodeList = function (a) {
  5992. if (a && "number" == typeof a.length) {
  5993. if (goog.isObject(a))
  5994. return "function" == typeof a.item || "string" == typeof a.item;
  5995. if (goog.isFunction(a))
  5996. return "function" == typeof a.item
  5997. }
  5998. return !1
  5999. }
  6000. ;
  6001. goog.dom.getAncestorByTagNameAndClass = function (a, b, c, d) {
  6002. if (!b && !c)
  6003. return null;
  6004. var e = b ? String(b).toUpperCase() : null;
  6005. return goog.dom.getAncestor(a, function (a) {
  6006. return (!e || a.nodeName == e) && (!c || "string" === typeof a.className && goog.array.contains(a.className.split(/\s+/), c))
  6007. }, !0, d)
  6008. }
  6009. ;
  6010. goog.dom.getAncestorByClass = function (a, b, c) {
  6011. return goog.dom.getAncestorByTagNameAndClass(a, null, b, c)
  6012. }
  6013. ;
  6014. goog.dom.getAncestor = function (a, b, c, d) {
  6015. a && !c && (a = a.parentNode);
  6016. for (c = 0; a && (null == d || c <= d);) {
  6017. goog.asserts.assert("parentNode" != a.name);
  6018. if (b(a))
  6019. return a;
  6020. a = a.parentNode;
  6021. c++
  6022. }
  6023. return null
  6024. }
  6025. ;
  6026. goog.dom.getActiveElement = function (a) {
  6027. try {
  6028. var b = a && a.activeElement;
  6029. return b && b.nodeName ? b : null
  6030. } catch (c) {
  6031. return null
  6032. }
  6033. }
  6034. ;
  6035. goog.dom.getPixelRatio = function () {
  6036. var a = goog.dom.getWindow();
  6037. return void 0 !== a.devicePixelRatio ? a.devicePixelRatio : a.matchMedia ? goog.dom.matchesPixelRatio_(3) || goog.dom.matchesPixelRatio_(2) || goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(1) || .75 : 1
  6038. }
  6039. ;
  6040. goog.dom.matchesPixelRatio_ = function (a) {
  6041. return goog.dom.getWindow().matchMedia("(min-resolution: " + a + "dppx),(min--moz-device-pixel-ratio: " + a + "),(min-resolution: " + 96 * a + "dpi)").matches ? a : 0
  6042. }
  6043. ;
  6044. goog.dom.getCanvasContext2D = function (a) {
  6045. return a.getContext("2d")
  6046. }
  6047. ;
  6048. goog.dom.DomHelper = function (a) {
  6049. this.document_ = a || goog.global.document || document
  6050. }
  6051. ;
  6052. goog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper;
  6053. goog.dom.DomHelper.prototype.setDocument = function (a) {
  6054. this.document_ = a
  6055. }
  6056. ;
  6057. goog.dom.DomHelper.prototype.getDocument = function () {
  6058. return this.document_
  6059. }
  6060. ;
  6061. goog.dom.DomHelper.prototype.getElement = function (a) {
  6062. return goog.dom.getElementHelper_(this.document_, a)
  6063. }
  6064. ;
  6065. goog.dom.DomHelper.prototype.getRequiredElement = function (a) {
  6066. return goog.dom.getRequiredElementHelper_(this.document_, a)
  6067. }
  6068. ;
  6069. goog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement;
  6070. goog.dom.DomHelper.prototype.getElementsByTagName = function (a, b) {
  6071. return (b || this.document_).getElementsByTagName(String(a))
  6072. }
  6073. ;
  6074. goog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function (a, b, c) {
  6075. return goog.dom.getElementsByTagNameAndClass_(this.document_, a, b, c)
  6076. }
  6077. ;
  6078. goog.dom.DomHelper.prototype.getElementByTagNameAndClass = function (a, b, c) {
  6079. return goog.dom.getElementByTagNameAndClass_(this.document_, a, b, c)
  6080. }
  6081. ;
  6082. goog.dom.DomHelper.prototype.getElementsByClass = function (a, b) {
  6083. return goog.dom.getElementsByClass(a, b || this.document_)
  6084. }
  6085. ;
  6086. goog.dom.DomHelper.prototype.getElementByClass = function (a, b) {
  6087. return goog.dom.getElementByClass(a, b || this.document_)
  6088. }
  6089. ;
  6090. goog.dom.DomHelper.prototype.getRequiredElementByClass = function (a, b) {
  6091. return goog.dom.getRequiredElementByClass(a, b || this.document_)
  6092. }
  6093. ;
  6094. goog.dom.DomHelper.prototype.$$ = goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;
  6095. goog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties;
  6096. goog.dom.DomHelper.prototype.getViewportSize = function (a) {
  6097. return goog.dom.getViewportSize(a || this.getWindow())
  6098. }
  6099. ;
  6100. goog.dom.DomHelper.prototype.getDocumentHeight = function () {
  6101. return goog.dom.getDocumentHeight_(this.getWindow())
  6102. }
  6103. ;
  6104. goog.dom.DomHelper.prototype.createDom = function (a, b, c) {
  6105. return goog.dom.createDom_(this.document_, arguments)
  6106. }
  6107. ;
  6108. goog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom;
  6109. goog.dom.DomHelper.prototype.createElement = function (a) {
  6110. return goog.dom.createElement_(this.document_, a)
  6111. }
  6112. ;
  6113. goog.dom.DomHelper.prototype.createTextNode = function (a) {
  6114. return this.document_.createTextNode(String(a))
  6115. }
  6116. ;
  6117. goog.dom.DomHelper.prototype.createTable = function (a, b, c) {
  6118. return goog.dom.createTable_(this.document_, a, b, !!c)
  6119. }
  6120. ;
  6121. goog.dom.DomHelper.prototype.safeHtmlToNode = function (a) {
  6122. return goog.dom.safeHtmlToNode_(this.document_, a)
  6123. }
  6124. ;
  6125. goog.dom.DomHelper.prototype.isCss1CompatMode = function () {
  6126. return goog.dom.isCss1CompatMode_(this.document_)
  6127. }
  6128. ;
  6129. goog.dom.DomHelper.prototype.getWindow = function () {
  6130. return goog.dom.getWindow_(this.document_)
  6131. }
  6132. ;
  6133. goog.dom.DomHelper.prototype.getDocumentScrollElement = function () {
  6134. return goog.dom.getDocumentScrollElement_(this.document_)
  6135. }
  6136. ;
  6137. goog.dom.DomHelper.prototype.getDocumentScroll = function () {
  6138. return goog.dom.getDocumentScroll_(this.document_)
  6139. }
  6140. ;
  6141. goog.dom.DomHelper.prototype.getActiveElement = function (a) {
  6142. return goog.dom.getActiveElement(a || this.document_)
  6143. }
  6144. ;
  6145. goog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild;
  6146. goog.dom.DomHelper.prototype.append = goog.dom.append;
  6147. goog.dom.DomHelper.prototype.canHaveChildren = goog.dom.canHaveChildren;
  6148. goog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren;
  6149. goog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore;
  6150. goog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter;
  6151. goog.dom.DomHelper.prototype.insertChildAt = goog.dom.insertChildAt;
  6152. goog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode;
  6153. goog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode;
  6154. goog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement;
  6155. goog.dom.DomHelper.prototype.getChildren = goog.dom.getChildren;
  6156. goog.dom.DomHelper.prototype.getFirstElementChild = goog.dom.getFirstElementChild;
  6157. goog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild;
  6158. goog.dom.DomHelper.prototype.getNextElementSibling = goog.dom.getNextElementSibling;
  6159. goog.dom.DomHelper.prototype.getPreviousElementSibling = goog.dom.getPreviousElementSibling;
  6160. goog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode;
  6161. goog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode;
  6162. goog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike;
  6163. goog.dom.DomHelper.prototype.isElement = goog.dom.isElement;
  6164. goog.dom.DomHelper.prototype.isWindow = goog.dom.isWindow;
  6165. goog.dom.DomHelper.prototype.getParentElement = goog.dom.getParentElement;
  6166. goog.dom.DomHelper.prototype.contains = goog.dom.contains;
  6167. goog.dom.DomHelper.prototype.compareNodeOrder = goog.dom.compareNodeOrder;
  6168. goog.dom.DomHelper.prototype.findCommonAncestor = goog.dom.findCommonAncestor;
  6169. goog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument;
  6170. goog.dom.DomHelper.prototype.getFrameContentDocument = goog.dom.getFrameContentDocument;
  6171. goog.dom.DomHelper.prototype.getFrameContentWindow = goog.dom.getFrameContentWindow;
  6172. goog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent;
  6173. goog.dom.DomHelper.prototype.getOuterHtml = goog.dom.getOuterHtml;
  6174. goog.dom.DomHelper.prototype.findNode = goog.dom.findNode;
  6175. goog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes;
  6176. goog.dom.DomHelper.prototype.isFocusableTabIndex = goog.dom.isFocusableTabIndex;
  6177. goog.dom.DomHelper.prototype.setFocusableTabIndex = goog.dom.setFocusableTabIndex;
  6178. goog.dom.DomHelper.prototype.isFocusable = goog.dom.isFocusable;
  6179. goog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent;
  6180. goog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength;
  6181. goog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset;
  6182. goog.dom.DomHelper.prototype.getNodeAtOffset = goog.dom.getNodeAtOffset;
  6183. goog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList;
  6184. goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass = goog.dom.getAncestorByTagNameAndClass;
  6185. goog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass;
  6186. goog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor;
  6187. goog.dom.DomHelper.prototype.getCanvasContext2D = goog.dom.getCanvasContext2D;
  6188. goog.async.throwException = function (a) {
  6189. goog.global.setTimeout(function () {
  6190. throw a;
  6191. }, 0)
  6192. }
  6193. ;
  6194. goog.async.nextTick = function (a, b, c) {
  6195. var d = a;
  6196. b && (d = goog.bind(a, b));
  6197. d = goog.async.nextTick.wrapCallback_(d);
  6198. goog.isFunction(goog.global.setImmediate) && (c || goog.async.nextTick.useSetImmediate_()) ? goog.global.setImmediate(d) : (goog.async.nextTick.setImmediate_ || (goog.async.nextTick.setImmediate_ = goog.async.nextTick.getSetImmediateEmulator_()),
  6199. goog.async.nextTick.setImmediate_(d))
  6200. }
  6201. ;
  6202. goog.async.nextTick.useSetImmediate_ = function () {
  6203. return goog.global.Window && goog.global.Window.prototype && !goog.labs.userAgent.browser.isEdge() && goog.global.Window.prototype.setImmediate == goog.global.setImmediate ? !1 : !0
  6204. }
  6205. ;
  6206. goog.async.nextTick.getSetImmediateEmulator_ = function () {
  6207. var a = goog.global.MessageChannel;
  6208. "undefined" === typeof a && "undefined" !== typeof window && window.postMessage && window.addEventListener && !goog.labs.userAgent.engine.isPresto() && (a = function () {
  6209. var a = goog.dom.createElement("IFRAME");
  6210. a.style.display = "none";
  6211. goog.dom.safe.setIframeSrc(a, goog.html.TrustedResourceUrl.fromConstant(goog.string.Const.EMPTY));
  6212. document.documentElement.appendChild(a);
  6213. var b = a.contentWindow;
  6214. a = b.document;
  6215. a.open();
  6216. goog.dom.safe.documentWrite(a, goog.html.SafeHtml.EMPTY);
  6217. a.close();
  6218. var c = "callImmediate" + Math.random()
  6219. , d = "file:" == b.location.protocol ? "*" : b.location.protocol + "//" + b.location.host;
  6220. a = goog.bind(function (a) {
  6221. if (("*" == d || a.origin == d) && a.data == c)
  6222. this.port1.onmessage()
  6223. }, this);
  6224. b.addEventListener("message", a, !1);
  6225. this.port1 = {};
  6226. this.port2 = {
  6227. postMessage: function () {
  6228. b.postMessage(c, d)
  6229. }
  6230. }
  6231. }
  6232. );
  6233. if ("undefined" !== typeof a && !goog.labs.userAgent.browser.isIE()) {
  6234. var b = new a
  6235. , c = {}
  6236. , d = c;
  6237. b.port1.onmessage = function () {
  6238. if (void 0 !== c.next) {
  6239. c = c.next;
  6240. var a = c.cb;
  6241. c.cb = null;
  6242. a()
  6243. }
  6244. }
  6245. ;
  6246. return function (a) {
  6247. d.next = {
  6248. cb: a
  6249. };
  6250. d = d.next;
  6251. b.port2.postMessage(0)
  6252. }
  6253. }
  6254. return "undefined" !== typeof document && "onreadystatechange" in goog.dom.createElement("SCRIPT") ? function (a) {
  6255. var b = goog.dom.createElement("SCRIPT");
  6256. b.onreadystatechange = function () {
  6257. b.onreadystatechange = null;
  6258. b.parentNode.removeChild(b);
  6259. b = null;
  6260. a();
  6261. a = null
  6262. }
  6263. ;
  6264. document.documentElement.appendChild(b)
  6265. }
  6266. : function (a) {
  6267. goog.global.setTimeout(a, 0)
  6268. }
  6269. }
  6270. ;
  6271. goog.async.nextTick.wrapCallback_ = goog.functions.identity;
  6272. goog.debug.entryPointRegistry.register(function (a) {
  6273. goog.async.nextTick.wrapCallback_ = a
  6274. });
  6275. goog.ASSUME_NATIVE_PROMISE = !1;
  6276. goog.async.run = function (a, b) {
  6277. goog.async.run.schedule_ || goog.async.run.initializeRunner_();
  6278. goog.async.run.workQueueScheduled_ || (goog.async.run.schedule_(),
  6279. goog.async.run.workQueueScheduled_ = !0);
  6280. goog.async.run.workQueue_.add(a, b)
  6281. }
  6282. ;
  6283. goog.async.run.initializeRunner_ = function () {
  6284. if (goog.ASSUME_NATIVE_PROMISE || goog.global.Promise && goog.global.Promise.resolve) {
  6285. var a = goog.global.Promise.resolve(void 0);
  6286. goog.async.run.schedule_ = function () {
  6287. a.then(goog.async.run.processWorkQueue)
  6288. }
  6289. } else
  6290. goog.async.run.schedule_ = function () {
  6291. goog.async.nextTick(goog.async.run.processWorkQueue)
  6292. }
  6293. }
  6294. ;
  6295. goog.async.run.forceNextTick = function (a) {
  6296. goog.async.run.schedule_ = function () {
  6297. goog.async.nextTick(goog.async.run.processWorkQueue);
  6298. a && a(goog.async.run.processWorkQueue)
  6299. }
  6300. }
  6301. ;
  6302. goog.async.run.workQueueScheduled_ = !1;
  6303. goog.async.run.workQueue_ = new goog.async.WorkQueue;
  6304. goog.DEBUG && (goog.async.run.resetQueue = function () {
  6305. goog.async.run.workQueueScheduled_ = !1;
  6306. goog.async.run.workQueue_ = new goog.async.WorkQueue
  6307. }
  6308. );
  6309. goog.async.run.processWorkQueue = function () {
  6310. for (var a; a = goog.async.run.workQueue_.remove();) {
  6311. try {
  6312. a.fn.call(a.scope)
  6313. } catch (b) {
  6314. goog.async.throwException(b)
  6315. }
  6316. goog.async.run.workQueue_.returnUnused(a)
  6317. }
  6318. goog.async.run.workQueueScheduled_ = !1
  6319. }
  6320. ;
  6321. goog.promise = {};
  6322. goog.promise.Resolver = function () { }
  6323. ;
  6324. goog.Promise = function (a, b) {
  6325. this.state_ = goog.Promise.State_.PENDING;
  6326. this.result_ = void 0;
  6327. this.callbackEntriesTail_ = this.callbackEntries_ = this.parent_ = null;
  6328. this.executing_ = !1;
  6329. 0 < goog.Promise.UNHANDLED_REJECTION_DELAY ? this.unhandledRejectionId_ = 0 : 0 == goog.Promise.UNHANDLED_REJECTION_DELAY && (this.hadUnhandledRejection_ = !1);
  6330. goog.Promise.LONG_STACK_TRACES && (this.stack_ = [],
  6331. this.addStackTrace_(Error("created")),
  6332. this.currentStep_ = 0);
  6333. if (a != goog.nullFunction)
  6334. try {
  6335. var c = this;
  6336. a.call(b, function (a) {
  6337. c.resolve_(goog.Promise.State_.FULFILLED, a)
  6338. }, function (a) {
  6339. if (goog.DEBUG && !(a instanceof goog.Promise.CancellationError))
  6340. try {
  6341. if (a instanceof Error)
  6342. throw a;
  6343. throw Error("Promise rejected.");
  6344. } catch (e) { }
  6345. c.resolve_(goog.Promise.State_.REJECTED, a)
  6346. })
  6347. } catch (d) {
  6348. this.resolve_(goog.Promise.State_.REJECTED, d)
  6349. }
  6350. }
  6351. ;
  6352. goog.Promise.LONG_STACK_TRACES = !1;
  6353. goog.Promise.UNHANDLED_REJECTION_DELAY = 0;
  6354. goog.Promise.State_ = {
  6355. PENDING: 0,
  6356. BLOCKED: 1,
  6357. FULFILLED: 2,
  6358. REJECTED: 3
  6359. };
  6360. goog.Promise.CallbackEntry_ = function () {
  6361. this.next = this.context = this.onRejected = this.onFulfilled = this.child = null;
  6362. this.always = !1
  6363. }
  6364. ;
  6365. goog.Promise.CallbackEntry_.prototype.reset = function () {
  6366. this.context = this.onRejected = this.onFulfilled = this.child = null;
  6367. this.always = !1
  6368. }
  6369. ;
  6370. goog.Promise.DEFAULT_MAX_UNUSED = 100;
  6371. goog.Promise.freelist_ = new goog.async.FreeList(function () {
  6372. return new goog.Promise.CallbackEntry_
  6373. }
  6374. , function (a) {
  6375. a.reset()
  6376. }
  6377. , goog.Promise.DEFAULT_MAX_UNUSED);
  6378. goog.Promise.getCallbackEntry_ = function (a, b, c) {
  6379. var d = goog.Promise.freelist_.get();
  6380. d.onFulfilled = a;
  6381. d.onRejected = b;
  6382. d.context = c;
  6383. return d
  6384. }
  6385. ;
  6386. goog.Promise.returnEntry_ = function (a) {
  6387. goog.Promise.freelist_.put(a)
  6388. }
  6389. ;
  6390. goog.Promise.resolve = function (a) {
  6391. if (a instanceof goog.Promise)
  6392. return a;
  6393. var b = new goog.Promise(goog.nullFunction);
  6394. b.resolve_(goog.Promise.State_.FULFILLED, a);
  6395. return b
  6396. }
  6397. ;
  6398. goog.Promise.reject = function (a) {
  6399. return new goog.Promise(function (b, c) {
  6400. c(a)
  6401. }
  6402. )
  6403. }
  6404. ;
  6405. goog.Promise.resolveThen_ = function (a, b, c) {
  6406. goog.Promise.maybeThen_(a, b, c, null) || goog.async.run(goog.partial(b, a))
  6407. }
  6408. ;
  6409. goog.Promise.race = function (a) {
  6410. return new goog.Promise(function (b, c) {
  6411. a.length || b(void 0);
  6412. for (var d = 0, e; d < a.length; d++)
  6413. e = a[d],
  6414. goog.Promise.resolveThen_(e, b, c)
  6415. }
  6416. )
  6417. }
  6418. ;
  6419. goog.Promise.all = function (a) {
  6420. return new goog.Promise(function (b, c) {
  6421. var d = a.length
  6422. , e = [];
  6423. if (d)
  6424. for (var f = function (a, c) {
  6425. d--;
  6426. e[a] = c;
  6427. 0 == d && b(e)
  6428. }, g = function (a) {
  6429. c(a)
  6430. }, h = 0, k; h < a.length; h++)
  6431. k = a[h],
  6432. goog.Promise.resolveThen_(k, goog.partial(f, h), g);
  6433. else
  6434. b(e)
  6435. }
  6436. )
  6437. }
  6438. ;
  6439. goog.Promise.allSettled = function (a) {
  6440. return new goog.Promise(function (b, c) {
  6441. var d = a.length
  6442. , e = [];
  6443. if (d)
  6444. for (var f = function (a, c, f) {
  6445. d--;
  6446. e[a] = c ? {
  6447. fulfilled: !0,
  6448. value: f
  6449. } : {
  6450. fulfilled: !1,
  6451. reason: f
  6452. };
  6453. 0 == d && b(e)
  6454. }, g = 0, h; g < a.length; g++)
  6455. h = a[g],
  6456. goog.Promise.resolveThen_(h, goog.partial(f, g, !0), goog.partial(f, g, !1));
  6457. else
  6458. b(e)
  6459. }
  6460. )
  6461. }
  6462. ;
  6463. goog.Promise.firstFulfilled = function (a) {
  6464. return new goog.Promise(function (b, c) {
  6465. var d = a.length
  6466. , e = [];
  6467. if (d)
  6468. for (var f = function (a) {
  6469. b(a)
  6470. }, g = function (a, b) {
  6471. d--;
  6472. e[a] = b;
  6473. 0 == d && c(e)
  6474. }, h = 0, k; h < a.length; h++)
  6475. k = a[h],
  6476. goog.Promise.resolveThen_(k, f, goog.partial(g, h));
  6477. else
  6478. b(void 0)
  6479. }
  6480. )
  6481. }
  6482. ;
  6483. goog.Promise.withResolver = function () {
  6484. var a, b, c = new goog.Promise(function (c, e) {
  6485. a = c;
  6486. b = e
  6487. }
  6488. );
  6489. return new goog.Promise.Resolver_(c, a, b)
  6490. }
  6491. ;
  6492. goog.Promise.prototype.then = function (a, b, c) {
  6493. null != a && goog.asserts.assertFunction(a, "opt_onFulfilled should be a function.");
  6494. null != b && goog.asserts.assertFunction(b, "opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");
  6495. goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("then"));
  6496. return this.addChildPromise_(goog.isFunction(a) ? a : null, goog.isFunction(b) ? b : null, c)
  6497. }
  6498. ;
  6499. goog.Thenable.addImplementation(goog.Promise);
  6500. goog.Promise.prototype.thenVoid = function (a, b, c) {
  6501. null != a && goog.asserts.assertFunction(a, "opt_onFulfilled should be a function.");
  6502. null != b && goog.asserts.assertFunction(b, "opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");
  6503. goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("then"));
  6504. this.addCallbackEntry_(goog.Promise.getCallbackEntry_(a || goog.nullFunction, b || null, c))
  6505. }
  6506. ;
  6507. goog.Promise.prototype.thenAlways = function (a, b) {
  6508. goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("thenAlways"));
  6509. var c = goog.Promise.getCallbackEntry_(a, a, b);
  6510. c.always = !0;
  6511. this.addCallbackEntry_(c);
  6512. return this
  6513. }
  6514. ;
  6515. goog.Promise.prototype.thenCatch = function (a, b) {
  6516. goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("thenCatch"));
  6517. return this.addChildPromise_(null, a, b)
  6518. }
  6519. ;
  6520. goog.Promise.prototype.cancel = function (a) {
  6521. if (this.state_ == goog.Promise.State_.PENDING) {
  6522. var b = new goog.Promise.CancellationError(a);
  6523. goog.async.run(function () {
  6524. this.cancelInternal_(b)
  6525. }, this)
  6526. }
  6527. }
  6528. ;
  6529. goog.Promise.prototype.cancelInternal_ = function (a) {
  6530. this.state_ == goog.Promise.State_.PENDING && (this.parent_ ? (this.parent_.cancelChild_(this, a),
  6531. this.parent_ = null) : this.resolve_(goog.Promise.State_.REJECTED, a))
  6532. }
  6533. ;
  6534. goog.Promise.prototype.cancelChild_ = function (a, b) {
  6535. if (this.callbackEntries_) {
  6536. for (var c = 0, d = null, e = null, f = this.callbackEntries_; f && (f.always || (c++,
  6537. f.child == a && (d = f),
  6538. !(d && 1 < c))); f = f.next)
  6539. d || (e = f);
  6540. d && (this.state_ == goog.Promise.State_.PENDING && 1 == c ? this.cancelInternal_(b) : (e ? this.removeEntryAfter_(e) : this.popEntry_(),
  6541. this.executeCallback_(d, goog.Promise.State_.REJECTED, b)))
  6542. }
  6543. }
  6544. ;
  6545. goog.Promise.prototype.addCallbackEntry_ = function (a) {
  6546. this.hasEntry_() || this.state_ != goog.Promise.State_.FULFILLED && this.state_ != goog.Promise.State_.REJECTED || this.scheduleCallbacks_();
  6547. this.queueEntry_(a)
  6548. }
  6549. ;
  6550. goog.Promise.prototype.addChildPromise_ = function (a, b, c) {
  6551. var d = goog.Promise.getCallbackEntry_(null, null, null);
  6552. d.child = new goog.Promise(function (e, f) {
  6553. d.onFulfilled = a ? function (b) {
  6554. try {
  6555. var d = a.call(c, b);
  6556. e(d)
  6557. } catch (k) {
  6558. f(k)
  6559. }
  6560. }
  6561. : e;
  6562. d.onRejected = b ? function (a) {
  6563. try {
  6564. var d = b.call(c, a);
  6565. void 0 === d && a instanceof goog.Promise.CancellationError ? f(a) : e(d)
  6566. } catch (k) {
  6567. f(k)
  6568. }
  6569. }
  6570. : f
  6571. }
  6572. );
  6573. d.child.parent_ = this;
  6574. this.addCallbackEntry_(d);
  6575. return d.child
  6576. }
  6577. ;
  6578. goog.Promise.prototype.unblockAndFulfill_ = function (a) {
  6579. goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED);
  6580. this.state_ = goog.Promise.State_.PENDING;
  6581. this.resolve_(goog.Promise.State_.FULFILLED, a)
  6582. }
  6583. ;
  6584. goog.Promise.prototype.unblockAndReject_ = function (a) {
  6585. goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED);
  6586. this.state_ = goog.Promise.State_.PENDING;
  6587. this.resolve_(goog.Promise.State_.REJECTED, a)
  6588. }
  6589. ;
  6590. goog.Promise.prototype.resolve_ = function (a, b) {
  6591. this.state_ == goog.Promise.State_.PENDING && (this === b && (a = goog.Promise.State_.REJECTED,
  6592. b = new TypeError("Promise cannot resolve to itself")),
  6593. this.state_ = goog.Promise.State_.BLOCKED,
  6594. goog.Promise.maybeThen_(b, this.unblockAndFulfill_, this.unblockAndReject_, this) || (this.result_ = b,
  6595. this.state_ = a,
  6596. this.parent_ = null,
  6597. this.scheduleCallbacks_(),
  6598. a != goog.Promise.State_.REJECTED || b instanceof goog.Promise.CancellationError || goog.Promise.addUnhandledRejection_(this, b)))
  6599. }
  6600. ;
  6601. goog.Promise.maybeThen_ = function (a, b, c, d) {
  6602. if (a instanceof goog.Promise)
  6603. return a.thenVoid(b, c, d),
  6604. !0;
  6605. if (goog.Thenable.isImplementedBy(a))
  6606. return a.then(b, c, d),
  6607. !0;
  6608. if (goog.isObject(a))
  6609. try {
  6610. var e = a.then;
  6611. if (goog.isFunction(e))
  6612. return goog.Promise.tryThen_(a, e, b, c, d),
  6613. !0
  6614. } catch (f) {
  6615. return c.call(d, f),
  6616. !0
  6617. }
  6618. return !1
  6619. }
  6620. ;
  6621. goog.Promise.tryThen_ = function (a, b, c, d, e) {
  6622. var f = !1
  6623. , g = function (a) {
  6624. f || (f = !0,
  6625. c.call(e, a))
  6626. }
  6627. , h = function (a) {
  6628. f || (f = !0,
  6629. d.call(e, a))
  6630. };
  6631. try {
  6632. b.call(a, g, h)
  6633. } catch (k) {
  6634. h(k)
  6635. }
  6636. }
  6637. ;
  6638. goog.Promise.prototype.scheduleCallbacks_ = function () {
  6639. this.executing_ || (this.executing_ = !0,
  6640. goog.async.run(this.executeCallbacks_, this))
  6641. }
  6642. ;
  6643. goog.Promise.prototype.hasEntry_ = function () {
  6644. return !!this.callbackEntries_
  6645. }
  6646. ;
  6647. goog.Promise.prototype.queueEntry_ = function (a) {
  6648. goog.asserts.assert(null != a.onFulfilled);
  6649. this.callbackEntriesTail_ ? this.callbackEntriesTail_.next = a : this.callbackEntries_ = a;
  6650. this.callbackEntriesTail_ = a
  6651. }
  6652. ;
  6653. goog.Promise.prototype.popEntry_ = function () {
  6654. var a = null;
  6655. this.callbackEntries_ && (a = this.callbackEntries_,
  6656. this.callbackEntries_ = a.next,
  6657. a.next = null);
  6658. this.callbackEntries_ || (this.callbackEntriesTail_ = null);
  6659. null != a && goog.asserts.assert(null != a.onFulfilled);
  6660. return a
  6661. }
  6662. ;
  6663. goog.Promise.prototype.removeEntryAfter_ = function (a) {
  6664. goog.asserts.assert(this.callbackEntries_);
  6665. goog.asserts.assert(null != a);
  6666. a.next == this.callbackEntriesTail_ && (this.callbackEntriesTail_ = a);
  6667. a.next = a.next.next
  6668. }
  6669. ;
  6670. goog.Promise.prototype.executeCallbacks_ = function () {
  6671. for (var a; a = this.popEntry_();)
  6672. goog.Promise.LONG_STACK_TRACES && this.currentStep_++,
  6673. this.executeCallback_(a, this.state_, this.result_);
  6674. this.executing_ = !1
  6675. }
  6676. ;
  6677. goog.Promise.prototype.executeCallback_ = function (a, b, c) {
  6678. b == goog.Promise.State_.REJECTED && a.onRejected && !a.always && this.removeUnhandledRejection_();
  6679. if (a.child)
  6680. a.child.parent_ = null,
  6681. goog.Promise.invokeCallback_(a, b, c);
  6682. else
  6683. try {
  6684. a.always ? a.onFulfilled.call(a.context) : goog.Promise.invokeCallback_(a, b, c)
  6685. } catch (d) {
  6686. goog.Promise.handleRejection_.call(null, d)
  6687. }
  6688. goog.Promise.returnEntry_(a)
  6689. }
  6690. ;
  6691. goog.Promise.invokeCallback_ = function (a, b, c) {
  6692. b == goog.Promise.State_.FULFILLED ? a.onFulfilled.call(a.context, c) : a.onRejected && a.onRejected.call(a.context, c)
  6693. }
  6694. ;
  6695. goog.Promise.prototype.addStackTrace_ = function (a) {
  6696. if (goog.Promise.LONG_STACK_TRACES && "string" === typeof a.stack) {
  6697. var b = a.stack.split("\n", 4)[3];
  6698. a = a.message;
  6699. a += Array(11 - a.length).join(" ");
  6700. this.stack_.push(a + b)
  6701. }
  6702. }
  6703. ;
  6704. goog.Promise.prototype.appendLongStack_ = function (a) {
  6705. if (goog.Promise.LONG_STACK_TRACES && a && "string" === typeof a.stack && this.stack_.length) {
  6706. for (var b = ["Promise trace:"], c = this; c; c = c.parent_) {
  6707. for (var d = this.currentStep_; 0 <= d; d--)
  6708. b.push(c.stack_[d]);
  6709. b.push("Value: [" + (c.state_ == goog.Promise.State_.REJECTED ? "REJECTED" : "FULFILLED") + "] <" + String(c.result_) + ">")
  6710. }
  6711. a.stack += "\n\n" + b.join("\n")
  6712. }
  6713. }
  6714. ;
  6715. goog.Promise.prototype.removeUnhandledRejection_ = function () {
  6716. if (0 < goog.Promise.UNHANDLED_REJECTION_DELAY)
  6717. for (var a = this; a && a.unhandledRejectionId_; a = a.parent_)
  6718. goog.global.clearTimeout(a.unhandledRejectionId_),
  6719. a.unhandledRejectionId_ = 0;
  6720. else if (0 == goog.Promise.UNHANDLED_REJECTION_DELAY)
  6721. for (a = this; a && a.hadUnhandledRejection_; a = a.parent_)
  6722. a.hadUnhandledRejection_ = !1
  6723. }
  6724. ;
  6725. goog.Promise.addUnhandledRejection_ = function (a, b) {
  6726. 0 < goog.Promise.UNHANDLED_REJECTION_DELAY ? a.unhandledRejectionId_ = goog.global.setTimeout(function () {
  6727. a.appendLongStack_(b);
  6728. goog.Promise.handleRejection_.call(null, b)
  6729. }, goog.Promise.UNHANDLED_REJECTION_DELAY) : 0 == goog.Promise.UNHANDLED_REJECTION_DELAY && (a.hadUnhandledRejection_ = !0,
  6730. goog.async.run(function () {
  6731. a.hadUnhandledRejection_ && (a.appendLongStack_(b),
  6732. goog.Promise.handleRejection_.call(null, b))
  6733. }))
  6734. }
  6735. ;
  6736. goog.Promise.handleRejection_ = goog.async.throwException;
  6737. goog.Promise.setUnhandledRejectionHandler = function (a) {
  6738. goog.Promise.handleRejection_ = a
  6739. }
  6740. ;
  6741. goog.Promise.CancellationError = function (a) {
  6742. goog.debug.Error.call(this, a)
  6743. }
  6744. ;
  6745. goog.inherits(goog.Promise.CancellationError, goog.debug.Error);
  6746. goog.Promise.CancellationError.prototype.name = "cancel";
  6747. goog.Promise.Resolver_ = function (a, b, c) {
  6748. this.promise = a;
  6749. this.resolve = b;
  6750. this.reject = c
  6751. }
  6752. ;
  6753. goog.disposable = {};
  6754. goog.disposable.IDisposable = function () { }
  6755. ;
  6756. goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod;
  6757. goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod;
  6758. goog.Disposable = function () {
  6759. goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF && (goog.Disposable.INCLUDE_STACK_ON_CREATION && (this.creationStack = Error().stack),
  6760. goog.Disposable.instances_[goog.getUid(this)] = this);
  6761. this.disposed_ = this.disposed_;
  6762. this.onDisposeCallbacks_ = this.onDisposeCallbacks_
  6763. }
  6764. ;
  6765. goog.Disposable.MonitoringMode = {
  6766. OFF: 0,
  6767. PERMANENT: 1,
  6768. INTERACTIVE: 2
  6769. };
  6770. goog.Disposable.MONITORING_MODE = 0;
  6771. goog.Disposable.INCLUDE_STACK_ON_CREATION = !0;
  6772. goog.Disposable.instances_ = {};
  6773. goog.Disposable.getUndisposedObjects = function () {
  6774. var a = [], b;
  6775. for (b in goog.Disposable.instances_)
  6776. goog.Disposable.instances_.hasOwnProperty(b) && a.push(goog.Disposable.instances_[Number(b)]);
  6777. return a
  6778. }
  6779. ;
  6780. goog.Disposable.clearUndisposedObjects = function () {
  6781. goog.Disposable.instances_ = {}
  6782. }
  6783. ;
  6784. goog.Disposable.prototype.disposed_ = !1;
  6785. goog.Disposable.prototype.isDisposed = function () {
  6786. return this.disposed_
  6787. }
  6788. ;
  6789. goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed;
  6790. goog.Disposable.prototype.dispose = function () {
  6791. if (!this.disposed_ && (this.disposed_ = !0,
  6792. this.disposeInternal(),
  6793. goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF)) {
  6794. var a = goog.getUid(this);
  6795. if (goog.Disposable.MONITORING_MODE == goog.Disposable.MonitoringMode.PERMANENT && !goog.Disposable.instances_.hasOwnProperty(a))
  6796. throw Error(this + " did not call the goog.Disposable base constructor or was disposed of after a clearUndisposedObjects call");
  6797. if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF && this.onDisposeCallbacks_ && 0 < this.onDisposeCallbacks_.length)
  6798. throw Error(this + " did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");
  6799. delete goog.Disposable.instances_[a]
  6800. }
  6801. }
  6802. ;
  6803. goog.Disposable.prototype.registerDisposable = function (a) {
  6804. this.addOnDisposeCallback(goog.partial(goog.dispose, a))
  6805. }
  6806. ;
  6807. goog.Disposable.prototype.addOnDisposeCallback = function (a, b) {
  6808. this.disposed_ ? void 0 !== b ? a.call(b) : a() : (this.onDisposeCallbacks_ || (this.onDisposeCallbacks_ = []),
  6809. this.onDisposeCallbacks_.push(void 0 !== b ? goog.bind(a, b) : a))
  6810. }
  6811. ;
  6812. goog.Disposable.prototype.disposeInternal = function () {
  6813. if (this.onDisposeCallbacks_)
  6814. for (; this.onDisposeCallbacks_.length;)
  6815. this.onDisposeCallbacks_.shift()()
  6816. }
  6817. ;
  6818. goog.Disposable.isDisposed = function (a) {
  6819. return a && "function" == typeof a.isDisposed ? a.isDisposed() : !1
  6820. }
  6821. ;
  6822. goog.dispose = function (a) {
  6823. a && "function" == typeof a.dispose && a.dispose()
  6824. }
  6825. ;
  6826. goog.disposeAll = function (a) {
  6827. for (var b = 0, c = arguments.length; b < c; ++b) {
  6828. var d = arguments[b];
  6829. goog.isArrayLike(d) ? goog.disposeAll.apply(null, d) : goog.dispose(d)
  6830. }
  6831. }
  6832. ;
  6833. goog.debug.errorcontext = {};
  6834. goog.debug.errorcontext.addErrorContext = function (a, b, c) {
  6835. a[goog.debug.errorcontext.CONTEXT_KEY_] || (a[goog.debug.errorcontext.CONTEXT_KEY_] = {});
  6836. a[goog.debug.errorcontext.CONTEXT_KEY_][b] = c
  6837. }
  6838. ;
  6839. goog.debug.errorcontext.getErrorContext = function (a) {
  6840. return a[goog.debug.errorcontext.CONTEXT_KEY_] || {}
  6841. }
  6842. ;
  6843. goog.debug.errorcontext.CONTEXT_KEY_ = "__closure__error__context__984382";
  6844. goog.debug.LOGGING_ENABLED = goog.DEBUG;
  6845. goog.debug.FORCE_SLOPPY_STACKS = !1;
  6846. goog.debug.catchErrors = function (a, b, c) {
  6847. c = c || goog.global;
  6848. var d = c.onerror
  6849. , e = !!b;
  6850. goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("535.3") && (e = !e);
  6851. c.onerror = function (b, c, h, k, m) {
  6852. d && d(b, c, h, k, m);
  6853. a({
  6854. message: b,
  6855. fileName: c,
  6856. line: h,
  6857. lineNumber: h,
  6858. col: k,
  6859. error: m
  6860. });
  6861. return e
  6862. }
  6863. }
  6864. ;
  6865. goog.debug.expose = function (a, b) {
  6866. if ("undefined" == typeof a)
  6867. return "undefined";
  6868. if (null == a)
  6869. return "NULL";
  6870. var c = [], d;
  6871. for (d in a)
  6872. if (b || !goog.isFunction(a[d])) {
  6873. var e = d + " = ";
  6874. try {
  6875. e += a[d]
  6876. } catch (f) {
  6877. e += "*** " + f + " ***"
  6878. }
  6879. c.push(e)
  6880. }
  6881. return c.join("\n")
  6882. }
  6883. ;
  6884. goog.debug.deepExpose = function (a, b) {
  6885. var c = []
  6886. , d = []
  6887. , e = {}
  6888. , f = function (a, g) {
  6889. var h = g + " ";
  6890. try {
  6891. if (void 0 === a)
  6892. c.push("undefined");
  6893. else if (null === a)
  6894. c.push("NULL");
  6895. else if ("string" === typeof a)
  6896. c.push('"' + a.replace(/\n/g, "\n" + g) + '"');
  6897. else if (goog.isFunction(a))
  6898. c.push(String(a).replace(/\n/g, "\n" + g));
  6899. else if (goog.isObject(a)) {
  6900. goog.hasUid(a) || d.push(a);
  6901. var k = goog.getUid(a);
  6902. if (e[k])
  6903. c.push("*** reference loop detected (id=" + k + ") ***");
  6904. else {
  6905. e[k] = !0;
  6906. c.push("{");
  6907. for (var l in a)
  6908. if (b || !goog.isFunction(a[l]))
  6909. c.push("\n"),
  6910. c.push(h),
  6911. c.push(l + " = "),
  6912. f(a[l], h);
  6913. c.push("\n" + g + "}");
  6914. delete e[k]
  6915. }
  6916. } else
  6917. c.push(a)
  6918. } catch (n) {
  6919. c.push("*** " + n + " ***")
  6920. }
  6921. };
  6922. f(a, "");
  6923. for (var g = 0; g < d.length; g++)
  6924. goog.removeUid(d[g]);
  6925. return c.join("")
  6926. }
  6927. ;
  6928. goog.debug.exposeArray = function (a) {
  6929. for (var b = [], c = 0; c < a.length; c++)
  6930. goog.isArray(a[c]) ? b.push(goog.debug.exposeArray(a[c])) : b.push(a[c]);
  6931. return "[ " + b.join(", ") + " ]"
  6932. }
  6933. ;
  6934. goog.debug.normalizeErrorObject = function (a) {
  6935. var b = goog.getObjectByName("window.location.href");
  6936. null == a && (a = 'Unknown Error of type "null/undefined"');
  6937. if ("string" === typeof a)
  6938. return {
  6939. message: a,
  6940. name: "Unknown error",
  6941. lineNumber: "Not available",
  6942. fileName: b,
  6943. stack: "Not available"
  6944. };
  6945. var c = !1;
  6946. try {
  6947. var d = a.lineNumber || a.line || "Not available"
  6948. } catch (f) {
  6949. d = "Not available",
  6950. c = !0
  6951. }
  6952. try {
  6953. var e = a.fileName || a.filename || a.sourceURL || goog.global.$googDebugFname || b
  6954. } catch (f) {
  6955. e = "Not available",
  6956. c = !0
  6957. }
  6958. return !c && a.lineNumber && a.fileName && a.stack && a.message && a.name ? a : (b = a.message,
  6959. null == b && (b = a.constructor && a.constructor instanceof Function ? 'Unknown Error of type "' + (a.constructor.name ? a.constructor.name : goog.debug.getFunctionName(a.constructor)) + '"' : "Unknown Error of unknown type"),
  6960. {
  6961. message: b,
  6962. name: a.name || "UnknownError",
  6963. lineNumber: d,
  6964. fileName: e,
  6965. stack: a.stack || "Not available"
  6966. })
  6967. }
  6968. ;
  6969. goog.debug.enhanceError = function (a, b) {
  6970. if (a instanceof Error)
  6971. var c = a;
  6972. else
  6973. c = Error(a),
  6974. Error.captureStackTrace && Error.captureStackTrace(c, goog.debug.enhanceError);
  6975. c.stack || (c.stack = goog.debug.getStacktrace(goog.debug.enhanceError));
  6976. if (b) {
  6977. for (var d = 0; c["message" + d];)
  6978. ++d;
  6979. c["message" + d] = String(b)
  6980. }
  6981. return c
  6982. }
  6983. ;
  6984. goog.debug.enhanceErrorWithContext = function (a, b) {
  6985. var c = goog.debug.enhanceError(a);
  6986. if (b)
  6987. for (var d in b)
  6988. goog.debug.errorcontext.addErrorContext(c, d, b[d]);
  6989. return c
  6990. }
  6991. ;
  6992. goog.debug.getStacktraceSimple = function (a) {
  6993. if (!goog.debug.FORCE_SLOPPY_STACKS) {
  6994. var b = goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple);
  6995. if (b)
  6996. return b
  6997. }
  6998. b = [];
  6999. for (var c = arguments.callee.caller, d = 0; c && (!a || d < a);) {
  7000. b.push(goog.debug.getFunctionName(c));
  7001. b.push("()\n");
  7002. try {
  7003. c = c.caller
  7004. } catch (e) {
  7005. b.push("[exception trying to get caller]\n");
  7006. break
  7007. }
  7008. d++;
  7009. if (d >= goog.debug.MAX_STACK_DEPTH) {
  7010. b.push("[...long stack...]");
  7011. break
  7012. }
  7013. }
  7014. a && d >= a ? b.push("[...reached max depth limit...]") : b.push("[end]");
  7015. return b.join("")
  7016. }
  7017. ;
  7018. goog.debug.MAX_STACK_DEPTH = 50;
  7019. goog.debug.getNativeStackTrace_ = function (a) {
  7020. var b = Error();
  7021. if (Error.captureStackTrace)
  7022. return Error.captureStackTrace(b, a),
  7023. String(b.stack);
  7024. try {
  7025. throw b;
  7026. } catch (c) {
  7027. b = c
  7028. }
  7029. return (a = b.stack) ? String(a) : null
  7030. }
  7031. ;
  7032. goog.debug.getStacktrace = function (a) {
  7033. var b;
  7034. goog.debug.FORCE_SLOPPY_STACKS || (b = goog.debug.getNativeStackTrace_(a || goog.debug.getStacktrace));
  7035. b || (b = goog.debug.getStacktraceHelper_(a || arguments.callee.caller, []));
  7036. return b
  7037. }
  7038. ;
  7039. goog.debug.getStacktraceHelper_ = function (a, b) {
  7040. var c = [];
  7041. if (goog.array.contains(b, a))
  7042. c.push("[...circular reference...]");
  7043. else if (a && b.length < goog.debug.MAX_STACK_DEPTH) {
  7044. c.push(goog.debug.getFunctionName(a) + "(");
  7045. for (var d = a.arguments, e = 0; d && e < d.length; e++) {
  7046. 0 < e && c.push(", ");
  7047. var f = d[e];
  7048. switch (typeof f) {
  7049. case "object":
  7050. f = f ? "object" : "null";
  7051. break;
  7052. case "string":
  7053. break;
  7054. case "number":
  7055. f = String(f);
  7056. break;
  7057. case "boolean":
  7058. f = f ? "true" : "false";
  7059. break;
  7060. case "function":
  7061. f = (f = goog.debug.getFunctionName(f)) ? f : "[fn]";
  7062. break;
  7063. default:
  7064. f = typeof f
  7065. }
  7066. 40 < f.length && (f = f.substr(0, 40) + "...");
  7067. c.push(f)
  7068. }
  7069. b.push(a);
  7070. c.push(")\n");
  7071. try {
  7072. c.push(goog.debug.getStacktraceHelper_(a.caller, b))
  7073. } catch (g) {
  7074. c.push("[exception trying to get caller]\n")
  7075. }
  7076. } else
  7077. a ? c.push("[...long stack...]") : c.push("[end]");
  7078. return c.join("")
  7079. }
  7080. ;
  7081. goog.debug.getFunctionName = function (a) {
  7082. if (goog.debug.fnNameCache_[a])
  7083. return goog.debug.fnNameCache_[a];
  7084. a = String(a);
  7085. if (!goog.debug.fnNameCache_[a]) {
  7086. var b = /function\s+([^\(]+)/m.exec(a);
  7087. goog.debug.fnNameCache_[a] = b ? b[1] : "[Anonymous]"
  7088. }
  7089. return goog.debug.fnNameCache_[a]
  7090. }
  7091. ;
  7092. goog.debug.makeWhitespaceVisible = function (a) {
  7093. return a.replace(/ /g, "[_]").replace(/\f/g, "[f]").replace(/\n/g, "[n]\n").replace(/\r/g, "[r]").replace(/\t/g, "[t]")
  7094. }
  7095. ;
  7096. goog.debug.runtimeType = function (a) {
  7097. return a instanceof Function ? a.displayName || a.name || "unknown type name" : a instanceof Object ? a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a) : null === a ? "null" : typeof a
  7098. }
  7099. ;
  7100. goog.debug.fnNameCache_ = {};
  7101. goog.debug.freezeInternal_ = goog.DEBUG && Object.freeze || function (a) {
  7102. return a
  7103. }
  7104. ;
  7105. goog.debug.freeze = function (a) {
  7106. return goog.debug.freezeInternal_(a)
  7107. }
  7108. ;
  7109. goog.events = {};
  7110. $jscomp.scope.purify = function (a) {
  7111. return {
  7112. valueOf: a
  7113. }.valueOf()
  7114. }
  7115. ;
  7116. goog.events.BrowserFeature = {
  7117. HAS_W3C_BUTTON: !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9),
  7118. HAS_W3C_EVENT_SUPPORT: !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9),
  7119. SET_KEY_CODE_TO_PREVENT_DEFAULT: goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"),
  7120. HAS_NAVIGATOR_ONLINE_PROPERTY: !goog.userAgent.WEBKIT || goog.userAgent.isVersionOrHigher("528"),
  7121. HAS_HTML5_NETWORK_EVENT_SUPPORT: goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9b") || goog.userAgent.IE && goog.userAgent.isVersionOrHigher("8") || goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher("9.5") || goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("528"),
  7122. HTML5_NETWORK_EVENTS_FIRE_ON_BODY: goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher("8") || goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"),
  7123. TOUCH_ENABLED: "ontouchstart" in goog.global || !!(goog.global.document && document.documentElement && "ontouchstart" in document.documentElement) || !(!goog.global.navigator || !goog.global.navigator.maxTouchPoints && !goog.global.navigator.msMaxTouchPoints),
  7124. POINTER_EVENTS: "PointerEvent" in goog.global,
  7125. MSPOINTER_EVENTS: "MSPointerEvent" in goog.global && !(!goog.global.navigator || !goog.global.navigator.msPointerEnabled),
  7126. PASSIVE_EVENTS: (0,
  7127. $jscomp.scope.purify)(function () {
  7128. if (!goog.global.addEventListener || !Object.defineProperty)
  7129. return !1;
  7130. var a = !1
  7131. , b = Object.defineProperty({}, "passive", {
  7132. get: function () {
  7133. a = !0
  7134. }
  7135. });
  7136. try {
  7137. goog.global.addEventListener("test", goog.nullFunction, b),
  7138. goog.global.removeEventListener("test", goog.nullFunction, b)
  7139. } catch (c) { }
  7140. return a
  7141. })
  7142. };
  7143. goog.events.EventId = function (a) {
  7144. this.id = a
  7145. }
  7146. ;
  7147. goog.events.EventId.prototype.toString = function () {
  7148. return this.id
  7149. }
  7150. ;
  7151. goog.events.Event = function (a, b) {
  7152. this.type = a instanceof goog.events.EventId ? String(a) : a;
  7153. this.currentTarget = this.target = b;
  7154. this.defaultPrevented = this.propagationStopped_ = !1;
  7155. this.returnValue_ = !0
  7156. }
  7157. ;
  7158. goog.events.Event.prototype.stopPropagation = function () {
  7159. this.propagationStopped_ = !0
  7160. }
  7161. ;
  7162. goog.events.Event.prototype.preventDefault = function () {
  7163. this.defaultPrevented = !0;
  7164. this.returnValue_ = !1
  7165. }
  7166. ;
  7167. goog.events.Event.stopPropagation = function (a) {
  7168. a.stopPropagation()
  7169. }
  7170. ;
  7171. goog.events.Event.preventDefault = function (a) {
  7172. a.preventDefault()
  7173. }
  7174. ;
  7175. goog.events.getVendorPrefixedName_ = function (a) {
  7176. return goog.userAgent.WEBKIT ? "webkit" + a : goog.userAgent.OPERA ? "o" + a.toLowerCase() : a.toLowerCase()
  7177. }
  7178. ;
  7179. goog.events.EventType = {
  7180. CLICK: "click",
  7181. RIGHTCLICK: "rightclick",
  7182. DBLCLICK: "dblclick",
  7183. AUXCLICK: "auxclick",
  7184. MOUSEDOWN: "mousedown",
  7185. MOUSEUP: "mouseup",
  7186. MOUSEOVER: "mouseover",
  7187. MOUSEOUT: "mouseout",
  7188. MOUSEMOVE: "mousemove",
  7189. MOUSEENTER: "mouseenter",
  7190. MOUSELEAVE: "mouseleave",
  7191. MOUSECANCEL: "mousecancel",
  7192. SELECTIONCHANGE: "selectionchange",
  7193. SELECTSTART: "selectstart",
  7194. WHEEL: "wheel",
  7195. KEYPRESS: "keypress",
  7196. KEYDOWN: "keydown",
  7197. KEYUP: "keyup",
  7198. BLUR: "blur",
  7199. FOCUS: "focus",
  7200. DEACTIVATE: "deactivate",
  7201. FOCUSIN: "focusin",
  7202. FOCUSOUT: "focusout",
  7203. CHANGE: "change",
  7204. RESET: "reset",
  7205. SELECT: "select",
  7206. SUBMIT: "submit",
  7207. INPUT: "input",
  7208. PROPERTYCHANGE: "propertychange",
  7209. DRAGSTART: "dragstart",
  7210. DRAG: "drag",
  7211. DRAGENTER: "dragenter",
  7212. DRAGOVER: "dragover",
  7213. DRAGLEAVE: "dragleave",
  7214. DROP: "drop",
  7215. DRAGEND: "dragend",
  7216. TOUCHSTART: "touchstart",
  7217. TOUCHMOVE: "touchmove",
  7218. TOUCHEND: "touchend",
  7219. TOUCHCANCEL: "touchcancel",
  7220. BEFOREUNLOAD: "beforeunload",
  7221. CONSOLEMESSAGE: "consolemessage",
  7222. CONTEXTMENU: "contextmenu",
  7223. DEVICECHANGE: "devicechange",
  7224. DEVICEMOTION: "devicemotion",
  7225. DEVICEORIENTATION: "deviceorientation",
  7226. DOMCONTENTLOADED: "DOMContentLoaded",
  7227. ERROR: "error",
  7228. HELP: "help",
  7229. LOAD: "load",
  7230. LOSECAPTURE: "losecapture",
  7231. ORIENTATIONCHANGE: "orientationchange",
  7232. READYSTATECHANGE: "readystatechange",
  7233. RESIZE: "resize",
  7234. SCROLL: "scroll",
  7235. UNLOAD: "unload",
  7236. CANPLAY: "canplay",
  7237. CANPLAYTHROUGH: "canplaythrough",
  7238. DURATIONCHANGE: "durationchange",
  7239. EMPTIED: "emptied",
  7240. ENDED: "ended",
  7241. LOADEDDATA: "loadeddata",
  7242. LOADEDMETADATA: "loadedmetadata",
  7243. PAUSE: "pause",
  7244. PLAY: "play",
  7245. PLAYING: "playing",
  7246. PROGRESS: "progress",
  7247. RATECHANGE: "ratechange",
  7248. SEEKED: "seeked",
  7249. SEEKING: "seeking",
  7250. STALLED: "stalled",
  7251. SUSPEND: "suspend",
  7252. TIMEUPDATE: "timeupdate",
  7253. VOLUMECHANGE: "volumechange",
  7254. WAITING: "waiting",
  7255. SOURCEOPEN: "sourceopen",
  7256. SOURCEENDED: "sourceended",
  7257. SOURCECLOSED: "sourceclosed",
  7258. ABORT: "abort",
  7259. UPDATE: "update",
  7260. UPDATESTART: "updatestart",
  7261. UPDATEEND: "updateend",
  7262. HASHCHANGE: "hashchange",
  7263. PAGEHIDE: "pagehide",
  7264. PAGESHOW: "pageshow",
  7265. POPSTATE: "popstate",
  7266. COPY: "copy",
  7267. PASTE: "paste",
  7268. CUT: "cut",
  7269. BEFORECOPY: "beforecopy",
  7270. BEFORECUT: "beforecut",
  7271. BEFOREPASTE: "beforepaste",
  7272. ONLINE: "online",
  7273. OFFLINE: "offline",
  7274. MESSAGE: "message",
  7275. CONNECT: "connect",
  7276. INSTALL: "install",
  7277. ACTIVATE: "activate",
  7278. FETCH: "fetch",
  7279. FOREIGNFETCH: "foreignfetch",
  7280. MESSAGEERROR: "messageerror",
  7281. STATECHANGE: "statechange",
  7282. UPDATEFOUND: "updatefound",
  7283. CONTROLLERCHANGE: "controllerchange",
  7284. ANIMATIONSTART: goog.events.getVendorPrefixedName_("AnimationStart"),
  7285. ANIMATIONEND: goog.events.getVendorPrefixedName_("AnimationEnd"),
  7286. ANIMATIONITERATION: goog.events.getVendorPrefixedName_("AnimationIteration"),
  7287. TRANSITIONEND: goog.events.getVendorPrefixedName_("TransitionEnd"),
  7288. POINTERDOWN: "pointerdown",
  7289. POINTERUP: "pointerup",
  7290. POINTERCANCEL: "pointercancel",
  7291. POINTERMOVE: "pointermove",
  7292. POINTEROVER: "pointerover",
  7293. POINTEROUT: "pointerout",
  7294. POINTERENTER: "pointerenter",
  7295. POINTERLEAVE: "pointerleave",
  7296. GOTPOINTERCAPTURE: "gotpointercapture",
  7297. LOSTPOINTERCAPTURE: "lostpointercapture",
  7298. MSGESTURECHANGE: "MSGestureChange",
  7299. MSGESTUREEND: "MSGestureEnd",
  7300. MSGESTUREHOLD: "MSGestureHold",
  7301. MSGESTURESTART: "MSGestureStart",
  7302. MSGESTURETAP: "MSGestureTap",
  7303. MSGOTPOINTERCAPTURE: "MSGotPointerCapture",
  7304. MSINERTIASTART: "MSInertiaStart",
  7305. MSLOSTPOINTERCAPTURE: "MSLostPointerCapture",
  7306. MSPOINTERCANCEL: "MSPointerCancel",
  7307. MSPOINTERDOWN: "MSPointerDown",
  7308. MSPOINTERENTER: "MSPointerEnter",
  7309. MSPOINTERHOVER: "MSPointerHover",
  7310. MSPOINTERLEAVE: "MSPointerLeave",
  7311. MSPOINTERMOVE: "MSPointerMove",
  7312. MSPOINTEROUT: "MSPointerOut",
  7313. MSPOINTEROVER: "MSPointerOver",
  7314. MSPOINTERUP: "MSPointerUp",
  7315. TEXT: "text",
  7316. TEXTINPUT: goog.userAgent.IE ? "textinput" : "textInput",
  7317. COMPOSITIONSTART: "compositionstart",
  7318. COMPOSITIONUPDATE: "compositionupdate",
  7319. COMPOSITIONEND: "compositionend",
  7320. BEFOREINPUT: "beforeinput",
  7321. EXIT: "exit",
  7322. LOADABORT: "loadabort",
  7323. LOADCOMMIT: "loadcommit",
  7324. LOADREDIRECT: "loadredirect",
  7325. LOADSTART: "loadstart",
  7326. LOADSTOP: "loadstop",
  7327. RESPONSIVE: "responsive",
  7328. SIZECHANGED: "sizechanged",
  7329. UNRESPONSIVE: "unresponsive",
  7330. VISIBILITYCHANGE: "visibilitychange",
  7331. STORAGE: "storage",
  7332. DOMSUBTREEMODIFIED: "DOMSubtreeModified",
  7333. DOMNODEINSERTED: "DOMNodeInserted",
  7334. DOMNODEREMOVED: "DOMNodeRemoved",
  7335. DOMNODEREMOVEDFROMDOCUMENT: "DOMNodeRemovedFromDocument",
  7336. DOMNODEINSERTEDINTODOCUMENT: "DOMNodeInsertedIntoDocument",
  7337. DOMATTRMODIFIED: "DOMAttrModified",
  7338. DOMCHARACTERDATAMODIFIED: "DOMCharacterDataModified",
  7339. BEFOREPRINT: "beforeprint",
  7340. AFTERPRINT: "afterprint",
  7341. BEFOREINSTALLPROMPT: "beforeinstallprompt",
  7342. APPINSTALLED: "appinstalled"
  7343. };
  7344. goog.events.getPointerFallbackEventName_ = function (a, b, c) {
  7345. return goog.events.BrowserFeature.POINTER_EVENTS ? a : goog.events.BrowserFeature.MSPOINTER_EVENTS ? b : c
  7346. }
  7347. ;
  7348. goog.events.PointerFallbackEventType = {
  7349. POINTERDOWN: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERDOWN, goog.events.EventType.MSPOINTERDOWN, goog.events.EventType.MOUSEDOWN),
  7350. POINTERUP: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERUP, goog.events.EventType.MSPOINTERUP, goog.events.EventType.MOUSEUP),
  7351. POINTERCANCEL: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERCANCEL, goog.events.EventType.MSPOINTERCANCEL, goog.events.EventType.MOUSECANCEL),
  7352. POINTERMOVE: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERMOVE, goog.events.EventType.MSPOINTERMOVE, goog.events.EventType.MOUSEMOVE),
  7353. POINTEROVER: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTEROVER, goog.events.EventType.MSPOINTEROVER, goog.events.EventType.MOUSEOVER),
  7354. POINTEROUT: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTEROUT, goog.events.EventType.MSPOINTEROUT, goog.events.EventType.MOUSEOUT),
  7355. POINTERENTER: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERENTER, goog.events.EventType.MSPOINTERENTER, goog.events.EventType.MOUSEENTER),
  7356. POINTERLEAVE: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERLEAVE, goog.events.EventType.MSPOINTERLEAVE, goog.events.EventType.MOUSELEAVE)
  7357. };
  7358. goog.events.PointerTouchFallbackEventType = {
  7359. POINTERDOWN: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERDOWN, goog.events.EventType.MSPOINTERDOWN, goog.events.EventType.TOUCHSTART),
  7360. POINTERUP: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERUP, goog.events.EventType.MSPOINTERUP, goog.events.EventType.TOUCHEND),
  7361. POINTERCANCEL: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERCANCEL, goog.events.EventType.MSPOINTERCANCEL, goog.events.EventType.TOUCHCANCEL),
  7362. POINTERMOVE: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERMOVE, goog.events.EventType.MSPOINTERMOVE, goog.events.EventType.TOUCHMOVE)
  7363. };
  7364. goog.events.PointerAsMouseEventType = {
  7365. MOUSEDOWN: goog.events.PointerFallbackEventType.POINTERDOWN,
  7366. MOUSEUP: goog.events.PointerFallbackEventType.POINTERUP,
  7367. MOUSECANCEL: goog.events.PointerFallbackEventType.POINTERCANCEL,
  7368. MOUSEMOVE: goog.events.PointerFallbackEventType.POINTERMOVE,
  7369. MOUSEOVER: goog.events.PointerFallbackEventType.POINTEROVER,
  7370. MOUSEOUT: goog.events.PointerFallbackEventType.POINTEROUT,
  7371. MOUSEENTER: goog.events.PointerFallbackEventType.POINTERENTER,
  7372. MOUSELEAVE: goog.events.PointerFallbackEventType.POINTERLEAVE
  7373. };
  7374. goog.events.MouseAsMouseEventType = {
  7375. MOUSEDOWN: goog.events.EventType.MOUSEDOWN,
  7376. MOUSEUP: goog.events.EventType.MOUSEUP,
  7377. MOUSECANCEL: goog.events.EventType.MOUSECANCEL,
  7378. MOUSEMOVE: goog.events.EventType.MOUSEMOVE,
  7379. MOUSEOVER: goog.events.EventType.MOUSEOVER,
  7380. MOUSEOUT: goog.events.EventType.MOUSEOUT,
  7381. MOUSEENTER: goog.events.EventType.MOUSEENTER,
  7382. MOUSELEAVE: goog.events.EventType.MOUSELEAVE
  7383. };
  7384. goog.events.PointerAsTouchEventType = {
  7385. TOUCHCANCEL: goog.events.PointerTouchFallbackEventType.POINTERCANCEL,
  7386. TOUCHEND: goog.events.PointerTouchFallbackEventType.POINTERUP,
  7387. TOUCHMOVE: goog.events.PointerTouchFallbackEventType.POINTERMOVE,
  7388. TOUCHSTART: goog.events.PointerTouchFallbackEventType.POINTERDOWN
  7389. };
  7390. goog.events.USE_LAYER_XY_AS_OFFSET_XY = !1;
  7391. goog.events.BrowserEvent = function (a, b) {
  7392. goog.events.Event.call(this, a ? a.type : "");
  7393. this.relatedTarget = this.currentTarget = this.target = null;
  7394. this.button = this.screenY = this.screenX = this.clientY = this.clientX = this.offsetY = this.offsetX = 0;
  7395. this.key = "";
  7396. this.charCode = this.keyCode = 0;
  7397. this.metaKey = this.shiftKey = this.altKey = this.ctrlKey = !1;
  7398. this.state = null;
  7399. this.platformModifierKey = !1;
  7400. this.pointerId = 0;
  7401. this.pointerType = "";
  7402. this.event_ = null;
  7403. a && this.init(a, b)
  7404. }
  7405. ;
  7406. goog.inherits(goog.events.BrowserEvent, goog.events.Event);
  7407. goog.events.BrowserEvent.MouseButton = {
  7408. LEFT: 0,
  7409. MIDDLE: 1,
  7410. RIGHT: 2
  7411. };
  7412. goog.events.BrowserEvent.PointerType = {
  7413. MOUSE: "mouse",
  7414. PEN: "pen",
  7415. TOUCH: "touch"
  7416. };
  7417. goog.events.BrowserEvent.IEButtonMap = goog.debug.freeze([1, 4, 2]);
  7418. goog.events.BrowserEvent.IE_BUTTON_MAP = goog.events.BrowserEvent.IEButtonMap;
  7419. goog.events.BrowserEvent.IE_POINTER_TYPE_MAP = goog.debug.freeze({
  7420. 2: goog.events.BrowserEvent.PointerType.TOUCH,
  7421. 3: goog.events.BrowserEvent.PointerType.PEN,
  7422. 4: goog.events.BrowserEvent.PointerType.MOUSE
  7423. });
  7424. goog.events.BrowserEvent.prototype.init = function (a, b) {
  7425. var c = this.type = a.type
  7426. , d = a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : null;
  7427. this.target = a.target || a.srcElement;
  7428. this.currentTarget = b;
  7429. var e = a.relatedTarget;
  7430. e ? goog.userAgent.GECKO && (goog.reflect.canAccessProperty(e, "nodeName") || (e = null)) : c == goog.events.EventType.MOUSEOVER ? e = a.fromElement : c == goog.events.EventType.MOUSEOUT && (e = a.toElement);
  7431. this.relatedTarget = e;
  7432. d ? (this.clientX = void 0 !== d.clientX ? d.clientX : d.pageX,
  7433. this.clientY = void 0 !== d.clientY ? d.clientY : d.pageY,
  7434. this.screenX = d.screenX || 0,
  7435. this.screenY = d.screenY || 0) : (goog.events.USE_LAYER_XY_AS_OFFSET_XY ? (this.offsetX = void 0 !== a.layerX ? a.layerX : a.offsetX,
  7436. this.offsetY = void 0 !== a.layerY ? a.layerY : a.offsetY) : (this.offsetX = goog.userAgent.WEBKIT || void 0 !== a.offsetX ? a.offsetX : a.layerX,
  7437. this.offsetY = goog.userAgent.WEBKIT || void 0 !== a.offsetY ? a.offsetY : a.layerY),
  7438. this.clientX = void 0 !== a.clientX ? a.clientX : a.pageX,
  7439. this.clientY = void 0 !== a.clientY ? a.clientY : a.pageY,
  7440. this.screenX = a.screenX || 0,
  7441. this.screenY = a.screenY || 0);
  7442. this.button = a.button;
  7443. this.keyCode = a.keyCode || 0;
  7444. this.key = a.key || "";
  7445. this.charCode = a.charCode || ("keypress" == c ? a.keyCode : 0);
  7446. this.ctrlKey = a.ctrlKey;
  7447. this.altKey = a.altKey;
  7448. this.shiftKey = a.shiftKey;
  7449. this.metaKey = a.metaKey;
  7450. this.platformModifierKey = goog.userAgent.MAC ? a.metaKey : a.ctrlKey;
  7451. this.pointerId = a.pointerId || 0;
  7452. this.pointerType = goog.events.BrowserEvent.getPointerType_(a);
  7453. this.state = a.state;
  7454. this.event_ = a;
  7455. a.defaultPrevented && this.preventDefault()
  7456. }
  7457. ;
  7458. goog.events.BrowserEvent.prototype.isButton = function (a) {
  7459. return goog.events.BrowserFeature.HAS_W3C_BUTTON ? this.event_.button == a : "click" == this.type ? a == goog.events.BrowserEvent.MouseButton.LEFT : !!(this.event_.button & goog.events.BrowserEvent.IE_BUTTON_MAP[a])
  7460. }
  7461. ;
  7462. goog.events.BrowserEvent.prototype.isMouseActionButton = function () {
  7463. return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT) && !(goog.userAgent.WEBKIT && goog.userAgent.MAC && this.ctrlKey)
  7464. }
  7465. ;
  7466. goog.events.BrowserEvent.prototype.stopPropagation = function () {
  7467. goog.events.BrowserEvent.superClass_.stopPropagation.call(this);
  7468. this.event_.stopPropagation ? this.event_.stopPropagation() : this.event_.cancelBubble = !0
  7469. }
  7470. ;
  7471. goog.events.BrowserEvent.prototype.preventDefault = function () {
  7472. goog.events.BrowserEvent.superClass_.preventDefault.call(this);
  7473. var a = this.event_;
  7474. if (a.preventDefault)
  7475. a.preventDefault();
  7476. else if (a.returnValue = !1,
  7477. goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT)
  7478. try {
  7479. if (a.ctrlKey || 112 <= a.keyCode && 123 >= a.keyCode)
  7480. a.keyCode = -1
  7481. } catch (b) { }
  7482. }
  7483. ;
  7484. goog.events.BrowserEvent.prototype.getBrowserEvent = function () {
  7485. return this.event_
  7486. }
  7487. ;
  7488. goog.events.BrowserEvent.getPointerType_ = function (a) {
  7489. return "string" === typeof a.pointerType ? a.pointerType : goog.events.BrowserEvent.IE_POINTER_TYPE_MAP[a.pointerType] || ""
  7490. }
  7491. ;
  7492. goog.events.Listenable = function () { }
  7493. ;
  7494. goog.events.Listenable.IMPLEMENTED_BY_PROP = "closure_listenable_" + (1E6 * Math.random() | 0);
  7495. goog.events.Listenable.addImplementation = function (a) {
  7496. a.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP] = !0
  7497. }
  7498. ;
  7499. goog.events.Listenable.isImplementedBy = function (a) {
  7500. return !(!a || !a[goog.events.Listenable.IMPLEMENTED_BY_PROP])
  7501. }
  7502. ;
  7503. goog.events.ListenableKey = function () { }
  7504. ;
  7505. goog.events.ListenableKey.counter_ = 0;
  7506. goog.events.ListenableKey.reserveKey = function () {
  7507. return ++goog.events.ListenableKey.counter_
  7508. }
  7509. ;
  7510. goog.events.Listener = function (a, b, c, d, e, f) {
  7511. goog.events.Listener.ENABLE_MONITORING && (this.creationStack = Error().stack);
  7512. this.listener = a;
  7513. this.proxy = b;
  7514. this.src = c;
  7515. this.type = d;
  7516. this.capture = !!e;
  7517. this.handler = f;
  7518. this.key = goog.events.ListenableKey.reserveKey();
  7519. this.removed = this.callOnce = !1
  7520. }
  7521. ;
  7522. goog.events.Listener.ENABLE_MONITORING = !1;
  7523. goog.events.Listener.prototype.markAsRemoved = function () {
  7524. this.removed = !0;
  7525. this.handler = this.src = this.proxy = this.listener = null
  7526. }
  7527. ;
  7528. goog.events.ListenerMap = function (a) {
  7529. this.src = a;
  7530. this.listeners = {};
  7531. this.typeCount_ = 0
  7532. }
  7533. ;
  7534. goog.events.ListenerMap.prototype.getTypeCount = function () {
  7535. return this.typeCount_
  7536. }
  7537. ;
  7538. goog.events.ListenerMap.prototype.getListenerCount = function () {
  7539. var a = 0, b;
  7540. for (b in this.listeners)
  7541. a += this.listeners[b].length;
  7542. return a
  7543. }
  7544. ;
  7545. goog.events.ListenerMap.prototype.add = function (a, b, c, d, e) {
  7546. var f = a.toString();
  7547. a = this.listeners[f];
  7548. a || (a = this.listeners[f] = [],
  7549. this.typeCount_++);
  7550. var g = goog.events.ListenerMap.findListenerIndex_(a, b, d, e);
  7551. -1 < g ? (b = a[g],
  7552. c || (b.callOnce = !1)) : (b = new goog.events.Listener(b, null, this.src, f, !!d, e),
  7553. b.callOnce = c,
  7554. a.push(b));
  7555. return b
  7556. }
  7557. ;
  7558. goog.events.ListenerMap.prototype.remove = function (a, b, c, d) {
  7559. a = a.toString();
  7560. if (!(a in this.listeners))
  7561. return !1;
  7562. var e = this.listeners[a];
  7563. b = goog.events.ListenerMap.findListenerIndex_(e, b, c, d);
  7564. return -1 < b ? (e[b].markAsRemoved(),
  7565. goog.array.removeAt(e, b),
  7566. 0 == e.length && (delete this.listeners[a],
  7567. this.typeCount_--),
  7568. !0) : !1
  7569. }
  7570. ;
  7571. goog.events.ListenerMap.prototype.removeByKey = function (a) {
  7572. var b = a.type;
  7573. if (!(b in this.listeners))
  7574. return !1;
  7575. var c = goog.array.remove(this.listeners[b], a);
  7576. c && (a.markAsRemoved(),
  7577. 0 == this.listeners[b].length && (delete this.listeners[b],
  7578. this.typeCount_--));
  7579. return c
  7580. }
  7581. ;
  7582. goog.events.ListenerMap.prototype.removeAll = function (a) {
  7583. a = a && a.toString();
  7584. var b = 0, c;
  7585. for (c in this.listeners)
  7586. if (!a || c == a) {
  7587. for (var d = this.listeners[c], e = 0; e < d.length; e++)
  7588. ++b,
  7589. d[e].markAsRemoved();
  7590. delete this.listeners[c];
  7591. this.typeCount_--
  7592. }
  7593. return b
  7594. }
  7595. ;
  7596. goog.events.ListenerMap.prototype.getListeners = function (a, b) {
  7597. var c = this.listeners[a.toString()]
  7598. , d = [];
  7599. if (c)
  7600. for (var e = 0; e < c.length; ++e) {
  7601. var f = c[e];
  7602. f.capture == b && d.push(f)
  7603. }
  7604. return d
  7605. }
  7606. ;
  7607. goog.events.ListenerMap.prototype.getListener = function (a, b, c, d) {
  7608. a = this.listeners[a.toString()];
  7609. var e = -1;
  7610. a && (e = goog.events.ListenerMap.findListenerIndex_(a, b, c, d));
  7611. return -1 < e ? a[e] : null
  7612. }
  7613. ;
  7614. goog.events.ListenerMap.prototype.hasListener = function (a, b) {
  7615. var c = void 0 !== a
  7616. , d = c ? a.toString() : ""
  7617. , e = void 0 !== b;
  7618. return goog.object.some(this.listeners, function (a, g) {
  7619. for (var f = 0; f < a.length; ++f)
  7620. if (!(c && a[f].type != d || e && a[f].capture != b))
  7621. return !0;
  7622. return !1
  7623. })
  7624. }
  7625. ;
  7626. goog.events.ListenerMap.findListenerIndex_ = function (a, b, c, d) {
  7627. for (var e = 0; e < a.length; ++e) {
  7628. var f = a[e];
  7629. if (!f.removed && f.listener == b && f.capture == !!c && f.handler == d)
  7630. return e
  7631. }
  7632. return -1
  7633. }
  7634. ;
  7635. goog.events.LISTENER_MAP_PROP_ = "closure_lm_" + (1E6 * Math.random() | 0);
  7636. goog.events.onString_ = "on";
  7637. goog.events.onStringMap_ = {};
  7638. goog.events.CaptureSimulationMode = {
  7639. OFF_AND_FAIL: 0,
  7640. OFF_AND_SILENT: 1,
  7641. ON: 2
  7642. };
  7643. goog.events.CAPTURE_SIMULATION_MODE = 2;
  7644. goog.events.listenerCountEstimate_ = 0;
  7645. goog.events.listen = function (a, b, c, d, e) {
  7646. if (d && d.once)
  7647. return goog.events.listenOnce(a, b, c, d, e);
  7648. if (goog.isArray(b)) {
  7649. for (var f = 0; f < b.length; f++)
  7650. goog.events.listen(a, b[f], c, d, e);
  7651. return null
  7652. }
  7653. c = goog.events.wrapListener(c);
  7654. return goog.events.Listenable.isImplementedBy(a) ? (d = goog.isObject(d) ? !!d.capture : !!d,
  7655. a.listen(b, c, d, e)) : goog.events.listen_(a, b, c, !1, d, e)
  7656. }
  7657. ;
  7658. goog.events.listen_ = function (a, b, c, d, e, f) {
  7659. if (!b)
  7660. throw Error("Invalid event type");
  7661. var g = goog.isObject(e) ? !!e.capture : !!e;
  7662. if (g && !goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) {
  7663. if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.OFF_AND_FAIL)
  7664. return goog.asserts.fail("Can not register capture listener in IE8-."),
  7665. null;
  7666. if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.OFF_AND_SILENT)
  7667. return null
  7668. }
  7669. var h = goog.events.getListenerMap_(a);
  7670. h || (a[goog.events.LISTENER_MAP_PROP_] = h = new goog.events.ListenerMap(a));
  7671. c = h.add(b, c, d, g, f);
  7672. if (c.proxy)
  7673. return c;
  7674. d = goog.events.getProxy();
  7675. c.proxy = d;
  7676. d.src = a;
  7677. d.listener = c;
  7678. if (a.addEventListener)
  7679. goog.events.BrowserFeature.PASSIVE_EVENTS || (e = g),
  7680. void 0 === e && (e = !1),
  7681. a.addEventListener(b.toString(), d, e);
  7682. else if (a.attachEvent)
  7683. a.attachEvent(goog.events.getOnString_(b.toString()), d);
  7684. else if (a.addListener && a.removeListener)
  7685. goog.asserts.assert("change" === b, "MediaQueryList only has a change event"),
  7686. a.addListener(d);
  7687. else
  7688. throw Error("addEventListener and attachEvent are unavailable.");
  7689. goog.events.listenerCountEstimate_++;
  7690. return c
  7691. }
  7692. ;
  7693. goog.events.getProxy = function () {
  7694. var a = goog.events.handleBrowserEvent_
  7695. , b = goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT ? function (c) {
  7696. return a.call(b.src, b.listener, c)
  7697. }
  7698. : function (c) {
  7699. c = a.call(b.src, b.listener, c);
  7700. if (!c)
  7701. return c
  7702. }
  7703. ;
  7704. return b
  7705. }
  7706. ;
  7707. goog.events.listenOnce = function (a, b, c, d, e) {
  7708. if (goog.isArray(b)) {
  7709. for (var f = 0; f < b.length; f++)
  7710. goog.events.listenOnce(a, b[f], c, d, e);
  7711. return null
  7712. }
  7713. c = goog.events.wrapListener(c);
  7714. return goog.events.Listenable.isImplementedBy(a) ? (d = goog.isObject(d) ? !!d.capture : !!d,
  7715. a.listenOnce(b, c, d, e)) : goog.events.listen_(a, b, c, !0, d, e)
  7716. }
  7717. ;
  7718. goog.events.listenWithWrapper = function (a, b, c, d, e) {
  7719. b.listen(a, c, d, e)
  7720. }
  7721. ;
  7722. goog.events.unlisten = function (a, b, c, d, e) {
  7723. if (goog.isArray(b)) {
  7724. for (var f = 0; f < b.length; f++)
  7725. goog.events.unlisten(a, b[f], c, d, e);
  7726. return null
  7727. }
  7728. d = goog.isObject(d) ? !!d.capture : !!d;
  7729. c = goog.events.wrapListener(c);
  7730. if (goog.events.Listenable.isImplementedBy(a))
  7731. return a.unlisten(b, c, d, e);
  7732. if (!a)
  7733. return !1;
  7734. if (a = goog.events.getListenerMap_(a))
  7735. if (b = a.getListener(b, c, d, e))
  7736. return goog.events.unlistenByKey(b);
  7737. return !1
  7738. }
  7739. ;
  7740. goog.events.unlistenByKey = function (a) {
  7741. if ("number" === typeof a || !a || a.removed)
  7742. return !1;
  7743. var b = a.src;
  7744. if (goog.events.Listenable.isImplementedBy(b))
  7745. return b.unlistenByKey(a);
  7746. var c = a.type
  7747. , d = a.proxy;
  7748. b.removeEventListener ? b.removeEventListener(c, d, a.capture) : b.detachEvent ? b.detachEvent(goog.events.getOnString_(c), d) : b.addListener && b.removeListener && b.removeListener(d);
  7749. goog.events.listenerCountEstimate_--;
  7750. (c = goog.events.getListenerMap_(b)) ? (c.removeByKey(a),
  7751. 0 == c.getTypeCount() && (c.src = null,
  7752. b[goog.events.LISTENER_MAP_PROP_] = null)) : a.markAsRemoved();
  7753. return !0
  7754. }
  7755. ;
  7756. goog.events.unlistenWithWrapper = function (a, b, c, d, e) {
  7757. b.unlisten(a, c, d, e)
  7758. }
  7759. ;
  7760. goog.events.removeAll = function (a, b) {
  7761. if (!a)
  7762. return 0;
  7763. if (goog.events.Listenable.isImplementedBy(a))
  7764. return a.removeAllListeners(b);
  7765. var c = goog.events.getListenerMap_(a);
  7766. if (!c)
  7767. return 0;
  7768. var d = 0, e = b && b.toString(), f;
  7769. for (f in c.listeners)
  7770. if (!e || f == e)
  7771. for (var g = c.listeners[f].concat(), h = 0; h < g.length; ++h)
  7772. goog.events.unlistenByKey(g[h]) && ++d;
  7773. return d
  7774. }
  7775. ;
  7776. goog.events.getListeners = function (a, b, c) {
  7777. return goog.events.Listenable.isImplementedBy(a) ? a.getListeners(b, c) : a ? (a = goog.events.getListenerMap_(a)) ? a.getListeners(b, c) : [] : []
  7778. }
  7779. ;
  7780. goog.events.getListener = function (a, b, c, d, e) {
  7781. c = goog.events.wrapListener(c);
  7782. d = !!d;
  7783. return goog.events.Listenable.isImplementedBy(a) ? a.getListener(b, c, d, e) : a ? (a = goog.events.getListenerMap_(a)) ? a.getListener(b, c, d, e) : null : null
  7784. }
  7785. ;
  7786. goog.events.hasListener = function (a, b, c) {
  7787. if (goog.events.Listenable.isImplementedBy(a))
  7788. return a.hasListener(b, c);
  7789. a = goog.events.getListenerMap_(a);
  7790. return !!a && a.hasListener(b, c)
  7791. }
  7792. ;
  7793. goog.events.expose = function (a) {
  7794. var b = [], c;
  7795. for (c in a)
  7796. a[c] && a[c].id ? b.push(c + " = " + a[c] + " (" + a[c].id + ")") : b.push(c + " = " + a[c]);
  7797. return b.join("\n")
  7798. }
  7799. ;
  7800. goog.events.getOnString_ = function (a) {
  7801. return a in goog.events.onStringMap_ ? goog.events.onStringMap_[a] : goog.events.onStringMap_[a] = goog.events.onString_ + a
  7802. }
  7803. ;
  7804. goog.events.fireListeners = function (a, b, c, d) {
  7805. return goog.events.Listenable.isImplementedBy(a) ? a.fireListeners(b, c, d) : goog.events.fireListeners_(a, b, c, d)
  7806. }
  7807. ;
  7808. goog.events.fireListeners_ = function (a, b, c, d) {
  7809. var e = !0;
  7810. if (a = goog.events.getListenerMap_(a))
  7811. if (b = a.listeners[b.toString()])
  7812. for (b = b.concat(),
  7813. a = 0; a < b.length; a++) {
  7814. var f = b[a];
  7815. f && f.capture == c && !f.removed && (f = goog.events.fireListener(f, d),
  7816. e = e && !1 !== f)
  7817. }
  7818. return e
  7819. }
  7820. ;
  7821. goog.events.fireListener = function (a, b) {
  7822. var c = a.listener
  7823. , d = a.handler || a.src;
  7824. a.callOnce && goog.events.unlistenByKey(a);
  7825. return c.call(d, b)
  7826. }
  7827. ;
  7828. goog.events.getTotalListenerCount = function () {
  7829. return goog.events.listenerCountEstimate_
  7830. }
  7831. ;
  7832. goog.events.dispatchEvent = function (a, b) {
  7833. goog.asserts.assert(goog.events.Listenable.isImplementedBy(a), "Can not use goog.events.dispatchEvent with non-goog.events.Listenable instance.");
  7834. return a.dispatchEvent(b)
  7835. }
  7836. ;
  7837. goog.events.protectBrowserEventEntryPoint = function (a) {
  7838. goog.events.handleBrowserEvent_ = a.protectEntryPoint(goog.events.handleBrowserEvent_)
  7839. }
  7840. ;
  7841. goog.events.handleBrowserEvent_ = function (a, b) {
  7842. if (a.removed)
  7843. return !0;
  7844. if (!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) {
  7845. var c = b || goog.getObjectByName("window.event")
  7846. , d = new goog.events.BrowserEvent(c, this)
  7847. , e = !0;
  7848. if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.ON) {
  7849. if (!goog.events.isMarkedIeEvent_(c)) {
  7850. goog.events.markIeEvent_(c);
  7851. c = [];
  7852. for (var f = d.currentTarget; f; f = f.parentNode)
  7853. c.push(f);
  7854. f = a.type;
  7855. for (var g = c.length - 1; !d.propagationStopped_ && 0 <= g; g--) {
  7856. d.currentTarget = c[g];
  7857. var h = goog.events.fireListeners_(c[g], f, !0, d);
  7858. e = e && h
  7859. }
  7860. for (g = 0; !d.propagationStopped_ && g < c.length; g++)
  7861. d.currentTarget = c[g],
  7862. h = goog.events.fireListeners_(c[g], f, !1, d),
  7863. e = e && h
  7864. }
  7865. } else
  7866. e = goog.events.fireListener(a, d);
  7867. return e
  7868. }
  7869. return goog.events.fireListener(a, new goog.events.BrowserEvent(b, this))
  7870. }
  7871. ;
  7872. goog.events.markIeEvent_ = function (a) {
  7873. var b = !1;
  7874. if (0 == a.keyCode)
  7875. try {
  7876. a.keyCode = -1;
  7877. return
  7878. } catch (c) {
  7879. b = !0
  7880. }
  7881. if (b || void 0 == a.returnValue)
  7882. a.returnValue = !0
  7883. }
  7884. ;
  7885. goog.events.isMarkedIeEvent_ = function (a) {
  7886. return 0 > a.keyCode || void 0 != a.returnValue
  7887. }
  7888. ;
  7889. goog.events.uniqueIdCounter_ = 0;
  7890. goog.events.getUniqueId = function (a) {
  7891. return a + "_" + goog.events.uniqueIdCounter_++
  7892. }
  7893. ;
  7894. goog.events.getListenerMap_ = function (a) {
  7895. a = a[goog.events.LISTENER_MAP_PROP_];
  7896. return a instanceof goog.events.ListenerMap ? a : null
  7897. }
  7898. ;
  7899. goog.events.LISTENER_WRAPPER_PROP_ = "__closure_events_fn_" + (1E9 * Math.random() >>> 0);
  7900. goog.events.wrapListener = function (a) {
  7901. goog.asserts.assert(a, "Listener can not be null.");
  7902. if (goog.isFunction(a))
  7903. return a;
  7904. goog.asserts.assert(a.handleEvent, "An object listener must have handleEvent method.");
  7905. a[goog.events.LISTENER_WRAPPER_PROP_] || (a[goog.events.LISTENER_WRAPPER_PROP_] = function (b) {
  7906. return a.handleEvent(b)
  7907. }
  7908. );
  7909. return a[goog.events.LISTENER_WRAPPER_PROP_]
  7910. }
  7911. ;
  7912. goog.debug.entryPointRegistry.register(function (a) {
  7913. goog.events.handleBrowserEvent_ = a(goog.events.handleBrowserEvent_)
  7914. });
  7915. goog.events.EventTarget = function () {
  7916. goog.Disposable.call(this);
  7917. this.eventTargetListeners_ = new goog.events.ListenerMap(this);
  7918. this.actualEventTarget_ = this;
  7919. this.parentEventTarget_ = null
  7920. }
  7921. ;
  7922. goog.inherits(goog.events.EventTarget, goog.Disposable);
  7923. goog.events.Listenable.addImplementation(goog.events.EventTarget);
  7924. goog.events.EventTarget.MAX_ANCESTORS_ = 1E3;
  7925. goog.events.EventTarget.prototype.getParentEventTarget = function () {
  7926. return this.parentEventTarget_
  7927. }
  7928. ;
  7929. goog.events.EventTarget.prototype.setParentEventTarget = function (a) {
  7930. this.parentEventTarget_ = a
  7931. }
  7932. ;
  7933. goog.events.EventTarget.prototype.addEventListener = function (a, b, c, d) {
  7934. goog.events.listen(this, a, b, c, d)
  7935. }
  7936. ;
  7937. goog.events.EventTarget.prototype.removeEventListener = function (a, b, c, d) {
  7938. goog.events.unlisten(this, a, b, c, d)
  7939. }
  7940. ;
  7941. goog.events.EventTarget.prototype.dispatchEvent = function (a) {
  7942. this.assertInitialized_();
  7943. var b = this.getParentEventTarget();
  7944. if (b) {
  7945. var c = [];
  7946. for (var d = 1; b; b = b.getParentEventTarget())
  7947. c.push(b),
  7948. goog.asserts.assert(++d < goog.events.EventTarget.MAX_ANCESTORS_, "infinite loop")
  7949. }
  7950. return goog.events.EventTarget.dispatchEventInternal_(this.actualEventTarget_, a, c)
  7951. }
  7952. ;
  7953. goog.events.EventTarget.prototype.disposeInternal = function () {
  7954. goog.events.EventTarget.superClass_.disposeInternal.call(this);
  7955. this.removeAllListeners();
  7956. this.parentEventTarget_ = null
  7957. }
  7958. ;
  7959. goog.events.EventTarget.prototype.listen = function (a, b, c, d) {
  7960. this.assertInitialized_();
  7961. return this.eventTargetListeners_.add(String(a), b, !1, c, d)
  7962. }
  7963. ;
  7964. goog.events.EventTarget.prototype.listenOnce = function (a, b, c, d) {
  7965. return this.eventTargetListeners_.add(String(a), b, !0, c, d)
  7966. }
  7967. ;
  7968. goog.events.EventTarget.prototype.unlisten = function (a, b, c, d) {
  7969. return this.eventTargetListeners_.remove(String(a), b, c, d)
  7970. }
  7971. ;
  7972. goog.events.EventTarget.prototype.unlistenByKey = function (a) {
  7973. return this.eventTargetListeners_.removeByKey(a)
  7974. }
  7975. ;
  7976. goog.events.EventTarget.prototype.removeAllListeners = function (a) {
  7977. return this.eventTargetListeners_ ? this.eventTargetListeners_.removeAll(a) : 0
  7978. }
  7979. ;
  7980. goog.events.EventTarget.prototype.fireListeners = function (a, b, c) {
  7981. a = this.eventTargetListeners_.listeners[String(a)];
  7982. if (!a)
  7983. return !0;
  7984. a = a.concat();
  7985. for (var d = !0, e = 0; e < a.length; ++e) {
  7986. var f = a[e];
  7987. if (f && !f.removed && f.capture == b) {
  7988. var g = f.listener
  7989. , h = f.handler || f.src;
  7990. f.callOnce && this.unlistenByKey(f);
  7991. d = !1 !== g.call(h, c) && d
  7992. }
  7993. }
  7994. return d && 0 != c.returnValue_
  7995. }
  7996. ;
  7997. goog.events.EventTarget.prototype.getListeners = function (a, b) {
  7998. return this.eventTargetListeners_.getListeners(String(a), b)
  7999. }
  8000. ;
  8001. goog.events.EventTarget.prototype.getListener = function (a, b, c, d) {
  8002. return this.eventTargetListeners_.getListener(String(a), b, c, d)
  8003. }
  8004. ;
  8005. goog.events.EventTarget.prototype.hasListener = function (a, b) {
  8006. return this.eventTargetListeners_.hasListener(void 0 !== a ? String(a) : void 0, b)
  8007. }
  8008. ;
  8009. goog.events.EventTarget.prototype.setTargetForTesting = function (a) {
  8010. this.actualEventTarget_ = a
  8011. }
  8012. ;
  8013. goog.events.EventTarget.prototype.assertInitialized_ = function () {
  8014. goog.asserts.assert(this.eventTargetListeners_, "Event target is not initialized. Did you call the superclass (goog.events.EventTarget) constructor?")
  8015. }
  8016. ;
  8017. goog.events.EventTarget.dispatchEventInternal_ = function (a, b, c) {
  8018. var d = b.type || b;
  8019. if ("string" === typeof b)
  8020. b = new goog.events.Event(b, a);
  8021. else if (b instanceof goog.events.Event)
  8022. b.target = b.target || a;
  8023. else {
  8024. var e = b;
  8025. b = new goog.events.Event(d, a);
  8026. goog.object.extend(b, e)
  8027. }
  8028. e = !0;
  8029. if (c)
  8030. for (var f = c.length - 1; !b.propagationStopped_ && 0 <= f; f--) {
  8031. var g = b.currentTarget = c[f];
  8032. e = g.fireListeners(d, !0, b) && e
  8033. }
  8034. b.propagationStopped_ || (g = b.currentTarget = a,
  8035. e = g.fireListeners(d, !0, b) && e,
  8036. b.propagationStopped_ || (e = g.fireListeners(d, !1, b) && e));
  8037. if (c)
  8038. for (f = 0; !b.propagationStopped_ && f < c.length; f++)
  8039. g = b.currentTarget = c[f],
  8040. e = g.fireListeners(d, !1, b) && e;
  8041. return e
  8042. }
  8043. ;
  8044. goog.Timer = function (a, b) {
  8045. goog.events.EventTarget.call(this);
  8046. this.interval_ = a || 1;
  8047. this.timerObject_ = b || goog.Timer.defaultTimerObject;
  8048. this.boundTick_ = goog.bind(this.tick_, this);
  8049. this.last_ = goog.now()
  8050. }
  8051. ;
  8052. goog.inherits(goog.Timer, goog.events.EventTarget);
  8053. goog.Timer.MAX_TIMEOUT_ = 2147483647;
  8054. goog.Timer.INVALID_TIMEOUT_ID_ = -1;
  8055. goog.Timer.prototype.enabled = !1;
  8056. goog.Timer.defaultTimerObject = goog.global;
  8057. goog.Timer.intervalScale = .8;
  8058. goog.Timer.prototype.timer_ = null;
  8059. goog.Timer.prototype.getInterval = function () {
  8060. return this.interval_
  8061. }
  8062. ;
  8063. goog.Timer.prototype.setInterval = function (a) {
  8064. this.interval_ = a;
  8065. this.timer_ && this.enabled ? (this.stop(),
  8066. this.start()) : this.timer_ && this.stop()
  8067. }
  8068. ;
  8069. goog.Timer.prototype.tick_ = function () {
  8070. if (this.enabled) {
  8071. var a = goog.now() - this.last_;
  8072. 0 < a && a < this.interval_ * goog.Timer.intervalScale ? this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_ - a) : (this.timer_ && (this.timerObject_.clearTimeout(this.timer_),
  8073. this.timer_ = null),
  8074. this.dispatchTick(),
  8075. this.enabled && (this.stop(),
  8076. this.start()))
  8077. }
  8078. }
  8079. ;
  8080. goog.Timer.prototype.dispatchTick = function () {
  8081. this.dispatchEvent(goog.Timer.TICK)
  8082. }
  8083. ;
  8084. goog.Timer.prototype.start = function () {
  8085. this.enabled = !0;
  8086. this.timer_ || (this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_),
  8087. this.last_ = goog.now())
  8088. }
  8089. ;
  8090. goog.Timer.prototype.stop = function () {
  8091. this.enabled = !1;
  8092. this.timer_ && (this.timerObject_.clearTimeout(this.timer_),
  8093. this.timer_ = null)
  8094. }
  8095. ;
  8096. goog.Timer.prototype.disposeInternal = function () {
  8097. goog.Timer.superClass_.disposeInternal.call(this);
  8098. this.stop();
  8099. delete this.timerObject_
  8100. }
  8101. ;
  8102. goog.Timer.TICK = "tick";
  8103. goog.Timer.callOnce = function (a, b, c) {
  8104. if (goog.isFunction(a))
  8105. c && (a = goog.bind(a, c));
  8106. else if (a && "function" == typeof a.handleEvent)
  8107. a = goog.bind(a.handleEvent, a);
  8108. else
  8109. throw Error("Invalid listener argument");
  8110. return Number(b) > goog.Timer.MAX_TIMEOUT_ ? goog.Timer.INVALID_TIMEOUT_ID_ : goog.Timer.defaultTimerObject.setTimeout(a, b || 0)
  8111. }
  8112. ;
  8113. goog.Timer.clear = function (a) {
  8114. goog.Timer.defaultTimerObject.clearTimeout(a)
  8115. }
  8116. ;
  8117. goog.Timer.promise = function (a, b) {
  8118. var c = null;
  8119. return (new goog.Promise(function (d, e) {
  8120. c = goog.Timer.callOnce(function () {
  8121. d(b)
  8122. }, a);
  8123. c == goog.Timer.INVALID_TIMEOUT_ID_ && e(Error("Failed to schedule timer."))
  8124. }
  8125. )).thenCatch(function (a) {
  8126. goog.Timer.clear(c);
  8127. throw a;
  8128. })
  8129. }
  8130. ;
  8131. goog.color = {};
  8132. goog.color.names = {
  8133. aliceblue: "#f0f8ff",
  8134. antiquewhite: "#faebd7",
  8135. aqua: "#00ffff",
  8136. aquamarine: "#7fffd4",
  8137. azure: "#f0ffff",
  8138. beige: "#f5f5dc",
  8139. bisque: "#ffe4c4",
  8140. black: "#000000",
  8141. blanchedalmond: "#ffebcd",
  8142. blue: "#0000ff",
  8143. blueviolet: "#8a2be2",
  8144. brown: "#a52a2a",
  8145. burlywood: "#deb887",
  8146. cadetblue: "#5f9ea0",
  8147. chartreuse: "#7fff00",
  8148. chocolate: "#d2691e",
  8149. coral: "#ff7f50",
  8150. cornflowerblue: "#6495ed",
  8151. cornsilk: "#fff8dc",
  8152. crimson: "#dc143c",
  8153. cyan: "#00ffff",
  8154. darkblue: "#00008b",
  8155. darkcyan: "#008b8b",
  8156. darkgoldenrod: "#b8860b",
  8157. darkgray: "#a9a9a9",
  8158. darkgreen: "#006400",
  8159. darkgrey: "#a9a9a9",
  8160. darkkhaki: "#bdb76b",
  8161. darkmagenta: "#8b008b",
  8162. darkolivegreen: "#556b2f",
  8163. darkorange: "#ff8c00",
  8164. darkorchid: "#9932cc",
  8165. darkred: "#8b0000",
  8166. darksalmon: "#e9967a",
  8167. darkseagreen: "#8fbc8f",
  8168. darkslateblue: "#483d8b",
  8169. darkslategray: "#2f4f4f",
  8170. darkslategrey: "#2f4f4f",
  8171. darkturquoise: "#00ced1",
  8172. darkviolet: "#9400d3",
  8173. deeppink: "#ff1493",
  8174. deepskyblue: "#00bfff",
  8175. dimgray: "#696969",
  8176. dimgrey: "#696969",
  8177. dodgerblue: "#1e90ff",
  8178. firebrick: "#b22222",
  8179. floralwhite: "#fffaf0",
  8180. forestgreen: "#228b22",
  8181. fuchsia: "#ff00ff",
  8182. gainsboro: "#dcdcdc",
  8183. ghostwhite: "#f8f8ff",
  8184. gold: "#ffd700",
  8185. goldenrod: "#daa520",
  8186. gray: "#808080",
  8187. green: "#008000",
  8188. greenyellow: "#adff2f",
  8189. grey: "#808080",
  8190. honeydew: "#f0fff0",
  8191. hotpink: "#ff69b4",
  8192. indianred: "#cd5c5c",
  8193. indigo: "#4b0082",
  8194. ivory: "#fffff0",
  8195. khaki: "#f0e68c",
  8196. lavender: "#e6e6fa",
  8197. lavenderblush: "#fff0f5",
  8198. lawngreen: "#7cfc00",
  8199. lemonchiffon: "#fffacd",
  8200. lightblue: "#add8e6",
  8201. lightcoral: "#f08080",
  8202. lightcyan: "#e0ffff",
  8203. lightgoldenrodyellow: "#fafad2",
  8204. lightgray: "#d3d3d3",
  8205. lightgreen: "#90ee90",
  8206. lightgrey: "#d3d3d3",
  8207. lightpink: "#ffb6c1",
  8208. lightsalmon: "#ffa07a",
  8209. lightseagreen: "#20b2aa",
  8210. lightskyblue: "#87cefa",
  8211. lightslategray: "#778899",
  8212. lightslategrey: "#778899",
  8213. lightsteelblue: "#b0c4de",
  8214. lightyellow: "#ffffe0",
  8215. lime: "#00ff00",
  8216. limegreen: "#32cd32",
  8217. linen: "#faf0e6",
  8218. magenta: "#ff00ff",
  8219. maroon: "#800000",
  8220. mediumaquamarine: "#66cdaa",
  8221. mediumblue: "#0000cd",
  8222. mediumorchid: "#ba55d3",
  8223. mediumpurple: "#9370db",
  8224. mediumseagreen: "#3cb371",
  8225. mediumslateblue: "#7b68ee",
  8226. mediumspringgreen: "#00fa9a",
  8227. mediumturquoise: "#48d1cc",
  8228. mediumvioletred: "#c71585",
  8229. midnightblue: "#191970",
  8230. mintcream: "#f5fffa",
  8231. mistyrose: "#ffe4e1",
  8232. moccasin: "#ffe4b5",
  8233. navajowhite: "#ffdead",
  8234. navy: "#000080",
  8235. oldlace: "#fdf5e6",
  8236. olive: "#808000",
  8237. olivedrab: "#6b8e23",
  8238. orange: "#ffa500",
  8239. orangered: "#ff4500",
  8240. orchid: "#da70d6",
  8241. palegoldenrod: "#eee8aa",
  8242. palegreen: "#98fb98",
  8243. paleturquoise: "#afeeee",
  8244. palevioletred: "#db7093",
  8245. papayawhip: "#ffefd5",
  8246. peachpuff: "#ffdab9",
  8247. peru: "#cd853f",
  8248. pink: "#ffc0cb",
  8249. plum: "#dda0dd",
  8250. powderblue: "#b0e0e6",
  8251. purple: "#800080",
  8252. red: "#ff0000",
  8253. rosybrown: "#bc8f8f",
  8254. royalblue: "#4169e1",
  8255. saddlebrown: "#8b4513",
  8256. salmon: "#fa8072",
  8257. sandybrown: "#f4a460",
  8258. seagreen: "#2e8b57",
  8259. seashell: "#fff5ee",
  8260. sienna: "#a0522d",
  8261. silver: "#c0c0c0",
  8262. skyblue: "#87ceeb",
  8263. slateblue: "#6a5acd",
  8264. slategray: "#708090",
  8265. slategrey: "#708090",
  8266. snow: "#fffafa",
  8267. springgreen: "#00ff7f",
  8268. steelblue: "#4682b4",
  8269. tan: "#d2b48c",
  8270. teal: "#008080",
  8271. thistle: "#d8bfd8",
  8272. tomato: "#ff6347",
  8273. turquoise: "#40e0d0",
  8274. violet: "#ee82ee",
  8275. wheat: "#f5deb3",
  8276. white: "#ffffff",
  8277. whitesmoke: "#f5f5f5",
  8278. yellow: "#ffff00",
  8279. yellowgreen: "#9acd32"
  8280. };
  8281. goog.color.parse = function (a) {
  8282. var b = {};
  8283. a = String(a);
  8284. var c = goog.color.prependHashIfNecessaryHelper(a);
  8285. if (goog.color.isValidHexColor_(c))
  8286. return b.hex = goog.color.normalizeHex(c),
  8287. b.type = "hex",
  8288. b;
  8289. c = goog.color.isValidRgbColor_(a);
  8290. if (c.length)
  8291. return b.hex = goog.color.rgbArrayToHex(c),
  8292. b.type = "rgb",
  8293. b;
  8294. if (goog.color.names && (c = goog.color.names[a.toLowerCase()]))
  8295. return b.hex = c,
  8296. b.type = "named",
  8297. b;
  8298. throw Error(a + " is not a valid color string");
  8299. }
  8300. ;
  8301. goog.color.isValidColor = function (a) {
  8302. var b = goog.color.prependHashIfNecessaryHelper(a);
  8303. return !!(goog.color.isValidHexColor_(b) || goog.color.isValidRgbColor_(a).length || goog.color.names && goog.color.names[a.toLowerCase()])
  8304. }
  8305. ;
  8306. goog.color.parseRgb = function (a) {
  8307. var b = goog.color.isValidRgbColor_(a);
  8308. if (!b.length)
  8309. throw Error(a + " is not a valid RGB color");
  8310. return b
  8311. }
  8312. ;
  8313. goog.color.hexToRgbStyle = function (a) {
  8314. return goog.color.rgbStyle_(goog.color.hexToRgb(a))
  8315. }
  8316. ;
  8317. goog.color.hexTripletRe_ = /#(.)(.)(.)/;
  8318. goog.color.normalizeHex = function (a) {
  8319. if (!goog.color.isValidHexColor_(a))
  8320. throw Error("'" + a + "' is not a valid hex color");
  8321. 4 == a.length && (a = a.replace(goog.color.hexTripletRe_, "#$1$1$2$2$3$3"));
  8322. return a.toLowerCase()
  8323. }
  8324. ;
  8325. goog.color.hexToRgb = function (a) {
  8326. a = goog.color.normalizeHex(a);
  8327. a = parseInt(a.substr(1), 16);
  8328. return [a >> 16, a >> 8 & 255, a & 255]
  8329. }
  8330. ;
  8331. goog.color.rgbToHex = function (a, b, c) {
  8332. a = Number(a);
  8333. b = Number(b);
  8334. c = Number(c);
  8335. if (a != (a & 255) || b != (b & 255) || c != (c & 255))
  8336. throw Error('"(' + a + "," + b + "," + c + '") is not a valid RGB color');
  8337. b = a << 16 | b << 8 | c;
  8338. return 16 > a ? "#" + (16777216 | b).toString(16).substr(1) : "#" + b.toString(16)
  8339. }
  8340. ;
  8341. goog.color.rgbArrayToHex = function (a) {
  8342. return goog.color.rgbToHex(a[0], a[1], a[2])
  8343. }
  8344. ;
  8345. goog.color.rgbToHsl = function (a, b, c) {
  8346. a /= 255;
  8347. b /= 255;
  8348. c /= 255;
  8349. var d = Math.max(a, b, c)
  8350. , e = Math.min(a, b, c)
  8351. , f = 0
  8352. , g = 0
  8353. , h = .5 * (d + e);
  8354. d != e && (d == a ? f = 60 * (b - c) / (d - e) : d == b ? f = 60 * (c - a) / (d - e) + 120 : d == c && (f = 60 * (a - b) / (d - e) + 240),
  8355. g = 0 < h && .5 >= h ? (d - e) / (2 * h) : (d - e) / (2 - 2 * h));
  8356. return [Math.round(f + 360) % 360, g, h]
  8357. }
  8358. ;
  8359. goog.color.rgbArrayToHsl = function (a) {
  8360. return goog.color.rgbToHsl(a[0], a[1], a[2])
  8361. }
  8362. ;
  8363. goog.color.hueToRgb_ = function (a, b, c) {
  8364. 0 > c ? c += 1 : 1 < c && --c;
  8365. return 1 > 6 * c ? a + 6 * (b - a) * c : 1 > 2 * c ? b : 2 > 3 * c ? a + (b - a) * (2 / 3 - c) * 6 : a
  8366. }
  8367. ;
  8368. goog.color.hslToRgb = function (a, b, c) {
  8369. a /= 360;
  8370. if (0 == b)
  8371. c = b = a = 255 * c;
  8372. else {
  8373. var d = .5 > c ? c * (1 + b) : c + b - b * c;
  8374. var e = 2 * c - d;
  8375. c = 255 * goog.color.hueToRgb_(e, d, a + 1 / 3);
  8376. b = 255 * goog.color.hueToRgb_(e, d, a);
  8377. a = 255 * goog.color.hueToRgb_(e, d, a - 1 / 3)
  8378. }
  8379. return [Math.round(c), Math.round(b), Math.round(a)]
  8380. }
  8381. ;
  8382. goog.color.hslArrayToRgb = function (a) {
  8383. return goog.color.hslToRgb(a[0], a[1], a[2])
  8384. }
  8385. ;
  8386. goog.color.validHexColorRe_ = /^#(?:[0-9a-f]{3}){1,2}$/i;
  8387. goog.color.isValidHexColor_ = function (a) {
  8388. return goog.color.validHexColorRe_.test(a)
  8389. }
  8390. ;
  8391. goog.color.rgbColorRe_ = /^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;
  8392. goog.color.isValidRgbColor_ = function (a) {
  8393. var b = a.match(goog.color.rgbColorRe_);
  8394. if (b) {
  8395. a = Number(b[1]);
  8396. var c = Number(b[2]);
  8397. b = Number(b[3]);
  8398. if (0 <= a && 255 >= a && 0 <= c && 255 >= c && 0 <= b && 255 >= b)
  8399. return [a, c, b]
  8400. }
  8401. return []
  8402. }
  8403. ;
  8404. goog.color.prependZeroIfNecessaryHelper = function (a) {
  8405. return 1 == a.length ? "0" + a : a
  8406. }
  8407. ;
  8408. goog.color.prependHashIfNecessaryHelper = function (a) {
  8409. return "#" == a.charAt(0) ? a : "#" + a
  8410. }
  8411. ;
  8412. goog.color.rgbStyle_ = function (a) {
  8413. return "rgb(" + a.join(",") + ")"
  8414. }
  8415. ;
  8416. goog.color.hsvToRgb = function (a, b, c) {
  8417. var d = 0
  8418. , e = 0
  8419. , f = 0;
  8420. if (0 == b)
  8421. f = e = d = c;
  8422. else {
  8423. var g = Math.floor(a / 60)
  8424. , h = a / 60 - g;
  8425. a = c * (1 - b);
  8426. var k = c * (1 - b * h);
  8427. b = c * (1 - b * (1 - h));
  8428. switch (g) {
  8429. case 1:
  8430. d = k;
  8431. e = c;
  8432. f = a;
  8433. break;
  8434. case 2:
  8435. d = a;
  8436. e = c;
  8437. f = b;
  8438. break;
  8439. case 3:
  8440. d = a;
  8441. e = k;
  8442. f = c;
  8443. break;
  8444. case 4:
  8445. d = b;
  8446. e = a;
  8447. f = c;
  8448. break;
  8449. case 5:
  8450. d = c;
  8451. e = a;
  8452. f = k;
  8453. break;
  8454. case 6:
  8455. case 0:
  8456. d = c,
  8457. e = b,
  8458. f = a
  8459. }
  8460. }
  8461. return [Math.round(d), Math.round(e), Math.round(f)]
  8462. }
  8463. ;
  8464. goog.color.rgbToHsv = function (a, b, c) {
  8465. var d = Math.max(Math.max(a, b), c)
  8466. , e = Math.min(Math.min(a, b), c);
  8467. if (e == d)
  8468. e = a = 0;
  8469. else {
  8470. var f = d - e;
  8471. e = f / d;
  8472. a = 60 * (a == d ? (b - c) / f : b == d ? 2 + (c - a) / f : 4 + (a - b) / f);
  8473. 0 > a && (a += 360);
  8474. 360 < a && (a -= 360)
  8475. }
  8476. return [a, e, d]
  8477. }
  8478. ;
  8479. goog.color.rgbArrayToHsv = function (a) {
  8480. return goog.color.rgbToHsv(a[0], a[1], a[2])
  8481. }
  8482. ;
  8483. goog.color.hsvArrayToRgb = function (a) {
  8484. return goog.color.hsvToRgb(a[0], a[1], a[2])
  8485. }
  8486. ;
  8487. goog.color.hexToHsl = function (a) {
  8488. a = goog.color.hexToRgb(a);
  8489. return goog.color.rgbToHsl(a[0], a[1], a[2])
  8490. }
  8491. ;
  8492. goog.color.hslToHex = function (a, b, c) {
  8493. return goog.color.rgbArrayToHex(goog.color.hslToRgb(a, b, c))
  8494. }
  8495. ;
  8496. goog.color.hslArrayToHex = function (a) {
  8497. return goog.color.rgbArrayToHex(goog.color.hslToRgb(a[0], a[1], a[2]))
  8498. }
  8499. ;
  8500. goog.color.hexToHsv = function (a) {
  8501. return goog.color.rgbArrayToHsv(goog.color.hexToRgb(a))
  8502. }
  8503. ;
  8504. goog.color.hsvToHex = function (a, b, c) {
  8505. return goog.color.rgbArrayToHex(goog.color.hsvToRgb(a, b, c))
  8506. }
  8507. ;
  8508. goog.color.hsvArrayToHex = function (a) {
  8509. return goog.color.hsvToHex(a[0], a[1], a[2])
  8510. }
  8511. ;
  8512. goog.color.hslDistance = function (a, b) {
  8513. var c = .5 >= a[2] ? a[1] * a[2] : a[1] * (1 - a[2]);
  8514. var d = .5 >= b[2] ? b[1] * b[2] : b[1] * (1 - b[2]);
  8515. return (a[2] - b[2]) * (a[2] - b[2]) + c * c + d * d - 2 * c * d * Math.cos(2 * (a[0] / 360 - b[0] / 360) * Math.PI)
  8516. }
  8517. ;
  8518. goog.color.blend = function (a, b, c) {
  8519. c = goog.math.clamp(c, 0, 1);
  8520. return [Math.round(b[0] + c * (a[0] - b[0])), Math.round(b[1] + c * (a[1] - b[1])), Math.round(b[2] + c * (a[2] - b[2]))]
  8521. }
  8522. ;
  8523. goog.color.darken = function (a, b) {
  8524. return goog.color.blend([0, 0, 0], a, b)
  8525. }
  8526. ;
  8527. goog.color.lighten = function (a, b) {
  8528. return goog.color.blend([255, 255, 255], a, b)
  8529. }
  8530. ;
  8531. goog.color.highContrast = function (a, b) {
  8532. for (var c = [], d = 0; d < b.length; d++)
  8533. c.push({
  8534. color: b[d],
  8535. diff: goog.color.yiqBrightnessDiff_(b[d], a) + goog.color.colorDiff_(b[d], a)
  8536. });
  8537. c.sort(function (a, b) {
  8538. return b.diff - a.diff
  8539. });
  8540. return c[0].color
  8541. }
  8542. ;
  8543. goog.color.yiqBrightness_ = function (a) {
  8544. return Math.round((299 * a[0] + 587 * a[1] + 114 * a[2]) / 1E3)
  8545. }
  8546. ;
  8547. goog.color.yiqBrightnessDiff_ = function (a, b) {
  8548. return Math.abs(goog.color.yiqBrightness_(a) - goog.color.yiqBrightness_(b))
  8549. }
  8550. ;
  8551. goog.color.colorDiff_ = function (a, b) {
  8552. return Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]) + Math.abs(a[2] - b[2])
  8553. }
  8554. ;
  8555. goog.dom.vendor = {};
  8556. goog.dom.vendor.getVendorJsPrefix = function () {
  8557. return goog.userAgent.WEBKIT ? "Webkit" : goog.userAgent.GECKO ? "Moz" : goog.userAgent.IE ? "ms" : goog.userAgent.OPERA ? "O" : null
  8558. }
  8559. ;
  8560. goog.dom.vendor.getVendorPrefix = function () {
  8561. return goog.userAgent.WEBKIT ? "-webkit" : goog.userAgent.GECKO ? "-moz" : goog.userAgent.IE ? "-ms" : goog.userAgent.OPERA ? "-o" : null
  8562. }
  8563. ;
  8564. goog.dom.vendor.getPrefixedPropertyName = function (a, b) {
  8565. if (b && a in b)
  8566. return a;
  8567. var c = goog.dom.vendor.getVendorJsPrefix();
  8568. return c ? (c = c.toLowerCase(),
  8569. c += goog.string.toTitleCase(a),
  8570. void 0 === b || c in b ? c : null) : null
  8571. }
  8572. ;
  8573. goog.dom.vendor.getPrefixedEventType = function (a) {
  8574. return ((goog.dom.vendor.getVendorJsPrefix() || "") + a).toLowerCase()
  8575. }
  8576. ;
  8577. goog.math.Box = function (a, b, c, d) {
  8578. this.top = a;
  8579. this.right = b;
  8580. this.bottom = c;
  8581. this.left = d
  8582. }
  8583. ;
  8584. goog.math.Box.boundingBox = function (a) {
  8585. for (var b = new goog.math.Box(arguments[0].y, arguments[0].x, arguments[0].y, arguments[0].x), c = 1; c < arguments.length; c++)
  8586. b.expandToIncludeCoordinate(arguments[c]);
  8587. return b
  8588. }
  8589. ;
  8590. goog.math.Box.prototype.getWidth = function () {
  8591. return this.right - this.left
  8592. }
  8593. ;
  8594. goog.math.Box.prototype.getHeight = function () {
  8595. return this.bottom - this.top
  8596. }
  8597. ;
  8598. goog.math.Box.prototype.clone = function () {
  8599. return new goog.math.Box(this.top, this.right, this.bottom, this.left)
  8600. }
  8601. ;
  8602. goog.DEBUG && (goog.math.Box.prototype.toString = function () {
  8603. return "(" + this.top + "t, " + this.right + "r, " + this.bottom + "b, " + this.left + "l)"
  8604. }
  8605. );
  8606. goog.math.Box.prototype.contains = function (a) {
  8607. return goog.math.Box.contains(this, a)
  8608. }
  8609. ;
  8610. goog.math.Box.prototype.expand = function (a, b, c, d) {
  8611. goog.isObject(a) ? (this.top -= a.top,
  8612. this.right += a.right,
  8613. this.bottom += a.bottom,
  8614. this.left -= a.left) : (this.top -= a,
  8615. this.right += Number(b),
  8616. this.bottom += Number(c),
  8617. this.left -= Number(d));
  8618. return this
  8619. }
  8620. ;
  8621. goog.math.Box.prototype.expandToInclude = function (a) {
  8622. this.left = Math.min(this.left, a.left);
  8623. this.top = Math.min(this.top, a.top);
  8624. this.right = Math.max(this.right, a.right);
  8625. this.bottom = Math.max(this.bottom, a.bottom)
  8626. }
  8627. ;
  8628. goog.math.Box.prototype.expandToIncludeCoordinate = function (a) {
  8629. this.top = Math.min(this.top, a.y);
  8630. this.right = Math.max(this.right, a.x);
  8631. this.bottom = Math.max(this.bottom, a.y);
  8632. this.left = Math.min(this.left, a.x)
  8633. }
  8634. ;
  8635. goog.math.Box.equals = function (a, b) {
  8636. return a == b ? !0 : a && b ? a.top == b.top && a.right == b.right && a.bottom == b.bottom && a.left == b.left : !1
  8637. }
  8638. ;
  8639. goog.math.Box.contains = function (a, b) {
  8640. return a && b ? b instanceof goog.math.Box ? b.left >= a.left && b.right <= a.right && b.top >= a.top && b.bottom <= a.bottom : b.x >= a.left && b.x <= a.right && b.y >= a.top && b.y <= a.bottom : !1
  8641. }
  8642. ;
  8643. goog.math.Box.relativePositionX = function (a, b) {
  8644. return b.x < a.left ? b.x - a.left : b.x > a.right ? b.x - a.right : 0
  8645. }
  8646. ;
  8647. goog.math.Box.relativePositionY = function (a, b) {
  8648. return b.y < a.top ? b.y - a.top : b.y > a.bottom ? b.y - a.bottom : 0
  8649. }
  8650. ;
  8651. goog.math.Box.distance = function (a, b) {
  8652. var c = goog.math.Box.relativePositionX(a, b)
  8653. , d = goog.math.Box.relativePositionY(a, b);
  8654. return Math.sqrt(c * c + d * d)
  8655. }
  8656. ;
  8657. goog.math.Box.intersects = function (a, b) {
  8658. return a.left <= b.right && b.left <= a.right && a.top <= b.bottom && b.top <= a.bottom
  8659. }
  8660. ;
  8661. goog.math.Box.intersectsWithPadding = function (a, b, c) {
  8662. return a.left <= b.right + c && b.left <= a.right + c && a.top <= b.bottom + c && b.top <= a.bottom + c
  8663. }
  8664. ;
  8665. goog.math.Box.prototype.ceil = function () {
  8666. this.top = Math.ceil(this.top);
  8667. this.right = Math.ceil(this.right);
  8668. this.bottom = Math.ceil(this.bottom);
  8669. this.left = Math.ceil(this.left);
  8670. return this
  8671. }
  8672. ;
  8673. goog.math.Box.prototype.floor = function () {
  8674. this.top = Math.floor(this.top);
  8675. this.right = Math.floor(this.right);
  8676. this.bottom = Math.floor(this.bottom);
  8677. this.left = Math.floor(this.left);
  8678. return this
  8679. }
  8680. ;
  8681. goog.math.Box.prototype.round = function () {
  8682. this.top = Math.round(this.top);
  8683. this.right = Math.round(this.right);
  8684. this.bottom = Math.round(this.bottom);
  8685. this.left = Math.round(this.left);
  8686. return this
  8687. }
  8688. ;
  8689. goog.math.Box.prototype.translate = function (a, b) {
  8690. a instanceof goog.math.Coordinate ? (this.left += a.x,
  8691. this.right += a.x,
  8692. this.top += a.y,
  8693. this.bottom += a.y) : (goog.asserts.assertNumber(a),
  8694. this.left += a,
  8695. this.right += a,
  8696. "number" === typeof b && (this.top += b,
  8697. this.bottom += b));
  8698. return this
  8699. }
  8700. ;
  8701. goog.math.Box.prototype.scale = function (a, b) {
  8702. var c = "number" === typeof b ? b : a;
  8703. this.left *= a;
  8704. this.right *= a;
  8705. this.top *= c;
  8706. this.bottom *= c;
  8707. return this
  8708. }
  8709. ;
  8710. goog.math.IRect = function () { }
  8711. ;
  8712. goog.math.Rect = function (a, b, c, d) {
  8713. this.left = a;
  8714. this.top = b;
  8715. this.width = c;
  8716. this.height = d
  8717. }
  8718. ;
  8719. goog.math.Rect.prototype.clone = function () {
  8720. return new goog.math.Rect(this.left, this.top, this.width, this.height)
  8721. }
  8722. ;
  8723. goog.math.Rect.prototype.toBox = function () {
  8724. return new goog.math.Box(this.top, this.left + this.width, this.top + this.height, this.left)
  8725. }
  8726. ;
  8727. goog.math.Rect.createFromPositionAndSize = function (a, b) {
  8728. return new goog.math.Rect(a.x, a.y, b.width, b.height)
  8729. }
  8730. ;
  8731. goog.math.Rect.createFromBox = function (a) {
  8732. return new goog.math.Rect(a.left, a.top, a.right - a.left, a.bottom - a.top)
  8733. }
  8734. ;
  8735. goog.DEBUG && (goog.math.Rect.prototype.toString = function () {
  8736. return "(" + this.left + ", " + this.top + " - " + this.width + "w x " + this.height + "h)"
  8737. }
  8738. );
  8739. goog.math.Rect.equals = function (a, b) {
  8740. return a == b ? !0 : a && b ? a.left == b.left && a.width == b.width && a.top == b.top && a.height == b.height : !1
  8741. }
  8742. ;
  8743. goog.math.Rect.prototype.intersection = function (a) {
  8744. var b = Math.max(this.left, a.left)
  8745. , c = Math.min(this.left + this.width, a.left + a.width);
  8746. if (b <= c) {
  8747. var d = Math.max(this.top, a.top);
  8748. a = Math.min(this.top + this.height, a.top + a.height);
  8749. if (d <= a)
  8750. return this.left = b,
  8751. this.top = d,
  8752. this.width = c - b,
  8753. this.height = a - d,
  8754. !0
  8755. }
  8756. return !1
  8757. }
  8758. ;
  8759. goog.math.Rect.intersection = function (a, b) {
  8760. var c = Math.max(a.left, b.left)
  8761. , d = Math.min(a.left + a.width, b.left + b.width);
  8762. if (c <= d) {
  8763. var e = Math.max(a.top, b.top)
  8764. , f = Math.min(a.top + a.height, b.top + b.height);
  8765. if (e <= f)
  8766. return new goog.math.Rect(c, e, d - c, f - e)
  8767. }
  8768. return null
  8769. }
  8770. ;
  8771. goog.math.Rect.intersects = function (a, b) {
  8772. return a.left <= b.left + b.width && b.left <= a.left + a.width && a.top <= b.top + b.height && b.top <= a.top + a.height
  8773. }
  8774. ;
  8775. goog.math.Rect.prototype.intersects = function (a) {
  8776. return goog.math.Rect.intersects(this, a)
  8777. }
  8778. ;
  8779. goog.math.Rect.difference = function (a, b) {
  8780. var c = goog.math.Rect.intersection(a, b);
  8781. if (!c || !c.height || !c.width)
  8782. return [a.clone()];
  8783. c = [];
  8784. var d = a.top
  8785. , e = a.height
  8786. , f = a.left + a.width
  8787. , g = a.top + a.height
  8788. , h = b.left + b.width
  8789. , k = b.top + b.height;
  8790. b.top > a.top && (c.push(new goog.math.Rect(a.left, a.top, a.width, b.top - a.top)),
  8791. d = b.top,
  8792. e -= b.top - a.top);
  8793. k < g && (c.push(new goog.math.Rect(a.left, k, a.width, g - k)),
  8794. e = k - d);
  8795. b.left > a.left && c.push(new goog.math.Rect(a.left, d, b.left - a.left, e));
  8796. h < f && c.push(new goog.math.Rect(h, d, f - h, e));
  8797. return c
  8798. }
  8799. ;
  8800. goog.math.Rect.prototype.difference = function (a) {
  8801. return goog.math.Rect.difference(this, a)
  8802. }
  8803. ;
  8804. goog.math.Rect.prototype.boundingRect = function (a) {
  8805. var b = Math.max(this.left + this.width, a.left + a.width)
  8806. , c = Math.max(this.top + this.height, a.top + a.height);
  8807. this.left = Math.min(this.left, a.left);
  8808. this.top = Math.min(this.top, a.top);
  8809. this.width = b - this.left;
  8810. this.height = c - this.top
  8811. }
  8812. ;
  8813. goog.math.Rect.boundingRect = function (a, b) {
  8814. if (!a || !b)
  8815. return null;
  8816. var c = new goog.math.Rect(a.left, a.top, a.width, a.height);
  8817. c.boundingRect(b);
  8818. return c
  8819. }
  8820. ;
  8821. goog.math.Rect.prototype.contains = function (a) {
  8822. return a instanceof goog.math.Coordinate ? a.x >= this.left && a.x <= this.left + this.width && a.y >= this.top && a.y <= this.top + this.height : this.left <= a.left && this.left + this.width >= a.left + a.width && this.top <= a.top && this.top + this.height >= a.top + a.height
  8823. }
  8824. ;
  8825. goog.math.Rect.prototype.squaredDistance = function (a) {
  8826. var b = a.x < this.left ? this.left - a.x : Math.max(a.x - (this.left + this.width), 0);
  8827. a = a.y < this.top ? this.top - a.y : Math.max(a.y - (this.top + this.height), 0);
  8828. return b * b + a * a
  8829. }
  8830. ;
  8831. goog.math.Rect.prototype.distance = function (a) {
  8832. return Math.sqrt(this.squaredDistance(a))
  8833. }
  8834. ;
  8835. goog.math.Rect.prototype.getSize = function () {
  8836. return new goog.math.Size(this.width, this.height)
  8837. }
  8838. ;
  8839. goog.math.Rect.prototype.getTopLeft = function () {
  8840. return new goog.math.Coordinate(this.left, this.top)
  8841. }
  8842. ;
  8843. goog.math.Rect.prototype.getCenter = function () {
  8844. return new goog.math.Coordinate(this.left + this.width / 2, this.top + this.height / 2)
  8845. }
  8846. ;
  8847. goog.math.Rect.prototype.getBottomRight = function () {
  8848. return new goog.math.Coordinate(this.left + this.width, this.top + this.height)
  8849. }
  8850. ;
  8851. goog.math.Rect.prototype.ceil = function () {
  8852. this.left = Math.ceil(this.left);
  8853. this.top = Math.ceil(this.top);
  8854. this.width = Math.ceil(this.width);
  8855. this.height = Math.ceil(this.height);
  8856. return this
  8857. }
  8858. ;
  8859. goog.math.Rect.prototype.floor = function () {
  8860. this.left = Math.floor(this.left);
  8861. this.top = Math.floor(this.top);
  8862. this.width = Math.floor(this.width);
  8863. this.height = Math.floor(this.height);
  8864. return this
  8865. }
  8866. ;
  8867. goog.math.Rect.prototype.round = function () {
  8868. this.left = Math.round(this.left);
  8869. this.top = Math.round(this.top);
  8870. this.width = Math.round(this.width);
  8871. this.height = Math.round(this.height);
  8872. return this
  8873. }
  8874. ;
  8875. goog.math.Rect.prototype.translate = function (a, b) {
  8876. a instanceof goog.math.Coordinate ? (this.left += a.x,
  8877. this.top += a.y) : (this.left += goog.asserts.assertNumber(a),
  8878. "number" === typeof b && (this.top += b));
  8879. return this
  8880. }
  8881. ;
  8882. goog.math.Rect.prototype.scale = function (a, b) {
  8883. var c = "number" === typeof b ? b : a;
  8884. this.left *= a;
  8885. this.width *= a;
  8886. this.top *= c;
  8887. this.height *= c;
  8888. return this
  8889. }
  8890. ;
  8891. goog.style = {};
  8892. goog.style.setStyle = function (a, b, c) {
  8893. if ("string" === typeof b)
  8894. goog.style.setStyle_(a, c, b);
  8895. else
  8896. for (var d in b)
  8897. goog.style.setStyle_(a, b[d], d)
  8898. }
  8899. ;
  8900. goog.style.setStyle_ = function (a, b, c) {
  8901. (c = goog.style.getVendorJsStyleName_(a, c)) && (a.style[c] = b)
  8902. }
  8903. ;
  8904. goog.style.styleNameCache_ = {};
  8905. goog.style.getVendorJsStyleName_ = function (a, b) {
  8906. var c = goog.style.styleNameCache_[b];
  8907. if (!c) {
  8908. var d = goog.string.toCamelCase(b);
  8909. c = d;
  8910. void 0 === a.style[d] && (d = goog.dom.vendor.getVendorJsPrefix() + goog.string.toTitleCase(d),
  8911. void 0 !== a.style[d] && (c = d));
  8912. goog.style.styleNameCache_[b] = c
  8913. }
  8914. return c
  8915. }
  8916. ;
  8917. goog.style.getVendorStyleName_ = function (a, b) {
  8918. var c = goog.string.toCamelCase(b);
  8919. return void 0 === a.style[c] && (c = goog.dom.vendor.getVendorJsPrefix() + goog.string.toTitleCase(c),
  8920. void 0 !== a.style[c]) ? goog.dom.vendor.getVendorPrefix() + "-" + b : b
  8921. }
  8922. ;
  8923. goog.style.getStyle = function (a, b) {
  8924. var c = a.style[goog.string.toCamelCase(b)];
  8925. return "undefined" !== typeof c ? c : a.style[goog.style.getVendorJsStyleName_(a, b)] || ""
  8926. }
  8927. ;
  8928. goog.style.getComputedStyle = function (a, b) {
  8929. var c = goog.dom.getOwnerDocument(a);
  8930. return c.defaultView && c.defaultView.getComputedStyle && (c = c.defaultView.getComputedStyle(a, null)) ? c[b] || c.getPropertyValue(b) || "" : ""
  8931. }
  8932. ;
  8933. goog.style.getCascadedStyle = function (a, b) {
  8934. return a.currentStyle ? a.currentStyle[b] : null
  8935. }
  8936. ;
  8937. goog.style.getStyle_ = function (a, b) {
  8938. return goog.style.getComputedStyle(a, b) || goog.style.getCascadedStyle(a, b) || a.style && a.style[b]
  8939. }
  8940. ;
  8941. goog.style.getComputedBoxSizing = function (a) {
  8942. return goog.style.getStyle_(a, "boxSizing") || goog.style.getStyle_(a, "MozBoxSizing") || goog.style.getStyle_(a, "WebkitBoxSizing") || null
  8943. }
  8944. ;
  8945. goog.style.getComputedPosition = function (a) {
  8946. return goog.style.getStyle_(a, "position")
  8947. }
  8948. ;
  8949. goog.style.getBackgroundColor = function (a) {
  8950. return goog.style.getStyle_(a, "backgroundColor")
  8951. }
  8952. ;
  8953. goog.style.getComputedOverflowX = function (a) {
  8954. return goog.style.getStyle_(a, "overflowX")
  8955. }
  8956. ;
  8957. goog.style.getComputedOverflowY = function (a) {
  8958. return goog.style.getStyle_(a, "overflowY")
  8959. }
  8960. ;
  8961. goog.style.getComputedZIndex = function (a) {
  8962. return goog.style.getStyle_(a, "zIndex")
  8963. }
  8964. ;
  8965. goog.style.getComputedTextAlign = function (a) {
  8966. return goog.style.getStyle_(a, "textAlign")
  8967. }
  8968. ;
  8969. goog.style.getComputedCursor = function (a) {
  8970. return goog.style.getStyle_(a, "cursor")
  8971. }
  8972. ;
  8973. goog.style.getComputedTransform = function (a) {
  8974. var b = goog.style.getVendorStyleName_(a, "transform");
  8975. return goog.style.getStyle_(a, b) || goog.style.getStyle_(a, "transform")
  8976. }
  8977. ;
  8978. goog.style.setPosition = function (a, b, c) {
  8979. if (b instanceof goog.math.Coordinate) {
  8980. var d = b.x;
  8981. b = b.y
  8982. } else
  8983. d = b,
  8984. b = c;
  8985. a.style.left = goog.style.getPixelStyleValue_(d, !1);
  8986. a.style.top = goog.style.getPixelStyleValue_(b, !1)
  8987. }
  8988. ;
  8989. goog.style.getPosition = function (a) {
  8990. return new goog.math.Coordinate(a.offsetLeft, a.offsetTop)
  8991. }
  8992. ;
  8993. goog.style.getClientViewportElement = function (a) {
  8994. a = a ? goog.dom.getOwnerDocument(a) : goog.dom.getDocument();
  8995. return !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9) || goog.dom.getDomHelper(a).isCss1CompatMode() ? a.documentElement : a.body
  8996. }
  8997. ;
  8998. goog.style.getViewportPageOffset = function (a) {
  8999. var b = a.body;
  9000. a = a.documentElement;
  9001. return new goog.math.Coordinate(b.scrollLeft || a.scrollLeft, b.scrollTop || a.scrollTop)
  9002. }
  9003. ;
  9004. goog.style.getBoundingClientRect_ = function (a) {
  9005. try {
  9006. var b = a.getBoundingClientRect()
  9007. } catch (c) {
  9008. return {
  9009. left: 0,
  9010. top: 0,
  9011. right: 0,
  9012. bottom: 0
  9013. }
  9014. }
  9015. goog.userAgent.IE && a.ownerDocument.body && (a = a.ownerDocument,
  9016. b.left -= a.documentElement.clientLeft + a.body.clientLeft,
  9017. b.top -= a.documentElement.clientTop + a.body.clientTop);
  9018. return b
  9019. }
  9020. ;
  9021. goog.style.getOffsetParent = function (a) {
  9022. if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(8))
  9023. return goog.asserts.assert(a && "offsetParent" in a),
  9024. a.offsetParent;
  9025. var b = goog.dom.getOwnerDocument(a)
  9026. , c = goog.style.getStyle_(a, "position")
  9027. , d = "fixed" == c || "absolute" == c;
  9028. for (a = a.parentNode; a && a != b; a = a.parentNode)
  9029. if (a.nodeType == goog.dom.NodeType.DOCUMENT_FRAGMENT && a.host && (a = a.host),
  9030. c = goog.style.getStyle_(a, "position"),
  9031. d = d && "static" == c && a != b.documentElement && a != b.body,
  9032. !d && (a.scrollWidth > a.clientWidth || a.scrollHeight > a.clientHeight || "fixed" == c || "absolute" == c || "relative" == c))
  9033. return a;
  9034. return null
  9035. }
  9036. ;
  9037. goog.style.getVisibleRectForElement = function (a) {
  9038. for (var b = new goog.math.Box(0, Infinity, Infinity, 0), c = goog.dom.getDomHelper(a), d = c.getDocument().body, e = c.getDocument().documentElement, f = c.getDocumentScrollElement(); a = goog.style.getOffsetParent(a);)
  9039. if (!(goog.userAgent.IE && 0 == a.clientWidth || goog.userAgent.WEBKIT && 0 == a.clientHeight && a == d) && a != d && a != e && "visible" != goog.style.getStyle_(a, "overflow")) {
  9040. var g = goog.style.getPageOffset(a)
  9041. , h = goog.style.getClientLeftTop(a);
  9042. g.x += h.x;
  9043. g.y += h.y;
  9044. b.top = Math.max(b.top, g.y);
  9045. b.right = Math.min(b.right, g.x + a.clientWidth);
  9046. b.bottom = Math.min(b.bottom, g.y + a.clientHeight);
  9047. b.left = Math.max(b.left, g.x)
  9048. }
  9049. d = f.scrollLeft;
  9050. f = f.scrollTop;
  9051. b.left = Math.max(b.left, d);
  9052. b.top = Math.max(b.top, f);
  9053. c = c.getViewportSize();
  9054. b.right = Math.min(b.right, d + c.width);
  9055. b.bottom = Math.min(b.bottom, f + c.height);
  9056. return 0 <= b.top && 0 <= b.left && b.bottom > b.top && b.right > b.left ? b : null
  9057. }
  9058. ;
  9059. goog.style.getContainerOffsetToScrollInto = function (a, b, c) {
  9060. var d = b || goog.dom.getDocumentScrollElement()
  9061. , e = goog.style.getPageOffset(a)
  9062. , f = goog.style.getPageOffset(d)
  9063. , g = goog.style.getBorderBox(d);
  9064. d == goog.dom.getDocumentScrollElement() ? (b = e.x - d.scrollLeft,
  9065. e = e.y - d.scrollTop,
  9066. goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(10) && (b += g.left,
  9067. e += g.top)) : (b = e.x - f.x - g.left,
  9068. e = e.y - f.y - g.top);
  9069. g = goog.style.getSizeWithDisplay_(a);
  9070. a = d.clientWidth - g.width;
  9071. g = d.clientHeight - g.height;
  9072. f = d.scrollLeft;
  9073. d = d.scrollTop;
  9074. c ? (f += b - a / 2,
  9075. d += e - g / 2) : (f += Math.min(b, Math.max(b - a, 0)),
  9076. d += Math.min(e, Math.max(e - g, 0)));
  9077. return new goog.math.Coordinate(f, d)
  9078. }
  9079. ;
  9080. goog.style.scrollIntoContainerView = function (a, b, c) {
  9081. b = b || goog.dom.getDocumentScrollElement();
  9082. a = goog.style.getContainerOffsetToScrollInto(a, b, c);
  9083. b.scrollLeft = a.x;
  9084. b.scrollTop = a.y
  9085. }
  9086. ;
  9087. goog.style.getClientLeftTop = function (a) {
  9088. return new goog.math.Coordinate(a.clientLeft, a.clientTop)
  9089. }
  9090. ;
  9091. goog.style.getPageOffset = function (a) {
  9092. var b = goog.dom.getOwnerDocument(a);
  9093. goog.asserts.assertObject(a, "Parameter is required");
  9094. var c = new goog.math.Coordinate(0, 0)
  9095. , d = goog.style.getClientViewportElement(b);
  9096. if (a == d)
  9097. return c;
  9098. a = goog.style.getBoundingClientRect_(a);
  9099. b = goog.dom.getDomHelper(b).getDocumentScroll();
  9100. c.x = a.left + b.x;
  9101. c.y = a.top + b.y;
  9102. return c
  9103. }
  9104. ;
  9105. goog.style.getPageOffsetLeft = function (a) {
  9106. return goog.style.getPageOffset(a).x
  9107. }
  9108. ;
  9109. goog.style.getPageOffsetTop = function (a) {
  9110. return goog.style.getPageOffset(a).y
  9111. }
  9112. ;
  9113. goog.style.getFramedPageOffset = function (a, b) {
  9114. var c = new goog.math.Coordinate(0, 0)
  9115. , d = goog.dom.getWindow(goog.dom.getOwnerDocument(a));
  9116. if (!goog.reflect.canAccessProperty(d, "parent"))
  9117. return c;
  9118. var e = a;
  9119. do {
  9120. var f = d == b ? goog.style.getPageOffset(e) : goog.style.getClientPositionForElement_(goog.asserts.assert(e));
  9121. c.x += f.x;
  9122. c.y += f.y
  9123. } while (d && d != b && d != d.parent && (e = d.frameElement) && (d = d.parent)); return c
  9124. }
  9125. ;
  9126. goog.style.translateRectForAnotherFrame = function (a, b, c) {
  9127. if (b.getDocument() != c.getDocument()) {
  9128. var d = b.getDocument().body;
  9129. c = goog.style.getFramedPageOffset(d, c.getWindow());
  9130. c = goog.math.Coordinate.difference(c, goog.style.getPageOffset(d));
  9131. !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9) || b.isCss1CompatMode() || (c = goog.math.Coordinate.difference(c, b.getDocumentScroll()));
  9132. a.left += c.x;
  9133. a.top += c.y
  9134. }
  9135. }
  9136. ;
  9137. goog.style.getRelativePosition = function (a, b) {
  9138. var c = goog.style.getClientPosition(a)
  9139. , d = goog.style.getClientPosition(b);
  9140. return new goog.math.Coordinate(c.x - d.x, c.y - d.y)
  9141. }
  9142. ;
  9143. goog.style.getClientPositionForElement_ = function (a) {
  9144. a = goog.style.getBoundingClientRect_(a);
  9145. return new goog.math.Coordinate(a.left, a.top)
  9146. }
  9147. ;
  9148. goog.style.getClientPosition = function (a) {
  9149. goog.asserts.assert(a);
  9150. if (a.nodeType == goog.dom.NodeType.ELEMENT)
  9151. return goog.style.getClientPositionForElement_(a);
  9152. a = a.changedTouches ? a.changedTouches[0] : a;
  9153. return new goog.math.Coordinate(a.clientX, a.clientY)
  9154. }
  9155. ;
  9156. goog.style.setPageOffset = function (a, b, c) {
  9157. var d = goog.style.getPageOffset(a);
  9158. b instanceof goog.math.Coordinate && (c = b.y,
  9159. b = b.x);
  9160. b = goog.asserts.assertNumber(b) - d.x;
  9161. goog.style.setPosition(a, a.offsetLeft + b, a.offsetTop + (Number(c) - d.y))
  9162. }
  9163. ;
  9164. goog.style.setSize = function (a, b, c) {
  9165. if (b instanceof goog.math.Size)
  9166. c = b.height,
  9167. b = b.width;
  9168. else if (void 0 == c)
  9169. throw Error("missing height argument");
  9170. goog.style.setWidth(a, b);
  9171. goog.style.setHeight(a, c)
  9172. }
  9173. ;
  9174. goog.style.getPixelStyleValue_ = function (a, b) {
  9175. "number" == typeof a && (a = (b ? Math.round(a) : a) + "px");
  9176. return a
  9177. }
  9178. ;
  9179. goog.style.setHeight = function (a, b) {
  9180. a.style.height = goog.style.getPixelStyleValue_(b, !0)
  9181. }
  9182. ;
  9183. goog.style.setWidth = function (a, b) {
  9184. a.style.width = goog.style.getPixelStyleValue_(b, !0)
  9185. }
  9186. ;
  9187. goog.style.getSize = function (a) {
  9188. return goog.style.evaluateWithTemporaryDisplay_(goog.style.getSizeWithDisplay_, a)
  9189. }
  9190. ;
  9191. goog.style.evaluateWithTemporaryDisplay_ = function (a, b) {
  9192. if ("none" != goog.style.getStyle_(b, "display"))
  9193. return a(b);
  9194. var c = b.style
  9195. , d = c.display
  9196. , e = c.visibility
  9197. , f = c.position;
  9198. c.visibility = "hidden";
  9199. c.position = "absolute";
  9200. c.display = "inline";
  9201. var g = a(b);
  9202. c.display = d;
  9203. c.position = f;
  9204. c.visibility = e;
  9205. return g
  9206. }
  9207. ;
  9208. goog.style.getSizeWithDisplay_ = function (a) {
  9209. var b = a.offsetWidth
  9210. , c = a.offsetHeight
  9211. , d = goog.userAgent.WEBKIT && !b && !c;
  9212. return (void 0 === b || d) && a.getBoundingClientRect ? (a = goog.style.getBoundingClientRect_(a),
  9213. new goog.math.Size(a.right - a.left, a.bottom - a.top)) : new goog.math.Size(b, c)
  9214. }
  9215. ;
  9216. goog.style.getTransformedSize = function (a) {
  9217. if (!a.getBoundingClientRect)
  9218. return null;
  9219. a = goog.style.evaluateWithTemporaryDisplay_(goog.style.getBoundingClientRect_, a);
  9220. return new goog.math.Size(a.right - a.left, a.bottom - a.top)
  9221. }
  9222. ;
  9223. goog.style.getBounds = function (a) {
  9224. var b = goog.style.getPageOffset(a);
  9225. a = goog.style.getSize(a);
  9226. return new goog.math.Rect(b.x, b.y, a.width, a.height)
  9227. }
  9228. ;
  9229. goog.style.toCamelCase = function (a) {
  9230. return goog.string.toCamelCase(String(a))
  9231. }
  9232. ;
  9233. goog.style.toSelectorCase = function (a) {
  9234. return goog.string.toSelectorCase(a)
  9235. }
  9236. ;
  9237. goog.style.getOpacity = function (a) {
  9238. goog.asserts.assert(a);
  9239. var b = a.style;
  9240. a = "";
  9241. "opacity" in b ? a = b.opacity : "MozOpacity" in b ? a = b.MozOpacity : "filter" in b && (b = b.filter.match(/alpha\(opacity=([\d.]+)\)/)) && (a = String(b[1] / 100));
  9242. return "" == a ? a : Number(a)
  9243. }
  9244. ;
  9245. goog.style.setOpacity = function (a, b) {
  9246. goog.asserts.assert(a);
  9247. var c = a.style;
  9248. "opacity" in c ? c.opacity = b : "MozOpacity" in c ? c.MozOpacity = b : "filter" in c && (c.filter = "" === b ? "" : "alpha(opacity=" + 100 * Number(b) + ")")
  9249. }
  9250. ;
  9251. goog.style.setTransparentBackgroundImage = function (a, b) {
  9252. var c = a.style;
  9253. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? c.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + b + '", sizingMethod="crop")' : (c.backgroundImage = "url(" + b + ")",
  9254. c.backgroundPosition = "top left",
  9255. c.backgroundRepeat = "no-repeat")
  9256. }
  9257. ;
  9258. goog.style.clearTransparentBackgroundImage = function (a) {
  9259. a = a.style;
  9260. "filter" in a ? a.filter = "" : a.backgroundImage = "none"
  9261. }
  9262. ;
  9263. goog.style.showElement = function (a, b) {
  9264. goog.style.setElementShown(a, b)
  9265. }
  9266. ;
  9267. goog.style.setElementShown = function (a, b) {
  9268. a.style.display = b ? "" : "none"
  9269. }
  9270. ;
  9271. goog.style.isElementShown = function (a) {
  9272. return "none" != a.style.display
  9273. }
  9274. ;
  9275. goog.style.installSafeStyleSheet = function (a, b) {
  9276. var c = goog.dom.getDomHelper(b)
  9277. , d = c.getDocument();
  9278. if (goog.userAgent.IE && d.createStyleSheet)
  9279. return c = d.createStyleSheet(),
  9280. goog.style.setSafeStyleSheet(c, a),
  9281. c;
  9282. d = c.getElementsByTagNameAndClass("HEAD")[0];
  9283. if (!d) {
  9284. var e = c.getElementsByTagNameAndClass("BODY")[0];
  9285. d = c.createDom("HEAD");
  9286. e.parentNode.insertBefore(d, e)
  9287. }
  9288. e = c.createDom("STYLE");
  9289. goog.style.setSafeStyleSheet(e, a);
  9290. c.appendChild(d, e);
  9291. return e
  9292. }
  9293. ;
  9294. goog.style.uninstallStyles = function (a) {
  9295. goog.dom.removeNode(a.ownerNode || a.owningElement || a)
  9296. }
  9297. ;
  9298. goog.style.setSafeStyleSheet = function (a, b) {
  9299. var c = goog.html.SafeStyleSheet.unwrap(b);
  9300. goog.userAgent.IE && void 0 !== a.cssText ? a.cssText = c : a.innerHTML = c
  9301. }
  9302. ;
  9303. goog.style.setPreWrap = function (a) {
  9304. a = a.style;
  9305. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? (a.whiteSpace = "pre",
  9306. a.wordWrap = "break-word") : a.whiteSpace = goog.userAgent.GECKO ? "-moz-pre-wrap" : "pre-wrap"
  9307. }
  9308. ;
  9309. goog.style.setInlineBlock = function (a) {
  9310. a = a.style;
  9311. a.position = "relative";
  9312. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? (a.zoom = "1",
  9313. a.display = "inline") : a.display = "inline-block"
  9314. }
  9315. ;
  9316. goog.style.isRightToLeft = function (a) {
  9317. return "rtl" == goog.style.getStyle_(a, "direction")
  9318. }
  9319. ;
  9320. goog.style.unselectableStyle_ = goog.userAgent.GECKO ? "MozUserSelect" : goog.userAgent.WEBKIT || goog.userAgent.EDGE ? "WebkitUserSelect" : null;
  9321. goog.style.isUnselectable = function (a) {
  9322. return goog.style.unselectableStyle_ ? "none" == a.style[goog.style.unselectableStyle_].toLowerCase() : goog.userAgent.IE || goog.userAgent.OPERA ? "on" == a.getAttribute("unselectable") : !1
  9323. }
  9324. ;
  9325. goog.style.setUnselectable = function (a, b, c) {
  9326. c = c ? null : a.getElementsByTagName("*");
  9327. var d = goog.style.unselectableStyle_;
  9328. if (d) {
  9329. if (b = b ? "none" : "",
  9330. a.style && (a.style[d] = b),
  9331. c) {
  9332. a = 0;
  9333. for (var e; e = c[a]; a++)
  9334. e.style && (e.style[d] = b)
  9335. }
  9336. } else if (goog.userAgent.IE || goog.userAgent.OPERA)
  9337. if (b = b ? "on" : "",
  9338. a.setAttribute("unselectable", b),
  9339. c)
  9340. for (a = 0; e = c[a]; a++)
  9341. e.setAttribute("unselectable", b)
  9342. }
  9343. ;
  9344. goog.style.getBorderBoxSize = function (a) {
  9345. return new goog.math.Size(a.offsetWidth, a.offsetHeight)
  9346. }
  9347. ;
  9348. goog.style.setBorderBoxSize = function (a, b) {
  9349. var c = goog.dom.getOwnerDocument(a)
  9350. , d = goog.dom.getDomHelper(c).isCss1CompatMode();
  9351. if (!goog.userAgent.IE || goog.userAgent.isVersionOrHigher("10") || d && goog.userAgent.isVersionOrHigher("8"))
  9352. goog.style.setBoxSizingSize_(a, b, "border-box");
  9353. else if (c = a.style,
  9354. d) {
  9355. d = goog.style.getPaddingBox(a);
  9356. var e = goog.style.getBorderBox(a);
  9357. c.pixelWidth = b.width - e.left - d.left - d.right - e.right;
  9358. c.pixelHeight = b.height - e.top - d.top - d.bottom - e.bottom
  9359. } else
  9360. c.pixelWidth = b.width,
  9361. c.pixelHeight = b.height
  9362. }
  9363. ;
  9364. goog.style.getContentBoxSize = function (a) {
  9365. var b = goog.dom.getOwnerDocument(a)
  9366. , c = goog.userAgent.IE && a.currentStyle;
  9367. if (c && goog.dom.getDomHelper(b).isCss1CompatMode() && "auto" != c.width && "auto" != c.height && !c.boxSizing)
  9368. return b = goog.style.getIePixelValue_(a, c.width, "width", "pixelWidth"),
  9369. a = goog.style.getIePixelValue_(a, c.height, "height", "pixelHeight"),
  9370. new goog.math.Size(b, a);
  9371. c = goog.style.getBorderBoxSize(a);
  9372. b = goog.style.getPaddingBox(a);
  9373. a = goog.style.getBorderBox(a);
  9374. return new goog.math.Size(c.width - a.left - b.left - b.right - a.right, c.height - a.top - b.top - b.bottom - a.bottom)
  9375. }
  9376. ;
  9377. goog.style.setContentBoxSize = function (a, b) {
  9378. var c = goog.dom.getOwnerDocument(a)
  9379. , d = goog.dom.getDomHelper(c).isCss1CompatMode();
  9380. if (!goog.userAgent.IE || goog.userAgent.isVersionOrHigher("10") || d && goog.userAgent.isVersionOrHigher("8"))
  9381. goog.style.setBoxSizingSize_(a, b, "content-box");
  9382. else if (c = a.style,
  9383. d)
  9384. c.pixelWidth = b.width,
  9385. c.pixelHeight = b.height;
  9386. else {
  9387. d = goog.style.getPaddingBox(a);
  9388. var e = goog.style.getBorderBox(a);
  9389. c.pixelWidth = b.width + e.left + d.left + d.right + e.right;
  9390. c.pixelHeight = b.height + e.top + d.top + d.bottom + e.bottom
  9391. }
  9392. }
  9393. ;
  9394. goog.style.setBoxSizingSize_ = function (a, b, c) {
  9395. a = a.style;
  9396. goog.userAgent.GECKO ? a.MozBoxSizing = c : goog.userAgent.WEBKIT ? a.WebkitBoxSizing = c : a.boxSizing = c;
  9397. a.width = Math.max(b.width, 0) + "px";
  9398. a.height = Math.max(b.height, 0) + "px"
  9399. }
  9400. ;
  9401. goog.style.getIePixelValue_ = function (a, b, c, d) {
  9402. if (/^\d+px?$/.test(b))
  9403. return parseInt(b, 10);
  9404. var e = a.style[c]
  9405. , f = a.runtimeStyle[c];
  9406. a.runtimeStyle[c] = a.currentStyle[c];
  9407. a.style[c] = b;
  9408. b = a.style[d];
  9409. a.style[c] = e;
  9410. a.runtimeStyle[c] = f;
  9411. return +b
  9412. }
  9413. ;
  9414. goog.style.getIePixelDistance_ = function (a, b) {
  9415. var c = goog.style.getCascadedStyle(a, b);
  9416. return c ? goog.style.getIePixelValue_(a, c, "left", "pixelLeft") : 0
  9417. }
  9418. ;
  9419. goog.style.getBox_ = function (a, b) {
  9420. if (goog.userAgent.IE) {
  9421. var c = goog.style.getIePixelDistance_(a, b + "Left")
  9422. , d = goog.style.getIePixelDistance_(a, b + "Right")
  9423. , e = goog.style.getIePixelDistance_(a, b + "Top")
  9424. , f = goog.style.getIePixelDistance_(a, b + "Bottom");
  9425. return new goog.math.Box(e, d, f, c)
  9426. }
  9427. c = goog.style.getComputedStyle(a, b + "Left");
  9428. d = goog.style.getComputedStyle(a, b + "Right");
  9429. e = goog.style.getComputedStyle(a, b + "Top");
  9430. f = goog.style.getComputedStyle(a, b + "Bottom");
  9431. return new goog.math.Box(parseFloat(e), parseFloat(d), parseFloat(f), parseFloat(c))
  9432. }
  9433. ;
  9434. goog.style.getPaddingBox = function (a) {
  9435. return goog.style.getBox_(a, "padding")
  9436. }
  9437. ;
  9438. goog.style.getMarginBox = function (a) {
  9439. return goog.style.getBox_(a, "margin")
  9440. }
  9441. ;
  9442. goog.style.ieBorderWidthKeywords_ = {
  9443. thin: 2,
  9444. medium: 4,
  9445. thick: 6
  9446. };
  9447. goog.style.getIePixelBorder_ = function (a, b) {
  9448. if ("none" == goog.style.getCascadedStyle(a, b + "Style"))
  9449. return 0;
  9450. var c = goog.style.getCascadedStyle(a, b + "Width");
  9451. return c in goog.style.ieBorderWidthKeywords_ ? goog.style.ieBorderWidthKeywords_[c] : goog.style.getIePixelValue_(a, c, "left", "pixelLeft")
  9452. }
  9453. ;
  9454. goog.style.getBorderBox = function (a) {
  9455. if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
  9456. var b = goog.style.getIePixelBorder_(a, "borderLeft")
  9457. , c = goog.style.getIePixelBorder_(a, "borderRight")
  9458. , d = goog.style.getIePixelBorder_(a, "borderTop");
  9459. a = goog.style.getIePixelBorder_(a, "borderBottom");
  9460. return new goog.math.Box(d, c, a, b)
  9461. }
  9462. b = goog.style.getComputedStyle(a, "borderLeftWidth");
  9463. c = goog.style.getComputedStyle(a, "borderRightWidth");
  9464. d = goog.style.getComputedStyle(a, "borderTopWidth");
  9465. a = goog.style.getComputedStyle(a, "borderBottomWidth");
  9466. return new goog.math.Box(parseFloat(d), parseFloat(c), parseFloat(a), parseFloat(b))
  9467. }
  9468. ;
  9469. goog.style.getFontFamily = function (a) {
  9470. var b = goog.dom.getOwnerDocument(a)
  9471. , c = "";
  9472. if (b.body.createTextRange && goog.dom.contains(b, a)) {
  9473. b = b.body.createTextRange();
  9474. b.moveToElementText(a);
  9475. try {
  9476. c = b.queryCommandValue("FontName")
  9477. } catch (d) {
  9478. c = ""
  9479. }
  9480. }
  9481. c || (c = goog.style.getStyle_(a, "fontFamily"));
  9482. a = c.split(",");
  9483. 1 < a.length && (c = a[0]);
  9484. return goog.string.stripQuotes(c, "\"'")
  9485. }
  9486. ;
  9487. goog.style.lengthUnitRegex_ = /[^\d]+$/;
  9488. goog.style.getLengthUnits = function (a) {
  9489. return (a = a.match(goog.style.lengthUnitRegex_)) && a[0] || null
  9490. }
  9491. ;
  9492. goog.style.ABSOLUTE_CSS_LENGTH_UNITS_ = {
  9493. cm: 1,
  9494. "in": 1,
  9495. mm: 1,
  9496. pc: 1,
  9497. pt: 1
  9498. };
  9499. goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_ = {
  9500. em: 1,
  9501. ex: 1
  9502. };
  9503. goog.style.getFontSize = function (a) {
  9504. var b = goog.style.getStyle_(a, "fontSize")
  9505. , c = goog.style.getLengthUnits(b);
  9506. if (b && "px" == c)
  9507. return parseInt(b, 10);
  9508. if (goog.userAgent.IE) {
  9509. if (String(c) in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_)
  9510. return goog.style.getIePixelValue_(a, b, "left", "pixelLeft");
  9511. if (a.parentNode && a.parentNode.nodeType == goog.dom.NodeType.ELEMENT && String(c) in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_)
  9512. return a = a.parentNode,
  9513. c = goog.style.getStyle_(a, "fontSize"),
  9514. goog.style.getIePixelValue_(a, b == c ? "1em" : b, "left", "pixelLeft")
  9515. }
  9516. c = goog.dom.createDom("SPAN", {
  9517. style: "visibility:hidden;position:absolute;line-height:0;padding:0;margin:0;border:0;height:1em;"
  9518. });
  9519. goog.dom.appendChild(a, c);
  9520. b = c.offsetHeight;
  9521. goog.dom.removeNode(c);
  9522. return b
  9523. }
  9524. ;
  9525. goog.style.parseStyleAttribute = function (a) {
  9526. var b = {};
  9527. goog.array.forEach(a.split(/\s*;\s*/), function (a) {
  9528. var c = a.match(/\s*([\w-]+)\s*:(.+)/);
  9529. c && (a = c[1],
  9530. c = goog.string.trim(c[2]),
  9531. b[goog.string.toCamelCase(a.toLowerCase())] = c)
  9532. });
  9533. return b
  9534. }
  9535. ;
  9536. goog.style.toStyleAttribute = function (a) {
  9537. var b = [];
  9538. goog.object.forEach(a, function (a, d) {
  9539. b.push(goog.string.toSelectorCase(d), ":", a, ";")
  9540. });
  9541. return b.join("")
  9542. }
  9543. ;
  9544. goog.style.setFloat = function (a, b) {
  9545. a.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] = b
  9546. }
  9547. ;
  9548. goog.style.getFloat = function (a) {
  9549. return a.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] || ""
  9550. }
  9551. ;
  9552. goog.style.getScrollbarWidth = function (a) {
  9553. var b = goog.dom.createElement("DIV");
  9554. a && (b.className = a);
  9555. b.style.cssText = "overflow:auto;position:absolute;top:0;width:100px;height:100px";
  9556. a = goog.dom.createElement("DIV");
  9557. goog.style.setSize(a, "200px", "200px");
  9558. b.appendChild(a);
  9559. goog.dom.appendChild(goog.dom.getDocument().body, b);
  9560. a = b.offsetWidth - b.clientWidth;
  9561. goog.dom.removeNode(b);
  9562. return a
  9563. }
  9564. ;
  9565. goog.style.MATRIX_TRANSLATION_REGEX_ = /matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;
  9566. goog.style.getCssTranslation = function (a) {
  9567. a = goog.style.getComputedTransform(a);
  9568. return a ? (a = a.match(goog.style.MATRIX_TRANSLATION_REGEX_)) ? new goog.math.Coordinate(parseFloat(a[1]), parseFloat(a[2])) : new goog.math.Coordinate(0, 0) : new goog.math.Coordinate(0, 0)
  9569. }
  9570. ;
  9571. goog.events.EventHandler = function (a) {
  9572. goog.Disposable.call(this);
  9573. this.handler_ = a;
  9574. this.keys_ = {}
  9575. }
  9576. ;
  9577. goog.inherits(goog.events.EventHandler, goog.Disposable);
  9578. goog.events.EventHandler.typeArray_ = [];
  9579. goog.events.EventHandler.prototype.listen = function (a, b, c, d) {
  9580. return this.listen_(a, b, c, d)
  9581. }
  9582. ;
  9583. goog.events.EventHandler.prototype.listenWithScope = function (a, b, c, d, e) {
  9584. return this.listen_(a, b, c, d, e)
  9585. }
  9586. ;
  9587. goog.events.EventHandler.prototype.listen_ = function (a, b, c, d, e) {
  9588. goog.isArray(b) || (b && (goog.events.EventHandler.typeArray_[0] = b.toString()),
  9589. b = goog.events.EventHandler.typeArray_);
  9590. for (var f = 0; f < b.length; f++) {
  9591. var g = goog.events.listen(a, b[f], c || this.handleEvent, d || !1, e || this.handler_ || this);
  9592. if (!g)
  9593. break;
  9594. this.keys_[g.key] = g
  9595. }
  9596. return this
  9597. }
  9598. ;
  9599. goog.events.EventHandler.prototype.listenOnce = function (a, b, c, d) {
  9600. return this.listenOnce_(a, b, c, d)
  9601. }
  9602. ;
  9603. goog.events.EventHandler.prototype.listenOnceWithScope = function (a, b, c, d, e) {
  9604. return this.listenOnce_(a, b, c, d, e)
  9605. }
  9606. ;
  9607. goog.events.EventHandler.prototype.listenOnce_ = function (a, b, c, d, e) {
  9608. if (goog.isArray(b))
  9609. for (var f = 0; f < b.length; f++)
  9610. this.listenOnce_(a, b[f], c, d, e);
  9611. else {
  9612. a = goog.events.listenOnce(a, b, c || this.handleEvent, d, e || this.handler_ || this);
  9613. if (!a)
  9614. return this;
  9615. this.keys_[a.key] = a
  9616. }
  9617. return this
  9618. }
  9619. ;
  9620. goog.events.EventHandler.prototype.listenWithWrapper = function (a, b, c, d) {
  9621. return this.listenWithWrapper_(a, b, c, d)
  9622. }
  9623. ;
  9624. goog.events.EventHandler.prototype.listenWithWrapperAndScope = function (a, b, c, d, e) {
  9625. return this.listenWithWrapper_(a, b, c, d, e)
  9626. }
  9627. ;
  9628. goog.events.EventHandler.prototype.listenWithWrapper_ = function (a, b, c, d, e) {
  9629. b.listen(a, c, d, e || this.handler_ || this, this);
  9630. return this
  9631. }
  9632. ;
  9633. goog.events.EventHandler.prototype.getListenerCount = function () {
  9634. var a = 0, b;
  9635. for (b in this.keys_)
  9636. Object.prototype.hasOwnProperty.call(this.keys_, b) && a++;
  9637. return a
  9638. }
  9639. ;
  9640. goog.events.EventHandler.prototype.unlisten = function (a, b, c, d, e) {
  9641. if (goog.isArray(b))
  9642. for (var f = 0; f < b.length; f++)
  9643. this.unlisten(a, b[f], c, d, e);
  9644. else if (d = goog.isObject(d) ? !!d.capture : !!d,
  9645. a = goog.events.getListener(a, b, c || this.handleEvent, d, e || this.handler_ || this))
  9646. goog.events.unlistenByKey(a),
  9647. delete this.keys_[a.key];
  9648. return this
  9649. }
  9650. ;
  9651. goog.events.EventHandler.prototype.unlistenWithWrapper = function (a, b, c, d, e) {
  9652. b.unlisten(a, c, d, e || this.handler_ || this, this);
  9653. return this
  9654. }
  9655. ;
  9656. goog.events.EventHandler.prototype.removeAll = function () {
  9657. goog.object.forEach(this.keys_, function (a, b) {
  9658. this.keys_.hasOwnProperty(b) && goog.events.unlistenByKey(a)
  9659. }, this);
  9660. this.keys_ = {}
  9661. }
  9662. ;
  9663. goog.events.EventHandler.prototype.disposeInternal = function () {
  9664. goog.events.EventHandler.superClass_.disposeInternal.call(this);
  9665. this.removeAll()
  9666. }
  9667. ;
  9668. goog.events.EventHandler.prototype.handleEvent = function (a) {
  9669. throw Error("EventHandler.handleEvent not implemented");
  9670. }
  9671. ;
  9672. goog.ui = {};
  9673. goog.ui.IdGenerator = function () { }
  9674. ;
  9675. goog.addSingletonGetter(goog.ui.IdGenerator);
  9676. goog.ui.IdGenerator.prototype.nextId_ = 0;
  9677. goog.ui.IdGenerator.prototype.idPrefix_ = "";
  9678. goog.ui.IdGenerator.prototype.setIdPrefix = function (a) {
  9679. this.idPrefix_ = a
  9680. }
  9681. ;
  9682. goog.ui.IdGenerator.prototype.getNextUniqueId = function () {
  9683. return this.idPrefix_ + ":" + (this.nextId_++).toString(36)
  9684. }
  9685. ;
  9686. goog.ui.Component = function (a) {
  9687. goog.events.EventTarget.call(this);
  9688. this.dom_ = a || goog.dom.getDomHelper();
  9689. this.rightToLeft_ = goog.ui.Component.defaultRightToLeft_;
  9690. this.id_ = null;
  9691. this.inDocument_ = !1;
  9692. this.element_ = null;
  9693. this.googUiComponentHandler_ = void 0;
  9694. this.childIndex_ = this.children_ = this.parent_ = this.model_ = null;
  9695. this.pointerEventsEnabled_ = this.wasDecorated_ = !1
  9696. }
  9697. ;
  9698. goog.inherits(goog.ui.Component, goog.events.EventTarget);
  9699. goog.ui.Component.ALLOW_DETACHED_DECORATION = !1;
  9700. goog.ui.Component.prototype.idGenerator_ = goog.ui.IdGenerator.getInstance();
  9701. goog.ui.Component.DEFAULT_BIDI_DIR = 0;
  9702. goog.ui.Component.defaultRightToLeft_ = 1 == goog.ui.Component.DEFAULT_BIDI_DIR ? !1 : -1 == goog.ui.Component.DEFAULT_BIDI_DIR ? !0 : null;
  9703. goog.ui.Component.EventType = {
  9704. BEFORE_SHOW: "beforeshow",
  9705. SHOW: "show",
  9706. HIDE: "hide",
  9707. DISABLE: "disable",
  9708. ENABLE: "enable",
  9709. HIGHLIGHT: "highlight",
  9710. UNHIGHLIGHT: "unhighlight",
  9711. ACTIVATE: "activate",
  9712. DEACTIVATE: "deactivate",
  9713. SELECT: "select",
  9714. UNSELECT: "unselect",
  9715. CHECK: "check",
  9716. UNCHECK: "uncheck",
  9717. FOCUS: "focus",
  9718. BLUR: "blur",
  9719. OPEN: "open",
  9720. CLOSE: "close",
  9721. ENTER: "enter",
  9722. LEAVE: "leave",
  9723. ACTION: "action",
  9724. CHANGE: "change"
  9725. };
  9726. goog.ui.Component.Error = {
  9727. NOT_SUPPORTED: "Method not supported",
  9728. DECORATE_INVALID: "Invalid element to decorate",
  9729. ALREADY_RENDERED: "Component already rendered",
  9730. PARENT_UNABLE_TO_BE_SET: "Unable to set parent component",
  9731. CHILD_INDEX_OUT_OF_BOUNDS: "Child component index out of bounds",
  9732. NOT_OUR_CHILD: "Child is not in parent component",
  9733. NOT_IN_DOCUMENT: "Operation not supported while component is not in document",
  9734. STATE_INVALID: "Invalid component state"
  9735. };
  9736. goog.ui.Component.State = {
  9737. ALL: 255,
  9738. DISABLED: 1,
  9739. HOVER: 2,
  9740. ACTIVE: 4,
  9741. SELECTED: 8,
  9742. CHECKED: 16,
  9743. FOCUSED: 32,
  9744. OPENED: 64
  9745. };
  9746. goog.ui.Component.getStateTransitionEvent = function (a, b) {
  9747. switch (a) {
  9748. case goog.ui.Component.State.DISABLED:
  9749. return b ? goog.ui.Component.EventType.DISABLE : goog.ui.Component.EventType.ENABLE;
  9750. case goog.ui.Component.State.HOVER:
  9751. return b ? goog.ui.Component.EventType.HIGHLIGHT : goog.ui.Component.EventType.UNHIGHLIGHT;
  9752. case goog.ui.Component.State.ACTIVE:
  9753. return b ? goog.ui.Component.EventType.ACTIVATE : goog.ui.Component.EventType.DEACTIVATE;
  9754. case goog.ui.Component.State.SELECTED:
  9755. return b ? goog.ui.Component.EventType.SELECT : goog.ui.Component.EventType.UNSELECT;
  9756. case goog.ui.Component.State.CHECKED:
  9757. return b ? goog.ui.Component.EventType.CHECK : goog.ui.Component.EventType.UNCHECK;
  9758. case goog.ui.Component.State.FOCUSED:
  9759. return b ? goog.ui.Component.EventType.FOCUS : goog.ui.Component.EventType.BLUR;
  9760. case goog.ui.Component.State.OPENED:
  9761. return b ? goog.ui.Component.EventType.OPEN : goog.ui.Component.EventType.CLOSE
  9762. }
  9763. throw Error(goog.ui.Component.Error.STATE_INVALID);
  9764. }
  9765. ;
  9766. goog.ui.Component.setDefaultRightToLeft = function (a) {
  9767. goog.ui.Component.defaultRightToLeft_ = a
  9768. }
  9769. ;
  9770. goog.ui.Component.prototype.getId = function () {
  9771. return this.id_ || (this.id_ = this.idGenerator_.getNextUniqueId())
  9772. }
  9773. ;
  9774. goog.ui.Component.prototype.setId = function (a) {
  9775. this.parent_ && this.parent_.childIndex_ && (goog.object.remove(this.parent_.childIndex_, this.id_),
  9776. goog.object.add(this.parent_.childIndex_, a, this));
  9777. this.id_ = a
  9778. }
  9779. ;
  9780. goog.ui.Component.prototype.getElement = function () {
  9781. return this.element_
  9782. }
  9783. ;
  9784. goog.ui.Component.prototype.getElementStrict = function () {
  9785. var a = this.element_;
  9786. goog.asserts.assert(a, "Can not call getElementStrict before rendering/decorating.");
  9787. return a
  9788. }
  9789. ;
  9790. goog.ui.Component.prototype.setElementInternal = function (a) {
  9791. this.element_ = a
  9792. }
  9793. ;
  9794. goog.ui.Component.prototype.getElementsByClass = function (a) {
  9795. return this.element_ ? this.dom_.getElementsByClass(a, this.element_) : []
  9796. }
  9797. ;
  9798. goog.ui.Component.prototype.getElementByClass = function (a) {
  9799. return this.element_ ? this.dom_.getElementByClass(a, this.element_) : null
  9800. }
  9801. ;
  9802. goog.ui.Component.prototype.getRequiredElementByClass = function (a) {
  9803. var b = this.getElementByClass(a);
  9804. goog.asserts.assert(b, "Expected element in component with class: %s", a);
  9805. return b
  9806. }
  9807. ;
  9808. goog.ui.Component.prototype.getHandler = function () {
  9809. this.googUiComponentHandler_ || (this.googUiComponentHandler_ = new goog.events.EventHandler(this));
  9810. return goog.asserts.assert(this.googUiComponentHandler_)
  9811. }
  9812. ;
  9813. goog.ui.Component.prototype.setParent = function (a) {
  9814. if (this == a)
  9815. throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);
  9816. if (a && this.parent_ && this.id_ && this.parent_.getChild(this.id_) && this.parent_ != a)
  9817. throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);
  9818. this.parent_ = a;
  9819. goog.ui.Component.superClass_.setParentEventTarget.call(this, a)
  9820. }
  9821. ;
  9822. goog.ui.Component.prototype.getParent = function () {
  9823. return this.parent_
  9824. }
  9825. ;
  9826. goog.ui.Component.prototype.setParentEventTarget = function (a) {
  9827. if (this.parent_ && this.parent_ != a)
  9828. throw Error(goog.ui.Component.Error.NOT_SUPPORTED);
  9829. goog.ui.Component.superClass_.setParentEventTarget.call(this, a)
  9830. }
  9831. ;
  9832. goog.ui.Component.prototype.getDomHelper = function () {
  9833. return this.dom_
  9834. }
  9835. ;
  9836. goog.ui.Component.prototype.isInDocument = function () {
  9837. return this.inDocument_
  9838. }
  9839. ;
  9840. goog.ui.Component.prototype.createDom = function () {
  9841. this.element_ = this.dom_.createElement("DIV")
  9842. }
  9843. ;
  9844. goog.ui.Component.prototype.render = function (a) {
  9845. this.render_(a)
  9846. }
  9847. ;
  9848. goog.ui.Component.prototype.renderBefore = function (a) {
  9849. this.render_(a.parentNode, a)
  9850. }
  9851. ;
  9852. goog.ui.Component.prototype.render_ = function (a, b) {
  9853. if (this.inDocument_)
  9854. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  9855. this.element_ || this.createDom();
  9856. a ? a.insertBefore(this.element_, b || null) : this.dom_.getDocument().body.appendChild(this.element_);
  9857. this.parent_ && !this.parent_.isInDocument() || this.enterDocument()
  9858. }
  9859. ;
  9860. goog.ui.Component.prototype.decorate = function (a) {
  9861. if (this.inDocument_)
  9862. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  9863. if (a && this.canDecorate(a)) {
  9864. this.wasDecorated_ = !0;
  9865. var b = goog.dom.getOwnerDocument(a);
  9866. this.dom_ && this.dom_.getDocument() == b || (this.dom_ = goog.dom.getDomHelper(a));
  9867. this.decorateInternal(a);
  9868. goog.ui.Component.ALLOW_DETACHED_DECORATION && !goog.dom.contains(b, a) || this.enterDocument()
  9869. } else
  9870. throw Error(goog.ui.Component.Error.DECORATE_INVALID);
  9871. }
  9872. ;
  9873. goog.ui.Component.prototype.canDecorate = function (a) {
  9874. return !0
  9875. }
  9876. ;
  9877. goog.ui.Component.prototype.wasDecorated = function () {
  9878. return this.wasDecorated_
  9879. }
  9880. ;
  9881. goog.ui.Component.prototype.decorateInternal = function (a) {
  9882. this.element_ = a
  9883. }
  9884. ;
  9885. goog.ui.Component.prototype.enterDocument = function () {
  9886. this.inDocument_ = !0;
  9887. this.forEachChild(function (a) {
  9888. !a.isInDocument() && a.getElement() && a.enterDocument()
  9889. })
  9890. }
  9891. ;
  9892. goog.ui.Component.prototype.exitDocument = function () {
  9893. this.forEachChild(function (a) {
  9894. a.isInDocument() && a.exitDocument()
  9895. });
  9896. this.googUiComponentHandler_ && this.googUiComponentHandler_.removeAll();
  9897. this.inDocument_ = !1
  9898. }
  9899. ;
  9900. goog.ui.Component.prototype.disposeInternal = function () {
  9901. this.inDocument_ && this.exitDocument();
  9902. this.googUiComponentHandler_ && (this.googUiComponentHandler_.dispose(),
  9903. delete this.googUiComponentHandler_);
  9904. this.forEachChild(function (a) {
  9905. a.dispose()
  9906. });
  9907. !this.wasDecorated_ && this.element_ && goog.dom.removeNode(this.element_);
  9908. this.parent_ = this.model_ = this.element_ = this.childIndex_ = this.children_ = null;
  9909. goog.ui.Component.superClass_.disposeInternal.call(this)
  9910. }
  9911. ;
  9912. goog.ui.Component.prototype.makeId = function (a) {
  9913. return this.getId() + "." + a
  9914. }
  9915. ;
  9916. goog.ui.Component.prototype.makeIds = function (a) {
  9917. var b = {}, c;
  9918. for (c in a)
  9919. b[c] = this.makeId(a[c]);
  9920. return b
  9921. }
  9922. ;
  9923. goog.ui.Component.prototype.getModel = function () {
  9924. return this.model_
  9925. }
  9926. ;
  9927. goog.ui.Component.prototype.setModel = function (a) {
  9928. this.model_ = a
  9929. }
  9930. ;
  9931. goog.ui.Component.prototype.getFragmentFromId = function (a) {
  9932. return a.substring(this.getId().length + 1)
  9933. }
  9934. ;
  9935. goog.ui.Component.prototype.getElementByFragment = function (a) {
  9936. if (!this.inDocument_)
  9937. throw Error(goog.ui.Component.Error.NOT_IN_DOCUMENT);
  9938. return this.dom_.getElement(this.makeId(a))
  9939. }
  9940. ;
  9941. goog.ui.Component.prototype.addChild = function (a, b) {
  9942. this.addChildAt(a, this.getChildCount(), b)
  9943. }
  9944. ;
  9945. goog.ui.Component.prototype.addChildAt = function (a, b, c) {
  9946. goog.asserts.assert(!!a, "Provided element must not be null.");
  9947. if (a.inDocument_ && (c || !this.inDocument_))
  9948. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  9949. if (0 > b || b > this.getChildCount())
  9950. throw Error(goog.ui.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS);
  9951. this.childIndex_ && this.children_ || (this.childIndex_ = {},
  9952. this.children_ = []);
  9953. a.getParent() == this ? (goog.object.set(this.childIndex_, a.getId(), a),
  9954. goog.array.remove(this.children_, a)) : goog.object.add(this.childIndex_, a.getId(), a);
  9955. a.setParent(this);
  9956. goog.array.insertAt(this.children_, a, b);
  9957. a.inDocument_ && this.inDocument_ && a.getParent() == this ? (c = this.getContentElement(),
  9958. b = c.childNodes[b] || null,
  9959. b != a.getElement() && c.insertBefore(a.getElement(), b)) : c ? (this.element_ || this.createDom(),
  9960. b = this.getChildAt(b + 1),
  9961. a.render_(this.getContentElement(), b ? b.element_ : null)) : this.inDocument_ && !a.inDocument_ && a.element_ && a.element_.parentNode && a.element_.parentNode.nodeType == goog.dom.NodeType.ELEMENT && a.enterDocument()
  9962. }
  9963. ;
  9964. goog.ui.Component.prototype.getContentElement = function () {
  9965. return this.element_
  9966. }
  9967. ;
  9968. goog.ui.Component.prototype.isRightToLeft = function () {
  9969. null == this.rightToLeft_ && (this.rightToLeft_ = goog.style.isRightToLeft(this.inDocument_ ? this.element_ : this.dom_.getDocument().body));
  9970. return this.rightToLeft_
  9971. }
  9972. ;
  9973. goog.ui.Component.prototype.setRightToLeft = function (a) {
  9974. if (this.inDocument_)
  9975. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  9976. this.rightToLeft_ = a
  9977. }
  9978. ;
  9979. goog.ui.Component.prototype.hasChildren = function () {
  9980. return !!this.children_ && 0 != this.children_.length
  9981. }
  9982. ;
  9983. goog.ui.Component.prototype.getChildCount = function () {
  9984. return this.children_ ? this.children_.length : 0
  9985. }
  9986. ;
  9987. goog.ui.Component.prototype.getChildIds = function () {
  9988. var a = [];
  9989. this.forEachChild(function (b) {
  9990. a.push(b.getId())
  9991. });
  9992. return a
  9993. }
  9994. ;
  9995. goog.ui.Component.prototype.getChild = function (a) {
  9996. return this.childIndex_ && a ? goog.object.get(this.childIndex_, a) || null : null
  9997. }
  9998. ;
  9999. goog.ui.Component.prototype.getChildAt = function (a) {
  10000. return this.children_ ? this.children_[a] || null : null
  10001. }
  10002. ;
  10003. goog.ui.Component.prototype.forEachChild = function (a, b) {
  10004. this.children_ && goog.array.forEach(this.children_, a, b)
  10005. }
  10006. ;
  10007. goog.ui.Component.prototype.indexOfChild = function (a) {
  10008. return this.children_ && a ? goog.array.indexOf(this.children_, a) : -1
  10009. }
  10010. ;
  10011. goog.ui.Component.prototype.removeChild = function (a, b) {
  10012. if (a) {
  10013. var c = "string" === typeof a ? a : a.getId();
  10014. a = this.getChild(c);
  10015. c && a && (goog.object.remove(this.childIndex_, c),
  10016. goog.array.remove(this.children_, a),
  10017. b && (a.exitDocument(),
  10018. a.element_ && goog.dom.removeNode(a.element_)),
  10019. a.setParent(null))
  10020. }
  10021. if (!a)
  10022. throw Error(goog.ui.Component.Error.NOT_OUR_CHILD);
  10023. return a
  10024. }
  10025. ;
  10026. goog.ui.Component.prototype.removeChildAt = function (a, b) {
  10027. return this.removeChild(this.getChildAt(a), b)
  10028. }
  10029. ;
  10030. goog.ui.Component.prototype.removeChildren = function (a) {
  10031. for (var b = []; this.hasChildren();)
  10032. b.push(this.removeChildAt(0, a));
  10033. return b
  10034. }
  10035. ;
  10036. goog.ui.Component.prototype.pointerEventsEnabled = function () {
  10037. return this.pointerEventsEnabled_
  10038. }
  10039. ;
  10040. goog.ui.Component.prototype.setPointerEventsEnabled = function (a) {
  10041. if (this.inDocument_)
  10042. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  10043. this.pointerEventsEnabled_ = a
  10044. }
  10045. ;
  10046. goog.a11y = {};
  10047. goog.a11y.aria = {};
  10048. goog.a11y.aria.Role = {
  10049. ALERT: "alert",
  10050. ALERTDIALOG: "alertdialog",
  10051. APPLICATION: "application",
  10052. ARTICLE: "article",
  10053. BANNER: "banner",
  10054. BUTTON: "button",
  10055. CHECKBOX: "checkbox",
  10056. COLUMNHEADER: "columnheader",
  10057. COMBOBOX: "combobox",
  10058. COMPLEMENTARY: "complementary",
  10059. CONTENTINFO: "contentinfo",
  10060. DEFINITION: "definition",
  10061. DIALOG: "dialog",
  10062. DIRECTORY: "directory",
  10063. DOCUMENT: "document",
  10064. FORM: "form",
  10065. GRID: "grid",
  10066. GRIDCELL: "gridcell",
  10067. GROUP: "group",
  10068. HEADING: "heading",
  10069. IMG: "img",
  10070. LINK: "link",
  10071. LIST: "list",
  10072. LISTBOX: "listbox",
  10073. LISTITEM: "listitem",
  10074. LOG: "log",
  10075. MAIN: "main",
  10076. MARQUEE: "marquee",
  10077. MATH: "math",
  10078. MENU: "menu",
  10079. MENUBAR: "menubar",
  10080. MENU_ITEM: "menuitem",
  10081. MENU_ITEM_CHECKBOX: "menuitemcheckbox",
  10082. MENU_ITEM_RADIO: "menuitemradio",
  10083. NAVIGATION: "navigation",
  10084. NOTE: "note",
  10085. OPTION: "option",
  10086. PRESENTATION: "presentation",
  10087. PROGRESSBAR: "progressbar",
  10088. RADIO: "radio",
  10089. RADIOGROUP: "radiogroup",
  10090. REGION: "region",
  10091. ROW: "row",
  10092. ROWGROUP: "rowgroup",
  10093. ROWHEADER: "rowheader",
  10094. SCROLLBAR: "scrollbar",
  10095. SEARCH: "search",
  10096. SEPARATOR: "separator",
  10097. SLIDER: "slider",
  10098. SPINBUTTON: "spinbutton",
  10099. STATUS: "status",
  10100. TAB: "tab",
  10101. TAB_LIST: "tablist",
  10102. TAB_PANEL: "tabpanel",
  10103. TEXTBOX: "textbox",
  10104. TEXTINFO: "textinfo",
  10105. TIMER: "timer",
  10106. TOOLBAR: "toolbar",
  10107. TOOLTIP: "tooltip",
  10108. TREE: "tree",
  10109. TREEGRID: "treegrid",
  10110. TREEITEM: "treeitem"
  10111. };
  10112. goog.a11y.aria.State = {
  10113. ACTIVEDESCENDANT: "activedescendant",
  10114. ATOMIC: "atomic",
  10115. AUTOCOMPLETE: "autocomplete",
  10116. BUSY: "busy",
  10117. CHECKED: "checked",
  10118. COLINDEX: "colindex",
  10119. CONTROLS: "controls",
  10120. DESCRIBEDBY: "describedby",
  10121. DISABLED: "disabled",
  10122. DROPEFFECT: "dropeffect",
  10123. EXPANDED: "expanded",
  10124. FLOWTO: "flowto",
  10125. GRABBED: "grabbed",
  10126. HASPOPUP: "haspopup",
  10127. HIDDEN: "hidden",
  10128. INVALID: "invalid",
  10129. LABEL: "label",
  10130. LABELLEDBY: "labelledby",
  10131. LEVEL: "level",
  10132. LIVE: "live",
  10133. MULTILINE: "multiline",
  10134. MULTISELECTABLE: "multiselectable",
  10135. ORIENTATION: "orientation",
  10136. OWNS: "owns",
  10137. POSINSET: "posinset",
  10138. PRESSED: "pressed",
  10139. READONLY: "readonly",
  10140. RELEVANT: "relevant",
  10141. REQUIRED: "required",
  10142. ROWINDEX: "rowindex",
  10143. SELECTED: "selected",
  10144. SETSIZE: "setsize",
  10145. SORT: "sort",
  10146. VALUEMAX: "valuemax",
  10147. VALUEMIN: "valuemin",
  10148. VALUENOW: "valuenow",
  10149. VALUETEXT: "valuetext"
  10150. };
  10151. goog.a11y.aria.AutoCompleteValues = {
  10152. INLINE: "inline",
  10153. LIST: "list",
  10154. BOTH: "both",
  10155. NONE: "none"
  10156. };
  10157. goog.a11y.aria.DropEffectValues = {
  10158. COPY: "copy",
  10159. MOVE: "move",
  10160. LINK: "link",
  10161. EXECUTE: "execute",
  10162. POPUP: "popup",
  10163. NONE: "none"
  10164. };
  10165. goog.a11y.aria.LivePriority = {
  10166. OFF: "off",
  10167. POLITE: "polite",
  10168. ASSERTIVE: "assertive"
  10169. };
  10170. goog.a11y.aria.OrientationValues = {
  10171. VERTICAL: "vertical",
  10172. HORIZONTAL: "horizontal"
  10173. };
  10174. goog.a11y.aria.RelevantValues = {
  10175. ADDITIONS: "additions",
  10176. REMOVALS: "removals",
  10177. TEXT: "text",
  10178. ALL: "all"
  10179. };
  10180. goog.a11y.aria.SortValues = {
  10181. ASCENDING: "ascending",
  10182. DESCENDING: "descending",
  10183. NONE: "none",
  10184. OTHER: "other"
  10185. };
  10186. goog.a11y.aria.CheckedValues = {
  10187. TRUE: "true",
  10188. FALSE: "false",
  10189. MIXED: "mixed",
  10190. UNDEFINED: "undefined"
  10191. };
  10192. goog.a11y.aria.ExpandedValues = {
  10193. TRUE: "true",
  10194. FALSE: "false",
  10195. UNDEFINED: "undefined"
  10196. };
  10197. goog.a11y.aria.GrabbedValues = {
  10198. TRUE: "true",
  10199. FALSE: "false",
  10200. UNDEFINED: "undefined"
  10201. };
  10202. goog.a11y.aria.InvalidValues = {
  10203. FALSE: "false",
  10204. TRUE: "true",
  10205. GRAMMAR: "grammar",
  10206. SPELLING: "spelling"
  10207. };
  10208. goog.a11y.aria.PressedValues = {
  10209. TRUE: "true",
  10210. FALSE: "false",
  10211. MIXED: "mixed",
  10212. UNDEFINED: "undefined"
  10213. };
  10214. goog.a11y.aria.SelectedValues = {
  10215. TRUE: "true",
  10216. FALSE: "false",
  10217. UNDEFINED: "undefined"
  10218. };
  10219. goog.a11y.aria.datatables = {};
  10220. goog.a11y.aria.datatables.getDefaultValuesMap = function () {
  10221. goog.a11y.aria.DefaultStateValueMap_ || (goog.a11y.aria.DefaultStateValueMap_ = goog.object.create(goog.a11y.aria.State.ATOMIC, !1, goog.a11y.aria.State.AUTOCOMPLETE, "none", goog.a11y.aria.State.DROPEFFECT, "none", goog.a11y.aria.State.HASPOPUP, !1, goog.a11y.aria.State.LIVE, "off", goog.a11y.aria.State.MULTILINE, !1, goog.a11y.aria.State.MULTISELECTABLE, !1, goog.a11y.aria.State.ORIENTATION, "vertical", goog.a11y.aria.State.READONLY, !1, goog.a11y.aria.State.RELEVANT, "additions text", goog.a11y.aria.State.REQUIRED, !1, goog.a11y.aria.State.SORT, "none", goog.a11y.aria.State.BUSY, !1, goog.a11y.aria.State.DISABLED, !1, goog.a11y.aria.State.HIDDEN, !1, goog.a11y.aria.State.INVALID, "false"));
  10222. return goog.a11y.aria.DefaultStateValueMap_
  10223. }
  10224. ;
  10225. goog.a11y.aria.ARIA_PREFIX_ = "aria-";
  10226. goog.a11y.aria.ROLE_ATTRIBUTE_ = "role";
  10227. goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = goog.object.createSet("A AREA BUTTON HEAD INPUT LINK MENU META OPTGROUP OPTION PROGRESS STYLE SELECT SOURCE TEXTAREA TITLE TRACK".split(" "));
  10228. goog.a11y.aria.CONTAINER_ROLES_ = [goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.Role.GRID, goog.a11y.aria.Role.GROUP, goog.a11y.aria.Role.LISTBOX, goog.a11y.aria.Role.MENU, goog.a11y.aria.Role.MENUBAR, goog.a11y.aria.Role.RADIOGROUP, goog.a11y.aria.Role.ROW, goog.a11y.aria.Role.ROWGROUP, goog.a11y.aria.Role.TAB_LIST, goog.a11y.aria.Role.TEXTBOX, goog.a11y.aria.Role.TOOLBAR, goog.a11y.aria.Role.TREE, goog.a11y.aria.Role.TREEGRID];
  10229. goog.a11y.aria.setRole = function (a, b) {
  10230. b ? (goog.asserts.ENABLE_ASSERTS && goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.Role, b), "No such ARIA role " + b),
  10231. a.setAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_, b)) : goog.a11y.aria.removeRole(a)
  10232. }
  10233. ;
  10234. goog.a11y.aria.getRole = function (a) {
  10235. return a.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_) || null
  10236. }
  10237. ;
  10238. goog.a11y.aria.removeRole = function (a) {
  10239. a.removeAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_)
  10240. }
  10241. ;
  10242. goog.a11y.aria.setState = function (a, b, c) {
  10243. goog.isArray(c) && (c = c.join(" "));
  10244. var d = goog.a11y.aria.getAriaAttributeName_(b);
  10245. "" === c || void 0 == c ? (c = goog.a11y.aria.datatables.getDefaultValuesMap(),
  10246. b in c ? a.setAttribute(d, c[b]) : a.removeAttribute(d)) : a.setAttribute(d, c)
  10247. }
  10248. ;
  10249. goog.a11y.aria.toggleState = function (a, b) {
  10250. var c = goog.a11y.aria.getState(a, b);
  10251. goog.string.isEmptyOrWhitespace(goog.string.makeSafe(c)) || "true" == c || "false" == c ? goog.a11y.aria.setState(a, b, "true" == c ? "false" : "true") : goog.a11y.aria.removeState(a, b)
  10252. }
  10253. ;
  10254. goog.a11y.aria.removeState = function (a, b) {
  10255. a.removeAttribute(goog.a11y.aria.getAriaAttributeName_(b))
  10256. }
  10257. ;
  10258. goog.a11y.aria.getState = function (a, b) {
  10259. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10260. return null == c || void 0 == c ? "" : String(c)
  10261. }
  10262. ;
  10263. goog.a11y.aria.getActiveDescendant = function (a) {
  10264. var b = goog.a11y.aria.getState(a, goog.a11y.aria.State.ACTIVEDESCENDANT);
  10265. return goog.dom.getOwnerDocument(a).getElementById(b)
  10266. }
  10267. ;
  10268. goog.a11y.aria.setActiveDescendant = function (a, b) {
  10269. var c = "";
  10270. b && (c = b.id,
  10271. goog.asserts.assert(c, "The active element should have an id."));
  10272. goog.a11y.aria.setState(a, goog.a11y.aria.State.ACTIVEDESCENDANT, c)
  10273. }
  10274. ;
  10275. goog.a11y.aria.getLabel = function (a) {
  10276. return goog.a11y.aria.getState(a, goog.a11y.aria.State.LABEL)
  10277. }
  10278. ;
  10279. goog.a11y.aria.setLabel = function (a, b) {
  10280. goog.a11y.aria.setState(a, goog.a11y.aria.State.LABEL, b)
  10281. }
  10282. ;
  10283. goog.a11y.aria.assertRoleIsSetInternalUtil = function (a, b) {
  10284. if (!goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_[a.tagName]) {
  10285. var c = goog.a11y.aria.getRole(a);
  10286. goog.asserts.assert(null != c, "The element ARIA role cannot be null.");
  10287. goog.asserts.assert(goog.array.contains(b, c), 'Non existing or incorrect role set for element.The role set is "' + c + '". The role should be any of "' + b + '". Check the ARIA specification for more details http://www.w3.org/TR/wai-aria/roles.')
  10288. }
  10289. }
  10290. ;
  10291. goog.a11y.aria.getStateBoolean = function (a, b) {
  10292. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10293. goog.asserts.assert("boolean" === typeof c || null == c || "true" == c || "false" == c);
  10294. return null == c ? c : "boolean" === typeof c ? c : "true" == c
  10295. }
  10296. ;
  10297. goog.a11y.aria.getStateNumber = function (a, b) {
  10298. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10299. goog.asserts.assert((null == c || !isNaN(Number(c))) && "boolean" !== typeof c);
  10300. return null == c ? null : Number(c)
  10301. }
  10302. ;
  10303. goog.a11y.aria.getStateString = function (a, b) {
  10304. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10305. goog.asserts.assert((null == c || "string" === typeof c) && ("" == c || isNaN(Number(c))) && "true" != c && "false" != c);
  10306. return null == c || "" == c ? null : c
  10307. }
  10308. ;
  10309. goog.a11y.aria.getStringArrayStateInternalUtil = function (a, b) {
  10310. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10311. return goog.a11y.aria.splitStringOnWhitespace_(c)
  10312. }
  10313. ;
  10314. goog.a11y.aria.hasState = function (a, b) {
  10315. return a.hasAttribute(goog.a11y.aria.getAriaAttributeName_(b))
  10316. }
  10317. ;
  10318. goog.a11y.aria.isContainerRole = function (a) {
  10319. a = goog.a11y.aria.getRole(a);
  10320. return goog.array.contains(goog.a11y.aria.CONTAINER_ROLES_, a)
  10321. }
  10322. ;
  10323. goog.a11y.aria.splitStringOnWhitespace_ = function (a) {
  10324. return a ? a.split(/\s+/) : []
  10325. }
  10326. ;
  10327. goog.a11y.aria.getAriaAttributeName_ = function (a) {
  10328. goog.asserts.ENABLE_ASSERTS && (goog.asserts.assert(a, "ARIA attribute cannot be empty."),
  10329. goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.State, a), "No such ARIA attribute " + a));
  10330. return goog.a11y.aria.ARIA_PREFIX_ + a
  10331. }
  10332. ;
  10333. goog.events.KeyCodes = {
  10334. WIN_KEY_FF_LINUX: 0,
  10335. MAC_ENTER: 3,
  10336. BACKSPACE: 8,
  10337. TAB: 9,
  10338. NUM_CENTER: 12,
  10339. ENTER: 13,
  10340. SHIFT: 16,
  10341. CTRL: 17,
  10342. ALT: 18,
  10343. PAUSE: 19,
  10344. CAPS_LOCK: 20,
  10345. ESC: 27,
  10346. SPACE: 32,
  10347. PAGE_UP: 33,
  10348. PAGE_DOWN: 34,
  10349. END: 35,
  10350. HOME: 36,
  10351. LEFT: 37,
  10352. UP: 38,
  10353. RIGHT: 39,
  10354. DOWN: 40,
  10355. PLUS_SIGN: 43,
  10356. PRINT_SCREEN: 44,
  10357. INSERT: 45,
  10358. DELETE: 46,
  10359. ZERO: 48,
  10360. ONE: 49,
  10361. TWO: 50,
  10362. THREE: 51,
  10363. FOUR: 52,
  10364. FIVE: 53,
  10365. SIX: 54,
  10366. SEVEN: 55,
  10367. EIGHT: 56,
  10368. NINE: 57,
  10369. FF_SEMICOLON: 59,
  10370. FF_EQUALS: 61,
  10371. FF_DASH: 173,
  10372. FF_HASH: 163,
  10373. FF_JP_QUOTE: 58,
  10374. QUESTION_MARK: 63,
  10375. AT_SIGN: 64,
  10376. A: 65,
  10377. B: 66,
  10378. C: 67,
  10379. D: 68,
  10380. E: 69,
  10381. F: 70,
  10382. G: 71,
  10383. H: 72,
  10384. I: 73,
  10385. J: 74,
  10386. K: 75,
  10387. L: 76,
  10388. M: 77,
  10389. N: 78,
  10390. O: 79,
  10391. P: 80,
  10392. Q: 81,
  10393. R: 82,
  10394. S: 83,
  10395. T: 84,
  10396. U: 85,
  10397. V: 86,
  10398. W: 87,
  10399. X: 88,
  10400. Y: 89,
  10401. Z: 90,
  10402. META: 91,
  10403. WIN_KEY_RIGHT: 92,
  10404. CONTEXT_MENU: 93,
  10405. NUM_ZERO: 96,
  10406. NUM_ONE: 97,
  10407. NUM_TWO: 98,
  10408. NUM_THREE: 99,
  10409. NUM_FOUR: 100,
  10410. NUM_FIVE: 101,
  10411. NUM_SIX: 102,
  10412. NUM_SEVEN: 103,
  10413. NUM_EIGHT: 104,
  10414. NUM_NINE: 105,
  10415. NUM_MULTIPLY: 106,
  10416. NUM_PLUS: 107,
  10417. NUM_MINUS: 109,
  10418. NUM_PERIOD: 110,
  10419. NUM_DIVISION: 111,
  10420. F1: 112,
  10421. F2: 113,
  10422. F3: 114,
  10423. F4: 115,
  10424. F5: 116,
  10425. F6: 117,
  10426. F7: 118,
  10427. F8: 119,
  10428. F9: 120,
  10429. F10: 121,
  10430. F11: 122,
  10431. F12: 123,
  10432. NUMLOCK: 144,
  10433. SCROLL_LOCK: 145,
  10434. FIRST_MEDIA_KEY: 166,
  10435. LAST_MEDIA_KEY: 183,
  10436. SEMICOLON: 186,
  10437. DASH: 189,
  10438. EQUALS: 187,
  10439. COMMA: 188,
  10440. PERIOD: 190,
  10441. SLASH: 191,
  10442. APOSTROPHE: 192,
  10443. TILDE: 192,
  10444. SINGLE_QUOTE: 222,
  10445. OPEN_SQUARE_BRACKET: 219,
  10446. BACKSLASH: 220,
  10447. CLOSE_SQUARE_BRACKET: 221,
  10448. WIN_KEY: 224,
  10449. MAC_FF_META: 224,
  10450. MAC_WK_CMD_LEFT: 91,
  10451. MAC_WK_CMD_RIGHT: 93,
  10452. WIN_IME: 229,
  10453. VK_NONAME: 252,
  10454. PHANTOM: 255
  10455. };
  10456. goog.events.KeyCodes.isTextModifyingKeyEvent = function (a) {
  10457. if (a.altKey && !a.ctrlKey || a.metaKey || a.keyCode >= goog.events.KeyCodes.F1 && a.keyCode <= goog.events.KeyCodes.F12)
  10458. return !1;
  10459. if (goog.events.KeyCodes.isCharacterKey(a.keyCode))
  10460. return !0;
  10461. switch (a.keyCode) {
  10462. case goog.events.KeyCodes.ALT:
  10463. case goog.events.KeyCodes.CAPS_LOCK:
  10464. case goog.events.KeyCodes.CONTEXT_MENU:
  10465. case goog.events.KeyCodes.CTRL:
  10466. case goog.events.KeyCodes.DOWN:
  10467. case goog.events.KeyCodes.END:
  10468. case goog.events.KeyCodes.ESC:
  10469. case goog.events.KeyCodes.HOME:
  10470. case goog.events.KeyCodes.INSERT:
  10471. case goog.events.KeyCodes.LEFT:
  10472. case goog.events.KeyCodes.MAC_FF_META:
  10473. case goog.events.KeyCodes.META:
  10474. case goog.events.KeyCodes.NUMLOCK:
  10475. case goog.events.KeyCodes.NUM_CENTER:
  10476. case goog.events.KeyCodes.PAGE_DOWN:
  10477. case goog.events.KeyCodes.PAGE_UP:
  10478. case goog.events.KeyCodes.PAUSE:
  10479. case goog.events.KeyCodes.PHANTOM:
  10480. case goog.events.KeyCodes.PRINT_SCREEN:
  10481. case goog.events.KeyCodes.RIGHT:
  10482. case goog.events.KeyCodes.SCROLL_LOCK:
  10483. case goog.events.KeyCodes.SHIFT:
  10484. case goog.events.KeyCodes.UP:
  10485. case goog.events.KeyCodes.VK_NONAME:
  10486. case goog.events.KeyCodes.WIN_KEY:
  10487. case goog.events.KeyCodes.WIN_KEY_RIGHT:
  10488. return !1;
  10489. case goog.events.KeyCodes.WIN_KEY_FF_LINUX:
  10490. return !goog.userAgent.GECKO;
  10491. default:
  10492. return a.keyCode < goog.events.KeyCodes.FIRST_MEDIA_KEY || a.keyCode > goog.events.KeyCodes.LAST_MEDIA_KEY
  10493. }
  10494. }
  10495. ;
  10496. goog.events.KeyCodes.firesKeyPressEvent = function (a, b, c, d, e, f) {
  10497. if (goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("525"))
  10498. return !0;
  10499. if (goog.userAgent.MAC && e)
  10500. return goog.events.KeyCodes.isCharacterKey(a);
  10501. if (e && !d)
  10502. return !1;
  10503. if (!goog.userAgent.GECKO) {
  10504. "number" === typeof b && (b = goog.events.KeyCodes.normalizeKeyCode(b));
  10505. var g = b == goog.events.KeyCodes.CTRL || b == goog.events.KeyCodes.ALT || goog.userAgent.MAC && b == goog.events.KeyCodes.META
  10506. , h = b == goog.events.KeyCodes.SHIFT && (d || f);
  10507. if ((!c || goog.userAgent.MAC) && g || goog.userAgent.MAC && h)
  10508. return !1
  10509. }
  10510. if ((goog.userAgent.WEBKIT || goog.userAgent.EDGE) && d && c)
  10511. switch (a) {
  10512. case goog.events.KeyCodes.BACKSLASH:
  10513. case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:
  10514. case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:
  10515. case goog.events.KeyCodes.TILDE:
  10516. case goog.events.KeyCodes.SEMICOLON:
  10517. case goog.events.KeyCodes.DASH:
  10518. case goog.events.KeyCodes.EQUALS:
  10519. case goog.events.KeyCodes.COMMA:
  10520. case goog.events.KeyCodes.PERIOD:
  10521. case goog.events.KeyCodes.SLASH:
  10522. case goog.events.KeyCodes.APOSTROPHE:
  10523. case goog.events.KeyCodes.SINGLE_QUOTE:
  10524. return !1
  10525. }
  10526. if (goog.userAgent.IE && d && b == a)
  10527. return !1;
  10528. switch (a) {
  10529. case goog.events.KeyCodes.ENTER:
  10530. return goog.userAgent.GECKO ? f || e ? !1 : !(c && d) : !0;
  10531. case goog.events.KeyCodes.ESC:
  10532. return !(goog.userAgent.WEBKIT || goog.userAgent.EDGE || goog.userAgent.GECKO)
  10533. }
  10534. return goog.userAgent.GECKO && (d || e || f) ? !1 : goog.events.KeyCodes.isCharacterKey(a)
  10535. }
  10536. ;
  10537. goog.events.KeyCodes.isCharacterKey = function (a) {
  10538. if (a >= goog.events.KeyCodes.ZERO && a <= goog.events.KeyCodes.NINE || a >= goog.events.KeyCodes.NUM_ZERO && a <= goog.events.KeyCodes.NUM_MULTIPLY || a >= goog.events.KeyCodes.A && a <= goog.events.KeyCodes.Z || (goog.userAgent.WEBKIT || goog.userAgent.EDGE) && 0 == a)
  10539. return !0;
  10540. switch (a) {
  10541. case goog.events.KeyCodes.SPACE:
  10542. case goog.events.KeyCodes.PLUS_SIGN:
  10543. case goog.events.KeyCodes.QUESTION_MARK:
  10544. case goog.events.KeyCodes.AT_SIGN:
  10545. case goog.events.KeyCodes.NUM_PLUS:
  10546. case goog.events.KeyCodes.NUM_MINUS:
  10547. case goog.events.KeyCodes.NUM_PERIOD:
  10548. case goog.events.KeyCodes.NUM_DIVISION:
  10549. case goog.events.KeyCodes.SEMICOLON:
  10550. case goog.events.KeyCodes.FF_SEMICOLON:
  10551. case goog.events.KeyCodes.DASH:
  10552. case goog.events.KeyCodes.EQUALS:
  10553. case goog.events.KeyCodes.FF_EQUALS:
  10554. case goog.events.KeyCodes.COMMA:
  10555. case goog.events.KeyCodes.PERIOD:
  10556. case goog.events.KeyCodes.SLASH:
  10557. case goog.events.KeyCodes.APOSTROPHE:
  10558. case goog.events.KeyCodes.SINGLE_QUOTE:
  10559. case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:
  10560. case goog.events.KeyCodes.BACKSLASH:
  10561. case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:
  10562. case goog.events.KeyCodes.FF_HASH:
  10563. case goog.events.KeyCodes.FF_JP_QUOTE:
  10564. return !0;
  10565. case goog.events.KeyCodes.FF_DASH:
  10566. return goog.userAgent.GECKO;
  10567. default:
  10568. return !1
  10569. }
  10570. }
  10571. ;
  10572. goog.events.KeyCodes.normalizeKeyCode = function (a) {
  10573. return goog.userAgent.GECKO ? goog.events.KeyCodes.normalizeGeckoKeyCode(a) : goog.userAgent.MAC && goog.userAgent.WEBKIT ? goog.events.KeyCodes.normalizeMacWebKitKeyCode(a) : a
  10574. }
  10575. ;
  10576. goog.events.KeyCodes.normalizeGeckoKeyCode = function (a) {
  10577. switch (a) {
  10578. case goog.events.KeyCodes.FF_EQUALS:
  10579. return goog.events.KeyCodes.EQUALS;
  10580. case goog.events.KeyCodes.FF_SEMICOLON:
  10581. return goog.events.KeyCodes.SEMICOLON;
  10582. case goog.events.KeyCodes.FF_DASH:
  10583. return goog.events.KeyCodes.DASH;
  10584. case goog.events.KeyCodes.MAC_FF_META:
  10585. return goog.events.KeyCodes.META;
  10586. case goog.events.KeyCodes.WIN_KEY_FF_LINUX:
  10587. return goog.events.KeyCodes.WIN_KEY;
  10588. default:
  10589. return a
  10590. }
  10591. }
  10592. ;
  10593. goog.events.KeyCodes.normalizeMacWebKitKeyCode = function (a) {
  10594. switch (a) {
  10595. case goog.events.KeyCodes.MAC_WK_CMD_RIGHT:
  10596. return goog.events.KeyCodes.META;
  10597. default:
  10598. return a
  10599. }
  10600. }
  10601. ;
  10602. goog.events.KeyHandler = function (a, b) {
  10603. goog.events.EventTarget.call(this);
  10604. a && this.attach(a, b)
  10605. }
  10606. ;
  10607. goog.inherits(goog.events.KeyHandler, goog.events.EventTarget);
  10608. goog.events.KeyHandler.prototype.element_ = null;
  10609. goog.events.KeyHandler.prototype.keyPressKey_ = null;
  10610. goog.events.KeyHandler.prototype.keyDownKey_ = null;
  10611. goog.events.KeyHandler.prototype.keyUpKey_ = null;
  10612. goog.events.KeyHandler.prototype.lastKey_ = -1;
  10613. goog.events.KeyHandler.prototype.keyCode_ = -1;
  10614. goog.events.KeyHandler.prototype.altKey_ = !1;
  10615. goog.events.KeyHandler.EventType = {
  10616. KEY: "key"
  10617. };
  10618. goog.events.KeyHandler.safariKey_ = {
  10619. 3: goog.events.KeyCodes.ENTER,
  10620. 12: goog.events.KeyCodes.NUMLOCK,
  10621. 63232: goog.events.KeyCodes.UP,
  10622. 63233: goog.events.KeyCodes.DOWN,
  10623. 63234: goog.events.KeyCodes.LEFT,
  10624. 63235: goog.events.KeyCodes.RIGHT,
  10625. 63236: goog.events.KeyCodes.F1,
  10626. 63237: goog.events.KeyCodes.F2,
  10627. 63238: goog.events.KeyCodes.F3,
  10628. 63239: goog.events.KeyCodes.F4,
  10629. 63240: goog.events.KeyCodes.F5,
  10630. 63241: goog.events.KeyCodes.F6,
  10631. 63242: goog.events.KeyCodes.F7,
  10632. 63243: goog.events.KeyCodes.F8,
  10633. 63244: goog.events.KeyCodes.F9,
  10634. 63245: goog.events.KeyCodes.F10,
  10635. 63246: goog.events.KeyCodes.F11,
  10636. 63247: goog.events.KeyCodes.F12,
  10637. 63248: goog.events.KeyCodes.PRINT_SCREEN,
  10638. 63272: goog.events.KeyCodes.DELETE,
  10639. 63273: goog.events.KeyCodes.HOME,
  10640. 63275: goog.events.KeyCodes.END,
  10641. 63276: goog.events.KeyCodes.PAGE_UP,
  10642. 63277: goog.events.KeyCodes.PAGE_DOWN,
  10643. 63289: goog.events.KeyCodes.NUMLOCK,
  10644. 63302: goog.events.KeyCodes.INSERT
  10645. };
  10646. goog.events.KeyHandler.keyIdentifier_ = {
  10647. Up: goog.events.KeyCodes.UP,
  10648. Down: goog.events.KeyCodes.DOWN,
  10649. Left: goog.events.KeyCodes.LEFT,
  10650. Right: goog.events.KeyCodes.RIGHT,
  10651. Enter: goog.events.KeyCodes.ENTER,
  10652. F1: goog.events.KeyCodes.F1,
  10653. F2: goog.events.KeyCodes.F2,
  10654. F3: goog.events.KeyCodes.F3,
  10655. F4: goog.events.KeyCodes.F4,
  10656. F5: goog.events.KeyCodes.F5,
  10657. F6: goog.events.KeyCodes.F6,
  10658. F7: goog.events.KeyCodes.F7,
  10659. F8: goog.events.KeyCodes.F8,
  10660. F9: goog.events.KeyCodes.F9,
  10661. F10: goog.events.KeyCodes.F10,
  10662. F11: goog.events.KeyCodes.F11,
  10663. F12: goog.events.KeyCodes.F12,
  10664. "U+007F": goog.events.KeyCodes.DELETE,
  10665. Home: goog.events.KeyCodes.HOME,
  10666. End: goog.events.KeyCodes.END,
  10667. PageUp: goog.events.KeyCodes.PAGE_UP,
  10668. PageDown: goog.events.KeyCodes.PAGE_DOWN,
  10669. Insert: goog.events.KeyCodes.INSERT
  10670. };
  10671. goog.events.KeyHandler.USES_KEYDOWN_ = !goog.userAgent.WEBKIT || goog.userAgent.isVersionOrHigher("525");
  10672. goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ = goog.userAgent.MAC && goog.userAgent.GECKO;
  10673. goog.events.KeyHandler.prototype.handleKeyDown_ = function (a) {
  10674. (goog.userAgent.WEBKIT || goog.userAgent.EDGE) && (this.lastKey_ == goog.events.KeyCodes.CTRL && !a.ctrlKey || this.lastKey_ == goog.events.KeyCodes.ALT && !a.altKey || goog.userAgent.MAC && this.lastKey_ == goog.events.KeyCodes.META && !a.metaKey) && this.resetState();
  10675. -1 == this.lastKey_ && (a.ctrlKey && a.keyCode != goog.events.KeyCodes.CTRL ? this.lastKey_ = goog.events.KeyCodes.CTRL : a.altKey && a.keyCode != goog.events.KeyCodes.ALT ? this.lastKey_ = goog.events.KeyCodes.ALT : a.metaKey && a.keyCode != goog.events.KeyCodes.META && (this.lastKey_ = goog.events.KeyCodes.META));
  10676. goog.events.KeyHandler.USES_KEYDOWN_ && !goog.events.KeyCodes.firesKeyPressEvent(a.keyCode, this.lastKey_, a.shiftKey, a.ctrlKey, a.altKey, a.metaKey) ? this.handleEvent(a) : (this.keyCode_ = goog.events.KeyCodes.normalizeKeyCode(a.keyCode),
  10677. goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ && (this.altKey_ = a.altKey))
  10678. }
  10679. ;
  10680. goog.events.KeyHandler.prototype.resetState = function () {
  10681. this.keyCode_ = this.lastKey_ = -1
  10682. }
  10683. ;
  10684. goog.events.KeyHandler.prototype.handleKeyup_ = function (a) {
  10685. this.resetState();
  10686. this.altKey_ = a.altKey
  10687. }
  10688. ;
  10689. goog.events.KeyHandler.prototype.handleEvent = function (a) {
  10690. var b = a.getBrowserEvent()
  10691. , c = b.altKey;
  10692. if (goog.userAgent.IE && a.type == goog.events.EventType.KEYPRESS) {
  10693. var d = this.keyCode_;
  10694. var e = d != goog.events.KeyCodes.ENTER && d != goog.events.KeyCodes.ESC ? b.keyCode : 0
  10695. } else
  10696. (goog.userAgent.WEBKIT || goog.userAgent.EDGE) && a.type == goog.events.EventType.KEYPRESS ? (d = this.keyCode_,
  10697. e = 0 <= b.charCode && 63232 > b.charCode && goog.events.KeyCodes.isCharacterKey(d) ? b.charCode : 0) : goog.userAgent.OPERA && !goog.userAgent.WEBKIT ? (d = this.keyCode_,
  10698. e = goog.events.KeyCodes.isCharacterKey(d) ? b.keyCode : 0) : (a.type == goog.events.EventType.KEYPRESS ? (goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ && (c = this.altKey_),
  10699. b.keyCode == b.charCode ? 32 > b.keyCode ? (d = b.keyCode,
  10700. e = 0) : (d = this.keyCode_,
  10701. e = b.charCode) : (d = b.keyCode || this.keyCode_,
  10702. e = b.charCode || 0)) : (d = b.keyCode || this.keyCode_,
  10703. e = b.charCode || 0),
  10704. goog.userAgent.MAC && e == goog.events.KeyCodes.QUESTION_MARK && d == goog.events.KeyCodes.WIN_KEY && (d = goog.events.KeyCodes.SLASH));
  10705. var f = d = goog.events.KeyCodes.normalizeKeyCode(d);
  10706. d ? 63232 <= d && d in goog.events.KeyHandler.safariKey_ ? f = goog.events.KeyHandler.safariKey_[d] : 25 == d && a.shiftKey && (f = 9) : b.keyIdentifier && b.keyIdentifier in goog.events.KeyHandler.keyIdentifier_ && (f = goog.events.KeyHandler.keyIdentifier_[b.keyIdentifier]);
  10707. goog.userAgent.GECKO && goog.events.KeyHandler.USES_KEYDOWN_ && a.type == goog.events.EventType.KEYPRESS && !goog.events.KeyCodes.firesKeyPressEvent(f, this.lastKey_, a.shiftKey, a.ctrlKey, c, a.metaKey) || (a = f == this.lastKey_,
  10708. this.lastKey_ = f,
  10709. b = new goog.events.KeyEvent(f, e, a, b),
  10710. b.altKey = c,
  10711. this.dispatchEvent(b))
  10712. }
  10713. ;
  10714. goog.events.KeyHandler.prototype.getElement = function () {
  10715. return this.element_
  10716. }
  10717. ;
  10718. goog.events.KeyHandler.prototype.attach = function (a, b) {
  10719. this.keyUpKey_ && this.detach();
  10720. this.element_ = a;
  10721. this.keyPressKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYPRESS, this, b);
  10722. this.keyDownKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYDOWN, this.handleKeyDown_, b, this);
  10723. this.keyUpKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYUP, this.handleKeyup_, b, this)
  10724. }
  10725. ;
  10726. goog.events.KeyHandler.prototype.detach = function () {
  10727. this.keyPressKey_ && (goog.events.unlistenByKey(this.keyPressKey_),
  10728. goog.events.unlistenByKey(this.keyDownKey_),
  10729. goog.events.unlistenByKey(this.keyUpKey_),
  10730. this.keyUpKey_ = this.keyDownKey_ = this.keyPressKey_ = null);
  10731. this.element_ = null;
  10732. this.keyCode_ = this.lastKey_ = -1
  10733. }
  10734. ;
  10735. goog.events.KeyHandler.prototype.disposeInternal = function () {
  10736. goog.events.KeyHandler.superClass_.disposeInternal.call(this);
  10737. this.detach()
  10738. }
  10739. ;
  10740. goog.events.KeyEvent = function (a, b, c, d) {
  10741. goog.events.BrowserEvent.call(this, d);
  10742. this.type = goog.events.KeyHandler.EventType.KEY;
  10743. this.keyCode = a;
  10744. this.charCode = b;
  10745. this.repeat = c
  10746. }
  10747. ;
  10748. goog.inherits(goog.events.KeyEvent, goog.events.BrowserEvent);
  10749. goog.ui.ComponentUtil = {};
  10750. goog.ui.ComponentUtil.getMouseEventType = function (a) {
  10751. return a.pointerEventsEnabled() ? goog.events.PointerAsMouseEventType : goog.events.MouseAsMouseEventType
  10752. }
  10753. ;
  10754. goog.dom.classlist = {};
  10755. goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST = !1;
  10756. goog.dom.classlist.getClassName_ = function (a) {
  10757. return "string" == typeof a.className ? a.className : a.getAttribute && a.getAttribute("class") || ""
  10758. }
  10759. ;
  10760. goog.dom.classlist.get = function (a) {
  10761. return goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList ? a.classList : goog.dom.classlist.getClassName_(a).match(/\S+/g) || []
  10762. }
  10763. ;
  10764. goog.dom.classlist.set = function (a, b) {
  10765. "string" == typeof a.className ? a.className = b : a.setAttribute && a.setAttribute("class", b)
  10766. }
  10767. ;
  10768. goog.dom.classlist.contains = function (a, b) {
  10769. return goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList ? a.classList.contains(b) : goog.array.contains(goog.dom.classlist.get(a), b)
  10770. }
  10771. ;
  10772. goog.dom.classlist.add = function (a, b) {
  10773. if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList)
  10774. a.classList.add(b);
  10775. else if (!goog.dom.classlist.contains(a, b)) {
  10776. var c = goog.dom.classlist.getClassName_(a);
  10777. goog.dom.classlist.set(a, c + (0 < c.length ? " " + b : b))
  10778. }
  10779. }
  10780. ;
  10781. goog.dom.classlist.addAll = function (a, b) {
  10782. if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList)
  10783. goog.array.forEach(b, function (b) {
  10784. goog.dom.classlist.add(a, b)
  10785. });
  10786. else {
  10787. var c = {};
  10788. goog.array.forEach(goog.dom.classlist.get(a), function (a) {
  10789. c[a] = !0
  10790. });
  10791. goog.array.forEach(b, function (a) {
  10792. c[a] = !0
  10793. });
  10794. var d = "", e;
  10795. for (e in c)
  10796. d += 0 < d.length ? " " + e : e;
  10797. goog.dom.classlist.set(a, d)
  10798. }
  10799. }
  10800. ;
  10801. goog.dom.classlist.remove = function (a, b) {
  10802. goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList ? a.classList.remove(b) : goog.dom.classlist.contains(a, b) && goog.dom.classlist.set(a, goog.array.filter(goog.dom.classlist.get(a), function (a) {
  10803. return a != b
  10804. }).join(" "))
  10805. }
  10806. ;
  10807. goog.dom.classlist.removeAll = function (a, b) {
  10808. goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList ? goog.array.forEach(b, function (b) {
  10809. goog.dom.classlist.remove(a, b)
  10810. }) : goog.dom.classlist.set(a, goog.array.filter(goog.dom.classlist.get(a), function (a) {
  10811. return !goog.array.contains(b, a)
  10812. }).join(" "))
  10813. }
  10814. ;
  10815. goog.dom.classlist.enable = function (a, b, c) {
  10816. c ? goog.dom.classlist.add(a, b) : goog.dom.classlist.remove(a, b)
  10817. }
  10818. ;
  10819. goog.dom.classlist.enableAll = function (a, b, c) {
  10820. (c ? goog.dom.classlist.addAll : goog.dom.classlist.removeAll)(a, b)
  10821. }
  10822. ;
  10823. goog.dom.classlist.swap = function (a, b, c) {
  10824. return goog.dom.classlist.contains(a, b) ? (goog.dom.classlist.remove(a, b),
  10825. goog.dom.classlist.add(a, c),
  10826. !0) : !1
  10827. }
  10828. ;
  10829. goog.dom.classlist.toggle = function (a, b) {
  10830. var c = !goog.dom.classlist.contains(a, b);
  10831. goog.dom.classlist.enable(a, b, c);
  10832. return c
  10833. }
  10834. ;
  10835. goog.dom.classlist.addRemove = function (a, b, c) {
  10836. goog.dom.classlist.remove(a, b);
  10837. goog.dom.classlist.add(a, c)
  10838. }
  10839. ;
  10840. goog.ui.registry = {};
  10841. goog.ui.registry.getDefaultRenderer = function (a) {
  10842. for (var b; a;) {
  10843. b = goog.getUid(a);
  10844. if (b = goog.ui.registry.defaultRenderers_[b])
  10845. break;
  10846. a = a.superClass_ ? a.superClass_.constructor : null
  10847. }
  10848. return b ? goog.isFunction(b.getInstance) ? b.getInstance() : new b : null
  10849. }
  10850. ;
  10851. goog.ui.registry.setDefaultRenderer = function (a, b) {
  10852. if (!goog.isFunction(a))
  10853. throw Error("Invalid component class " + a);
  10854. if (!goog.isFunction(b))
  10855. throw Error("Invalid renderer class " + b);
  10856. var c = goog.getUid(a);
  10857. goog.ui.registry.defaultRenderers_[c] = b
  10858. }
  10859. ;
  10860. goog.ui.registry.getDecoratorByClassName = function (a) {
  10861. return a in goog.ui.registry.decoratorFunctions_ ? goog.ui.registry.decoratorFunctions_[a]() : null
  10862. }
  10863. ;
  10864. goog.ui.registry.setDecoratorByClassName = function (a, b) {
  10865. if (!a)
  10866. throw Error("Invalid class name " + a);
  10867. if (!goog.isFunction(b))
  10868. throw Error("Invalid decorator function " + b);
  10869. goog.ui.registry.decoratorFunctions_[a] = b
  10870. }
  10871. ;
  10872. goog.ui.registry.getDecorator = function (a) {
  10873. goog.asserts.assert(a);
  10874. for (var b = goog.dom.classlist.get(a), c = 0, d = b.length; c < d; c++)
  10875. if (a = goog.ui.registry.getDecoratorByClassName(b[c]))
  10876. return a;
  10877. return null
  10878. }
  10879. ;
  10880. goog.ui.registry.reset = function () {
  10881. goog.ui.registry.defaultRenderers_ = {};
  10882. goog.ui.registry.decoratorFunctions_ = {}
  10883. }
  10884. ;
  10885. goog.ui.registry.defaultRenderers_ = {};
  10886. goog.ui.registry.decoratorFunctions_ = {};
  10887. goog.ui.ContainerRenderer = function (a) {
  10888. this.ariaRole_ = a
  10889. }
  10890. ;
  10891. goog.addSingletonGetter(goog.ui.ContainerRenderer);
  10892. goog.ui.ContainerRenderer.getCustomRenderer = function (a, b) {
  10893. var c = new a;
  10894. c.getCssClass = function () {
  10895. return b
  10896. }
  10897. ;
  10898. return c
  10899. }
  10900. ;
  10901. goog.ui.ContainerRenderer.CSS_CLASS = "goog-container";
  10902. goog.ui.ContainerRenderer.prototype.getAriaRole = function () {
  10903. return this.ariaRole_
  10904. }
  10905. ;
  10906. goog.ui.ContainerRenderer.prototype.enableTabIndex = function (a, b) {
  10907. a && (a.tabIndex = b ? 0 : -1)
  10908. }
  10909. ;
  10910. goog.ui.ContainerRenderer.prototype.createDom = function (a) {
  10911. return a.getDomHelper().createDom("DIV", this.getClassNames(a).join(" "))
  10912. }
  10913. ;
  10914. goog.ui.ContainerRenderer.prototype.getContentElement = function (a) {
  10915. return a
  10916. }
  10917. ;
  10918. goog.ui.ContainerRenderer.prototype.canDecorate = function (a) {
  10919. return "DIV" == a.tagName
  10920. }
  10921. ;
  10922. goog.ui.ContainerRenderer.prototype.decorate = function (a, b) {
  10923. b.id && a.setId(b.id);
  10924. var c = this.getCssClass()
  10925. , d = !1
  10926. , e = goog.dom.classlist.get(b);
  10927. e && goog.array.forEach(e, function (b) {
  10928. b == c ? d = !0 : b && this.setStateFromClassName(a, b, c)
  10929. }, this);
  10930. d || goog.dom.classlist.add(b, c);
  10931. this.decorateChildren(a, this.getContentElement(b));
  10932. return b
  10933. }
  10934. ;
  10935. goog.ui.ContainerRenderer.prototype.setStateFromClassName = function (a, b, c) {
  10936. b == c + "-disabled" ? a.setEnabled(!1) : b == c + "-horizontal" ? a.setOrientation(goog.ui.Container.Orientation.HORIZONTAL) : b == c + "-vertical" && a.setOrientation(goog.ui.Container.Orientation.VERTICAL)
  10937. }
  10938. ;
  10939. goog.ui.ContainerRenderer.prototype.decorateChildren = function (a, b, c) {
  10940. if (b) {
  10941. c = c || b.firstChild;
  10942. for (var d; c && c.parentNode == b;) {
  10943. d = c.nextSibling;
  10944. if (c.nodeType == goog.dom.NodeType.ELEMENT) {
  10945. var e = this.getDecoratorForChild(c);
  10946. e && (e.setElementInternal(c),
  10947. a.isEnabled() || e.setEnabled(!1),
  10948. a.addChild(e),
  10949. e.decorate(c))
  10950. } else
  10951. c.nodeValue && "" != goog.string.trim(c.nodeValue) || b.removeChild(c);
  10952. c = d
  10953. }
  10954. }
  10955. }
  10956. ;
  10957. goog.ui.ContainerRenderer.prototype.getDecoratorForChild = function (a) {
  10958. return goog.ui.registry.getDecorator(a)
  10959. }
  10960. ;
  10961. goog.ui.ContainerRenderer.prototype.initializeDom = function (a) {
  10962. a = a.getElement();
  10963. goog.asserts.assert(a, "The container DOM element cannot be null.");
  10964. goog.style.setUnselectable(a, !0, goog.userAgent.GECKO);
  10965. goog.userAgent.IE && (a.hideFocus = !0);
  10966. var b = this.getAriaRole();
  10967. b && goog.a11y.aria.setRole(a, b)
  10968. }
  10969. ;
  10970. goog.ui.ContainerRenderer.prototype.getKeyEventTarget = function (a) {
  10971. return a.getElement()
  10972. }
  10973. ;
  10974. goog.ui.ContainerRenderer.prototype.getCssClass = function () {
  10975. return goog.ui.ContainerRenderer.CSS_CLASS
  10976. }
  10977. ;
  10978. goog.ui.ContainerRenderer.prototype.getClassNames = function (a) {
  10979. var b = this.getCssClass()
  10980. , c = a.getOrientation() == goog.ui.Container.Orientation.HORIZONTAL;
  10981. c = [b, c ? b + "-horizontal" : b + "-vertical"];
  10982. a.isEnabled() || c.push(b + "-disabled");
  10983. return c
  10984. }
  10985. ;
  10986. goog.ui.ContainerRenderer.prototype.getDefaultOrientation = function () {
  10987. return goog.ui.Container.Orientation.VERTICAL
  10988. }
  10989. ;
  10990. goog.ui.ControlRenderer = function () { }
  10991. ;
  10992. goog.addSingletonGetter(goog.ui.ControlRenderer);
  10993. goog.tagUnsealableClass(goog.ui.ControlRenderer);
  10994. goog.ui.ControlRenderer.getCustomRenderer = function (a, b) {
  10995. var c = new a;
  10996. c.getCssClass = function () {
  10997. return b
  10998. }
  10999. ;
  11000. return c
  11001. }
  11002. ;
  11003. goog.ui.ControlRenderer.CSS_CLASS = "goog-control";
  11004. goog.ui.ControlRenderer.IE6_CLASS_COMBINATIONS = [];
  11005. goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_ = goog.object.create(goog.a11y.aria.Role.BUTTON, goog.a11y.aria.State.PRESSED, goog.a11y.aria.Role.CHECKBOX, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.MENU_ITEM, goog.a11y.aria.State.SELECTED, goog.a11y.aria.Role.MENU_ITEM_CHECKBOX, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.MENU_ITEM_RADIO, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.RADIO, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.TAB, goog.a11y.aria.State.SELECTED, goog.a11y.aria.Role.TREEITEM, goog.a11y.aria.State.SELECTED);
  11006. goog.ui.ControlRenderer.prototype.getAriaRole = function () { }
  11007. ;
  11008. goog.ui.ControlRenderer.prototype.createDom = function (a) {
  11009. return a.getDomHelper().createDom("DIV", this.getClassNames(a).join(" "), a.getContent())
  11010. }
  11011. ;
  11012. goog.ui.ControlRenderer.prototype.getContentElement = function (a) {
  11013. return a
  11014. }
  11015. ;
  11016. goog.ui.ControlRenderer.prototype.enableClassName = function (a, b, c) {
  11017. if (a = a.getElement ? a.getElement() : a) {
  11018. var d = [b];
  11019. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7") && (d = this.getAppliedCombinedClassNames_(goog.dom.classlist.get(a), b),
  11020. d.push(b));
  11021. goog.dom.classlist.enableAll(a, d, c)
  11022. }
  11023. }
  11024. ;
  11025. goog.ui.ControlRenderer.prototype.enableExtraClassName = function (a, b, c) {
  11026. this.enableClassName(a, b, c)
  11027. }
  11028. ;
  11029. goog.ui.ControlRenderer.prototype.canDecorate = function (a) {
  11030. return !0
  11031. }
  11032. ;
  11033. goog.ui.ControlRenderer.prototype.decorate = function (a, b) {
  11034. b.id && a.setId(b.id);
  11035. var c = this.getContentElement(b);
  11036. c && c.firstChild ? a.setContentInternal(c.firstChild.nextSibling ? goog.array.clone(c.childNodes) : c.firstChild) : a.setContentInternal(null);
  11037. var d = 0
  11038. , e = this.getCssClass()
  11039. , f = this.getStructuralCssClass()
  11040. , g = !1
  11041. , h = !1
  11042. , k = !1
  11043. , m = goog.array.toArray(goog.dom.classlist.get(b));
  11044. goog.array.forEach(m, function (a) {
  11045. g || a != e ? h || a != f ? d |= this.getStateFromClass(a) : h = !0 : (g = !0,
  11046. f == e && (h = !0));
  11047. this.getStateFromClass(a) == goog.ui.Component.State.DISABLED && (goog.asserts.assertElement(c),
  11048. goog.dom.isFocusableTabIndex(c) && goog.dom.setFocusableTabIndex(c, !1))
  11049. }, this);
  11050. a.setStateInternal(d);
  11051. g || (m.push(e),
  11052. f == e && (h = !0));
  11053. h || m.push(f);
  11054. var p = a.getExtraClassNames();
  11055. p && m.push.apply(m, p);
  11056. if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7")) {
  11057. var l = this.getAppliedCombinedClassNames_(m);
  11058. 0 < l.length && (m.push.apply(m, l),
  11059. k = !0)
  11060. }
  11061. g && h && !p && !k || goog.dom.classlist.set(b, m.join(" "));
  11062. return b
  11063. }
  11064. ;
  11065. goog.ui.ControlRenderer.prototype.initializeDom = function (a) {
  11066. a.isRightToLeft() && this.setRightToLeft(a.getElement(), !0);
  11067. a.isEnabled() && this.setFocusable(a, a.isVisible())
  11068. }
  11069. ;
  11070. goog.ui.ControlRenderer.prototype.setAriaRole = function (a, b) {
  11071. var c = b || this.getAriaRole();
  11072. if (c) {
  11073. goog.asserts.assert(a, "The element passed as a first parameter cannot be null.");
  11074. var d = goog.a11y.aria.getRole(a);
  11075. c != d && goog.a11y.aria.setRole(a, c)
  11076. }
  11077. }
  11078. ;
  11079. goog.ui.ControlRenderer.prototype.setAriaStates = function (a, b) {
  11080. goog.asserts.assert(a);
  11081. goog.asserts.assert(b);
  11082. var c = a.getAriaLabel();
  11083. null != c && this.setAriaLabel(b, c);
  11084. a.isVisible() || goog.a11y.aria.setState(b, goog.a11y.aria.State.HIDDEN, !a.isVisible());
  11085. a.isEnabled() || this.updateAriaState(b, goog.ui.Component.State.DISABLED, !a.isEnabled());
  11086. a.isSupportedState(goog.ui.Component.State.SELECTED) && this.updateAriaState(b, goog.ui.Component.State.SELECTED, a.isSelected());
  11087. a.isSupportedState(goog.ui.Component.State.CHECKED) && this.updateAriaState(b, goog.ui.Component.State.CHECKED, a.isChecked());
  11088. a.isSupportedState(goog.ui.Component.State.OPENED) && this.updateAriaState(b, goog.ui.Component.State.OPENED, a.isOpen())
  11089. }
  11090. ;
  11091. goog.ui.ControlRenderer.prototype.setAriaLabel = function (a, b) {
  11092. goog.a11y.aria.setLabel(a, b)
  11093. }
  11094. ;
  11095. goog.ui.ControlRenderer.prototype.setAllowTextSelection = function (a, b) {
  11096. goog.style.setUnselectable(a, !b, !goog.userAgent.IE && !goog.userAgent.OPERA)
  11097. }
  11098. ;
  11099. goog.ui.ControlRenderer.prototype.setRightToLeft = function (a, b) {
  11100. this.enableClassName(a, this.getStructuralCssClass() + "-rtl", b)
  11101. }
  11102. ;
  11103. goog.ui.ControlRenderer.prototype.isFocusable = function (a) {
  11104. var b;
  11105. return a.isSupportedState(goog.ui.Component.State.FOCUSED) && (b = a.getKeyEventTarget()) ? goog.dom.isFocusableTabIndex(b) : !1
  11106. }
  11107. ;
  11108. goog.ui.ControlRenderer.prototype.setFocusable = function (a, b) {
  11109. var c;
  11110. if (a.isSupportedState(goog.ui.Component.State.FOCUSED) && (c = a.getKeyEventTarget())) {
  11111. if (!b && a.isFocused()) {
  11112. try {
  11113. c.blur()
  11114. } catch (d) { }
  11115. a.isFocused() && a.handleBlur(null)
  11116. }
  11117. goog.dom.isFocusableTabIndex(c) != b && goog.dom.setFocusableTabIndex(c, b)
  11118. }
  11119. }
  11120. ;
  11121. goog.ui.ControlRenderer.prototype.setVisible = function (a, b) {
  11122. goog.style.setElementShown(a, b);
  11123. a && goog.a11y.aria.setState(a, goog.a11y.aria.State.HIDDEN, !b)
  11124. }
  11125. ;
  11126. goog.ui.ControlRenderer.prototype.setState = function (a, b, c) {
  11127. var d = a.getElement();
  11128. if (d) {
  11129. var e = this.getClassForState(b);
  11130. e && this.enableClassName(a, e, c);
  11131. this.updateAriaState(d, b, c)
  11132. }
  11133. }
  11134. ;
  11135. goog.ui.ControlRenderer.prototype.updateAriaState = function (a, b, c) {
  11136. goog.ui.ControlRenderer.ariaAttributeMap_ || (goog.ui.ControlRenderer.ariaAttributeMap_ = goog.object.create(goog.ui.Component.State.DISABLED, goog.a11y.aria.State.DISABLED, goog.ui.Component.State.SELECTED, goog.a11y.aria.State.SELECTED, goog.ui.Component.State.CHECKED, goog.a11y.aria.State.CHECKED, goog.ui.Component.State.OPENED, goog.a11y.aria.State.EXPANDED));
  11137. goog.asserts.assert(a, "The element passed as a first parameter cannot be null.");
  11138. (b = goog.ui.ControlRenderer.getAriaStateForAriaRole_(a, goog.ui.ControlRenderer.ariaAttributeMap_[b])) && goog.a11y.aria.setState(a, b, c)
  11139. }
  11140. ;
  11141. goog.ui.ControlRenderer.getAriaStateForAriaRole_ = function (a, b) {
  11142. var c = goog.a11y.aria.getRole(a);
  11143. if (!c)
  11144. return b;
  11145. c = goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_[c] || b;
  11146. return goog.ui.ControlRenderer.isAriaState_(b) ? c : b
  11147. }
  11148. ;
  11149. goog.ui.ControlRenderer.isAriaState_ = function (a) {
  11150. return a == goog.a11y.aria.State.CHECKED || a == goog.a11y.aria.State.SELECTED
  11151. }
  11152. ;
  11153. goog.ui.ControlRenderer.prototype.setContent = function (a, b) {
  11154. var c = this.getContentElement(a);
  11155. if (c && (goog.dom.removeChildren(c),
  11156. b))
  11157. if ("string" === typeof b)
  11158. goog.dom.setTextContent(c, b);
  11159. else {
  11160. var d = function (a) {
  11161. if (a) {
  11162. var b = goog.dom.getOwnerDocument(c);
  11163. c.appendChild("string" === typeof a ? b.createTextNode(a) : a)
  11164. }
  11165. };
  11166. goog.isArray(b) ? goog.array.forEach(b, d) : !goog.isArrayLike(b) || "nodeType" in b ? d(b) : goog.array.forEach(goog.array.clone(b), d)
  11167. }
  11168. }
  11169. ;
  11170. goog.ui.ControlRenderer.prototype.getKeyEventTarget = function (a) {
  11171. return a.getElement()
  11172. }
  11173. ;
  11174. goog.ui.ControlRenderer.prototype.getCssClass = function () {
  11175. return goog.ui.ControlRenderer.CSS_CLASS
  11176. }
  11177. ;
  11178. goog.ui.ControlRenderer.prototype.getIe6ClassCombinations = function () {
  11179. return []
  11180. }
  11181. ;
  11182. goog.ui.ControlRenderer.prototype.getStructuralCssClass = function () {
  11183. return this.getCssClass()
  11184. }
  11185. ;
  11186. goog.ui.ControlRenderer.prototype.getClassNames = function (a) {
  11187. var b = this.getCssClass()
  11188. , c = [b]
  11189. , d = this.getStructuralCssClass();
  11190. d != b && c.push(d);
  11191. b = this.getClassNamesForState(a.getState());
  11192. c.push.apply(c, b);
  11193. (a = a.getExtraClassNames()) && c.push.apply(c, a);
  11194. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7") && c.push.apply(c, this.getAppliedCombinedClassNames_(c));
  11195. return c
  11196. }
  11197. ;
  11198. goog.ui.ControlRenderer.prototype.getAppliedCombinedClassNames_ = function (a, b) {
  11199. var c = [];
  11200. b && (a = goog.array.concat(a, [b]));
  11201. goog.array.forEach(this.getIe6ClassCombinations(), function (d) {
  11202. !goog.array.every(d, goog.partial(goog.array.contains, a)) || b && !goog.array.contains(d, b) || c.push(d.join("_"))
  11203. });
  11204. return c
  11205. }
  11206. ;
  11207. goog.ui.ControlRenderer.prototype.getClassNamesForState = function (a) {
  11208. for (var b = []; a;) {
  11209. var c = a & -a;
  11210. b.push(this.getClassForState(c));
  11211. a &= ~c
  11212. }
  11213. return b
  11214. }
  11215. ;
  11216. goog.ui.ControlRenderer.prototype.getClassForState = function (a) {
  11217. this.classByState_ || this.createClassByStateMap_();
  11218. return this.classByState_[a]
  11219. }
  11220. ;
  11221. goog.ui.ControlRenderer.prototype.getStateFromClass = function (a) {
  11222. this.stateByClass_ || this.createStateByClassMap_();
  11223. a = parseInt(this.stateByClass_[a], 10);
  11224. return isNaN(a) ? 0 : a
  11225. }
  11226. ;
  11227. goog.ui.ControlRenderer.prototype.createClassByStateMap_ = function () {
  11228. var a = this.getStructuralCssClass()
  11229. , b = !goog.string.contains(goog.string.normalizeWhitespace(a), " ");
  11230. goog.asserts.assert(b, "ControlRenderer has an invalid css class: '" + a + "'");
  11231. this.classByState_ = goog.object.create(goog.ui.Component.State.DISABLED, a + "-disabled", goog.ui.Component.State.HOVER, a + "-hover", goog.ui.Component.State.ACTIVE, a + "-active", goog.ui.Component.State.SELECTED, a + "-selected", goog.ui.Component.State.CHECKED, a + "-checked", goog.ui.Component.State.FOCUSED, a + "-focused", goog.ui.Component.State.OPENED, a + "-open")
  11232. }
  11233. ;
  11234. goog.ui.ControlRenderer.prototype.createStateByClassMap_ = function () {
  11235. this.classByState_ || this.createClassByStateMap_();
  11236. this.stateByClass_ = goog.object.transpose(this.classByState_)
  11237. }
  11238. ;
  11239. goog.ui.Control = function (a, b, c) {
  11240. goog.ui.Component.call(this, c);
  11241. this.renderer_ = b || goog.ui.registry.getDefaultRenderer(this.constructor);
  11242. this.setContentInternal(void 0 !== a ? a : null);
  11243. this.ariaLabel_ = null
  11244. }
  11245. ;
  11246. goog.inherits(goog.ui.Control, goog.ui.Component);
  11247. goog.tagUnsealableClass(goog.ui.Control);
  11248. goog.ui.Control.registerDecorator = goog.ui.registry.setDecoratorByClassName;
  11249. goog.ui.Control.getDecorator = goog.ui.registry.getDecorator;
  11250. goog.ui.Control.prototype.content_ = null;
  11251. goog.ui.Control.prototype.state_ = 0;
  11252. goog.ui.Control.prototype.supportedStates_ = goog.ui.Component.State.DISABLED | goog.ui.Component.State.HOVER | goog.ui.Component.State.ACTIVE | goog.ui.Component.State.FOCUSED;
  11253. goog.ui.Control.prototype.autoStates_ = goog.ui.Component.State.ALL;
  11254. goog.ui.Control.prototype.statesWithTransitionEvents_ = 0;
  11255. goog.ui.Control.prototype.visible_ = !0;
  11256. goog.ui.Control.prototype.extraClassNames_ = null;
  11257. goog.ui.Control.prototype.handleMouseEvents_ = !0;
  11258. goog.ui.Control.prototype.allowTextSelection_ = !1;
  11259. goog.ui.Control.prototype.preferredAriaRole_ = null;
  11260. goog.ui.Control.prototype.isHandleMouseEvents = function () {
  11261. return this.handleMouseEvents_
  11262. }
  11263. ;
  11264. goog.ui.Control.prototype.setHandleMouseEvents = function (a) {
  11265. this.isInDocument() && a != this.handleMouseEvents_ && this.enableMouseEventHandling_(a);
  11266. this.handleMouseEvents_ = a
  11267. }
  11268. ;
  11269. goog.ui.Control.prototype.getKeyEventTarget = function () {
  11270. return this.renderer_.getKeyEventTarget(this)
  11271. }
  11272. ;
  11273. goog.ui.Control.prototype.getKeyHandler = function () {
  11274. return this.keyHandler_ || (this.keyHandler_ = new goog.events.KeyHandler)
  11275. }
  11276. ;
  11277. goog.ui.Control.prototype.getRenderer = function () {
  11278. return this.renderer_
  11279. }
  11280. ;
  11281. goog.ui.Control.prototype.setRenderer = function (a) {
  11282. if (this.isInDocument())
  11283. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  11284. this.getElement() && this.setElementInternal(null);
  11285. this.renderer_ = a
  11286. }
  11287. ;
  11288. goog.ui.Control.prototype.getExtraClassNames = function () {
  11289. return this.extraClassNames_
  11290. }
  11291. ;
  11292. goog.ui.Control.prototype.addClassName = function (a) {
  11293. a && (this.extraClassNames_ ? goog.array.contains(this.extraClassNames_, a) || this.extraClassNames_.push(a) : this.extraClassNames_ = [a],
  11294. this.renderer_.enableExtraClassName(this, a, !0))
  11295. }
  11296. ;
  11297. goog.ui.Control.prototype.removeClassName = function (a) {
  11298. a && this.extraClassNames_ && goog.array.remove(this.extraClassNames_, a) && (0 == this.extraClassNames_.length && (this.extraClassNames_ = null),
  11299. this.renderer_.enableExtraClassName(this, a, !1))
  11300. }
  11301. ;
  11302. goog.ui.Control.prototype.enableClassName = function (a, b) {
  11303. b ? this.addClassName(a) : this.removeClassName(a)
  11304. }
  11305. ;
  11306. goog.ui.Control.prototype.createDom = function () {
  11307. var a = this.renderer_.createDom(this);
  11308. this.setElementInternal(a);
  11309. this.renderer_.setAriaRole(a, this.getPreferredAriaRole());
  11310. this.isAllowTextSelection() || this.renderer_.setAllowTextSelection(a, !1);
  11311. this.isVisible() || this.renderer_.setVisible(a, !1)
  11312. }
  11313. ;
  11314. goog.ui.Control.prototype.getPreferredAriaRole = function () {
  11315. return this.preferredAriaRole_
  11316. }
  11317. ;
  11318. goog.ui.Control.prototype.setPreferredAriaRole = function (a) {
  11319. this.preferredAriaRole_ = a
  11320. }
  11321. ;
  11322. goog.ui.Control.prototype.getAriaLabel = function () {
  11323. return this.ariaLabel_
  11324. }
  11325. ;
  11326. goog.ui.Control.prototype.setAriaLabel = function (a) {
  11327. this.ariaLabel_ = a;
  11328. var b = this.getElement();
  11329. b && this.renderer_.setAriaLabel(b, a)
  11330. }
  11331. ;
  11332. goog.ui.Control.prototype.getContentElement = function () {
  11333. return this.renderer_.getContentElement(this.getElement())
  11334. }
  11335. ;
  11336. goog.ui.Control.prototype.canDecorate = function (a) {
  11337. return this.renderer_.canDecorate(a)
  11338. }
  11339. ;
  11340. goog.ui.Control.prototype.decorateInternal = function (a) {
  11341. a = this.renderer_.decorate(this, a);
  11342. this.setElementInternal(a);
  11343. this.renderer_.setAriaRole(a, this.getPreferredAriaRole());
  11344. this.isAllowTextSelection() || this.renderer_.setAllowTextSelection(a, !1);
  11345. this.visible_ = "none" != a.style.display
  11346. }
  11347. ;
  11348. goog.ui.Control.prototype.enterDocument = function () {
  11349. goog.ui.Control.superClass_.enterDocument.call(this);
  11350. this.renderer_.setAriaStates(this, this.getElementStrict());
  11351. this.renderer_.initializeDom(this);
  11352. if (this.supportedStates_ & ~goog.ui.Component.State.DISABLED && (this.isHandleMouseEvents() && this.enableMouseEventHandling_(!0),
  11353. this.isSupportedState(goog.ui.Component.State.FOCUSED))) {
  11354. var a = this.getKeyEventTarget();
  11355. if (a) {
  11356. var b = this.getKeyHandler();
  11357. b.attach(a);
  11358. this.getHandler().listen(b, goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent).listen(a, goog.events.EventType.FOCUS, this.handleFocus).listen(a, goog.events.EventType.BLUR, this.handleBlur)
  11359. }
  11360. }
  11361. }
  11362. ;
  11363. goog.ui.Control.prototype.enableMouseEventHandling_ = function (a) {
  11364. var b = goog.ui.ComponentUtil.getMouseEventType(this)
  11365. , c = this.getHandler()
  11366. , d = this.getElement();
  11367. a ? (c.listen(d, b.MOUSEDOWN, this.handleMouseDown).listen(d, [b.MOUSEUP, b.MOUSECANCEL], this.handleMouseUp).listen(d, goog.events.EventType.MOUSEOVER, this.handleMouseOver).listen(d, goog.events.EventType.MOUSEOUT, this.handleMouseOut),
  11368. this.pointerEventsEnabled() && c.listen(d, goog.events.EventType.GOTPOINTERCAPTURE, this.preventPointerCapture_),
  11369. this.handleContextMenu != goog.nullFunction && c.listen(d, goog.events.EventType.CONTEXTMENU, this.handleContextMenu),
  11370. goog.userAgent.IE && (goog.userAgent.isVersionOrHigher(9) || c.listen(d, goog.events.EventType.DBLCLICK, this.handleDblClick),
  11371. this.ieMouseEventSequenceSimulator_ || (this.ieMouseEventSequenceSimulator_ = new goog.ui.Control.IeMouseEventSequenceSimulator_(this),
  11372. this.registerDisposable(this.ieMouseEventSequenceSimulator_)))) : (c.unlisten(d, b.MOUSEDOWN, this.handleMouseDown).unlisten(d, [b.MOUSEUP, b.MOUSECANCEL], this.handleMouseUp).unlisten(d, goog.events.EventType.MOUSEOVER, this.handleMouseOver).unlisten(d, goog.events.EventType.MOUSEOUT, this.handleMouseOut),
  11373. this.pointerEventsEnabled() && c.unlisten(d, goog.events.EventType.GOTPOINTERCAPTURE, this.preventPointerCapture_),
  11374. this.handleContextMenu != goog.nullFunction && c.unlisten(d, goog.events.EventType.CONTEXTMENU, this.handleContextMenu),
  11375. goog.userAgent.IE && (goog.userAgent.isVersionOrHigher(9) || c.unlisten(d, goog.events.EventType.DBLCLICK, this.handleDblClick),
  11376. goog.dispose(this.ieMouseEventSequenceSimulator_),
  11377. this.ieMouseEventSequenceSimulator_ = null))
  11378. }
  11379. ;
  11380. goog.ui.Control.prototype.exitDocument = function () {
  11381. goog.ui.Control.superClass_.exitDocument.call(this);
  11382. this.keyHandler_ && this.keyHandler_.detach();
  11383. this.isVisible() && this.isEnabled() && this.renderer_.setFocusable(this, !1)
  11384. }
  11385. ;
  11386. goog.ui.Control.prototype.disposeInternal = function () {
  11387. goog.ui.Control.superClass_.disposeInternal.call(this);
  11388. this.keyHandler_ && (this.keyHandler_.dispose(),
  11389. delete this.keyHandler_);
  11390. delete this.renderer_;
  11391. this.ieMouseEventSequenceSimulator_ = this.extraClassNames_ = this.content_ = null
  11392. }
  11393. ;
  11394. goog.ui.Control.prototype.getContent = function () {
  11395. return this.content_
  11396. }
  11397. ;
  11398. goog.ui.Control.prototype.setContent = function (a) {
  11399. this.renderer_.setContent(this.getElement(), a);
  11400. this.setContentInternal(a)
  11401. }
  11402. ;
  11403. goog.ui.Control.prototype.setContentInternal = function (a) {
  11404. this.content_ = a
  11405. }
  11406. ;
  11407. goog.ui.Control.prototype.getCaption = function () {
  11408. var a = this.getContent();
  11409. if (!a)
  11410. return "";
  11411. a = "string" === typeof a ? a : goog.isArray(a) ? goog.array.map(a, goog.dom.getRawTextContent).join("") : goog.dom.getTextContent(a);
  11412. return goog.string.collapseBreakingSpaces(a)
  11413. }
  11414. ;
  11415. goog.ui.Control.prototype.setCaption = function (a) {
  11416. this.setContent(a)
  11417. }
  11418. ;
  11419. goog.ui.Control.prototype.setRightToLeft = function (a) {
  11420. goog.ui.Control.superClass_.setRightToLeft.call(this, a);
  11421. var b = this.getElement();
  11422. b && this.renderer_.setRightToLeft(b, a)
  11423. }
  11424. ;
  11425. goog.ui.Control.prototype.isAllowTextSelection = function () {
  11426. return this.allowTextSelection_
  11427. }
  11428. ;
  11429. goog.ui.Control.prototype.setAllowTextSelection = function (a) {
  11430. this.allowTextSelection_ = a;
  11431. var b = this.getElement();
  11432. b && this.renderer_.setAllowTextSelection(b, a)
  11433. }
  11434. ;
  11435. goog.ui.Control.prototype.isVisible = function () {
  11436. return this.visible_
  11437. }
  11438. ;
  11439. goog.ui.Control.prototype.setVisible = function (a, b) {
  11440. if (b || this.visible_ != a && this.dispatchEvent(a ? goog.ui.Component.EventType.SHOW : goog.ui.Component.EventType.HIDE)) {
  11441. var c = this.getElement();
  11442. c && this.renderer_.setVisible(c, a);
  11443. this.isEnabled() && this.renderer_.setFocusable(this, a);
  11444. this.visible_ = a;
  11445. return !0
  11446. }
  11447. return !1
  11448. }
  11449. ;
  11450. goog.ui.Control.prototype.isEnabled = function () {
  11451. return !this.hasState(goog.ui.Component.State.DISABLED)
  11452. }
  11453. ;
  11454. goog.ui.Control.prototype.isParentDisabled_ = function () {
  11455. var a = this.getParent();
  11456. return !!a && "function" == typeof a.isEnabled && !a.isEnabled()
  11457. }
  11458. ;
  11459. goog.ui.Control.prototype.setEnabled = function (a) {
  11460. !this.isParentDisabled_() && this.isTransitionAllowed(goog.ui.Component.State.DISABLED, !a) && (a || (this.setActive(!1),
  11461. this.setHighlighted(!1)),
  11462. this.isVisible() && this.renderer_.setFocusable(this, a),
  11463. this.setState(goog.ui.Component.State.DISABLED, !a, !0))
  11464. }
  11465. ;
  11466. goog.ui.Control.prototype.isHighlighted = function () {
  11467. return this.hasState(goog.ui.Component.State.HOVER)
  11468. }
  11469. ;
  11470. goog.ui.Control.prototype.setHighlighted = function (a) {
  11471. this.isTransitionAllowed(goog.ui.Component.State.HOVER, a) && this.setState(goog.ui.Component.State.HOVER, a)
  11472. }
  11473. ;
  11474. goog.ui.Control.prototype.isActive = function () {
  11475. return this.hasState(goog.ui.Component.State.ACTIVE)
  11476. }
  11477. ;
  11478. goog.ui.Control.prototype.setActive = function (a) {
  11479. this.isTransitionAllowed(goog.ui.Component.State.ACTIVE, a) && this.setState(goog.ui.Component.State.ACTIVE, a)
  11480. }
  11481. ;
  11482. goog.ui.Control.prototype.isSelected = function () {
  11483. return this.hasState(goog.ui.Component.State.SELECTED)
  11484. }
  11485. ;
  11486. goog.ui.Control.prototype.setSelected = function (a) {
  11487. this.isTransitionAllowed(goog.ui.Component.State.SELECTED, a) && this.setState(goog.ui.Component.State.SELECTED, a)
  11488. }
  11489. ;
  11490. goog.ui.Control.prototype.isChecked = function () {
  11491. return this.hasState(goog.ui.Component.State.CHECKED)
  11492. }
  11493. ;
  11494. goog.ui.Control.prototype.setChecked = function (a) {
  11495. this.isTransitionAllowed(goog.ui.Component.State.CHECKED, a) && this.setState(goog.ui.Component.State.CHECKED, a)
  11496. }
  11497. ;
  11498. goog.ui.Control.prototype.isFocused = function () {
  11499. return this.hasState(goog.ui.Component.State.FOCUSED)
  11500. }
  11501. ;
  11502. goog.ui.Control.prototype.setFocused = function (a) {
  11503. this.isTransitionAllowed(goog.ui.Component.State.FOCUSED, a) && this.setState(goog.ui.Component.State.FOCUSED, a)
  11504. }
  11505. ;
  11506. goog.ui.Control.prototype.isOpen = function () {
  11507. return this.hasState(goog.ui.Component.State.OPENED)
  11508. }
  11509. ;
  11510. goog.ui.Control.prototype.setOpen = function (a) {
  11511. this.isTransitionAllowed(goog.ui.Component.State.OPENED, a) && this.setState(goog.ui.Component.State.OPENED, a)
  11512. }
  11513. ;
  11514. goog.ui.Control.prototype.getState = function () {
  11515. return this.state_
  11516. }
  11517. ;
  11518. goog.ui.Control.prototype.hasState = function (a) {
  11519. return !!(this.state_ & a)
  11520. }
  11521. ;
  11522. goog.ui.Control.prototype.setState = function (a, b, c) {
  11523. c || a != goog.ui.Component.State.DISABLED ? this.isSupportedState(a) && b != this.hasState(a) && (this.renderer_.setState(this, a, b),
  11524. this.state_ = b ? this.state_ | a : this.state_ & ~a) : this.setEnabled(!b)
  11525. }
  11526. ;
  11527. goog.ui.Control.prototype.setStateInternal = function (a) {
  11528. this.state_ = a
  11529. }
  11530. ;
  11531. goog.ui.Control.prototype.isSupportedState = function (a) {
  11532. return !!(this.supportedStates_ & a)
  11533. }
  11534. ;
  11535. goog.ui.Control.prototype.setSupportedState = function (a, b) {
  11536. if (this.isInDocument() && this.hasState(a) && !b)
  11537. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  11538. !b && this.hasState(a) && this.setState(a, !1);
  11539. this.supportedStates_ = b ? this.supportedStates_ | a : this.supportedStates_ & ~a
  11540. }
  11541. ;
  11542. goog.ui.Control.prototype.isAutoState = function (a) {
  11543. return !!(this.autoStates_ & a) && this.isSupportedState(a)
  11544. }
  11545. ;
  11546. goog.ui.Control.prototype.setAutoStates = function (a, b) {
  11547. this.autoStates_ = b ? this.autoStates_ | a : this.autoStates_ & ~a
  11548. }
  11549. ;
  11550. goog.ui.Control.prototype.isDispatchTransitionEvents = function (a) {
  11551. return !!(this.statesWithTransitionEvents_ & a) && this.isSupportedState(a)
  11552. }
  11553. ;
  11554. goog.ui.Control.prototype.setDispatchTransitionEvents = function (a, b) {
  11555. this.statesWithTransitionEvents_ = b ? this.statesWithTransitionEvents_ | a : this.statesWithTransitionEvents_ & ~a
  11556. }
  11557. ;
  11558. goog.ui.Control.prototype.isTransitionAllowed = function (a, b) {
  11559. return this.isSupportedState(a) && this.hasState(a) != b && (!(this.statesWithTransitionEvents_ & a) || this.dispatchEvent(goog.ui.Component.getStateTransitionEvent(a, b))) && !this.isDisposed()
  11560. }
  11561. ;
  11562. goog.ui.Control.prototype.handleMouseOver = function (a) {
  11563. !goog.ui.Control.isMouseEventWithinElement_(a, this.getElement()) && this.dispatchEvent(goog.ui.Component.EventType.ENTER) && this.isEnabled() && this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0)
  11564. }
  11565. ;
  11566. goog.ui.Control.prototype.handleMouseOut = function (a) {
  11567. !goog.ui.Control.isMouseEventWithinElement_(a, this.getElement()) && this.dispatchEvent(goog.ui.Component.EventType.LEAVE) && (this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1),
  11568. this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!1))
  11569. }
  11570. ;
  11571. goog.ui.Control.prototype.preventPointerCapture_ = function (a) {
  11572. var b = a.target;
  11573. b.releasePointerCapture && b.releasePointerCapture(a.pointerId)
  11574. }
  11575. ;
  11576. goog.ui.Control.prototype.handleContextMenu = goog.nullFunction;
  11577. goog.ui.Control.isMouseEventWithinElement_ = function (a, b) {
  11578. return !!a.relatedTarget && goog.dom.contains(b, a.relatedTarget)
  11579. }
  11580. ;
  11581. goog.ui.Control.prototype.handleMouseDown = function (a) {
  11582. this.isEnabled() && (this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0),
  11583. a.isMouseActionButton() && (this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!0),
  11584. this.renderer_ && this.renderer_.isFocusable(this) && this.getKeyEventTarget().focus()));
  11585. !this.isAllowTextSelection() && a.isMouseActionButton() && a.preventDefault()
  11586. }
  11587. ;
  11588. goog.ui.Control.prototype.handleMouseUp = function (a) {
  11589. this.isEnabled() && (this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0),
  11590. this.isActive() && this.performActionInternal(a) && this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1))
  11591. }
  11592. ;
  11593. goog.ui.Control.prototype.handleDblClick = function (a) {
  11594. this.isEnabled() && this.performActionInternal(a)
  11595. }
  11596. ;
  11597. goog.ui.Control.prototype.performActionInternal = function (a) {
  11598. this.isAutoState(goog.ui.Component.State.CHECKED) && this.setChecked(!this.isChecked());
  11599. this.isAutoState(goog.ui.Component.State.SELECTED) && this.setSelected(!0);
  11600. this.isAutoState(goog.ui.Component.State.OPENED) && this.setOpen(!this.isOpen());
  11601. var b = new goog.events.Event(goog.ui.Component.EventType.ACTION, this);
  11602. a && (b.altKey = a.altKey,
  11603. b.ctrlKey = a.ctrlKey,
  11604. b.metaKey = a.metaKey,
  11605. b.shiftKey = a.shiftKey,
  11606. b.platformModifierKey = a.platformModifierKey);
  11607. return this.dispatchEvent(b)
  11608. }
  11609. ;
  11610. goog.ui.Control.prototype.handleFocus = function (a) {
  11611. this.isAutoState(goog.ui.Component.State.FOCUSED) && this.setFocused(!0)
  11612. }
  11613. ;
  11614. goog.ui.Control.prototype.handleBlur = function (a) {
  11615. this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1);
  11616. this.isAutoState(goog.ui.Component.State.FOCUSED) && this.setFocused(!1)
  11617. }
  11618. ;
  11619. goog.ui.Control.prototype.handleKeyEvent = function (a) {
  11620. return this.isVisible() && this.isEnabled() && this.handleKeyEventInternal(a) ? (a.preventDefault(),
  11621. a.stopPropagation(),
  11622. !0) : !1
  11623. }
  11624. ;
  11625. goog.ui.Control.prototype.handleKeyEventInternal = function (a) {
  11626. return a.keyCode == goog.events.KeyCodes.ENTER && this.performActionInternal(a)
  11627. }
  11628. ;
  11629. goog.ui.registry.setDefaultRenderer(goog.ui.Control, goog.ui.ControlRenderer);
  11630. goog.ui.registry.setDecoratorByClassName(goog.ui.ControlRenderer.CSS_CLASS, function () {
  11631. return new goog.ui.Control(null)
  11632. });
  11633. goog.ui.Control.IeMouseEventSequenceSimulator_ = function (a) {
  11634. goog.Disposable.call(this);
  11635. this.control_ = a;
  11636. this.clickExpected_ = !1;
  11637. this.handler_ = new goog.events.EventHandler(this);
  11638. this.registerDisposable(this.handler_);
  11639. var b = this.control_.getElementStrict();
  11640. a = goog.ui.ComponentUtil.getMouseEventType(a);
  11641. this.handler_.listen(b, a.MOUSEDOWN, this.handleMouseDown_).listen(b, a.MOUSEUP, this.handleMouseUp_).listen(b, goog.events.EventType.CLICK, this.handleClick_)
  11642. }
  11643. ;
  11644. goog.inherits(goog.ui.Control.IeMouseEventSequenceSimulator_, goog.Disposable);
  11645. goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_ = !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9);
  11646. goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleMouseDown_ = function () {
  11647. this.clickExpected_ = !1
  11648. }
  11649. ;
  11650. goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleMouseUp_ = function () {
  11651. this.clickExpected_ = !0
  11652. }
  11653. ;
  11654. goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_ = function (a, b) {
  11655. if (!goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_)
  11656. return a.button = goog.events.BrowserEvent.MouseButton.LEFT,
  11657. a.type = b,
  11658. a;
  11659. var c = document.createEvent("MouseEvents");
  11660. c.initMouseEvent(b, a.bubbles, a.cancelable, a.view || null, a.detail, a.screenX, a.screenY, a.clientX, a.clientY, a.ctrlKey, a.altKey, a.shiftKey, a.metaKey, goog.events.BrowserEvent.MouseButton.LEFT, a.relatedTarget || null);
  11661. return c
  11662. }
  11663. ;
  11664. goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleClick_ = function (a) {
  11665. if (this.clickExpected_)
  11666. this.clickExpected_ = !1;
  11667. else {
  11668. var b = a.getBrowserEvent()
  11669. , c = b.button
  11670. , d = b.type
  11671. , e = goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_(b, goog.events.EventType.MOUSEDOWN);
  11672. this.control_.handleMouseDown(new goog.events.BrowserEvent(e, a.currentTarget));
  11673. e = goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_(b, goog.events.EventType.MOUSEUP);
  11674. this.control_.handleMouseUp(new goog.events.BrowserEvent(e, a.currentTarget));
  11675. goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_ || (b.button = c,
  11676. b.type = d)
  11677. }
  11678. }
  11679. ;
  11680. goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.disposeInternal = function () {
  11681. this.control_ = null;
  11682. goog.ui.Control.IeMouseEventSequenceSimulator_.superClass_.disposeInternal.call(this)
  11683. }
  11684. ;
  11685. goog.ui.Container = function (a, b, c) {
  11686. goog.ui.Component.call(this, c);
  11687. this.renderer_ = b || goog.ui.ContainerRenderer.getInstance();
  11688. this.orientation_ = a || this.renderer_.getDefaultOrientation()
  11689. }
  11690. ;
  11691. goog.inherits(goog.ui.Container, goog.ui.Component);
  11692. goog.tagUnsealableClass(goog.ui.Container);
  11693. goog.ui.Container.EventType = {
  11694. AFTER_SHOW: "aftershow",
  11695. AFTER_HIDE: "afterhide"
  11696. };
  11697. goog.ui.Container.Orientation = {
  11698. HORIZONTAL: "horizontal",
  11699. VERTICAL: "vertical"
  11700. };
  11701. goog.ui.Container.prototype.keyEventTarget_ = null;
  11702. goog.ui.Container.prototype.keyHandler_ = null;
  11703. goog.ui.Container.prototype.renderer_ = null;
  11704. goog.ui.Container.prototype.orientation_ = null;
  11705. goog.ui.Container.prototype.visible_ = !0;
  11706. goog.ui.Container.prototype.enabled_ = !0;
  11707. goog.ui.Container.prototype.focusable_ = !0;
  11708. goog.ui.Container.prototype.highlightedIndex_ = -1;
  11709. goog.ui.Container.prototype.openItem_ = null;
  11710. goog.ui.Container.prototype.mouseButtonPressed_ = !1;
  11711. goog.ui.Container.prototype.allowFocusableChildren_ = !1;
  11712. goog.ui.Container.prototype.openFollowsHighlight_ = !0;
  11713. goog.ui.Container.prototype.childElementIdMap_ = null;
  11714. goog.ui.Container.prototype.getKeyEventTarget = function () {
  11715. return this.keyEventTarget_ || this.renderer_.getKeyEventTarget(this)
  11716. }
  11717. ;
  11718. goog.ui.Container.prototype.setKeyEventTarget = function (a) {
  11719. if (this.focusable_) {
  11720. var b = this.getKeyEventTarget()
  11721. , c = this.isInDocument();
  11722. this.keyEventTarget_ = a;
  11723. var d = this.getKeyEventTarget();
  11724. c && (this.keyEventTarget_ = b,
  11725. this.enableFocusHandling_(!1),
  11726. this.keyEventTarget_ = a,
  11727. this.getKeyHandler().attach(d),
  11728. this.enableFocusHandling_(!0))
  11729. } else
  11730. throw Error("Can't set key event target for container that doesn't support keyboard focus!");
  11731. }
  11732. ;
  11733. goog.ui.Container.prototype.getKeyHandler = function () {
  11734. return this.keyHandler_ || (this.keyHandler_ = new goog.events.KeyHandler(this.getKeyEventTarget()))
  11735. }
  11736. ;
  11737. goog.ui.Container.prototype.getRenderer = function () {
  11738. return this.renderer_
  11739. }
  11740. ;
  11741. goog.ui.Container.prototype.setRenderer = function (a) {
  11742. if (this.getElement())
  11743. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  11744. this.renderer_ = a
  11745. }
  11746. ;
  11747. goog.ui.Container.prototype.createDom = function () {
  11748. this.setElementInternal(this.renderer_.createDom(this))
  11749. }
  11750. ;
  11751. goog.ui.Container.prototype.getContentElement = function () {
  11752. return this.renderer_.getContentElement(this.getElement())
  11753. }
  11754. ;
  11755. goog.ui.Container.prototype.canDecorate = function (a) {
  11756. return this.renderer_.canDecorate(a)
  11757. }
  11758. ;
  11759. goog.ui.Container.prototype.decorateInternal = function (a) {
  11760. this.setElementInternal(this.renderer_.decorate(this, a));
  11761. "none" == a.style.display && (this.visible_ = !1)
  11762. }
  11763. ;
  11764. goog.ui.Container.prototype.enterDocument = function () {
  11765. goog.ui.Container.superClass_.enterDocument.call(this);
  11766. this.forEachChild(function (a) {
  11767. a.isInDocument() && this.registerChildId_(a)
  11768. }, this);
  11769. var a = this.getElement();
  11770. this.renderer_.initializeDom(this);
  11771. this.setVisible(this.visible_, !0);
  11772. var b = goog.ui.ComponentUtil.getMouseEventType(this);
  11773. this.getHandler().listen(this, goog.ui.Component.EventType.ENTER, this.handleEnterItem).listen(this, goog.ui.Component.EventType.HIGHLIGHT, this.handleHighlightItem).listen(this, goog.ui.Component.EventType.UNHIGHLIGHT, this.handleUnHighlightItem).listen(this, goog.ui.Component.EventType.OPEN, this.handleOpenItem).listen(this, goog.ui.Component.EventType.CLOSE, this.handleCloseItem).listen(a, b.MOUSEDOWN, this.handleMouseDown).listen(goog.dom.getOwnerDocument(a), [b.MOUSEUP, b.MOUSECANCEL], this.handleDocumentMouseUp).listen(a, [b.MOUSEDOWN, b.MOUSEUP, b.MOUSECANCEL, goog.events.EventType.MOUSEOVER, goog.events.EventType.MOUSEOUT, goog.events.EventType.CONTEXTMENU], this.handleChildMouseEvents);
  11774. this.pointerEventsEnabled() && this.getHandler().listen(a, goog.events.EventType.GOTPOINTERCAPTURE, this.preventPointerCapture_);
  11775. this.isFocusable() && this.enableFocusHandling_(!0)
  11776. }
  11777. ;
  11778. goog.ui.Container.prototype.preventPointerCapture_ = function (a) {
  11779. var b = a.target;
  11780. b.releasePointerCapture && b.releasePointerCapture(a.pointerId)
  11781. }
  11782. ;
  11783. goog.ui.Container.prototype.enableFocusHandling_ = function (a) {
  11784. var b = this.getHandler()
  11785. , c = this.getKeyEventTarget();
  11786. a ? b.listen(c, goog.events.EventType.FOCUS, this.handleFocus).listen(c, goog.events.EventType.BLUR, this.handleBlur).listen(this.getKeyHandler(), goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent) : b.unlisten(c, goog.events.EventType.FOCUS, this.handleFocus).unlisten(c, goog.events.EventType.BLUR, this.handleBlur).unlisten(this.getKeyHandler(), goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent)
  11787. }
  11788. ;
  11789. goog.ui.Container.prototype.exitDocument = function () {
  11790. this.setHighlightedIndex(-1);
  11791. this.openItem_ && this.openItem_.setOpen(!1);
  11792. this.mouseButtonPressed_ = !1;
  11793. goog.ui.Container.superClass_.exitDocument.call(this)
  11794. }
  11795. ;
  11796. goog.ui.Container.prototype.disposeInternal = function () {
  11797. goog.ui.Container.superClass_.disposeInternal.call(this);
  11798. this.keyHandler_ && (this.keyHandler_.dispose(),
  11799. this.keyHandler_ = null);
  11800. this.renderer_ = this.openItem_ = this.childElementIdMap_ = this.keyEventTarget_ = null
  11801. }
  11802. ;
  11803. goog.ui.Container.prototype.handleEnterItem = function (a) {
  11804. return !0
  11805. }
  11806. ;
  11807. goog.ui.Container.prototype.handleHighlightItem = function (a) {
  11808. var b = this.indexOfChild(a.target);
  11809. if (-1 < b && b != this.highlightedIndex_) {
  11810. var c = this.getHighlighted();
  11811. c && c.setHighlighted(!1);
  11812. this.highlightedIndex_ = b;
  11813. c = this.getHighlighted();
  11814. this.isMouseButtonPressed() && c.setActive(!0);
  11815. this.openFollowsHighlight_ && this.openItem_ && c != this.openItem_ && (c.isSupportedState(goog.ui.Component.State.OPENED) ? c.setOpen(!0) : this.openItem_.setOpen(!1))
  11816. }
  11817. b = this.getElement();
  11818. goog.asserts.assert(b, "The DOM element for the container cannot be null.");
  11819. null != a.target.getElement() && goog.a11y.aria.setState(b, goog.a11y.aria.State.ACTIVEDESCENDANT, a.target.getElement().id)
  11820. }
  11821. ;
  11822. goog.ui.Container.prototype.handleUnHighlightItem = function (a) {
  11823. a.target == this.getHighlighted() && (this.highlightedIndex_ = -1);
  11824. a = this.getElement();
  11825. goog.asserts.assert(a, "The DOM element for the container cannot be null.");
  11826. goog.a11y.aria.removeState(a, goog.a11y.aria.State.ACTIVEDESCENDANT)
  11827. }
  11828. ;
  11829. goog.ui.Container.prototype.handleOpenItem = function (a) {
  11830. (a = a.target) && a != this.openItem_ && a.getParent() == this && (this.openItem_ && this.openItem_.setOpen(!1),
  11831. this.openItem_ = a)
  11832. }
  11833. ;
  11834. goog.ui.Container.prototype.handleCloseItem = function (a) {
  11835. a.target == this.openItem_ && (this.openItem_ = null);
  11836. var b = this.getElement()
  11837. , c = a.target.getElement();
  11838. b && a.target.isHighlighted() && c && goog.a11y.aria.setActiveDescendant(b, c)
  11839. }
  11840. ;
  11841. goog.ui.Container.prototype.handleMouseDown = function (a) {
  11842. this.enabled_ && this.setMouseButtonPressed(!0);
  11843. var b = this.getKeyEventTarget();
  11844. b && goog.dom.isFocusableTabIndex(b) ? b.focus() : a.preventDefault()
  11845. }
  11846. ;
  11847. goog.ui.Container.prototype.handleDocumentMouseUp = function (a) {
  11848. this.setMouseButtonPressed(!1)
  11849. }
  11850. ;
  11851. goog.ui.Container.prototype.handleChildMouseEvents = function (a) {
  11852. var b = goog.ui.ComponentUtil.getMouseEventType(this)
  11853. , c = this.getOwnerControl(a.target);
  11854. if (c)
  11855. switch (a.type) {
  11856. case b.MOUSEDOWN:
  11857. c.handleMouseDown(a);
  11858. break;
  11859. case b.MOUSEUP:
  11860. case b.MOUSECANCEL:
  11861. c.handleMouseUp(a);
  11862. break;
  11863. case goog.events.EventType.MOUSEOVER:
  11864. c.handleMouseOver(a);
  11865. break;
  11866. case goog.events.EventType.MOUSEOUT:
  11867. c.handleMouseOut(a);
  11868. break;
  11869. case goog.events.EventType.CONTEXTMENU:
  11870. c.handleContextMenu(a)
  11871. }
  11872. }
  11873. ;
  11874. goog.ui.Container.prototype.getOwnerControl = function (a) {
  11875. if (this.childElementIdMap_)
  11876. for (var b = this.getElement(); a && a !== b;) {
  11877. var c = a.id;
  11878. if (c in this.childElementIdMap_)
  11879. return this.childElementIdMap_[c];
  11880. a = a.parentNode
  11881. }
  11882. return null
  11883. }
  11884. ;
  11885. goog.ui.Container.prototype.handleFocus = function (a) { }
  11886. ;
  11887. goog.ui.Container.prototype.handleBlur = function (a) {
  11888. this.setHighlightedIndex(-1);
  11889. this.setMouseButtonPressed(!1);
  11890. this.openItem_ && this.openItem_.setOpen(!1)
  11891. }
  11892. ;
  11893. goog.ui.Container.prototype.handleKeyEvent = function (a) {
  11894. return this.isEnabled() && this.isVisible() && (0 != this.getChildCount() || this.keyEventTarget_) && this.handleKeyEventInternal(a) ? (a.preventDefault(),
  11895. a.stopPropagation(),
  11896. !0) : !1
  11897. }
  11898. ;
  11899. goog.ui.Container.prototype.handleKeyEventInternal = function (a) {
  11900. var b = this.getHighlighted();
  11901. if (b && "function" == typeof b.handleKeyEvent && b.handleKeyEvent(a) || this.openItem_ && this.openItem_ != b && "function" == typeof this.openItem_.handleKeyEvent && this.openItem_.handleKeyEvent(a))
  11902. return !0;
  11903. if (a.shiftKey || a.ctrlKey || a.metaKey || a.altKey)
  11904. return !1;
  11905. switch (a.keyCode) {
  11906. case goog.events.KeyCodes.ESC:
  11907. if (this.isFocusable())
  11908. this.getKeyEventTarget().blur();
  11909. else
  11910. return !1;
  11911. break;
  11912. case goog.events.KeyCodes.HOME:
  11913. this.highlightFirst();
  11914. break;
  11915. case goog.events.KeyCodes.END:
  11916. this.highlightLast();
  11917. break;
  11918. case goog.events.KeyCodes.UP:
  11919. if (this.orientation_ == goog.ui.Container.Orientation.VERTICAL)
  11920. this.highlightPrevious();
  11921. else
  11922. return !1;
  11923. break;
  11924. case goog.events.KeyCodes.LEFT:
  11925. if (this.orientation_ == goog.ui.Container.Orientation.HORIZONTAL)
  11926. this.isRightToLeft() ? this.highlightNext() : this.highlightPrevious();
  11927. else
  11928. return !1;
  11929. break;
  11930. case goog.events.KeyCodes.DOWN:
  11931. if (this.orientation_ == goog.ui.Container.Orientation.VERTICAL)
  11932. this.highlightNext();
  11933. else
  11934. return !1;
  11935. break;
  11936. case goog.events.KeyCodes.RIGHT:
  11937. if (this.orientation_ == goog.ui.Container.Orientation.HORIZONTAL)
  11938. this.isRightToLeft() ? this.highlightPrevious() : this.highlightNext();
  11939. else
  11940. return !1;
  11941. break;
  11942. default:
  11943. return !1
  11944. }
  11945. return !0
  11946. }
  11947. ;
  11948. goog.ui.Container.prototype.registerChildId_ = function (a) {
  11949. var b = a.getElement();
  11950. b = b.id || (b.id = a.getId());
  11951. this.childElementIdMap_ || (this.childElementIdMap_ = {});
  11952. this.childElementIdMap_[b] = a
  11953. }
  11954. ;
  11955. goog.ui.Container.prototype.addChild = function (a, b) {
  11956. goog.asserts.assertInstanceof(a, goog.ui.Control, "The child of a container must be a control");
  11957. goog.ui.Container.superClass_.addChild.call(this, a, b)
  11958. }
  11959. ;
  11960. goog.ui.Container.prototype.addChildAt = function (a, b, c) {
  11961. goog.asserts.assertInstanceof(a, goog.ui.Control);
  11962. a.setDispatchTransitionEvents(goog.ui.Component.State.HOVER, !0);
  11963. a.setDispatchTransitionEvents(goog.ui.Component.State.OPENED, !0);
  11964. !this.isFocusable() && this.isFocusableChildrenAllowed() || a.setSupportedState(goog.ui.Component.State.FOCUSED, !1);
  11965. a.setHandleMouseEvents(!1);
  11966. var d = a.getParent() == this ? this.indexOfChild(a) : -1;
  11967. goog.ui.Container.superClass_.addChildAt.call(this, a, b, c);
  11968. a.isInDocument() && this.isInDocument() && this.registerChildId_(a);
  11969. this.updateHighlightedIndex_(d, b)
  11970. }
  11971. ;
  11972. goog.ui.Container.prototype.updateHighlightedIndex_ = function (a, b) {
  11973. -1 == a && (a = this.getChildCount());
  11974. a == this.highlightedIndex_ ? this.highlightedIndex_ = Math.min(this.getChildCount() - 1, b) : a > this.highlightedIndex_ && b <= this.highlightedIndex_ ? this.highlightedIndex_++ : a < this.highlightedIndex_ && b > this.highlightedIndex_ && this.highlightedIndex_--
  11975. }
  11976. ;
  11977. goog.ui.Container.prototype.removeChild = function (a, b) {
  11978. a = "string" === typeof a ? this.getChild(a) : a;
  11979. goog.asserts.assertInstanceof(a, goog.ui.Control);
  11980. if (a) {
  11981. var c = this.indexOfChild(a);
  11982. -1 != c && (c == this.highlightedIndex_ ? (a.setHighlighted(!1),
  11983. this.highlightedIndex_ = -1) : c < this.highlightedIndex_ && this.highlightedIndex_--);
  11984. (c = a.getElement()) && c.id && this.childElementIdMap_ && goog.object.remove(this.childElementIdMap_, c.id)
  11985. }
  11986. a = goog.ui.Container.superClass_.removeChild.call(this, a, b);
  11987. a.setHandleMouseEvents(!0);
  11988. return a
  11989. }
  11990. ;
  11991. goog.ui.Container.prototype.getOrientation = function () {
  11992. return this.orientation_
  11993. }
  11994. ;
  11995. goog.ui.Container.prototype.setOrientation = function (a) {
  11996. if (this.getElement())
  11997. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  11998. this.orientation_ = a
  11999. }
  12000. ;
  12001. goog.ui.Container.prototype.isVisible = function () {
  12002. return this.visible_
  12003. }
  12004. ;
  12005. goog.ui.Container.prototype.setVisible = function (a, b) {
  12006. if (b || this.visible_ != a && this.dispatchEvent(a ? goog.ui.Component.EventType.SHOW : goog.ui.Component.EventType.HIDE)) {
  12007. this.visible_ = a;
  12008. var c = this.getElement();
  12009. c && (goog.style.setElementShown(c, a),
  12010. this.isFocusable() && this.renderer_.enableTabIndex(this.getKeyEventTarget(), this.enabled_ && this.visible_),
  12011. b || this.dispatchEvent(this.visible_ ? goog.ui.Container.EventType.AFTER_SHOW : goog.ui.Container.EventType.AFTER_HIDE));
  12012. return !0
  12013. }
  12014. return !1
  12015. }
  12016. ;
  12017. goog.ui.Container.prototype.isEnabled = function () {
  12018. return this.enabled_
  12019. }
  12020. ;
  12021. goog.ui.Container.prototype.setEnabled = function (a) {
  12022. this.enabled_ != a && this.dispatchEvent(a ? goog.ui.Component.EventType.ENABLE : goog.ui.Component.EventType.DISABLE) && (a ? (this.enabled_ = !0,
  12023. this.forEachChild(function (a) {
  12024. a.wasDisabled ? delete a.wasDisabled : a.setEnabled(!0)
  12025. })) : (this.forEachChild(function (a) {
  12026. a.isEnabled() ? a.setEnabled(!1) : a.wasDisabled = !0
  12027. }),
  12028. this.enabled_ = !1,
  12029. this.setMouseButtonPressed(!1)),
  12030. this.isFocusable() && this.renderer_.enableTabIndex(this.getKeyEventTarget(), a && this.visible_))
  12031. }
  12032. ;
  12033. goog.ui.Container.prototype.isFocusable = function () {
  12034. return this.focusable_
  12035. }
  12036. ;
  12037. goog.ui.Container.prototype.setFocusable = function (a) {
  12038. a != this.focusable_ && this.isInDocument() && this.enableFocusHandling_(a);
  12039. this.focusable_ = a;
  12040. this.enabled_ && this.visible_ && this.renderer_.enableTabIndex(this.getKeyEventTarget(), a)
  12041. }
  12042. ;
  12043. goog.ui.Container.prototype.isFocusableChildrenAllowed = function () {
  12044. return this.allowFocusableChildren_
  12045. }
  12046. ;
  12047. goog.ui.Container.prototype.setFocusableChildrenAllowed = function (a) {
  12048. this.allowFocusableChildren_ = a
  12049. }
  12050. ;
  12051. goog.ui.Container.prototype.isOpenFollowsHighlight = function () {
  12052. return this.openFollowsHighlight_
  12053. }
  12054. ;
  12055. goog.ui.Container.prototype.setOpenFollowsHighlight = function (a) {
  12056. this.openFollowsHighlight_ = a
  12057. }
  12058. ;
  12059. goog.ui.Container.prototype.getHighlightedIndex = function () {
  12060. return this.highlightedIndex_
  12061. }
  12062. ;
  12063. goog.ui.Container.prototype.setHighlightedIndex = function (a) {
  12064. (a = this.getChildAt(a)) ? a.setHighlighted(!0) : -1 < this.highlightedIndex_ && this.getHighlighted().setHighlighted(!1)
  12065. }
  12066. ;
  12067. goog.ui.Container.prototype.setHighlighted = function (a) {
  12068. this.setHighlightedIndex(this.indexOfChild(a))
  12069. }
  12070. ;
  12071. goog.ui.Container.prototype.getHighlighted = function () {
  12072. return this.getChildAt(this.highlightedIndex_)
  12073. }
  12074. ;
  12075. goog.ui.Container.prototype.highlightFirst = function () {
  12076. this.highlightHelper(function (a, b) {
  12077. return (a + 1) % b
  12078. }, this.getChildCount() - 1)
  12079. }
  12080. ;
  12081. goog.ui.Container.prototype.highlightLast = function () {
  12082. this.highlightHelper(function (a, b) {
  12083. a--;
  12084. return 0 > a ? b - 1 : a
  12085. }, 0)
  12086. }
  12087. ;
  12088. goog.ui.Container.prototype.highlightNext = function () {
  12089. this.highlightHelper(function (a, b) {
  12090. return (a + 1) % b
  12091. }, this.highlightedIndex_)
  12092. }
  12093. ;
  12094. goog.ui.Container.prototype.highlightPrevious = function () {
  12095. this.highlightHelper(function (a, b) {
  12096. a--;
  12097. return 0 > a ? b - 1 : a
  12098. }, this.highlightedIndex_)
  12099. }
  12100. ;
  12101. goog.ui.Container.prototype.highlightHelper = function (a, b) {
  12102. var c = 0 > b ? this.indexOfChild(this.openItem_) : b
  12103. , d = this.getChildCount();
  12104. c = a.call(this, c, d);
  12105. for (var e = 0; e <= d;) {
  12106. var f = this.getChildAt(c);
  12107. if (f && this.canHighlightItem(f))
  12108. return this.setHighlightedIndexFromKeyEvent(c),
  12109. !0;
  12110. e++;
  12111. c = a.call(this, c, d)
  12112. }
  12113. return !1
  12114. }
  12115. ;
  12116. goog.ui.Container.prototype.canHighlightItem = function (a) {
  12117. return a.isVisible() && a.isEnabled() && a.isSupportedState(goog.ui.Component.State.HOVER)
  12118. }
  12119. ;
  12120. goog.ui.Container.prototype.setHighlightedIndexFromKeyEvent = function (a) {
  12121. this.setHighlightedIndex(a)
  12122. }
  12123. ;
  12124. goog.ui.Container.prototype.getOpenItem = function () {
  12125. return this.openItem_
  12126. }
  12127. ;
  12128. goog.ui.Container.prototype.isMouseButtonPressed = function () {
  12129. return this.mouseButtonPressed_
  12130. }
  12131. ;
  12132. goog.ui.Container.prototype.setMouseButtonPressed = function (a) {
  12133. this.mouseButtonPressed_ = a
  12134. }
  12135. ;
  12136. goog.ui.MenuHeaderRenderer = function () {
  12137. goog.ui.ControlRenderer.call(this)
  12138. }
  12139. ;
  12140. goog.inherits(goog.ui.MenuHeaderRenderer, goog.ui.ControlRenderer);
  12141. goog.addSingletonGetter(goog.ui.MenuHeaderRenderer);
  12142. goog.ui.MenuHeaderRenderer.CSS_CLASS = "goog-menuheader";
  12143. goog.ui.MenuHeaderRenderer.prototype.getCssClass = function () {
  12144. return goog.ui.MenuHeaderRenderer.CSS_CLASS
  12145. }
  12146. ;
  12147. goog.ui.MenuHeader = function (a, b, c) {
  12148. goog.ui.Control.call(this, a, c || goog.ui.MenuHeaderRenderer.getInstance(), b);
  12149. this.setSupportedState(goog.ui.Component.State.DISABLED, !1);
  12150. this.setSupportedState(goog.ui.Component.State.HOVER, !1);
  12151. this.setSupportedState(goog.ui.Component.State.ACTIVE, !1);
  12152. this.setSupportedState(goog.ui.Component.State.FOCUSED, !1);
  12153. this.setStateInternal(goog.ui.Component.State.DISABLED)
  12154. }
  12155. ;
  12156. goog.inherits(goog.ui.MenuHeader, goog.ui.Control);
  12157. goog.ui.registry.setDecoratorByClassName(goog.ui.MenuHeaderRenderer.CSS_CLASS, function () {
  12158. return new goog.ui.MenuHeader(null)
  12159. });
  12160. goog.ui.MenuItemRenderer = function () {
  12161. goog.ui.ControlRenderer.call(this);
  12162. this.classNameCache_ = []
  12163. }
  12164. ;
  12165. goog.inherits(goog.ui.MenuItemRenderer, goog.ui.ControlRenderer);
  12166. goog.addSingletonGetter(goog.ui.MenuItemRenderer);
  12167. goog.ui.MenuItemRenderer.CSS_CLASS = "goog-menuitem";
  12168. goog.ui.MenuItemRenderer.CompositeCssClassIndex_ = {
  12169. HOVER: 0,
  12170. CHECKBOX: 1,
  12171. CONTENT: 2
  12172. };
  12173. goog.ui.MenuItemRenderer.prototype.allowTextSelection_ = true;
  12174. goog.ui.MenuItemRenderer.prototype.getCompositeCssClass_ = function (a) {
  12175. var b = this.classNameCache_[a];
  12176. if (!b) {
  12177. switch (a) {
  12178. case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER:
  12179. b = this.getStructuralCssClass() + "-highlight";
  12180. break;
  12181. case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX:
  12182. b = this.getStructuralCssClass() + "-checkbox";
  12183. break;
  12184. case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT:
  12185. b = this.getStructuralCssClass() + "-content"
  12186. }
  12187. this.classNameCache_[a] = b
  12188. }
  12189. return b
  12190. }
  12191. ;
  12192. goog.ui.MenuItemRenderer.prototype.getAriaRole = function () {
  12193. return goog.a11y.aria.Role.MENU_ITEM
  12194. }
  12195. ;
  12196. goog.ui.MenuItemRenderer.prototype.createDom = function (a) {
  12197. var b = a.getDomHelper().createDom("DIV", this.getClassNames(a).join(" "), this.createContent(a.getContent(), a.getDomHelper()));
  12198. this.setEnableCheckBoxStructure(a, b, a.isSupportedState(goog.ui.Component.State.SELECTED) || a.isSupportedState(goog.ui.Component.State.CHECKED));
  12199. return b
  12200. }
  12201. ;
  12202. goog.ui.MenuItemRenderer.prototype.getContentElement = function (a) {
  12203. return a && a.firstChild
  12204. }
  12205. ;
  12206. goog.ui.MenuItemRenderer.prototype.decorate = function (a, b) {
  12207. goog.asserts.assert(b);
  12208. this.hasContentStructure(b) || b.appendChild(this.createContent(b.childNodes, a.getDomHelper()));
  12209. goog.dom.classlist.contains(b, "goog-option") && (a.setCheckable(!0),
  12210. this.setCheckable(a, b, !0));
  12211. return goog.ui.MenuItemRenderer.superClass_.decorate.call(this, a, b)
  12212. }
  12213. ;
  12214. goog.ui.MenuItemRenderer.prototype.setContent = function (a, b) {
  12215. var c = this.getContentElement(a)
  12216. , d = this.hasCheckBoxStructure(a) ? c.firstChild : null;
  12217. goog.ui.MenuItemRenderer.superClass_.setContent.call(this, a, b);
  12218. d && !this.hasCheckBoxStructure(a) && c.insertBefore(d, c.firstChild || null)
  12219. }
  12220. ;
  12221. goog.ui.MenuItemRenderer.prototype.hasContentStructure = function (a) {
  12222. a = goog.dom.getFirstElementChild(a);
  12223. var b = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT);
  12224. return !!a && goog.dom.classlist.contains(a, b)
  12225. }
  12226. ;
  12227. goog.ui.MenuItemRenderer.prototype.createContent = function (a, b) {
  12228. var c = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT);
  12229. return b.createDom("DIV", c, a)
  12230. }
  12231. ;
  12232. goog.ui.MenuItemRenderer.prototype.setSelectable = function (a, b, c) {
  12233. a && b && this.setEnableCheckBoxStructure(a, b, c)
  12234. }
  12235. ;
  12236. goog.ui.MenuItemRenderer.prototype.setCheckable = function (a, b, c) {
  12237. a && b && this.setEnableCheckBoxStructure(a, b, c)
  12238. }
  12239. ;
  12240. goog.ui.MenuItemRenderer.prototype.hasCheckBoxStructure = function (a) {
  12241. if (a = this.getContentElement(a)) {
  12242. a = a.firstChild;
  12243. var b = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX);
  12244. return !!a && goog.dom.isElement(a) && goog.dom.classlist.contains(a, b)
  12245. }
  12246. return !1
  12247. }
  12248. ;
  12249. goog.ui.MenuItemRenderer.prototype.setEnableCheckBoxStructure = function (a, b, c) {
  12250. this.setAriaRole(b, a.getPreferredAriaRole());
  12251. this.setAriaStates(a, b);
  12252. c != this.hasCheckBoxStructure(b) && (goog.dom.classlist.enable(b, "goog-option", c),
  12253. b = this.getContentElement(b),
  12254. c ? (c = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX),
  12255. b.insertBefore(a.getDomHelper().createDom("DIV", c), b.firstChild || null)) : b.removeChild(b.firstChild))
  12256. }
  12257. ;
  12258. goog.ui.MenuItemRenderer.prototype.getClassForState = function (a) {
  12259. switch (a) {
  12260. case goog.ui.Component.State.HOVER:
  12261. return this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER);
  12262. case goog.ui.Component.State.CHECKED:
  12263. case goog.ui.Component.State.SELECTED:
  12264. return "goog-option-selected";
  12265. default:
  12266. return goog.ui.MenuItemRenderer.superClass_.getClassForState.call(this, a)
  12267. }
  12268. }
  12269. ;
  12270. goog.ui.MenuItemRenderer.prototype.getStateFromClass = function (a) {
  12271. var b = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER);
  12272. switch (a) {
  12273. case "goog-option-selected":
  12274. return goog.ui.Component.State.CHECKED;
  12275. case b:
  12276. return goog.ui.Component.State.HOVER;
  12277. default:
  12278. return goog.ui.MenuItemRenderer.superClass_.getStateFromClass.call(this, a)
  12279. }
  12280. }
  12281. ;
  12282. goog.ui.MenuItemRenderer.prototype.getCssClass = function () {
  12283. return goog.ui.MenuItemRenderer.CSS_CLASS
  12284. }
  12285. ;
  12286. goog.ui.MenuItem = function (a, b, c, d) {
  12287. goog.ui.Control.call(this, a, d || goog.ui.MenuItemRenderer.getInstance(), c);
  12288. this.setValue(b)
  12289. }
  12290. ;
  12291. goog.inherits(goog.ui.MenuItem, goog.ui.Control);
  12292. goog.tagUnsealableClass(goog.ui.MenuItem);
  12293. goog.ui.MenuItem.MNEMONIC_WRAPPER_CLASS_ = "goog-menuitem-mnemonic-separator";
  12294. goog.ui.MenuItem.ACCELERATOR_CLASS = "goog-menuitem-accel";
  12295. goog.ui.MenuItem.prototype.allowTextSelection_ = true;
  12296. goog.ui.MenuItem.prototype.getValue = function () {
  12297. var a = this.getModel();
  12298. return null != a ? a : this.getCaption()
  12299. }
  12300. ;
  12301. goog.ui.MenuItem.prototype.setValue = function (a) {
  12302. this.setModel(a)
  12303. }
  12304. ;
  12305. goog.ui.MenuItem.prototype.setSupportedState = function (a, b) {
  12306. goog.ui.MenuItem.superClass_.setSupportedState.call(this, a, b);
  12307. switch (a) {
  12308. case goog.ui.Component.State.SELECTED:
  12309. this.setSelectableInternal_(b);
  12310. break;
  12311. case goog.ui.Component.State.CHECKED:
  12312. this.setCheckableInternal_(b)
  12313. }
  12314. }
  12315. ;
  12316. goog.ui.MenuItem.prototype.setSelectable = function (a) {
  12317. this.setSupportedState(goog.ui.Component.State.SELECTED, a)
  12318. }
  12319. ;
  12320. goog.ui.MenuItem.prototype.setSelectableInternal_ = function (a) {
  12321. this.isChecked() && !a && this.setChecked(!1);
  12322. var b = this.getElement();
  12323. b && this.getRenderer().setSelectable(this, b, a)
  12324. }
  12325. ;
  12326. goog.ui.MenuItem.prototype.setCheckable = function (a) {
  12327. this.setSupportedState(goog.ui.Component.State.CHECKED, a)
  12328. }
  12329. ;
  12330. goog.ui.MenuItem.prototype.setCheckableInternal_ = function (a) {
  12331. var b = this.getElement();
  12332. b && this.getRenderer().setCheckable(this, b, a)
  12333. }
  12334. ;
  12335. goog.ui.MenuItem.prototype.getCaption = function () {
  12336. var a = this.getContent();
  12337. if (goog.isArray(a)) {
  12338. var b = goog.ui.MenuItem.ACCELERATOR_CLASS
  12339. , c = goog.ui.MenuItem.MNEMONIC_WRAPPER_CLASS_;
  12340. a = goog.array.map(a, function (a) {
  12341. return goog.dom.isElement(a) && (goog.dom.classlist.contains(a, b) || goog.dom.classlist.contains(a, c)) ? "" : goog.dom.getRawTextContent(a)
  12342. }).join("");
  12343. return goog.string.collapseBreakingSpaces(a)
  12344. }
  12345. return goog.ui.MenuItem.superClass_.getCaption.call(this)
  12346. }
  12347. ;
  12348. goog.ui.MenuItem.prototype.getAccelerator = function () {
  12349. var a = this.getDomHelper()
  12350. , b = this.getContent();
  12351. return goog.isArray(b) && (b = goog.array.find(b, function (a) {
  12352. return goog.dom.classlist.contains(a, goog.ui.MenuItem.ACCELERATOR_CLASS)
  12353. })) ? a.getTextContent(b) : null
  12354. }
  12355. ;
  12356. goog.ui.MenuItem.prototype.handleMouseUp = function (a) {
  12357. var b = this.getParent();
  12358. if (b) {
  12359. var c = b.openingCoords;
  12360. b.openingCoords = null;
  12361. if (c && "number" === typeof a.clientX && (b = new goog.math.Coordinate(a.clientX, a.clientY),
  12362. goog.math.Coordinate.equals(c, b)))
  12363. return
  12364. }
  12365. goog.ui.MenuItem.superClass_.handleMouseUp.call(this, a)
  12366. }
  12367. ;
  12368. goog.ui.MenuItem.prototype.handleKeyEventInternal = function (a) {
  12369. return a.keyCode == this.getMnemonic() && this.performActionInternal(a) ? !0 : goog.ui.MenuItem.superClass_.handleKeyEventInternal.call(this, a)
  12370. }
  12371. ;
  12372. goog.ui.MenuItem.prototype.setMnemonic = function (a) {
  12373. this.mnemonicKey_ = a
  12374. }
  12375. ;
  12376. goog.ui.MenuItem.prototype.getMnemonic = function () {
  12377. return this.mnemonicKey_
  12378. }
  12379. ;
  12380. goog.ui.registry.setDecoratorByClassName(goog.ui.MenuItemRenderer.CSS_CLASS, function () {
  12381. return new goog.ui.MenuItem(null)
  12382. });
  12383. goog.ui.MenuItem.prototype.getPreferredAriaRole = function () {
  12384. return this.isSupportedState(goog.ui.Component.State.CHECKED) ? goog.a11y.aria.Role.MENU_ITEM_CHECKBOX : this.isSupportedState(goog.ui.Component.State.SELECTED) ? goog.a11y.aria.Role.MENU_ITEM_RADIO : goog.ui.MenuItem.superClass_.getPreferredAriaRole.call(this)
  12385. }
  12386. ;
  12387. goog.ui.MenuItem.prototype.getParent = function () {
  12388. return goog.ui.Control.prototype.getParent.call(this)
  12389. }
  12390. ;
  12391. goog.ui.MenuItem.prototype.getParentEventTarget = function () {
  12392. return goog.ui.Control.prototype.getParentEventTarget.call(this)
  12393. }
  12394. ;
  12395. goog.ui.MenuSeparatorRenderer = function () {
  12396. goog.ui.ControlRenderer.call(this)
  12397. }
  12398. ;
  12399. goog.inherits(goog.ui.MenuSeparatorRenderer, goog.ui.ControlRenderer);
  12400. goog.addSingletonGetter(goog.ui.MenuSeparatorRenderer);
  12401. goog.ui.MenuSeparatorRenderer.CSS_CLASS = "goog-menuseparator";
  12402. goog.ui.MenuSeparatorRenderer.prototype.createDom = function (a) {
  12403. return a.getDomHelper().createDom("DIV", this.getCssClass())
  12404. }
  12405. ;
  12406. goog.ui.MenuSeparatorRenderer.prototype.decorate = function (a, b) {
  12407. b.id && a.setId(b.id);
  12408. if ("HR" == b.tagName) {
  12409. var c = b;
  12410. b = this.createDom(a);
  12411. goog.dom.insertSiblingBefore(b, c);
  12412. goog.dom.removeNode(c)
  12413. } else
  12414. goog.dom.classlist.add(b, this.getCssClass());
  12415. return b
  12416. }
  12417. ;
  12418. goog.ui.MenuSeparatorRenderer.prototype.setContent = function (a, b) { }
  12419. ;
  12420. goog.ui.MenuSeparatorRenderer.prototype.getCssClass = function () {
  12421. return goog.ui.MenuSeparatorRenderer.CSS_CLASS
  12422. }
  12423. ;
  12424. goog.ui.Separator = function (a, b) {
  12425. goog.ui.Control.call(this, null, a || goog.ui.MenuSeparatorRenderer.getInstance(), b);
  12426. this.setSupportedState(goog.ui.Component.State.DISABLED, !1);
  12427. this.setSupportedState(goog.ui.Component.State.HOVER, !1);
  12428. this.setSupportedState(goog.ui.Component.State.ACTIVE, !1);
  12429. this.setSupportedState(goog.ui.Component.State.FOCUSED, !1);
  12430. this.setStateInternal(goog.ui.Component.State.DISABLED)
  12431. }
  12432. ;
  12433. goog.inherits(goog.ui.Separator, goog.ui.Control);
  12434. goog.ui.Separator.prototype.enterDocument = function () {
  12435. goog.ui.Separator.superClass_.enterDocument.call(this);
  12436. var a = this.getElement();
  12437. goog.asserts.assert(a, "The DOM element for the separator cannot be null.");
  12438. goog.a11y.aria.setRole(a, "separator")
  12439. }
  12440. ;
  12441. goog.ui.registry.setDecoratorByClassName(goog.ui.MenuSeparatorRenderer.CSS_CLASS, function () {
  12442. return new goog.ui.Separator
  12443. });
  12444. goog.ui.MenuRenderer = function (a) {
  12445. goog.ui.ContainerRenderer.call(this, a || goog.a11y.aria.Role.MENU)
  12446. }
  12447. ;
  12448. goog.inherits(goog.ui.MenuRenderer, goog.ui.ContainerRenderer);
  12449. goog.addSingletonGetter(goog.ui.MenuRenderer);
  12450. goog.ui.MenuRenderer.CSS_CLASS = "goog-menu";
  12451. goog.ui.MenuRenderer.prototype.canDecorate = function (a) {
  12452. return "UL" == a.tagName || goog.ui.MenuRenderer.superClass_.canDecorate.call(this, a)
  12453. }
  12454. ;
  12455. goog.ui.MenuRenderer.prototype.getDecoratorForChild = function (a) {
  12456. return "HR" == a.tagName ? new goog.ui.Separator : goog.ui.MenuRenderer.superClass_.getDecoratorForChild.call(this, a)
  12457. }
  12458. ;
  12459. goog.ui.MenuRenderer.prototype.containsElement = function (a, b) {
  12460. return goog.dom.contains(a.getElement(), b)
  12461. }
  12462. ;
  12463. goog.ui.MenuRenderer.prototype.getCssClass = function () {
  12464. return goog.ui.MenuRenderer.CSS_CLASS
  12465. }
  12466. ;
  12467. goog.ui.MenuRenderer.prototype.initializeDom = function (a) {
  12468. goog.ui.MenuRenderer.superClass_.initializeDom.call(this, a);
  12469. a = a.getElement();
  12470. goog.asserts.assert(a, "The menu DOM element cannot be null.");
  12471. goog.a11y.aria.setState(a, goog.a11y.aria.State.HASPOPUP, "true")
  12472. }
  12473. ;
  12474. goog.ui.MenuSeparator = function (a) {
  12475. goog.ui.Separator.call(this, goog.ui.MenuSeparatorRenderer.getInstance(), a)
  12476. }
  12477. ;
  12478. goog.inherits(goog.ui.MenuSeparator, goog.ui.Separator);
  12479. goog.ui.registry.setDecoratorByClassName(goog.ui.MenuSeparatorRenderer.CSS_CLASS, function () {
  12480. return new goog.ui.Separator
  12481. });
  12482. goog.ui.Menu = function (a, b) {
  12483. goog.ui.Container.call(this, goog.ui.Container.Orientation.VERTICAL, b || goog.ui.MenuRenderer.getInstance(), a);
  12484. this.setFocusable(!1)
  12485. }
  12486. ;
  12487. goog.inherits(goog.ui.Menu, goog.ui.Container);
  12488. goog.tagUnsealableClass(goog.ui.Menu);
  12489. goog.ui.Menu.EventType = {
  12490. BEFORE_SHOW: goog.ui.Component.EventType.BEFORE_SHOW,
  12491. SHOW: goog.ui.Component.EventType.SHOW,
  12492. BEFORE_HIDE: goog.ui.Component.EventType.HIDE,
  12493. HIDE: goog.ui.Component.EventType.HIDE
  12494. };
  12495. goog.ui.Menu.CSS_CLASS = goog.ui.MenuRenderer.CSS_CLASS;
  12496. goog.ui.Menu.prototype.allowAutoFocus_ = !0;
  12497. goog.ui.Menu.prototype.allowHighlightDisabled_ = !1;
  12498. goog.ui.Menu.prototype.getCssClass = function () {
  12499. return this.getRenderer().getCssClass()
  12500. }
  12501. ;
  12502. goog.ui.Menu.prototype.containsElement = function (a) {
  12503. if (this.getRenderer().containsElement(this, a))
  12504. return !0;
  12505. for (var b = 0, c = this.getChildCount(); b < c; b++) {
  12506. var d = this.getChildAt(b);
  12507. if ("function" == typeof d.containsElement && d.containsElement(a))
  12508. return !0
  12509. }
  12510. return !1
  12511. }
  12512. ;
  12513. goog.ui.Menu.prototype.addItem = function (a) {
  12514. this.addChild(a, !0)
  12515. }
  12516. ;
  12517. goog.ui.Menu.prototype.addItemAt = function (a, b) {
  12518. this.addChildAt(a, b, !0)
  12519. }
  12520. ;
  12521. goog.ui.Menu.prototype.removeItem = function (a) {
  12522. (a = this.removeChild(a, !0)) && a.dispose()
  12523. }
  12524. ;
  12525. goog.ui.Menu.prototype.removeItemAt = function (a) {
  12526. (a = this.removeChildAt(a, !0)) && a.dispose()
  12527. }
  12528. ;
  12529. goog.ui.Menu.prototype.getItemAt = function (a) {
  12530. return this.getChildAt(a)
  12531. }
  12532. ;
  12533. goog.ui.Menu.prototype.getItemCount = function () {
  12534. return this.getChildCount()
  12535. }
  12536. ;
  12537. goog.ui.Menu.prototype.getItems = function () {
  12538. var a = [];
  12539. this.forEachChild(function (b) {
  12540. a.push(b)
  12541. });
  12542. return a
  12543. }
  12544. ;
  12545. goog.ui.Menu.prototype.setPosition = function (a, b) {
  12546. var c = this.isVisible();
  12547. c || goog.style.setElementShown(this.getElement(), !0);
  12548. goog.style.setPageOffset(this.getElement(), a, b);
  12549. c || goog.style.setElementShown(this.getElement(), !1)
  12550. }
  12551. ;
  12552. goog.ui.Menu.prototype.getPosition = function () {
  12553. return this.isVisible() ? goog.style.getPageOffset(this.getElement()) : null
  12554. }
  12555. ;
  12556. goog.ui.Menu.prototype.setAllowAutoFocus = function (a) {
  12557. (this.allowAutoFocus_ = a) && this.setFocusable(!0)
  12558. }
  12559. ;
  12560. goog.ui.Menu.prototype.getAllowAutoFocus = function () {
  12561. return this.allowAutoFocus_
  12562. }
  12563. ;
  12564. goog.ui.Menu.prototype.setAllowHighlightDisabled = function (a) {
  12565. this.allowHighlightDisabled_ = a
  12566. }
  12567. ;
  12568. goog.ui.Menu.prototype.getAllowHighlightDisabled = function () {
  12569. return this.allowHighlightDisabled_
  12570. }
  12571. ;
  12572. goog.ui.Menu.prototype.setVisible = function (a, b, c) {
  12573. (b = goog.ui.Menu.superClass_.setVisible.call(this, a, b)) && a && this.isInDocument() && this.allowAutoFocus_ && this.getKeyEventTarget().focus();
  12574. this.openingCoords = a && c && "number" === typeof c.clientX ? new goog.math.Coordinate(c.clientX, c.clientY) : null;
  12575. return b
  12576. }
  12577. ;
  12578. goog.ui.Menu.prototype.handleEnterItem = function (a) {
  12579. this.allowAutoFocus_ && this.getKeyEventTarget().focus();
  12580. return goog.ui.Menu.superClass_.handleEnterItem.call(this, a)
  12581. }
  12582. ;
  12583. goog.ui.Menu.prototype.highlightNextPrefix = function (a) {
  12584. var b = new RegExp("^" + goog.string.regExpEscape(a), "i");
  12585. return this.highlightHelper(function (a, d) {
  12586. var c = 0 > a ? 0 : a
  12587. , f = !1;
  12588. do {
  12589. ++a;
  12590. a == d && (a = 0,
  12591. f = !0);
  12592. var g = this.getChildAt(a).getCaption();
  12593. if (g && g.match(b))
  12594. return a
  12595. } while (!f || a != c); return this.getHighlightedIndex()
  12596. }, this.getHighlightedIndex())
  12597. }
  12598. ;
  12599. goog.ui.Menu.prototype.canHighlightItem = function (a) {
  12600. return (this.allowHighlightDisabled_ || a.isEnabled()) && a.isVisible() && a.isSupportedState(goog.ui.Component.State.HOVER)
  12601. }
  12602. ;
  12603. goog.ui.Menu.prototype.decorateInternal = function (a) {
  12604. this.decorateContent(a);
  12605. goog.ui.Menu.superClass_.decorateInternal.call(this, a)
  12606. }
  12607. ;
  12608. goog.ui.Menu.prototype.handleKeyEventInternal = function (a) {
  12609. var b = goog.ui.Menu.superClass_.handleKeyEventInternal.call(this, a);
  12610. b || this.forEachChild(function (c) {
  12611. !b && c.getMnemonic && c.getMnemonic() == a.keyCode && (this.isEnabled() && this.setHighlighted(c),
  12612. b = c.handleKeyEvent(a))
  12613. }, this);
  12614. return b
  12615. }
  12616. ;
  12617. goog.ui.Menu.prototype.setHighlightedIndex = function (a) {
  12618. goog.ui.Menu.superClass_.setHighlightedIndex.call(this, a);
  12619. (a = this.getChildAt(a)) && goog.style.scrollIntoContainerView(a.getElement(), this.getElement())
  12620. }
  12621. ;
  12622. goog.ui.Menu.prototype.decorateContent = function (a) {
  12623. var b = this.getRenderer();
  12624. a = this.getDomHelper().getElementsByTagNameAndClass("DIV", b.getCssClass() + "-content", a);
  12625. for (var c = a.length, d = 0; d < c; d++)
  12626. b.decorateChildren(this, a[d])
  12627. }
  12628. ;
  12629. goog.iter = {};
  12630. goog.iter.StopIteration = "StopIteration" in goog.global ? goog.global.StopIteration : {
  12631. message: "StopIteration",
  12632. stack: ""
  12633. };
  12634. goog.iter.Iterator = function () { }
  12635. ;
  12636. goog.iter.Iterator.prototype.next = function () {
  12637. throw goog.iter.StopIteration;
  12638. }
  12639. ;
  12640. goog.iter.Iterator.prototype.__iterator__ = function (a) {
  12641. return this
  12642. }
  12643. ;
  12644. goog.iter.toIterator = function (a) {
  12645. if (a instanceof goog.iter.Iterator)
  12646. return a;
  12647. if ("function" == typeof a.__iterator__)
  12648. return a.__iterator__(!1);
  12649. if (goog.isArrayLike(a)) {
  12650. var b = 0
  12651. , c = new goog.iter.Iterator;
  12652. c.next = function () {
  12653. for (; ;) {
  12654. if (b >= a.length)
  12655. throw goog.iter.StopIteration;
  12656. if (b in a)
  12657. return a[b++];
  12658. b++
  12659. }
  12660. }
  12661. ;
  12662. return c
  12663. }
  12664. throw Error("Not implemented");
  12665. }
  12666. ;
  12667. goog.iter.forEach = function (a, b, c) {
  12668. if (goog.isArrayLike(a))
  12669. try {
  12670. goog.array.forEach(a, b, c)
  12671. } catch (d) {
  12672. if (d !== goog.iter.StopIteration)
  12673. throw d;
  12674. }
  12675. else {
  12676. a = goog.iter.toIterator(a);
  12677. try {
  12678. for (; ;)
  12679. b.call(c, a.next(), void 0, a)
  12680. } catch (d) {
  12681. if (d !== goog.iter.StopIteration)
  12682. throw d;
  12683. }
  12684. }
  12685. }
  12686. ;
  12687. goog.iter.filter = function (a, b, c) {
  12688. var d = goog.iter.toIterator(a);
  12689. a = new goog.iter.Iterator;
  12690. a.next = function () {
  12691. for (; ;) {
  12692. var a = d.next();
  12693. if (b.call(c, a, void 0, d))
  12694. return a
  12695. }
  12696. }
  12697. ;
  12698. return a
  12699. }
  12700. ;
  12701. goog.iter.filterFalse = function (a, b, c) {
  12702. return goog.iter.filter(a, goog.functions.not(b), c)
  12703. }
  12704. ;
  12705. goog.iter.range = function (a, b, c) {
  12706. var d = 0
  12707. , e = a
  12708. , f = c || 1;
  12709. 1 < arguments.length && (d = a,
  12710. e = +b);
  12711. if (0 == f)
  12712. throw Error("Range step argument must not be zero");
  12713. var g = new goog.iter.Iterator;
  12714. g.next = function () {
  12715. if (0 < f && d >= e || 0 > f && d <= e)
  12716. throw goog.iter.StopIteration;
  12717. var a = d;
  12718. d += f;
  12719. return a
  12720. }
  12721. ;
  12722. return g
  12723. }
  12724. ;
  12725. goog.iter.join = function (a, b) {
  12726. return goog.iter.toArray(a).join(b)
  12727. }
  12728. ;
  12729. goog.iter.map = function (a, b, c) {
  12730. var d = goog.iter.toIterator(a);
  12731. a = new goog.iter.Iterator;
  12732. a.next = function () {
  12733. var a = d.next();
  12734. return b.call(c, a, void 0, d)
  12735. }
  12736. ;
  12737. return a
  12738. }
  12739. ;
  12740. goog.iter.reduce = function (a, b, c, d) {
  12741. var e = c;
  12742. goog.iter.forEach(a, function (a) {
  12743. e = b.call(d, e, a)
  12744. });
  12745. return e
  12746. }
  12747. ;
  12748. goog.iter.some = function (a, b, c) {
  12749. a = goog.iter.toIterator(a);
  12750. try {
  12751. for (; ;)
  12752. if (b.call(c, a.next(), void 0, a))
  12753. return !0
  12754. } catch (d) {
  12755. if (d !== goog.iter.StopIteration)
  12756. throw d;
  12757. }
  12758. return !1
  12759. }
  12760. ;
  12761. goog.iter.every = function (a, b, c) {
  12762. a = goog.iter.toIterator(a);
  12763. try {
  12764. for (; ;)
  12765. if (!b.call(c, a.next(), void 0, a))
  12766. return !1
  12767. } catch (d) {
  12768. if (d !== goog.iter.StopIteration)
  12769. throw d;
  12770. }
  12771. return !0
  12772. }
  12773. ;
  12774. goog.iter.chain = function (a) {
  12775. return goog.iter.chainFromIterable(arguments)
  12776. }
  12777. ;
  12778. goog.iter.chainFromIterable = function (a) {
  12779. var b = goog.iter.toIterator(a);
  12780. a = new goog.iter.Iterator;
  12781. var c = null;
  12782. a.next = function () {
  12783. for (; ;) {
  12784. if (null == c) {
  12785. var a = b.next();
  12786. c = goog.iter.toIterator(a)
  12787. }
  12788. try {
  12789. return c.next()
  12790. } catch (e) {
  12791. if (e !== goog.iter.StopIteration)
  12792. throw e;
  12793. c = null
  12794. }
  12795. }
  12796. }
  12797. ;
  12798. return a
  12799. }
  12800. ;
  12801. goog.iter.dropWhile = function (a, b, c) {
  12802. var d = goog.iter.toIterator(a);
  12803. a = new goog.iter.Iterator;
  12804. var e = !0;
  12805. a.next = function () {
  12806. for (; ;) {
  12807. var a = d.next();
  12808. if (!e || !b.call(c, a, void 0, d))
  12809. return e = !1,
  12810. a
  12811. }
  12812. }
  12813. ;
  12814. return a
  12815. }
  12816. ;
  12817. goog.iter.takeWhile = function (a, b, c) {
  12818. var d = goog.iter.toIterator(a);
  12819. a = new goog.iter.Iterator;
  12820. a.next = function () {
  12821. var a = d.next();
  12822. if (b.call(c, a, void 0, d))
  12823. return a;
  12824. throw goog.iter.StopIteration;
  12825. }
  12826. ;
  12827. return a
  12828. }
  12829. ;
  12830. goog.iter.toArray = function (a) {
  12831. if (goog.isArrayLike(a))
  12832. return goog.array.toArray(a);
  12833. a = goog.iter.toIterator(a);
  12834. var b = [];
  12835. goog.iter.forEach(a, function (a) {
  12836. b.push(a)
  12837. });
  12838. return b
  12839. }
  12840. ;
  12841. goog.iter.equals = function (a, b, c) {
  12842. a = goog.iter.zipLongest({}, a, b);
  12843. var d = c || goog.array.defaultCompareEquality;
  12844. return goog.iter.every(a, function (a) {
  12845. return d(a[0], a[1])
  12846. })
  12847. }
  12848. ;
  12849. goog.iter.nextOrValue = function (a, b) {
  12850. try {
  12851. return goog.iter.toIterator(a).next()
  12852. } catch (c) {
  12853. if (c != goog.iter.StopIteration)
  12854. throw c;
  12855. return b
  12856. }
  12857. }
  12858. ;
  12859. goog.iter.product = function (a) {
  12860. if (goog.array.some(arguments, function (a) {
  12861. return !a.length
  12862. }) || !arguments.length)
  12863. return new goog.iter.Iterator;
  12864. var b = new goog.iter.Iterator
  12865. , c = arguments
  12866. , d = goog.array.repeat(0, c.length);
  12867. b.next = function () {
  12868. if (d) {
  12869. for (var a = goog.array.map(d, function (a, b) {
  12870. return c[b][a]
  12871. }), b = d.length - 1; 0 <= b; b--) {
  12872. goog.asserts.assert(d);
  12873. if (d[b] < c[b].length - 1) {
  12874. d[b]++;
  12875. break
  12876. }
  12877. if (0 == b) {
  12878. d = null;
  12879. break
  12880. }
  12881. d[b] = 0
  12882. }
  12883. return a
  12884. }
  12885. throw goog.iter.StopIteration;
  12886. }
  12887. ;
  12888. return b
  12889. }
  12890. ;
  12891. goog.iter.cycle = function (a) {
  12892. var b = goog.iter.toIterator(a)
  12893. , c = []
  12894. , d = 0;
  12895. a = new goog.iter.Iterator;
  12896. var e = !1;
  12897. a.next = function () {
  12898. var a = null;
  12899. if (!e)
  12900. try {
  12901. return a = b.next(),
  12902. c.push(a),
  12903. a
  12904. } catch (g) {
  12905. if (g != goog.iter.StopIteration || goog.array.isEmpty(c))
  12906. throw g;
  12907. e = !0
  12908. }
  12909. a = c[d];
  12910. d = (d + 1) % c.length;
  12911. return a
  12912. }
  12913. ;
  12914. return a
  12915. }
  12916. ;
  12917. goog.iter.count = function (a, b) {
  12918. var c = a || 0
  12919. , d = void 0 !== b ? b : 1
  12920. , e = new goog.iter.Iterator;
  12921. e.next = function () {
  12922. var a = c;
  12923. c += d;
  12924. return a
  12925. }
  12926. ;
  12927. return e
  12928. }
  12929. ;
  12930. goog.iter.repeat = function (a) {
  12931. var b = new goog.iter.Iterator;
  12932. b.next = goog.functions.constant(a);
  12933. return b
  12934. }
  12935. ;
  12936. goog.iter.accumulate = function (a) {
  12937. var b = goog.iter.toIterator(a)
  12938. , c = 0;
  12939. a = new goog.iter.Iterator;
  12940. a.next = function () {
  12941. return c += b.next()
  12942. }
  12943. ;
  12944. return a
  12945. }
  12946. ;
  12947. goog.iter.zip = function (a) {
  12948. var b = arguments
  12949. , c = new goog.iter.Iterator;
  12950. if (0 < b.length) {
  12951. var d = goog.array.map(b, goog.iter.toIterator);
  12952. c.next = function () {
  12953. return goog.array.map(d, function (a) {
  12954. return a.next()
  12955. })
  12956. }
  12957. }
  12958. return c
  12959. }
  12960. ;
  12961. goog.iter.zipLongest = function (a, b) {
  12962. var c = goog.array.slice(arguments, 1)
  12963. , d = new goog.iter.Iterator;
  12964. if (0 < c.length) {
  12965. var e = goog.array.map(c, goog.iter.toIterator);
  12966. d.next = function () {
  12967. var b = !1
  12968. , c = goog.array.map(e, function (c) {
  12969. try {
  12970. var d = c.next();
  12971. b = !0
  12972. } catch (m) {
  12973. if (m !== goog.iter.StopIteration)
  12974. throw m;
  12975. d = a
  12976. }
  12977. return d
  12978. });
  12979. if (!b)
  12980. throw goog.iter.StopIteration;
  12981. return c
  12982. }
  12983. }
  12984. return d
  12985. }
  12986. ;
  12987. goog.iter.compress = function (a, b) {
  12988. var c = goog.iter.toIterator(b);
  12989. return goog.iter.filter(a, function () {
  12990. return !!c.next()
  12991. })
  12992. }
  12993. ;
  12994. goog.iter.GroupByIterator_ = function (a, b) {
  12995. this.iterator = goog.iter.toIterator(a);
  12996. this.keyFunc = b || goog.functions.identity
  12997. }
  12998. ;
  12999. goog.inherits(goog.iter.GroupByIterator_, goog.iter.Iterator);
  13000. goog.iter.GroupByIterator_.prototype.next = function () {
  13001. for (; this.currentKey == this.targetKey;)
  13002. this.currentValue = this.iterator.next(),
  13003. this.currentKey = this.keyFunc(this.currentValue);
  13004. this.targetKey = this.currentKey;
  13005. return [this.currentKey, this.groupItems_(this.targetKey)]
  13006. }
  13007. ;
  13008. goog.iter.GroupByIterator_.prototype.groupItems_ = function (a) {
  13009. for (var b = []; this.currentKey == a;) {
  13010. b.push(this.currentValue);
  13011. try {
  13012. this.currentValue = this.iterator.next()
  13013. } catch (c) {
  13014. if (c !== goog.iter.StopIteration)
  13015. throw c;
  13016. break
  13017. }
  13018. this.currentKey = this.keyFunc(this.currentValue)
  13019. }
  13020. return b
  13021. }
  13022. ;
  13023. goog.iter.groupBy = function (a, b) {
  13024. return new goog.iter.GroupByIterator_(a, b)
  13025. }
  13026. ;
  13027. goog.iter.starMap = function (a, b, c) {
  13028. var d = goog.iter.toIterator(a);
  13029. a = new goog.iter.Iterator;
  13030. a.next = function () {
  13031. var a = goog.iter.toArray(d.next());
  13032. return b.apply(c, goog.array.concat(a, void 0, d))
  13033. }
  13034. ;
  13035. return a
  13036. }
  13037. ;
  13038. goog.iter.tee = function (a, b) {
  13039. var c = goog.iter.toIterator(a)
  13040. , d = goog.array.map(goog.array.range("number" === typeof b ? b : 2), function () {
  13041. return []
  13042. })
  13043. , e = function () {
  13044. var a = c.next();
  13045. goog.array.forEach(d, function (b) {
  13046. b.push(a)
  13047. })
  13048. };
  13049. return goog.array.map(d, function (a) {
  13050. var b = new goog.iter.Iterator;
  13051. b.next = function () {
  13052. goog.array.isEmpty(a) && e();
  13053. goog.asserts.assert(!goog.array.isEmpty(a));
  13054. return a.shift()
  13055. }
  13056. ;
  13057. return b
  13058. })
  13059. }
  13060. ;
  13061. goog.iter.enumerate = function (a, b) {
  13062. return goog.iter.zip(goog.iter.count(b), a)
  13063. }
  13064. ;
  13065. goog.iter.limit = function (a, b) {
  13066. goog.asserts.assert(goog.math.isInt(b) && 0 <= b);
  13067. var c = goog.iter.toIterator(a)
  13068. , d = new goog.iter.Iterator
  13069. , e = b;
  13070. d.next = function () {
  13071. if (0 < e--)
  13072. return c.next();
  13073. throw goog.iter.StopIteration;
  13074. }
  13075. ;
  13076. return d
  13077. }
  13078. ;
  13079. goog.iter.consume = function (a, b) {
  13080. goog.asserts.assert(goog.math.isInt(b) && 0 <= b);
  13081. for (var c = goog.iter.toIterator(a); 0 < b--;)
  13082. goog.iter.nextOrValue(c, null);
  13083. return c
  13084. }
  13085. ;
  13086. goog.iter.slice = function (a, b, c) {
  13087. goog.asserts.assert(goog.math.isInt(b) && 0 <= b);
  13088. a = goog.iter.consume(a, b);
  13089. "number" === typeof c && (goog.asserts.assert(goog.math.isInt(c) && c >= b),
  13090. a = goog.iter.limit(a, c - b));
  13091. return a
  13092. }
  13093. ;
  13094. goog.iter.hasDuplicates_ = function (a) {
  13095. var b = [];
  13096. goog.array.removeDuplicates(a, b);
  13097. return a.length != b.length
  13098. }
  13099. ;
  13100. goog.iter.permutations = function (a, b) {
  13101. var c = goog.iter.toArray(a);
  13102. c = goog.array.repeat(c, "number" === typeof b ? b : c.length);
  13103. c = goog.iter.product.apply(void 0, c);
  13104. return goog.iter.filter(c, function (a) {
  13105. return !goog.iter.hasDuplicates_(a)
  13106. })
  13107. }
  13108. ;
  13109. goog.iter.combinations = function (a, b) {
  13110. function c(a) {
  13111. return d[a]
  13112. }
  13113. var d = goog.iter.toArray(a)
  13114. , e = goog.iter.range(d.length);
  13115. e = goog.iter.permutations(e, b);
  13116. var f = goog.iter.filter(e, function (a) {
  13117. return goog.array.isSorted(a)
  13118. });
  13119. e = new goog.iter.Iterator;
  13120. e.next = function () {
  13121. return goog.array.map(f.next(), c)
  13122. }
  13123. ;
  13124. return e
  13125. }
  13126. ;
  13127. goog.iter.combinationsWithReplacement = function (a, b) {
  13128. function c(a) {
  13129. return d[a]
  13130. }
  13131. var d = goog.iter.toArray(a)
  13132. , e = goog.array.range(d.length);
  13133. e = goog.array.repeat(e, b);
  13134. e = goog.iter.product.apply(void 0, e);
  13135. var f = goog.iter.filter(e, function (a) {
  13136. return goog.array.isSorted(a)
  13137. });
  13138. e = new goog.iter.Iterator;
  13139. e.next = function () {
  13140. return goog.array.map(f.next(), c)
  13141. }
  13142. ;
  13143. return e
  13144. }
  13145. ;
  13146. goog.dom.TagWalkType = {
  13147. START_TAG: 1,
  13148. OTHER: 0,
  13149. END_TAG: -1
  13150. };
  13151. goog.dom.TagIterator = function (a, b, c, d, e) {
  13152. this.reversed = !!b;
  13153. this.node = null;
  13154. this.tagType = goog.dom.TagWalkType.OTHER;
  13155. this.started_ = !1;
  13156. this.constrained = !c;
  13157. a && this.setPosition(a, d);
  13158. this.depth = void 0 != e ? e : this.tagType || 0;
  13159. this.reversed && (this.depth *= -1)
  13160. }
  13161. ;
  13162. goog.inherits(goog.dom.TagIterator, goog.iter.Iterator);
  13163. goog.dom.TagIterator.prototype.setPosition = function (a, b, c) {
  13164. if (this.node = a)
  13165. this.tagType = "number" === typeof b ? b : this.node.nodeType != goog.dom.NodeType.ELEMENT ? goog.dom.TagWalkType.OTHER : this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
  13166. "number" === typeof c && (this.depth = c)
  13167. }
  13168. ;
  13169. goog.dom.TagIterator.prototype.copyFrom = function (a) {
  13170. this.node = a.node;
  13171. this.tagType = a.tagType;
  13172. this.depth = a.depth;
  13173. this.reversed = a.reversed;
  13174. this.constrained = a.constrained
  13175. }
  13176. ;
  13177. goog.dom.TagIterator.prototype.clone = function () {
  13178. return new goog.dom.TagIterator(this.node, this.reversed, !this.constrained, this.tagType, this.depth)
  13179. }
  13180. ;
  13181. goog.dom.TagIterator.prototype.skipTag = function () {
  13182. var a = this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
  13183. this.tagType == a && (this.tagType = -1 * a,
  13184. this.depth += this.tagType * (this.reversed ? -1 : 1))
  13185. }
  13186. ;
  13187. goog.dom.TagIterator.prototype.restartTag = function () {
  13188. var a = this.reversed ? goog.dom.TagWalkType.START_TAG : goog.dom.TagWalkType.END_TAG;
  13189. this.tagType == a && (this.tagType = -1 * a,
  13190. this.depth += this.tagType * (this.reversed ? -1 : 1))
  13191. }
  13192. ;
  13193. goog.dom.TagIterator.prototype.next = function () {
  13194. if (this.started_) {
  13195. if (!this.node || this.constrained && 0 == this.depth)
  13196. throw goog.iter.StopIteration;
  13197. var a = this.node;
  13198. var b = this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
  13199. if (this.tagType == b) {
  13200. var c = this.reversed ? a.lastChild : a.firstChild;
  13201. c ? this.setPosition(c) : this.setPosition(a, -1 * b)
  13202. } else
  13203. (c = this.reversed ? a.previousSibling : a.nextSibling) ? this.setPosition(c) : this.setPosition(a.parentNode, -1 * b);
  13204. this.depth += this.tagType * (this.reversed ? -1 : 1)
  13205. } else
  13206. this.started_ = !0;
  13207. a = this.node;
  13208. if (!this.node)
  13209. throw goog.iter.StopIteration;
  13210. return a
  13211. }
  13212. ;
  13213. goog.dom.TagIterator.prototype.isStarted = function () {
  13214. return this.started_
  13215. }
  13216. ;
  13217. goog.dom.TagIterator.prototype.isStartTag = function () {
  13218. return this.tagType == goog.dom.TagWalkType.START_TAG
  13219. }
  13220. ;
  13221. goog.dom.TagIterator.prototype.isEndTag = function () {
  13222. return this.tagType == goog.dom.TagWalkType.END_TAG
  13223. }
  13224. ;
  13225. goog.dom.TagIterator.prototype.isNonElement = function () {
  13226. return this.tagType == goog.dom.TagWalkType.OTHER
  13227. }
  13228. ;
  13229. goog.dom.TagIterator.prototype.equals = function (a) {
  13230. return a.node == this.node && (!this.node || a.tagType == this.tagType)
  13231. }
  13232. ;
  13233. goog.dom.TagIterator.prototype.splice = function (a) {
  13234. var b = this.node;
  13235. this.restartTag();
  13236. this.reversed = !this.reversed;
  13237. goog.dom.TagIterator.prototype.next.call(this);
  13238. this.reversed = !this.reversed;
  13239. for (var c = goog.isArrayLike(arguments[0]) ? arguments[0] : arguments, d = c.length - 1; 0 <= d; d--)
  13240. goog.dom.insertSiblingAfter(c[d], b);
  13241. goog.dom.removeNode(b)
  13242. }
  13243. ;
  13244. goog.dom.NodeIterator = function (a, b, c, d) {
  13245. goog.dom.TagIterator.call(this, a, b, c, null, d)
  13246. }
  13247. ;
  13248. goog.inherits(goog.dom.NodeIterator, goog.dom.TagIterator);
  13249. goog.dom.NodeIterator.prototype.next = function () {
  13250. do
  13251. goog.dom.NodeIterator.superClass_.next.call(this);
  13252. while (this.isEndTag()); return this.node
  13253. }
  13254. ;
  13255. goog.userAgent.product = {};
  13256. goog.userAgent.product.ASSUME_FIREFOX = !1;
  13257. goog.userAgent.product.ASSUME_IPHONE = !1;
  13258. goog.userAgent.product.ASSUME_IPAD = !1;
  13259. goog.userAgent.product.ASSUME_ANDROID = !1;
  13260. goog.userAgent.product.ASSUME_CHROME = !1;
  13261. goog.userAgent.product.ASSUME_SAFARI = !1;
  13262. goog.userAgent.product.PRODUCT_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_OPERA || goog.userAgent.product.ASSUME_FIREFOX || goog.userAgent.product.ASSUME_IPHONE || goog.userAgent.product.ASSUME_IPAD || goog.userAgent.product.ASSUME_ANDROID || goog.userAgent.product.ASSUME_CHROME || goog.userAgent.product.ASSUME_SAFARI;
  13263. goog.userAgent.product.OPERA = goog.userAgent.OPERA;
  13264. goog.userAgent.product.IE = goog.userAgent.IE;
  13265. goog.userAgent.product.EDGE = goog.userAgent.EDGE;
  13266. goog.userAgent.product.FIREFOX = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_FIREFOX : goog.labs.userAgent.browser.isFirefox();
  13267. goog.userAgent.product.isIphoneOrIpod_ = function () {
  13268. return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpod()
  13269. }
  13270. ;
  13271. goog.userAgent.product.IPHONE = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPHONE : goog.userAgent.product.isIphoneOrIpod_();
  13272. goog.userAgent.product.IPAD = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad();
  13273. goog.userAgent.product.ANDROID = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_ANDROID : goog.labs.userAgent.browser.isAndroidBrowser();
  13274. goog.userAgent.product.CHROME = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_CHROME : goog.labs.userAgent.browser.isChrome();
  13275. goog.userAgent.product.isSafariDesktop_ = function () {
  13276. return goog.labs.userAgent.browser.isSafari() && !goog.labs.userAgent.platform.isIos()
  13277. }
  13278. ;
  13279. goog.userAgent.product.SAFARI = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_SAFARI : goog.userAgent.product.isSafariDesktop_();
  13280. goog.dom.dataset = {};
  13281. goog.dom.dataset.ALLOWED_ = !goog.userAgent.product.IE && !goog.labs.userAgent.browser.isSafari();
  13282. goog.dom.dataset.PREFIX_ = "data-";
  13283. goog.dom.dataset.isValidProperty_ = function (a) {
  13284. return !/-[a-z]/.test(a)
  13285. }
  13286. ;
  13287. goog.dom.dataset.set = function (a, b, c) {
  13288. if (goog.dom.dataset.ALLOWED_ && a.dataset)
  13289. a.dataset[b] = c;
  13290. else if (goog.dom.dataset.isValidProperty_(b))
  13291. a.setAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b), c);
  13292. else
  13293. throw Error(goog.DEBUG ? '"' + b + '" is not a valid dataset property name.' : "");
  13294. }
  13295. ;
  13296. goog.dom.dataset.get = function (a, b) {
  13297. if (!goog.dom.dataset.isValidProperty_(b))
  13298. return null;
  13299. if (goog.dom.dataset.ALLOWED_ && a.dataset) {
  13300. if (goog.labs.userAgent.browser.isAndroidBrowser() && !(b in a.dataset))
  13301. return null;
  13302. var c = a.dataset[b];
  13303. return void 0 === c ? null : c
  13304. }
  13305. return a.getAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b))
  13306. }
  13307. ;
  13308. goog.dom.dataset.remove = function (a, b) {
  13309. goog.dom.dataset.isValidProperty_(b) && (goog.dom.dataset.ALLOWED_ && a.dataset ? goog.dom.dataset.has(a, b) && delete a.dataset[b] : a.removeAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b)))
  13310. }
  13311. ;
  13312. goog.dom.dataset.has = function (a, b) {
  13313. return goog.dom.dataset.isValidProperty_(b) ? goog.dom.dataset.ALLOWED_ && a.dataset ? b in a.dataset : a.hasAttribute ? a.hasAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b)) : !!a.getAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b)) : !1
  13314. }
  13315. ;
  13316. goog.dom.dataset.getAll = function (a) {
  13317. if (goog.dom.dataset.ALLOWED_ && a.dataset)
  13318. return a.dataset;
  13319. var b = {};
  13320. a = a.attributes;
  13321. for (var c = 0; c < a.length; ++c) {
  13322. var d = a[c];
  13323. if (goog.string.startsWith(d.name, goog.dom.dataset.PREFIX_)) {
  13324. var e = goog.string.toCamelCase(d.name.substr(5));
  13325. b[e] = d.value
  13326. }
  13327. }
  13328. return b
  13329. }
  13330. ;
  13331. goog.ui.PaletteRenderer = function () {
  13332. goog.ui.ControlRenderer.call(this)
  13333. }
  13334. ;
  13335. goog.inherits(goog.ui.PaletteRenderer, goog.ui.ControlRenderer);
  13336. goog.addSingletonGetter(goog.ui.PaletteRenderer);
  13337. goog.ui.PaletteRenderer.cellId_ = 0;
  13338. goog.ui.PaletteRenderer.CSS_CLASS = "goog-palette";
  13339. goog.ui.PaletteRenderer.GRID_WIDTH_ATTRIBUTE = "gridWidth";
  13340. goog.ui.PaletteRenderer.prototype.createDom = function (a) {
  13341. var b = this.getClassNames(a);
  13342. b = a.getDomHelper().createDom("DIV", b, this.createGrid(a.getContent(), a.getSize(), a.getDomHelper()));
  13343. goog.a11y.aria.setRole(b, goog.a11y.aria.Role.GRID);
  13344. goog.dom.dataset.set(b, goog.ui.PaletteRenderer.GRID_WIDTH_ATTRIBUTE, a.getSize().width);
  13345. return b
  13346. }
  13347. ;
  13348. goog.ui.PaletteRenderer.prototype.createGrid = function (a, b, c) {
  13349. for (var d = [], e = 0, f = 0; e < b.height; e++) {
  13350. for (var g = [], h = 0; h < b.width; h++) {
  13351. var k = a && a[f++];
  13352. g.push(this.createCell(k, c))
  13353. }
  13354. d.push(this.createRow(g, c))
  13355. }
  13356. return this.createTable(d, c)
  13357. }
  13358. ;
  13359. goog.ui.PaletteRenderer.prototype.createTable = function (a, b) {
  13360. var c = b.createDom("TABLE", this.getCssClass() + "-table", b.createDom("TBODY", this.getCssClass() + "-body", a));
  13361. c.cellSpacing = "0";
  13362. c.cellPadding = "0";
  13363. return c
  13364. }
  13365. ;
  13366. goog.ui.PaletteRenderer.prototype.createRow = function (a, b) {
  13367. var c = b.createDom("TR", this.getCssClass() + "-row", a);
  13368. goog.a11y.aria.setRole(c, goog.a11y.aria.Role.ROW);
  13369. return c
  13370. }
  13371. ;
  13372. goog.ui.PaletteRenderer.prototype.createCell = function (a, b) {
  13373. var c = b.createDom("TD", {
  13374. "class": this.getCssClass() + "-cell",
  13375. id: this.getCssClass() + "-cell-" + goog.ui.PaletteRenderer.cellId_++
  13376. }, a);
  13377. goog.a11y.aria.setRole(c, goog.a11y.aria.Role.GRIDCELL);
  13378. goog.a11y.aria.setState(c, goog.a11y.aria.State.SELECTED, !1);
  13379. this.maybeUpdateAriaLabel_(c);
  13380. return c
  13381. }
  13382. ;
  13383. goog.ui.PaletteRenderer.prototype.maybeUpdateAriaLabel_ = function (a) {
  13384. if (!goog.dom.getTextContent(a) && !goog.a11y.aria.getLabel(a)) {
  13385. for (var b = new goog.dom.NodeIterator(a), c = "", d; !c && (d = goog.iter.nextOrValue(b, null));)
  13386. d.nodeType == goog.dom.NodeType.ELEMENT && (c = goog.a11y.aria.getLabel(d) || d.title);
  13387. c && goog.a11y.aria.setLabel(a, c)
  13388. }
  13389. }
  13390. ;
  13391. goog.ui.PaletteRenderer.prototype.canDecorate = function (a) {
  13392. return !1
  13393. }
  13394. ;
  13395. goog.ui.PaletteRenderer.prototype.decorate = function (a, b) {
  13396. return null
  13397. }
  13398. ;
  13399. goog.ui.PaletteRenderer.prototype.setContent = function (a, b) {
  13400. if (a) {
  13401. var c = goog.dom.getElementsByTagNameAndClass("TBODY", this.getCssClass() + "-body", a)[0];
  13402. if (c) {
  13403. var d = 0;
  13404. goog.array.forEach(c.rows, function (a) {
  13405. goog.array.forEach(a.cells, function (a) {
  13406. goog.dom.removeChildren(a);
  13407. goog.a11y.aria.removeState(a, goog.a11y.aria.State.LABEL);
  13408. if (b) {
  13409. var c = b[d++];
  13410. c && (goog.dom.appendChild(a, c),
  13411. this.maybeUpdateAriaLabel_(a))
  13412. }
  13413. }, this)
  13414. }, this);
  13415. if (d < b.length) {
  13416. for (var e = [], f = goog.dom.getDomHelper(a), g = goog.dom.dataset.get(a, goog.ui.PaletteRenderer.GRID_WIDTH_ATTRIBUTE); d < b.length;) {
  13417. var h = b[d++];
  13418. e.push(this.createCell(h, f));
  13419. e.length == g && (h = this.createRow(e, f),
  13420. goog.dom.appendChild(c, h),
  13421. e.length = 0)
  13422. }
  13423. if (0 < e.length) {
  13424. for (; e.length < g;)
  13425. e.push(this.createCell("", f));
  13426. h = this.createRow(e, f);
  13427. goog.dom.appendChild(c, h)
  13428. }
  13429. }
  13430. }
  13431. goog.style.setUnselectable(a, !0, goog.userAgent.GECKO)
  13432. }
  13433. }
  13434. ;
  13435. goog.ui.PaletteRenderer.prototype.getContainingItem = function (a, b) {
  13436. for (var c = a.getElement(); b && b.nodeType == goog.dom.NodeType.ELEMENT && b != c;) {
  13437. if ("TD" == b.tagName && goog.dom.classlist.contains(b, this.getCssClass() + "-cell"))
  13438. return b.firstChild;
  13439. b = b.parentNode
  13440. }
  13441. return null
  13442. }
  13443. ;
  13444. goog.ui.PaletteRenderer.prototype.highlightCell = function (a, b, c) {
  13445. b && (b = this.getCellForItem(b),
  13446. goog.asserts.assert(b),
  13447. goog.dom.classlist.enable(b, this.getCssClass() + "-cell-hover", c),
  13448. c ? goog.a11y.aria.setState(a.getElementStrict(), goog.a11y.aria.State.ACTIVEDESCENDANT, b.id) : b.id == goog.a11y.aria.getState(a.getElementStrict(), goog.a11y.aria.State.ACTIVEDESCENDANT) && goog.a11y.aria.removeState(a.getElementStrict(), goog.a11y.aria.State.ACTIVEDESCENDANT))
  13449. }
  13450. ;
  13451. goog.ui.PaletteRenderer.prototype.getCellForItem = function (a) {
  13452. return a ? a.parentNode : null
  13453. }
  13454. ;
  13455. goog.ui.PaletteRenderer.prototype.selectCell = function (a, b, c) {
  13456. b && (a = b.parentNode,
  13457. goog.dom.classlist.enable(a, this.getCssClass() + "-cell-selected", c),
  13458. goog.a11y.aria.setState(a, goog.a11y.aria.State.SELECTED, c))
  13459. }
  13460. ;
  13461. goog.ui.PaletteRenderer.prototype.getCssClass = function () {
  13462. return goog.ui.PaletteRenderer.CSS_CLASS
  13463. }
  13464. ;
  13465. goog.ui.SelectionModel = function (a) {
  13466. goog.events.EventTarget.call(this);
  13467. this.items_ = [];
  13468. this.addItems(a)
  13469. }
  13470. ;
  13471. goog.inherits(goog.ui.SelectionModel, goog.events.EventTarget);
  13472. goog.tagUnsealableClass(goog.ui.SelectionModel);
  13473. goog.ui.SelectionModel.prototype.selectedItem_ = null;
  13474. goog.ui.SelectionModel.prototype.selectionHandler_ = null;
  13475. goog.ui.SelectionModel.prototype.getSelectionHandler = function () {
  13476. return this.selectionHandler_
  13477. }
  13478. ;
  13479. goog.ui.SelectionModel.prototype.setSelectionHandler = function (a) {
  13480. this.selectionHandler_ = a
  13481. }
  13482. ;
  13483. goog.ui.SelectionModel.prototype.getItemCount = function () {
  13484. return this.items_.length
  13485. }
  13486. ;
  13487. goog.ui.SelectionModel.prototype.indexOfItem = function (a) {
  13488. return a ? goog.array.indexOf(this.items_, a) : -1
  13489. }
  13490. ;
  13491. goog.ui.SelectionModel.prototype.getFirst = function () {
  13492. return this.items_[0]
  13493. }
  13494. ;
  13495. goog.ui.SelectionModel.prototype.getLast = function () {
  13496. return this.items_[this.items_.length - 1]
  13497. }
  13498. ;
  13499. goog.ui.SelectionModel.prototype.getItemAt = function (a) {
  13500. return this.items_[a] || null
  13501. }
  13502. ;
  13503. goog.ui.SelectionModel.prototype.addItems = function (a) {
  13504. a && (goog.array.forEach(a, function (a) {
  13505. this.selectItem_(a, !1)
  13506. }, this),
  13507. goog.array.extend(this.items_, a))
  13508. }
  13509. ;
  13510. goog.ui.SelectionModel.prototype.addItem = function (a) {
  13511. this.addItemAt(a, this.getItemCount())
  13512. }
  13513. ;
  13514. goog.ui.SelectionModel.prototype.addItemAt = function (a, b) {
  13515. a && (this.selectItem_(a, !1),
  13516. goog.array.insertAt(this.items_, a, b))
  13517. }
  13518. ;
  13519. goog.ui.SelectionModel.prototype.removeItem = function (a) {
  13520. a && goog.array.remove(this.items_, a) && a == this.selectedItem_ && (this.selectedItem_ = null,
  13521. this.dispatchEvent(goog.events.EventType.SELECT))
  13522. }
  13523. ;
  13524. goog.ui.SelectionModel.prototype.removeItemAt = function (a) {
  13525. this.removeItem(this.getItemAt(a))
  13526. }
  13527. ;
  13528. goog.ui.SelectionModel.prototype.getSelectedItem = function () {
  13529. return this.selectedItem_
  13530. }
  13531. ;
  13532. goog.ui.SelectionModel.prototype.getItems = function () {
  13533. return goog.array.clone(this.items_)
  13534. }
  13535. ;
  13536. goog.ui.SelectionModel.prototype.setSelectedItem = function (a) {
  13537. a != this.selectedItem_ && (this.selectItem_(this.selectedItem_, !1),
  13538. this.selectedItem_ = a,
  13539. this.selectItem_(a, !0));
  13540. this.dispatchEvent(goog.events.EventType.SELECT)
  13541. }
  13542. ;
  13543. goog.ui.SelectionModel.prototype.getSelectedIndex = function () {
  13544. return this.indexOfItem(this.selectedItem_)
  13545. }
  13546. ;
  13547. goog.ui.SelectionModel.prototype.setSelectedIndex = function (a) {
  13548. this.setSelectedItem(this.getItemAt(a))
  13549. }
  13550. ;
  13551. goog.ui.SelectionModel.prototype.clear = function () {
  13552. goog.array.clear(this.items_);
  13553. this.selectedItem_ = null
  13554. }
  13555. ;
  13556. goog.ui.SelectionModel.prototype.disposeInternal = function () {
  13557. goog.ui.SelectionModel.superClass_.disposeInternal.call(this);
  13558. delete this.items_;
  13559. this.selectedItem_ = null
  13560. }
  13561. ;
  13562. goog.ui.SelectionModel.prototype.selectItem_ = function (a, b) {
  13563. a && ("function" == typeof this.selectionHandler_ ? this.selectionHandler_(a, b) : "function" == typeof a.setSelected && a.setSelected(b))
  13564. }
  13565. ;
  13566. goog.ui.Palette = function (a, b, c) {
  13567. goog.ui.Control.call(this, a, b || goog.ui.PaletteRenderer.getInstance(), c);
  13568. this.setAutoStates(goog.ui.Component.State.CHECKED | goog.ui.Component.State.SELECTED | goog.ui.Component.State.OPENED, !1);
  13569. this.currentCellControl_ = new goog.ui.Palette.CurrentCell_;
  13570. this.currentCellControl_.setParentEventTarget(this);
  13571. this.lastHighlightedIndex_ = -1
  13572. }
  13573. ;
  13574. goog.inherits(goog.ui.Palette, goog.ui.Control);
  13575. goog.tagUnsealableClass(goog.ui.Palette);
  13576. goog.ui.Palette.EventType = {
  13577. AFTER_HIGHLIGHT: goog.events.getUniqueId("afterhighlight")
  13578. };
  13579. goog.ui.Palette.prototype.size_ = null;
  13580. goog.ui.Palette.prototype.highlightedIndex_ = -1;
  13581. goog.ui.Palette.prototype.selectionModel_ = null;
  13582. goog.ui.Palette.prototype.disposeInternal = function () {
  13583. goog.ui.Palette.superClass_.disposeInternal.call(this);
  13584. this.selectionModel_ && (this.selectionModel_.dispose(),
  13585. this.selectionModel_ = null);
  13586. this.size_ = null;
  13587. this.currentCellControl_.dispose()
  13588. }
  13589. ;
  13590. goog.ui.Palette.prototype.setContentInternal = function (a) {
  13591. goog.ui.Palette.superClass_.setContentInternal.call(this, a);
  13592. this.adjustSize_();
  13593. this.selectionModel_ ? (this.selectionModel_.clear(),
  13594. this.selectionModel_.addItems(a)) : (this.selectionModel_ = new goog.ui.SelectionModel(a),
  13595. this.selectionModel_.setSelectionHandler(goog.bind(this.selectItem_, this)),
  13596. this.getHandler().listen(this.selectionModel_, goog.events.EventType.SELECT, this.handleSelectionChange));
  13597. this.highlightedIndex_ = -1
  13598. }
  13599. ;
  13600. goog.ui.Palette.prototype.getCaption = function () {
  13601. return ""
  13602. }
  13603. ;
  13604. goog.ui.Palette.prototype.setCaption = function (a) { }
  13605. ;
  13606. goog.ui.Palette.prototype.handleMouseOver = function (a) {
  13607. goog.ui.Palette.superClass_.handleMouseOver.call(this, a);
  13608. var b = this.getRenderer().getContainingItem(this, a.target);
  13609. b && a.relatedTarget && goog.dom.contains(b, a.relatedTarget) || b != this.getHighlightedItem() && this.setHighlightedItem(b)
  13610. }
  13611. ;
  13612. goog.ui.Palette.prototype.handleMouseDown = function (a) {
  13613. goog.ui.Palette.superClass_.handleMouseDown.call(this, a);
  13614. this.isActive() && (a = this.getRenderer().getContainingItem(this, a.target),
  13615. a != this.getHighlightedItem() && this.setHighlightedItem(a))
  13616. }
  13617. ;
  13618. goog.ui.Palette.prototype.performActionInternal = function (a) {
  13619. var b = this.getHighlightedItem();
  13620. return b ? (a && this.shouldSelectHighlightedItem_(a) && this.setSelectedItem(b),
  13621. goog.ui.Palette.superClass_.performActionInternal.call(this, a)) : !1
  13622. }
  13623. ;
  13624. goog.ui.Palette.prototype.shouldSelectHighlightedItem_ = function (a) {
  13625. return this.getSelectedItem() ? "mouseup" != a.type ? !0 : !!this.getRenderer().getContainingItem(this, a.target) : !0
  13626. }
  13627. ;
  13628. goog.ui.Palette.prototype.handleKeyEvent = function (a) {
  13629. var b = this.getContent();
  13630. b = b ? b.length : 0;
  13631. var c = this.size_.width;
  13632. if (0 == b || !this.isEnabled())
  13633. return !1;
  13634. if (a.keyCode == goog.events.KeyCodes.ENTER || a.keyCode == goog.events.KeyCodes.SPACE)
  13635. return this.performActionInternal(a);
  13636. if (a.keyCode == goog.events.KeyCodes.HOME)
  13637. return this.setHighlightedIndex(0),
  13638. !0;
  13639. if (a.keyCode == goog.events.KeyCodes.END)
  13640. return this.setHighlightedIndex(b - 1),
  13641. !0;
  13642. var d = 0 > this.highlightedIndex_ ? this.getSelectedIndex() : this.highlightedIndex_;
  13643. switch (a.keyCode) {
  13644. case goog.events.KeyCodes.LEFT:
  13645. if (-1 == d || 0 == d)
  13646. d = b;
  13647. this.setHighlightedIndex(d - 1);
  13648. a.preventDefault();
  13649. return !0;
  13650. case goog.events.KeyCodes.RIGHT:
  13651. return d == b - 1 && (d = -1),
  13652. this.setHighlightedIndex(d + 1),
  13653. a.preventDefault(),
  13654. !0;
  13655. case goog.events.KeyCodes.UP:
  13656. -1 == d && (d = b + c - 1);
  13657. if (d >= c)
  13658. return this.setHighlightedIndex(d - c),
  13659. a.preventDefault(),
  13660. !0;
  13661. break;
  13662. case goog.events.KeyCodes.DOWN:
  13663. if (-1 == d && (d = -c),
  13664. d < b - c)
  13665. return this.setHighlightedIndex(d + c),
  13666. a.preventDefault(),
  13667. !0
  13668. }
  13669. return !1
  13670. }
  13671. ;
  13672. goog.ui.Palette.prototype.handleSelectionChange = function (a) { }
  13673. ;
  13674. goog.ui.Palette.prototype.getSize = function () {
  13675. return this.size_
  13676. }
  13677. ;
  13678. goog.ui.Palette.prototype.setSize = function (a, b) {
  13679. if (this.getElement())
  13680. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  13681. this.size_ = "number" === typeof a ? new goog.math.Size(a, b) : a;
  13682. this.adjustSize_()
  13683. }
  13684. ;
  13685. goog.ui.Palette.prototype.getHighlightedIndex = function () {
  13686. return this.highlightedIndex_
  13687. }
  13688. ;
  13689. goog.ui.Palette.prototype.getHighlightedItem = function () {
  13690. var a = this.getContent();
  13691. return a && a[this.highlightedIndex_]
  13692. }
  13693. ;
  13694. goog.ui.Palette.prototype.getHighlightedCellElement_ = function () {
  13695. return this.getRenderer().getCellForItem(this.getHighlightedItem())
  13696. }
  13697. ;
  13698. goog.ui.Palette.prototype.setHighlightedIndex = function (a) {
  13699. a != this.highlightedIndex_ && (this.highlightIndex_(this.highlightedIndex_, !1),
  13700. this.lastHighlightedIndex_ = this.highlightedIndex_,
  13701. this.highlightedIndex_ = a,
  13702. this.highlightIndex_(a, !0),
  13703. this.dispatchEvent(goog.ui.Palette.EventType.AFTER_HIGHLIGHT))
  13704. }
  13705. ;
  13706. goog.ui.Palette.prototype.setHighlightedItem = function (a) {
  13707. var b = this.getContent();
  13708. this.setHighlightedIndex(b && a ? goog.array.indexOf(b, a) : -1)
  13709. }
  13710. ;
  13711. goog.ui.Palette.prototype.getSelectedIndex = function () {
  13712. return this.selectionModel_ ? this.selectionModel_.getSelectedIndex() : -1
  13713. }
  13714. ;
  13715. goog.ui.Palette.prototype.getSelectedItem = function () {
  13716. return this.selectionModel_ ? this.selectionModel_.getSelectedItem() : null
  13717. }
  13718. ;
  13719. goog.ui.Palette.prototype.setSelectedIndex = function (a) {
  13720. this.selectionModel_ && this.selectionModel_.setSelectedIndex(a)
  13721. }
  13722. ;
  13723. goog.ui.Palette.prototype.setSelectedItem = function (a) {
  13724. this.selectionModel_ && this.selectionModel_.setSelectedItem(a)
  13725. }
  13726. ;
  13727. goog.ui.Palette.prototype.highlightIndex_ = function (a, b) {
  13728. if (this.getElement()) {
  13729. var c = this.getContent();
  13730. if (c && 0 <= a && a < c.length) {
  13731. var d = this.getHighlightedCellElement_();
  13732. this.currentCellControl_.getElement() != d && this.currentCellControl_.setElementInternal(d);
  13733. this.currentCellControl_.tryHighlight(b) && this.getRenderer().highlightCell(this, c[a], b)
  13734. }
  13735. }
  13736. }
  13737. ;
  13738. goog.ui.Palette.prototype.setHighlighted = function (a) {
  13739. a && -1 == this.highlightedIndex_ ? this.setHighlightedIndex(-1 < this.lastHighlightedIndex_ ? this.lastHighlightedIndex_ : 0) : a || this.setHighlightedIndex(-1);
  13740. goog.ui.Palette.superClass_.setHighlighted.call(this, a)
  13741. }
  13742. ;
  13743. goog.ui.Palette.prototype.selectItem_ = function (a, b) {
  13744. this.getElement() && this.getRenderer().selectCell(this, a, b)
  13745. }
  13746. ;
  13747. goog.ui.Palette.prototype.adjustSize_ = function () {
  13748. var a = this.getContent();
  13749. if (a)
  13750. if (this.size_ && this.size_.width) {
  13751. if (a = Math.ceil(a.length / this.size_.width),
  13752. "number" !== typeof this.size_.height || this.size_.height < a)
  13753. this.size_.height = a
  13754. } else
  13755. a = Math.ceil(Math.sqrt(a.length)),
  13756. this.size_ = new goog.math.Size(a, a);
  13757. else
  13758. this.size_ = new goog.math.Size(0, 0)
  13759. }
  13760. ;
  13761. goog.ui.Palette.CurrentCell_ = function () {
  13762. goog.ui.Control.call(this, null);
  13763. this.setDispatchTransitionEvents(goog.ui.Component.State.HOVER, !0)
  13764. }
  13765. ;
  13766. goog.inherits(goog.ui.Palette.CurrentCell_, goog.ui.Control);
  13767. goog.ui.Palette.CurrentCell_.prototype.tryHighlight = function (a) {
  13768. this.setHighlighted(a);
  13769. return this.isHighlighted() == a
  13770. }
  13771. ;
  13772. goog.ui.ColorPalette = function (a, b, c) {
  13773. this.colors_ = a || [];
  13774. goog.ui.Palette.call(this, null, b || goog.ui.PaletteRenderer.getInstance(), c);
  13775. this.setColors(this.colors_)
  13776. }
  13777. ;
  13778. goog.inherits(goog.ui.ColorPalette, goog.ui.Palette);
  13779. goog.tagUnsealableClass(goog.ui.ColorPalette);
  13780. goog.ui.ColorPalette.prototype.normalizedColors_ = null;
  13781. goog.ui.ColorPalette.prototype.labels_ = null;
  13782. goog.ui.ColorPalette.prototype.getColors = function () {
  13783. return this.colors_
  13784. }
  13785. ;
  13786. goog.ui.ColorPalette.prototype.setColors = function (a, b) {
  13787. this.colors_ = a;
  13788. this.labels_ = b || null;
  13789. this.normalizedColors_ = null;
  13790. this.setContent(this.createColorNodes())
  13791. }
  13792. ;
  13793. goog.ui.ColorPalette.prototype.getSelectedColor = function () {
  13794. var a = this.getSelectedItem();
  13795. return a ? (a = goog.style.getStyle(a, "background-color"),
  13796. goog.ui.ColorPalette.parseColor_(a)) : null
  13797. }
  13798. ;
  13799. goog.ui.ColorPalette.prototype.setSelectedColor = function (a) {
  13800. a = goog.ui.ColorPalette.parseColor_(a);
  13801. this.normalizedColors_ || (this.normalizedColors_ = goog.array.map(this.colors_, function (a) {
  13802. return goog.ui.ColorPalette.parseColor_(a)
  13803. }));
  13804. this.setSelectedIndex(a ? goog.array.indexOf(this.normalizedColors_, a) : -1)
  13805. }
  13806. ;
  13807. goog.ui.ColorPalette.prototype.createColorNodes = function () {
  13808. return goog.array.map(this.colors_, function (a, b) {
  13809. var c = this.getDomHelper().createDom("DIV", {
  13810. "class": this.getRenderer().getCssClass() + "-colorswatch",
  13811. style: "background-color:" + a
  13812. });
  13813. c.title = this.labels_ && this.labels_[b] ? this.labels_[b] : "#" == a.charAt(0) ? "RGB (" + goog.color.hexToRgb(a).join(", ") + ")" : a;
  13814. return c
  13815. }, this)
  13816. }
  13817. ;
  13818. goog.ui.ColorPalette.parseColor_ = function (a) {
  13819. if (a)
  13820. try {
  13821. return goog.color.parse(a).hex
  13822. } catch (b) { }
  13823. return null
  13824. }
  13825. ;
  13826. goog.ui.ColorPicker = function (a, b) {
  13827. goog.ui.Component.call(this, a);
  13828. this.colorPalette_ = b || null;
  13829. this.getHandler().listen(this, goog.ui.Component.EventType.ACTION, this.onColorPaletteAction_)
  13830. }
  13831. ;
  13832. goog.inherits(goog.ui.ColorPicker, goog.ui.Component);
  13833. goog.ui.ColorPicker.DEFAULT_NUM_COLS = 5;
  13834. goog.ui.ColorPicker.EventType = {
  13835. CHANGE: "change"
  13836. };
  13837. goog.ui.ColorPicker.prototype.focusable_ = !0;
  13838. goog.ui.ColorPicker.prototype.getColors = function () {
  13839. return this.colorPalette_ ? this.colorPalette_.getColors() : null
  13840. }
  13841. ;
  13842. goog.ui.ColorPicker.prototype.setColors = function (a) {
  13843. this.colorPalette_ ? this.colorPalette_.setColors(a) : this.createColorPalette_(a)
  13844. }
  13845. ;
  13846. goog.ui.ColorPicker.prototype.addColors = function (a) {
  13847. this.setColors(a)
  13848. }
  13849. ;
  13850. goog.ui.ColorPicker.prototype.setSize = function (a) {
  13851. this.colorPalette_ || this.createColorPalette_([]);
  13852. this.colorPalette_.setSize(a)
  13853. }
  13854. ;
  13855. goog.ui.ColorPicker.prototype.getSize = function () {
  13856. return this.colorPalette_ ? this.colorPalette_.getSize() : null
  13857. }
  13858. ;
  13859. goog.ui.ColorPicker.prototype.setColumnCount = function (a) {
  13860. this.setSize(a)
  13861. }
  13862. ;
  13863. goog.ui.ColorPicker.prototype.getSelectedIndex = function () {
  13864. return this.colorPalette_ ? this.colorPalette_.getSelectedIndex() : -1
  13865. }
  13866. ;
  13867. goog.ui.ColorPicker.prototype.setSelectedIndex = function (a) {
  13868. this.colorPalette_ && this.colorPalette_.setSelectedIndex(a)
  13869. }
  13870. ;
  13871. goog.ui.ColorPicker.prototype.getSelectedColor = function () {
  13872. return this.colorPalette_ ? this.colorPalette_.getSelectedColor() : null
  13873. }
  13874. ;
  13875. goog.ui.ColorPicker.prototype.setSelectedColor = function (a) {
  13876. this.colorPalette_ && this.colorPalette_.setSelectedColor(a)
  13877. }
  13878. ;
  13879. goog.ui.ColorPicker.prototype.isFocusable = function () {
  13880. return this.focusable_
  13881. }
  13882. ;
  13883. goog.ui.ColorPicker.prototype.setFocusable = function (a) {
  13884. this.focusable_ = a;
  13885. this.colorPalette_ && this.colorPalette_.setSupportedState(goog.ui.Component.State.FOCUSED, a)
  13886. }
  13887. ;
  13888. goog.ui.ColorPicker.prototype.canDecorate = function (a) {
  13889. return !1
  13890. }
  13891. ;
  13892. goog.ui.ColorPicker.prototype.enterDocument = function () {
  13893. goog.ui.ColorPicker.superClass_.enterDocument.call(this);
  13894. this.colorPalette_ && this.colorPalette_.render(this.getElement());
  13895. this.getElement().unselectable = "on"
  13896. }
  13897. ;
  13898. goog.ui.ColorPicker.prototype.disposeInternal = function () {
  13899. goog.ui.ColorPicker.superClass_.disposeInternal.call(this);
  13900. this.colorPalette_ && (this.colorPalette_.dispose(),
  13901. this.colorPalette_ = null)
  13902. }
  13903. ;
  13904. goog.ui.ColorPicker.prototype.focus = function () {
  13905. this.colorPalette_ && this.colorPalette_.getElement().focus()
  13906. }
  13907. ;
  13908. goog.ui.ColorPicker.prototype.onColorPaletteAction_ = function (a) {
  13909. a.stopPropagation();
  13910. this.dispatchEvent(goog.ui.ColorPicker.EventType.CHANGE)
  13911. }
  13912. ;
  13913. goog.ui.ColorPicker.prototype.createColorPalette_ = function (a) {
  13914. a = new goog.ui.ColorPalette(a, null, this.getDomHelper());
  13915. a.setSize(goog.ui.ColorPicker.DEFAULT_NUM_COLS);
  13916. a.setSupportedState(goog.ui.Component.State.FOCUSED, this.focusable_);
  13917. this.addChild(a);
  13918. this.colorPalette_ = a;
  13919. this.isInDocument() && this.colorPalette_.render(this.getElement())
  13920. }
  13921. ;
  13922. goog.ui.ColorPicker.createSimpleColorGrid = function (a) {
  13923. a = new goog.ui.ColorPicker(a);
  13924. a.setSize(7);
  13925. a.setColors(goog.ui.ColorPicker.SIMPLE_GRID_COLORS);
  13926. return a
  13927. }
  13928. ;
  13929. goog.ui.ColorPicker.SIMPLE_GRID_COLORS = "#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" ");
  13930. goog.events.FocusHandler = function (a) {
  13931. goog.events.EventTarget.call(this);
  13932. this.element_ = a;
  13933. a = goog.userAgent.IE ? "focusout" : "blur";
  13934. this.listenKeyIn_ = goog.events.listen(this.element_, goog.userAgent.IE ? "focusin" : "focus", this, !goog.userAgent.IE);
  13935. this.listenKeyOut_ = goog.events.listen(this.element_, a, this, !goog.userAgent.IE)
  13936. }
  13937. ;
  13938. goog.inherits(goog.events.FocusHandler, goog.events.EventTarget);
  13939. goog.events.FocusHandler.EventType = {
  13940. FOCUSIN: "focusin",
  13941. FOCUSOUT: "focusout"
  13942. };
  13943. goog.events.FocusHandler.prototype.handleEvent = function (a) {
  13944. var b = a.getBrowserEvent();
  13945. b = new goog.events.BrowserEvent(b);
  13946. b.type = "focusin" == a.type || "focus" == a.type ? goog.events.FocusHandler.EventType.FOCUSIN : goog.events.FocusHandler.EventType.FOCUSOUT;
  13947. this.dispatchEvent(b)
  13948. }
  13949. ;
  13950. goog.events.FocusHandler.prototype.disposeInternal = function () {
  13951. goog.events.FocusHandler.superClass_.disposeInternal.call(this);
  13952. goog.events.unlistenByKey(this.listenKeyIn_);
  13953. goog.events.unlistenByKey(this.listenKeyOut_);
  13954. delete this.element_
  13955. }
  13956. ;
  13957. goog.debug.LogRecord = function (a, b, c, d, e) {
  13958. this.reset(a, b, c, d, e)
  13959. }
  13960. ;
  13961. goog.debug.LogRecord.prototype.sequenceNumber_ = 0;
  13962. goog.debug.LogRecord.prototype.exception_ = null;
  13963. goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS = !0;
  13964. goog.debug.LogRecord.nextSequenceNumber_ = 0;
  13965. goog.debug.LogRecord.prototype.reset = function (a, b, c, d, e) {
  13966. goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS && (this.sequenceNumber_ = "number" == typeof e ? e : goog.debug.LogRecord.nextSequenceNumber_++);
  13967. this.time_ = d || goog.now();
  13968. this.level_ = a;
  13969. this.msg_ = b;
  13970. this.loggerName_ = c;
  13971. delete this.exception_
  13972. }
  13973. ;
  13974. goog.debug.LogRecord.prototype.getLoggerName = function () {
  13975. return this.loggerName_
  13976. }
  13977. ;
  13978. goog.debug.LogRecord.prototype.getException = function () {
  13979. return this.exception_
  13980. }
  13981. ;
  13982. goog.debug.LogRecord.prototype.setException = function (a) {
  13983. this.exception_ = a
  13984. }
  13985. ;
  13986. goog.debug.LogRecord.prototype.setLoggerName = function (a) {
  13987. this.loggerName_ = a
  13988. }
  13989. ;
  13990. goog.debug.LogRecord.prototype.getLevel = function () {
  13991. return this.level_
  13992. }
  13993. ;
  13994. goog.debug.LogRecord.prototype.setLevel = function (a) {
  13995. this.level_ = a
  13996. }
  13997. ;
  13998. goog.debug.LogRecord.prototype.getMessage = function () {
  13999. return this.msg_
  14000. }
  14001. ;
  14002. goog.debug.LogRecord.prototype.setMessage = function (a) {
  14003. this.msg_ = a
  14004. }
  14005. ;
  14006. goog.debug.LogRecord.prototype.getMillis = function () {
  14007. return this.time_
  14008. }
  14009. ;
  14010. goog.debug.LogRecord.prototype.setMillis = function (a) {
  14011. this.time_ = a
  14012. }
  14013. ;
  14014. goog.debug.LogRecord.prototype.getSequenceNumber = function () {
  14015. return this.sequenceNumber_
  14016. }
  14017. ;
  14018. goog.debug.LogBuffer = function () {
  14019. goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(), "Cannot use goog.debug.LogBuffer without defining goog.debug.LogBuffer.CAPACITY.");
  14020. this.clear()
  14021. }
  14022. ;
  14023. goog.debug.LogBuffer.getInstance = function () {
  14024. goog.debug.LogBuffer.instance_ || (goog.debug.LogBuffer.instance_ = new goog.debug.LogBuffer);
  14025. return goog.debug.LogBuffer.instance_
  14026. }
  14027. ;
  14028. goog.debug.LogBuffer.CAPACITY = 0;
  14029. goog.debug.LogBuffer.prototype.addRecord = function (a, b, c) {
  14030. var d = (this.curIndex_ + 1) % goog.debug.LogBuffer.CAPACITY;
  14031. this.curIndex_ = d;
  14032. if (this.isFull_)
  14033. return d = this.buffer_[d],
  14034. d.reset(a, b, c),
  14035. d;
  14036. this.isFull_ = d == goog.debug.LogBuffer.CAPACITY - 1;
  14037. return this.buffer_[d] = new goog.debug.LogRecord(a, b, c)
  14038. }
  14039. ;
  14040. goog.debug.LogBuffer.isBufferingEnabled = function () {
  14041. return 0 < goog.debug.LogBuffer.CAPACITY
  14042. }
  14043. ;
  14044. goog.debug.LogBuffer.prototype.clear = function () {
  14045. this.buffer_ = Array(goog.debug.LogBuffer.CAPACITY);
  14046. this.curIndex_ = -1;
  14047. this.isFull_ = !1
  14048. }
  14049. ;
  14050. goog.debug.LogBuffer.prototype.forEachRecord = function (a) {
  14051. var b = this.buffer_;
  14052. if (b[0]) {
  14053. var c = this.curIndex_
  14054. , d = this.isFull_ ? c : -1;
  14055. do
  14056. d = (d + 1) % goog.debug.LogBuffer.CAPACITY,
  14057. a(b[d]);
  14058. while (d != c)
  14059. }
  14060. }
  14061. ;
  14062. goog.debug.Logger = function (a) {
  14063. this.name_ = a;
  14064. this.handlers_ = this.children_ = this.level_ = this.parent_ = null
  14065. }
  14066. ;
  14067. goog.debug.Logger.ROOT_LOGGER_NAME = "";
  14068. goog.debug.Logger.ENABLE_HIERARCHY = !0;
  14069. goog.debug.Logger.ENABLE_PROFILER_LOGGING = !1;
  14070. goog.debug.Logger.ENABLE_HIERARCHY || (goog.debug.Logger.rootHandlers_ = []);
  14071. goog.debug.Logger.Level = function (a, b) {
  14072. this.name = a;
  14073. this.value = b
  14074. }
  14075. ;
  14076. goog.debug.Logger.Level.prototype.toString = function () {
  14077. return this.name
  14078. }
  14079. ;
  14080. goog.debug.Logger.Level.OFF = new goog.debug.Logger.Level("OFF", Infinity);
  14081. goog.debug.Logger.Level.SHOUT = new goog.debug.Logger.Level("SHOUT", 1200);
  14082. goog.debug.Logger.Level.SEVERE = new goog.debug.Logger.Level("SEVERE", 1E3);
  14083. goog.debug.Logger.Level.WARNING = new goog.debug.Logger.Level("WARNING", 900);
  14084. goog.debug.Logger.Level.INFO = new goog.debug.Logger.Level("INFO", 800);
  14085. goog.debug.Logger.Level.CONFIG = new goog.debug.Logger.Level("CONFIG", 700);
  14086. goog.debug.Logger.Level.FINE = new goog.debug.Logger.Level("FINE", 500);
  14087. goog.debug.Logger.Level.FINER = new goog.debug.Logger.Level("FINER", 400);
  14088. goog.debug.Logger.Level.FINEST = new goog.debug.Logger.Level("FINEST", 300);
  14089. goog.debug.Logger.Level.ALL = new goog.debug.Logger.Level("ALL", 0);
  14090. goog.debug.Logger.Level.PREDEFINED_LEVELS = [goog.debug.Logger.Level.OFF, goog.debug.Logger.Level.SHOUT, goog.debug.Logger.Level.SEVERE, goog.debug.Logger.Level.WARNING, goog.debug.Logger.Level.INFO, goog.debug.Logger.Level.CONFIG, goog.debug.Logger.Level.FINE, goog.debug.Logger.Level.FINER, goog.debug.Logger.Level.FINEST, goog.debug.Logger.Level.ALL];
  14091. goog.debug.Logger.Level.predefinedLevelsCache_ = null;
  14092. goog.debug.Logger.Level.createPredefinedLevelsCache_ = function () {
  14093. goog.debug.Logger.Level.predefinedLevelsCache_ = {};
  14094. for (var a = 0, b; b = goog.debug.Logger.Level.PREDEFINED_LEVELS[a]; a++)
  14095. goog.debug.Logger.Level.predefinedLevelsCache_[b.value] = b,
  14096. goog.debug.Logger.Level.predefinedLevelsCache_[b.name] = b
  14097. }
  14098. ;
  14099. goog.debug.Logger.Level.getPredefinedLevel = function (a) {
  14100. goog.debug.Logger.Level.predefinedLevelsCache_ || goog.debug.Logger.Level.createPredefinedLevelsCache_();
  14101. return goog.debug.Logger.Level.predefinedLevelsCache_[a] || null
  14102. }
  14103. ;
  14104. goog.debug.Logger.Level.getPredefinedLevelByValue = function (a) {
  14105. goog.debug.Logger.Level.predefinedLevelsCache_ || goog.debug.Logger.Level.createPredefinedLevelsCache_();
  14106. if (a in goog.debug.Logger.Level.predefinedLevelsCache_)
  14107. return goog.debug.Logger.Level.predefinedLevelsCache_[a];
  14108. for (var b = 0; b < goog.debug.Logger.Level.PREDEFINED_LEVELS.length; ++b) {
  14109. var c = goog.debug.Logger.Level.PREDEFINED_LEVELS[b];
  14110. if (c.value <= a)
  14111. return c
  14112. }
  14113. return null
  14114. }
  14115. ;
  14116. goog.debug.Logger.getLogger = function (a) {
  14117. return goog.debug.LogManager.getLogger(a)
  14118. }
  14119. ;
  14120. goog.debug.Logger.logToProfilers = function (a) {
  14121. if (goog.debug.Logger.ENABLE_PROFILER_LOGGING) {
  14122. var b = goog.global.msWriteProfilerMark;
  14123. b ? b(a) : (b = goog.global.console) && b.timeStamp && b.timeStamp(a)
  14124. }
  14125. }
  14126. ;
  14127. goog.debug.Logger.prototype.getName = function () {
  14128. return this.name_
  14129. }
  14130. ;
  14131. goog.debug.Logger.prototype.addHandler = function (a) {
  14132. goog.debug.LOGGING_ENABLED && (goog.debug.Logger.ENABLE_HIERARCHY ? (this.handlers_ || (this.handlers_ = []),
  14133. this.handlers_.push(a)) : (goog.asserts.assert(!this.name_, "Cannot call addHandler on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."),
  14134. goog.debug.Logger.rootHandlers_.push(a)))
  14135. }
  14136. ;
  14137. goog.debug.Logger.prototype.removeHandler = function (a) {
  14138. if (goog.debug.LOGGING_ENABLED) {
  14139. var b = goog.debug.Logger.ENABLE_HIERARCHY ? this.handlers_ : goog.debug.Logger.rootHandlers_;
  14140. return !!b && goog.array.remove(b, a)
  14141. }
  14142. return !1
  14143. }
  14144. ;
  14145. goog.debug.Logger.prototype.getParent = function () {
  14146. return this.parent_
  14147. }
  14148. ;
  14149. goog.debug.Logger.prototype.getChildren = function () {
  14150. this.children_ || (this.children_ = {});
  14151. return this.children_
  14152. }
  14153. ;
  14154. goog.debug.Logger.prototype.setLevel = function (a) {
  14155. goog.debug.LOGGING_ENABLED && (goog.debug.Logger.ENABLE_HIERARCHY ? this.level_ = a : (goog.asserts.assert(!this.name_, "Cannot call setLevel() on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."),
  14156. goog.debug.Logger.rootLevel_ = a))
  14157. }
  14158. ;
  14159. goog.debug.Logger.prototype.getLevel = function () {
  14160. return goog.debug.LOGGING_ENABLED ? this.level_ : goog.debug.Logger.Level.OFF
  14161. }
  14162. ;
  14163. goog.debug.Logger.prototype.getEffectiveLevel = function () {
  14164. if (!goog.debug.LOGGING_ENABLED)
  14165. return goog.debug.Logger.Level.OFF;
  14166. if (!goog.debug.Logger.ENABLE_HIERARCHY)
  14167. return goog.debug.Logger.rootLevel_;
  14168. if (this.level_)
  14169. return this.level_;
  14170. if (this.parent_)
  14171. return this.parent_.getEffectiveLevel();
  14172. goog.asserts.fail("Root logger has no level set.");
  14173. return null
  14174. }
  14175. ;
  14176. goog.debug.Logger.prototype.isLoggable = function (a) {
  14177. return goog.debug.LOGGING_ENABLED && a.value >= this.getEffectiveLevel().value
  14178. }
  14179. ;
  14180. goog.debug.Logger.prototype.log = function (a, b, c) {
  14181. goog.debug.LOGGING_ENABLED && this.isLoggable(a) && (goog.isFunction(b) && (b = b()),
  14182. this.doLogRecord_(this.getLogRecord(a, b, c)))
  14183. }
  14184. ;
  14185. goog.debug.Logger.prototype.getLogRecord = function (a, b, c) {
  14186. a = goog.debug.LogBuffer.isBufferingEnabled() ? goog.debug.LogBuffer.getInstance().addRecord(a, b, this.name_) : new goog.debug.LogRecord(a, String(b), this.name_);
  14187. c && a.setException(c);
  14188. return a
  14189. }
  14190. ;
  14191. goog.debug.Logger.prototype.shout = function (a, b) {
  14192. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.SHOUT, a, b)
  14193. }
  14194. ;
  14195. goog.debug.Logger.prototype.severe = function (a, b) {
  14196. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.SEVERE, a, b)
  14197. }
  14198. ;
  14199. goog.debug.Logger.prototype.warning = function (a, b) {
  14200. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.WARNING, a, b)
  14201. }
  14202. ;
  14203. goog.debug.Logger.prototype.info = function (a, b) {
  14204. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.INFO, a, b)
  14205. }
  14206. ;
  14207. goog.debug.Logger.prototype.config = function (a, b) {
  14208. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.CONFIG, a, b)
  14209. }
  14210. ;
  14211. goog.debug.Logger.prototype.fine = function (a, b) {
  14212. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINE, a, b)
  14213. }
  14214. ;
  14215. goog.debug.Logger.prototype.finer = function (a, b) {
  14216. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINER, a, b)
  14217. }
  14218. ;
  14219. goog.debug.Logger.prototype.finest = function (a, b) {
  14220. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINEST, a, b)
  14221. }
  14222. ;
  14223. goog.debug.Logger.prototype.logRecord = function (a) {
  14224. goog.debug.LOGGING_ENABLED && this.isLoggable(a.getLevel()) && this.doLogRecord_(a)
  14225. }
  14226. ;
  14227. goog.debug.Logger.prototype.doLogRecord_ = function (a) {
  14228. goog.debug.Logger.ENABLE_PROFILER_LOGGING && goog.debug.Logger.logToProfilers("log:" + a.getMessage());
  14229. if (goog.debug.Logger.ENABLE_HIERARCHY)
  14230. for (var b = this; b;)
  14231. b.callPublish_(a),
  14232. b = b.getParent();
  14233. else {
  14234. b = 0;
  14235. for (var c; c = goog.debug.Logger.rootHandlers_[b++];)
  14236. c(a)
  14237. }
  14238. }
  14239. ;
  14240. goog.debug.Logger.prototype.callPublish_ = function (a) {
  14241. if (this.handlers_)
  14242. for (var b = 0, c; c = this.handlers_[b]; b++)
  14243. c(a)
  14244. }
  14245. ;
  14246. goog.debug.Logger.prototype.setParent_ = function (a) {
  14247. this.parent_ = a
  14248. }
  14249. ;
  14250. goog.debug.Logger.prototype.addChild_ = function (a, b) {
  14251. this.getChildren()[a] = b
  14252. }
  14253. ;
  14254. goog.debug.LogManager = {};
  14255. goog.debug.LogManager.loggers_ = {};
  14256. goog.debug.LogManager.rootLogger_ = null;
  14257. goog.debug.LogManager.initialize = function () {
  14258. goog.debug.LogManager.rootLogger_ || (goog.debug.LogManager.rootLogger_ = new goog.debug.Logger(goog.debug.Logger.ROOT_LOGGER_NAME),
  14259. goog.debug.LogManager.loggers_[goog.debug.Logger.ROOT_LOGGER_NAME] = goog.debug.LogManager.rootLogger_,
  14260. goog.debug.LogManager.rootLogger_.setLevel(goog.debug.Logger.Level.CONFIG))
  14261. }
  14262. ;
  14263. goog.debug.LogManager.getLoggers = function () {
  14264. return goog.debug.LogManager.loggers_
  14265. }
  14266. ;
  14267. goog.debug.LogManager.getRoot = function () {
  14268. goog.debug.LogManager.initialize();
  14269. return goog.debug.LogManager.rootLogger_
  14270. }
  14271. ;
  14272. goog.debug.LogManager.getLogger = function (a) {
  14273. goog.debug.LogManager.initialize();
  14274. return goog.debug.LogManager.loggers_[a] || goog.debug.LogManager.createLogger_(a)
  14275. }
  14276. ;
  14277. goog.debug.LogManager.createFunctionForCatchErrors = function (a) {
  14278. return function (b) {
  14279. (a || goog.debug.LogManager.getRoot()).severe("Error: " + b.message + " (" + b.fileName + " @ Line: " + b.line + ")")
  14280. }
  14281. }
  14282. ;
  14283. goog.debug.LogManager.createLogger_ = function (a) {
  14284. var b = new goog.debug.Logger(a);
  14285. if (goog.debug.Logger.ENABLE_HIERARCHY) {
  14286. var c = a.lastIndexOf(".")
  14287. , d = a.substr(0, c);
  14288. c = a.substr(c + 1);
  14289. d = goog.debug.LogManager.getLogger(d);
  14290. d.addChild_(c, b);
  14291. b.setParent_(d)
  14292. }
  14293. return goog.debug.LogManager.loggers_[a] = b
  14294. }
  14295. ;
  14296. goog.log = {};
  14297. goog.log.ENABLED = goog.debug.LOGGING_ENABLED;
  14298. goog.log.ROOT_LOGGER_NAME = goog.debug.Logger.ROOT_LOGGER_NAME;
  14299. goog.log.Logger = goog.debug.Logger;
  14300. goog.log.Level = goog.debug.Logger.Level;
  14301. goog.log.LogRecord = goog.debug.LogRecord;
  14302. goog.log.getLogger = function (a, b) {
  14303. if (goog.log.ENABLED) {
  14304. var c = goog.debug.LogManager.getLogger(a);
  14305. b && c && c.setLevel(b);
  14306. return c
  14307. }
  14308. return null
  14309. }
  14310. ;
  14311. goog.log.addHandler = function (a, b) {
  14312. goog.log.ENABLED && a && a.addHandler(b)
  14313. }
  14314. ;
  14315. goog.log.removeHandler = function (a, b) {
  14316. return goog.log.ENABLED && a ? a.removeHandler(b) : !1
  14317. }
  14318. ;
  14319. goog.log.log = function (a, b, c, d) {
  14320. goog.log.ENABLED && a && a.log(b, c, d)
  14321. }
  14322. ;
  14323. goog.log.error = function (a, b, c) {
  14324. goog.log.ENABLED && a && a.severe(b, c)
  14325. }
  14326. ;
  14327. goog.log.warning = function (a, b, c) {
  14328. goog.log.ENABLED && a && a.warning(b, c)
  14329. }
  14330. ;
  14331. goog.log.info = function (a, b, c) {
  14332. goog.log.ENABLED && a && a.info(b, c)
  14333. }
  14334. ;
  14335. goog.log.fine = function (a, b, c) {
  14336. goog.log.ENABLED && a && a.fine(b, c)
  14337. }
  14338. ;
  14339. goog.string.StringBuffer = function (a, b) {
  14340. null != a && this.append.apply(this, arguments)
  14341. }
  14342. ;
  14343. goog.string.StringBuffer.prototype.buffer_ = "";
  14344. goog.string.StringBuffer.prototype.set = function (a) {
  14345. this.buffer_ = "" + a
  14346. }
  14347. ;
  14348. goog.string.StringBuffer.prototype.append = function (a, b, c) {
  14349. this.buffer_ += String(a);
  14350. if (null != b)
  14351. for (var d = 1; d < arguments.length; d++)
  14352. this.buffer_ += arguments[d];
  14353. return this
  14354. }
  14355. ;
  14356. goog.string.StringBuffer.prototype.clear = function () {
  14357. this.buffer_ = ""
  14358. }
  14359. ;
  14360. goog.string.StringBuffer.prototype.getLength = function () {
  14361. return this.buffer_.length
  14362. }
  14363. ;
  14364. goog.string.StringBuffer.prototype.toString = function () {
  14365. return this.buffer_
  14366. }
  14367. ;
  14368. goog.ui.tree = {};
  14369. goog.ui.tree.BaseNode = function (a, b, c) {
  14370. goog.ui.Component.call(this, c);
  14371. this.config_ = b || goog.ui.tree.BaseNode.defaultConfig;
  14372. this.html_ = goog.html.SafeHtml.htmlEscapePreservingNewlines(a);
  14373. this.expanded_ = this.selected_ = !1;
  14374. this.toolTip_ = null;
  14375. this.afterLabelHtml_ = goog.html.SafeHtml.EMPTY;
  14376. this.isUserCollapsible_ = !0;
  14377. this.depth_ = -1
  14378. }
  14379. ;
  14380. goog.inherits(goog.ui.tree.BaseNode, goog.ui.Component);
  14381. goog.ui.tree.BaseNode.EventType = {
  14382. BEFORE_EXPAND: "beforeexpand",
  14383. EXPAND: "expand",
  14384. BEFORE_COLLAPSE: "beforecollapse",
  14385. COLLAPSE: "collapse"
  14386. };
  14387. goog.ui.tree.BaseNode.allNodes = {};
  14388. goog.ui.tree.BaseNode.prototype.disposeInternal = function () {
  14389. goog.ui.tree.BaseNode.superClass_.disposeInternal.call(this);
  14390. this.tree && (this.tree.removeNode(this),
  14391. this.tree = null);
  14392. this.setElementInternal(null)
  14393. }
  14394. ;
  14395. goog.ui.tree.BaseNode.prototype.initAccessibility = function () {
  14396. var a = this.getElement();
  14397. if (a) {
  14398. var b = this.getLabelElement();
  14399. b && !b.id && (b.id = this.getId() + ".label");
  14400. goog.a11y.aria.setRole(a, "treeitem");
  14401. goog.a11y.aria.setState(a, "selected", !1);
  14402. goog.a11y.aria.setState(a, "level", this.getDepth());
  14403. b && goog.a11y.aria.setState(a, "labelledby", b.id);
  14404. (b = this.getIconElement()) && goog.a11y.aria.setRole(b, "presentation");
  14405. (b = this.getExpandIconElement()) && goog.a11y.aria.setRole(b, "presentation");
  14406. if (b = this.getChildrenElement())
  14407. if (goog.a11y.aria.setRole(b, "group"),
  14408. b.hasChildNodes())
  14409. for (goog.a11y.aria.setState(a, goog.a11y.aria.State.EXPANDED, !1),
  14410. a = this.getChildCount(),
  14411. b = 1; b <= a; b++) {
  14412. var c = this.getChildAt(b - 1).getElement();
  14413. goog.asserts.assert(c, "The child element cannot be null");
  14414. goog.a11y.aria.setState(c, "setsize", a);
  14415. goog.a11y.aria.setState(c, "posinset", b)
  14416. }
  14417. }
  14418. }
  14419. ;
  14420. goog.ui.tree.BaseNode.prototype.createDom = function () {
  14421. var a = this.getDomHelper().safeHtmlToNode(this.toSafeHtml());
  14422. this.setElementInternal(a)
  14423. }
  14424. ;
  14425. goog.ui.tree.BaseNode.prototype.enterDocument = function () {
  14426. goog.ui.tree.BaseNode.superClass_.enterDocument.call(this);
  14427. goog.ui.tree.BaseNode.allNodes[this.getId()] = this;
  14428. this.initAccessibility()
  14429. }
  14430. ;
  14431. goog.ui.tree.BaseNode.prototype.exitDocument = function () {
  14432. goog.ui.tree.BaseNode.superClass_.exitDocument.call(this);
  14433. delete goog.ui.tree.BaseNode.allNodes[this.getId()]
  14434. }
  14435. ;
  14436. goog.ui.tree.BaseNode.prototype.addChildAt = function (a, b, c) {
  14437. goog.asserts.assert(!a.getParent());
  14438. goog.asserts.assertInstanceof(a, goog.ui.tree.BaseNode);
  14439. c = this.getChildAt(b - 1);
  14440. var d = this.getChildAt(b);
  14441. goog.ui.tree.BaseNode.superClass_.addChildAt.call(this, a, b);
  14442. a.previousSibling_ = c;
  14443. a.nextSibling_ = d;
  14444. c ? c.nextSibling_ = a : this.firstChild_ = a;
  14445. d ? d.previousSibling_ = a : this.lastChild_ = a;
  14446. (b = this.getTree()) && a.setTreeInternal(b);
  14447. a.setDepth_(this.getDepth() + 1);
  14448. if (b = this.getElement())
  14449. if (this.updateExpandIcon(),
  14450. goog.a11y.aria.setState(b, goog.a11y.aria.State.EXPANDED, this.getExpanded()),
  14451. this.getExpanded()) {
  14452. b = this.getChildrenElement();
  14453. a.getElement() || a.createDom();
  14454. var e = a.getElement()
  14455. , f = d && d.getElement();
  14456. b.insertBefore(e, f);
  14457. this.isInDocument() && a.enterDocument();
  14458. d || (c ? c.updateExpandIcon() : (goog.style.setElementShown(b, !0),
  14459. this.setExpanded(this.getExpanded())))
  14460. }
  14461. }
  14462. ;
  14463. goog.ui.tree.BaseNode.prototype.add = function (a, b) {
  14464. goog.asserts.assert(!b || b.getParent() == this, "Can only add nodes before siblings");
  14465. a.getParent() && a.getParent().removeChild(a);
  14466. this.addChildAt(a, b ? this.indexOfChild(b) : this.getChildCount());
  14467. return a
  14468. }
  14469. ;
  14470. goog.ui.tree.BaseNode.prototype.removeChild = function (a, b) {
  14471. var c = this.getTree()
  14472. , d = c ? c.getSelectedItem() : null;
  14473. if (d == a || a.contains(d))
  14474. c.hasFocus() ? (this.select(),
  14475. goog.Timer.callOnce(this.onTimeoutSelect_, 10, this)) : this.select();
  14476. goog.ui.tree.BaseNode.superClass_.removeChild.call(this, a);
  14477. this.lastChild_ == a && (this.lastChild_ = a.previousSibling_);
  14478. this.firstChild_ == a && (this.firstChild_ = a.nextSibling_);
  14479. a.previousSibling_ && (a.previousSibling_.nextSibling_ = a.nextSibling_);
  14480. a.nextSibling_ && (a.nextSibling_.previousSibling_ = a.previousSibling_);
  14481. d = a.isLastSibling();
  14482. a.tree = null;
  14483. a.depth_ = -1;
  14484. if (c && (c.removeNode(a),
  14485. this.isInDocument())) {
  14486. c = this.getChildrenElement();
  14487. if (a.isInDocument()) {
  14488. var e = a.getElement();
  14489. c.removeChild(e);
  14490. a.exitDocument()
  14491. }
  14492. d && (d = this.getLastChild()) && d.updateExpandIcon();
  14493. this.hasChildren() || (c.style.display = "none",
  14494. this.updateExpandIcon(),
  14495. this.updateIcon_(),
  14496. (d = this.getElement()) && goog.a11y.aria.removeState(d, goog.a11y.aria.State.EXPANDED))
  14497. }
  14498. return a
  14499. }
  14500. ;
  14501. goog.ui.tree.BaseNode.prototype.remove = goog.ui.tree.BaseNode.prototype.removeChild;
  14502. goog.ui.tree.BaseNode.prototype.onTimeoutSelect_ = function () {
  14503. this.select()
  14504. }
  14505. ;
  14506. goog.ui.tree.BaseNode.prototype.getTree = goog.abstractMethod;
  14507. goog.ui.tree.BaseNode.prototype.getDepth = function () {
  14508. var a = this.depth_;
  14509. 0 > a && (a = this.computeDepth_(),
  14510. this.setDepth_(a));
  14511. return a
  14512. }
  14513. ;
  14514. goog.ui.tree.BaseNode.prototype.computeDepth_ = function () {
  14515. var a = this.getParent();
  14516. return a ? a.getDepth() + 1 : 0
  14517. }
  14518. ;
  14519. goog.ui.tree.BaseNode.prototype.setDepth_ = function (a) {
  14520. if (a != this.depth_) {
  14521. this.depth_ = a;
  14522. var b = this.getRowElement();
  14523. if (b) {
  14524. var c = this.getPixelIndent_() + "px";
  14525. this.isRightToLeft() ? b.style.paddingRight = c : b.style.paddingLeft = c
  14526. }
  14527. this.forEachChild(function (b) {
  14528. b.setDepth_(a + 1)
  14529. })
  14530. }
  14531. }
  14532. ;
  14533. goog.ui.tree.BaseNode.prototype.contains = function (a) {
  14534. for (; a;) {
  14535. if (a == this)
  14536. return !0;
  14537. a = a.getParent()
  14538. }
  14539. return !1
  14540. }
  14541. ;
  14542. goog.ui.tree.BaseNode.EMPTY_CHILDREN_ = [];
  14543. goog.ui.tree.BaseNode.prototype.getChildren = function () {
  14544. var a = [];
  14545. this.forEachChild(function (b) {
  14546. a.push(b)
  14547. });
  14548. return a
  14549. }
  14550. ;
  14551. goog.ui.tree.BaseNode.prototype.getFirstChild = function () {
  14552. return this.getChildAt(0)
  14553. }
  14554. ;
  14555. goog.ui.tree.BaseNode.prototype.getLastChild = function () {
  14556. return this.getChildAt(this.getChildCount() - 1)
  14557. }
  14558. ;
  14559. goog.ui.tree.BaseNode.prototype.getPreviousSibling = function () {
  14560. return this.previousSibling_
  14561. }
  14562. ;
  14563. goog.ui.tree.BaseNode.prototype.getNextSibling = function () {
  14564. return this.nextSibling_
  14565. }
  14566. ;
  14567. goog.ui.tree.BaseNode.prototype.isLastSibling = function () {
  14568. return !this.nextSibling_
  14569. }
  14570. ;
  14571. goog.ui.tree.BaseNode.prototype.isSelected = function () {
  14572. return this.selected_;
  14573. }
  14574. ;
  14575. goog.ui.tree.BaseNode.prototype.select = function () {
  14576. var a = this.getTree();
  14577. a && a.setSelectedItem(this)
  14578. }
  14579. ;
  14580. goog.ui.tree.BaseNode.prototype.deselect = goog.nullFunction;
  14581. goog.ui.tree.BaseNode.prototype.setSelectedInternal = function (a) {
  14582. if (this.selected_ != a) {
  14583. this.selected_ = a;
  14584. this.updateRow();
  14585. var b = this.getElement();
  14586. b && (goog.a11y.aria.setState(b, "selected", a),
  14587. a && (a = this.getTree().getElement(),
  14588. goog.asserts.assert(a, "The DOM element for the tree cannot be null"),
  14589. goog.a11y.aria.setState(a, "activedescendant", this.getId())))
  14590. }
  14591. }
  14592. ;
  14593. goog.ui.tree.BaseNode.prototype.getExpanded = function () {
  14594. return this.expanded_
  14595. }
  14596. ;
  14597. goog.ui.tree.BaseNode.prototype.setExpandedInternal = function (a) {
  14598. this.expanded_ = a
  14599. }
  14600. ;
  14601. goog.ui.tree.BaseNode.prototype.setExpanded = function (a) {
  14602. var b = a != this.expanded_;
  14603. if (!b || this.dispatchEvent(a ? goog.ui.tree.BaseNode.EventType.BEFORE_EXPAND : goog.ui.tree.BaseNode.EventType.BEFORE_COLLAPSE)) {
  14604. this.expanded_ = a;
  14605. var c = this.getTree();
  14606. var d = this.getElement();
  14607. if (this.hasChildren()) {
  14608. if (!a && c && this.contains(c.getSelectedItem()) && this.select(),
  14609. d) {
  14610. if (c = this.getChildrenElement())
  14611. if (goog.style.setElementShown(c, a),
  14612. goog.a11y.aria.setState(d, goog.a11y.aria.State.EXPANDED, a),
  14613. a && this.isInDocument() && !c.hasChildNodes()) {
  14614. var e = [];
  14615. this.forEachChild(function (a) {
  14616. e.push(a.toSafeHtml())
  14617. });
  14618. goog.dom.safe.setInnerHtml(c, goog.html.SafeHtml.concat(e));
  14619. this.forEachChild(function (a) {
  14620. a.enterDocument()
  14621. })
  14622. }
  14623. this.updateExpandIcon()
  14624. }
  14625. } else
  14626. (c = this.getChildrenElement()) && goog.style.setElementShown(c, !1);
  14627. d && this.updateIcon_();
  14628. b && this.dispatchEvent(a ? goog.ui.tree.BaseNode.EventType.EXPAND : goog.ui.tree.BaseNode.EventType.COLLAPSE)
  14629. }
  14630. }
  14631. ;
  14632. goog.ui.tree.BaseNode.prototype.toggle = function () {
  14633. this.setExpanded(!this.getExpanded())
  14634. }
  14635. ;
  14636. goog.ui.tree.BaseNode.prototype.expand = function () {
  14637. this.setExpanded(!0)
  14638. }
  14639. ;
  14640. goog.ui.tree.BaseNode.prototype.collapse = function () {
  14641. this.setExpanded(!1)
  14642. }
  14643. ;
  14644. goog.ui.tree.BaseNode.prototype.collapseChildren = function () {
  14645. this.forEachChild(function (a) {
  14646. a.collapseAll()
  14647. })
  14648. }
  14649. ;
  14650. goog.ui.tree.BaseNode.prototype.collapseAll = function () {
  14651. this.collapseChildren();
  14652. this.collapse()
  14653. }
  14654. ;
  14655. goog.ui.tree.BaseNode.prototype.expandChildren = function () {
  14656. this.forEachChild(function (a) {
  14657. a.expandAll()
  14658. })
  14659. }
  14660. ;
  14661. goog.ui.tree.BaseNode.prototype.expandAll = function () {
  14662. this.expandChildren();
  14663. this.expand()
  14664. }
  14665. ;
  14666. goog.ui.tree.BaseNode.prototype.reveal = function () {
  14667. var a = this.getParent();
  14668. a && (a.setExpanded(!0),
  14669. a.reveal())
  14670. }
  14671. ;
  14672. goog.ui.tree.BaseNode.prototype.setIsUserCollapsible = function (a) {
  14673. (this.isUserCollapsible_ = a) || this.expand();
  14674. this.getElement() && this.updateExpandIcon()
  14675. }
  14676. ;
  14677. goog.ui.tree.BaseNode.prototype.isUserCollapsible = function () {
  14678. return this.isUserCollapsible_
  14679. }
  14680. ;
  14681. goog.ui.tree.BaseNode.prototype.toSafeHtml = function () {
  14682. var a = this.getTree()
  14683. , b = !a.getShowLines() || a == this.getParent() && !a.getShowRootLines() ? this.config_.cssChildrenNoLines : this.config_.cssChildren;
  14684. a = this.getExpanded() && this.hasChildren();
  14685. b = {
  14686. "class": b,
  14687. style: this.getLineStyle()
  14688. };
  14689. var c = [];
  14690. a && this.forEachChild(function (a) {
  14691. c.push(a.toSafeHtml())
  14692. });
  14693. a = goog.html.SafeHtml.create("div", b, c);
  14694. return goog.html.SafeHtml.create("div", {
  14695. "class": this.config_.cssItem,
  14696. id: this.getId()
  14697. }, [this.getRowSafeHtml(), a])
  14698. }
  14699. ;
  14700. goog.ui.tree.BaseNode.prototype.getPixelIndent_ = function () {
  14701. return Math.max(0, (this.getDepth() - 1) * this.config_.indentWidth)
  14702. }
  14703. ;
  14704. goog.ui.tree.BaseNode.prototype.getRowSafeHtml = function () {
  14705. var a = {};
  14706. a["padding-" + (this.isRightToLeft() ? "right" : "left")] = this.getPixelIndent_() + "px";
  14707. if (this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.ExtendedFunction || this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.catMainBoard || this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.catAI || this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.IOT || this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.System || this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.AI) { a["background"] = this.hexColour; }
  14708. a = {
  14709. "class": this.getRowClassName(),
  14710. style: a
  14711. };
  14712. var b = [this.getExpandIconSafeHtml(), this.getIconSafeHtml(), this.getLabelSafeHtml()];
  14713. return goog.html.SafeHtml.create("div", a, b)
  14714. }
  14715. ;
  14716. goog.ui.tree.BaseNode.prototype.getRowClassName = function () {
  14717. var a = this.isSelected() ? " " + this.config_.cssSelectedRow : "";
  14718. return this.config_.cssTreeRow + a
  14719. }
  14720. ;
  14721. goog.ui.tree.BaseNode.prototype.getLabelSafeHtml = function () {
  14722. var a = goog.html.SafeHtml.create("span", {
  14723. "class": this.config_.cssItemLabel,
  14724. title: this.getToolTip() || null
  14725. }, this.getSafeHtml());
  14726. return goog.html.SafeHtml.concat(a, goog.html.SafeHtml.create("span", {}, this.getAfterLabelSafeHtml()))
  14727. }
  14728. ;
  14729. goog.ui.tree.BaseNode.prototype.getAfterLabelHtml = function () {
  14730. return goog.html.SafeHtml.unwrap(this.getAfterLabelSafeHtml())
  14731. }
  14732. ;
  14733. goog.ui.tree.BaseNode.prototype.getAfterLabelSafeHtml = function () {
  14734. return this.afterLabelHtml_
  14735. }
  14736. ;
  14737. goog.ui.tree.BaseNode.prototype.setAfterLabelSafeHtml = function (a) {
  14738. this.afterLabelHtml_ = a;
  14739. var b = this.getAfterLabelElement();
  14740. b && goog.dom.safe.setInnerHtml(b, a)
  14741. }
  14742. ;
  14743. goog.ui.tree.BaseNode.prototype.getIconSafeHtml = function () {
  14744. return goog.html.SafeHtml.create("span", {
  14745. style: {
  14746. display: "inline-block"
  14747. },
  14748. "class": this.getCalculatedIconClass()
  14749. })
  14750. }
  14751. ;
  14752. goog.ui.tree.BaseNode.prototype.getCalculatedIconClass = goog.abstractMethod;
  14753. goog.ui.tree.BaseNode.prototype.getExpandIconSafeHtml = function () {
  14754. return goog.html.SafeHtml.create("span", {
  14755. type: "expand",
  14756. style: {
  14757. display: "inline-block"
  14758. },
  14759. "class": this.getExpandIconClass()
  14760. })
  14761. }
  14762. ;
  14763. goog.ui.tree.BaseNode.prototype.getExpandIconClass = function () {
  14764. var a = this.getTree()
  14765. , b = !a.getShowLines() || a == this.getParent() && !a.getShowRootLines()
  14766. , c = this.config_
  14767. , d = new goog.string.StringBuffer;
  14768. d.append(c.cssTreeIcon, " ", c.cssExpandTreeIcon, " ");
  14769. if (this.hasChildren()) {
  14770. var e = 0;
  14771. a.getShowExpandIcons() && this.isUserCollapsible_ && (e = this.getExpanded() ? 2 : 1);
  14772. b || (e = this.isLastSibling() ? e + 4 : e + 8);
  14773. switch (e) {
  14774. case 1:
  14775. d.append(c.cssExpandTreeIconPlus);
  14776. break;
  14777. case 2:
  14778. d.append(c.cssExpandTreeIconMinus);
  14779. break;
  14780. case 4:
  14781. d.append(c.cssExpandTreeIconL);
  14782. break;
  14783. case 5:
  14784. d.append(c.cssExpandTreeIconLPlus);
  14785. break;
  14786. case 6:
  14787. d.append(c.cssExpandTreeIconLMinus);
  14788. break;
  14789. case 8:
  14790. d.append(c.cssExpandTreeIconT);
  14791. break;
  14792. case 9:
  14793. d.append(c.cssExpandTreeIconTPlus);
  14794. break;
  14795. case 10:
  14796. d.append(c.cssExpandTreeIconTMinus);
  14797. break;
  14798. default:
  14799. d.append(c.cssExpandTreeIconBlank)
  14800. }
  14801. } else
  14802. b ? d.append(c.cssExpandTreeIconBlank) : this.isLastSibling() ? d.append(c.cssExpandTreeIconL) : d.append(c.cssExpandTreeIconT);
  14803. return d.toString()
  14804. }
  14805. ;
  14806. goog.ui.tree.BaseNode.prototype.getLineStyle = function () {
  14807. var a = this.getExpanded() && this.hasChildren();
  14808. return goog.html.SafeStyle.create({
  14809. "background-position": this.getBackgroundPosition(),
  14810. display: a ? null : "none"
  14811. })
  14812. }
  14813. ;
  14814. goog.ui.tree.BaseNode.prototype.getBackgroundPosition = function () {
  14815. return (this.isLastSibling() ? "-100" : (this.getDepth() - 1) * this.config_.indentWidth) + "px 0"
  14816. }
  14817. ;
  14818. goog.ui.tree.BaseNode.prototype.getElement = function () {
  14819. var a = goog.ui.tree.BaseNode.superClass_.getElement.call(this);
  14820. a || (a = this.getDomHelper().getElement(this.getId()),
  14821. this.setElementInternal(a));
  14822. return a
  14823. }
  14824. ;
  14825. goog.ui.tree.BaseNode.prototype.getRowElement = function () {
  14826. var a = this.getElement();
  14827. return a ? a.firstChild : null
  14828. }
  14829. ;
  14830. goog.ui.tree.BaseNode.prototype.getExpandIconElement = function () {
  14831. var a = this.getRowElement();
  14832. return a ? a.firstChild : null
  14833. }
  14834. ;
  14835. goog.ui.tree.BaseNode.prototype.getIconElement = function () {
  14836. var a = this.getRowElement();
  14837. return a ? a.childNodes[1] : null
  14838. }
  14839. ;
  14840. goog.ui.tree.BaseNode.prototype.getLabelElement = function () {
  14841. var a = this.getRowElement();
  14842. return a && a.lastChild ? a.lastChild.previousSibling : null
  14843. }
  14844. ;
  14845. goog.ui.tree.BaseNode.prototype.getAfterLabelElement = function () {
  14846. var a = this.getRowElement();
  14847. return a ? a.lastChild : null
  14848. }
  14849. ;
  14850. goog.ui.tree.BaseNode.prototype.getChildrenElement = function () {
  14851. var a = this.getElement();
  14852. return a ? a.lastChild : null
  14853. }
  14854. ;
  14855. goog.ui.tree.BaseNode.prototype.setIconClass = function (a) {
  14856. this.iconClass_ = a;
  14857. this.isInDocument() && this.updateIcon_()
  14858. }
  14859. ;
  14860. goog.ui.tree.BaseNode.prototype.getIconClass = function () {
  14861. return this.iconClass_
  14862. }
  14863. ;
  14864. goog.ui.tree.BaseNode.prototype.setExpandedIconClass = function (a) {
  14865. this.expandedIconClass_ = a;
  14866. this.isInDocument() && this.updateIcon_()
  14867. }
  14868. ;
  14869. goog.ui.tree.BaseNode.prototype.getExpandedIconClass = function () {
  14870. return this.expandedIconClass_
  14871. }
  14872. ;
  14873. goog.ui.tree.BaseNode.prototype.setText = function (a) {
  14874. this.setSafeHtml(goog.html.SafeHtml.htmlEscape(a))
  14875. }
  14876. ;
  14877. goog.ui.tree.BaseNode.prototype.getText = function () {
  14878. return goog.string.unescapeEntities(goog.html.SafeHtml.unwrap(this.html_))
  14879. }
  14880. ;
  14881. goog.ui.tree.BaseNode.prototype.setSafeHtml = function (a) {
  14882. this.html_ = a;
  14883. var b = this.getLabelElement();
  14884. b && goog.dom.safe.setInnerHtml(b, a);
  14885. (a = this.getTree()) && a.setNode(this)
  14886. }
  14887. ;
  14888. goog.ui.tree.BaseNode.prototype.getHtml = function () {
  14889. return goog.html.SafeHtml.unwrap(this.getSafeHtml())
  14890. }
  14891. ;
  14892. goog.ui.tree.BaseNode.prototype.getSafeHtml = function () {
  14893. return this.html_
  14894. }
  14895. ;
  14896. goog.ui.tree.BaseNode.prototype.setToolTip = function (a) {
  14897. this.toolTip_ = a;
  14898. var b = this.getLabelElement();
  14899. b && (b.title = a)
  14900. }
  14901. ;
  14902. goog.ui.tree.BaseNode.prototype.getToolTip = function () {
  14903. return this.toolTip_
  14904. }
  14905. ;
  14906. goog.ui.tree.BaseNode.prototype.updateRow = function () {
  14907. var a = this.getRowElement();
  14908. a && (a.className = this.getRowClassName())
  14909. }
  14910. ;
  14911. goog.ui.tree.BaseNode.prototype.updateExpandIcon = function () {
  14912. var a = this.getExpandIconElement();
  14913. a && (a.className = this.getExpandIconClass());
  14914. if (a = this.getChildrenElement())
  14915. a.style.backgroundPosition = this.getBackgroundPosition()
  14916. }
  14917. ;
  14918. goog.ui.tree.BaseNode.prototype.updateIcon_ = function () {
  14919. this.getIconElement().className = this.getCalculatedIconClass()
  14920. }
  14921. ;
  14922. goog.ui.tree.BaseNode.prototype.onMouseDown = function (a) {
  14923. "expand" == a.target.getAttribute("type") && this.hasChildren() ? this.isUserCollapsible_ && this.toggle() : (this.select(),
  14924. this.updateRow())
  14925. }
  14926. ;
  14927. goog.ui.tree.BaseNode.prototype.onClick_ = goog.events.Event.preventDefault;
  14928. goog.ui.tree.BaseNode.prototype.onDoubleClick_ = function (a) {
  14929. "expand" == a.target.getAttribute("type") && this.hasChildren() || this.isUserCollapsible_ && this.toggle()
  14930. }
  14931. ;
  14932. goog.ui.tree.BaseNode.prototype.onKeyDown = function (a) {
  14933. var b = !0;
  14934. switch (a.keyCode) {
  14935. case goog.events.KeyCodes.RIGHT:
  14936. if (a.altKey)
  14937. break;
  14938. this.hasChildren() && (this.getExpanded() ? this.getFirstChild().select() : this.setExpanded(!0));
  14939. break;
  14940. case goog.events.KeyCodes.LEFT:
  14941. if (a.altKey)
  14942. break;
  14943. if (this.hasChildren() && this.getExpanded() && this.isUserCollapsible_)
  14944. this.setExpanded(!1);
  14945. else {
  14946. var c = this.getParent()
  14947. , d = this.getTree();
  14948. c && (d.getShowRootNode() || c != d) && c.select()
  14949. }
  14950. break;
  14951. case goog.events.KeyCodes.DOWN:
  14952. (c = this.getNextShownNode()) && c.select();
  14953. break;
  14954. case goog.events.KeyCodes.UP:
  14955. (c = this.getPreviousShownNode()) && c.select();
  14956. break;
  14957. default:
  14958. b = !1
  14959. }
  14960. b && (a.preventDefault(),
  14961. (d = this.getTree()) && d.clearTypeAhead());
  14962. return b
  14963. }
  14964. ;
  14965. goog.ui.tree.BaseNode.prototype.getLastShownDescendant = function () {
  14966. return this.getExpanded() && this.hasChildren() ? this.getLastChild().getLastShownDescendant() : this
  14967. }
  14968. ;
  14969. goog.ui.tree.BaseNode.prototype.getNextShownNode = function () {
  14970. if (this.hasChildren() && this.getExpanded())
  14971. return this.getFirstChild();
  14972. for (var a = this, b; a != this.getTree();) {
  14973. b = a.getNextSibling();
  14974. if (null != b)
  14975. return b;
  14976. a = a.getParent()
  14977. }
  14978. return null
  14979. }
  14980. ;
  14981. goog.ui.tree.BaseNode.prototype.getPreviousShownNode = function () {
  14982. var a = this.getPreviousSibling();
  14983. if (null != a)
  14984. return a.getLastShownDescendant();
  14985. a = this.getParent();
  14986. var b = this.getTree();
  14987. return !b.getShowRootNode() && a == b || this == b ? null : a
  14988. }
  14989. ;
  14990. goog.ui.tree.BaseNode.prototype.getClientData = goog.ui.tree.BaseNode.prototype.getModel;
  14991. goog.ui.tree.BaseNode.prototype.setClientData = goog.ui.tree.BaseNode.prototype.setModel;
  14992. goog.ui.tree.BaseNode.prototype.getConfig = function () {
  14993. return this.config_
  14994. }
  14995. ;
  14996. goog.ui.tree.BaseNode.prototype.setTreeInternal = function (a) {
  14997. this.tree != a && (this.tree = a,
  14998. a.setNode(this),
  14999. this.forEachChild(function (b) {
  15000. b.setTreeInternal(a)
  15001. }))
  15002. }
  15003. ;
  15004. goog.ui.tree.BaseNode.defaultConfig = {
  15005. indentWidth: 19,
  15006. cssRoot: "goog-tree-root goog-tree-item",
  15007. cssHideRoot: "goog-tree-hide-root",
  15008. cssItem: "goog-tree-item",
  15009. cssChildren: "goog-tree-children",
  15010. cssChildrenNoLines: "goog-tree-children-nolines",
  15011. cssTreeRow: "goog-tree-row",
  15012. cssItemLabel: "goog-tree-item-label",
  15013. cssTreeIcon: "goog-tree-icon",
  15014. cssExpandTreeIcon: "goog-tree-expand-icon",
  15015. cssExpandTreeIconPlus: "goog-tree-expand-icon-plus",
  15016. cssExpandTreeIconMinus: "goog-tree-expand-icon-minus",
  15017. cssExpandTreeIconTPlus: "goog-tree-expand-icon-tplus",
  15018. cssExpandTreeIconTMinus: "goog-tree-expand-icon-tminus",
  15019. cssExpandTreeIconLPlus: "goog-tree-expand-icon-lplus",
  15020. cssExpandTreeIconLMinus: "goog-tree-expand-icon-lminus",
  15021. cssExpandTreeIconT: "goog-tree-expand-icon-t",
  15022. cssExpandTreeIconL: "goog-tree-expand-icon-l",
  15023. cssExpandTreeIconBlank: "goog-tree-expand-icon-blank",
  15024. cssExpandedFolderIcon: "goog-tree-expanded-folder-icon",
  15025. cssCollapsedFolderIcon: "goog-tree-collapsed-folder-icon",
  15026. cssFileIcon: "goog-tree-file-icon",
  15027. cssExpandedRootIcon: "goog-tree-expanded-folder-icon",
  15028. cssCollapsedRootIcon: "goog-tree-collapsed-folder-icon",
  15029. cssSelectedRow: "selected"
  15030. };
  15031. goog.ui.tree.TreeNode = function (a, b, c) {
  15032. goog.ui.tree.BaseNode.call(this, a, b, c)
  15033. }
  15034. ;
  15035. goog.inherits(goog.ui.tree.TreeNode, goog.ui.tree.BaseNode);
  15036. goog.ui.tree.TreeNode.prototype.getTree = function () {
  15037. if (this.tree)
  15038. return this.tree;
  15039. var a = this.getParent();
  15040. return a && (a = a.getTree()) ? (this.setTreeInternal(a),
  15041. a) : null
  15042. }
  15043. ;
  15044. goog.ui.tree.TreeNode.prototype.getCalculatedIconClass = function () {
  15045. var a = this.getExpanded()
  15046. , b = this.getExpandedIconClass();
  15047. if (a && b)
  15048. return b;
  15049. b = this.getIconClass();
  15050. if (!a && b)
  15051. return b;
  15052. b = this.getConfig();
  15053. if (this.hasChildren()) {
  15054. if (a && b.cssExpandedFolderIcon)
  15055. return b.cssTreeIcon + " " + b.cssExpandedFolderIcon;
  15056. if (!a && b.cssCollapsedFolderIcon)
  15057. return b.cssTreeIcon + " " + b.cssCollapsedFolderIcon
  15058. } else if (b.cssFileIcon)
  15059. return b.cssTreeIcon + " " + b.cssFileIcon;
  15060. return ""
  15061. }
  15062. ;
  15063. goog.structs = {};
  15064. goog.structs.getCount = function (a) {
  15065. return a.getCount && "function" == typeof a.getCount ? a.getCount() : goog.isArrayLike(a) || "string" === typeof a ? a.length : goog.object.getCount(a)
  15066. }
  15067. ;
  15068. goog.structs.getValues = function (a) {
  15069. if (a.getValues && "function" == typeof a.getValues)
  15070. return a.getValues();
  15071. if ("string" === typeof a)
  15072. return a.split("");
  15073. if (goog.isArrayLike(a)) {
  15074. for (var b = [], c = a.length, d = 0; d < c; d++)
  15075. b.push(a[d]);
  15076. return b
  15077. }
  15078. return goog.object.getValues(a)
  15079. }
  15080. ;
  15081. goog.structs.getKeys = function (a) {
  15082. if (a.getKeys && "function" == typeof a.getKeys)
  15083. return a.getKeys();
  15084. if (!a.getValues || "function" != typeof a.getValues) {
  15085. if (goog.isArrayLike(a) || "string" === typeof a) {
  15086. var b = [];
  15087. a = a.length;
  15088. for (var c = 0; c < a; c++)
  15089. b.push(c);
  15090. return b
  15091. }
  15092. return goog.object.getKeys(a)
  15093. }
  15094. }
  15095. ;
  15096. goog.structs.contains = function (a, b) {
  15097. return a.contains && "function" == typeof a.contains ? a.contains(b) : a.containsValue && "function" == typeof a.containsValue ? a.containsValue(b) : goog.isArrayLike(a) || "string" === typeof a ? goog.array.contains(a, b) : goog.object.containsValue(a, b)
  15098. }
  15099. ;
  15100. goog.structs.isEmpty = function (a) {
  15101. return a.isEmpty && "function" == typeof a.isEmpty ? a.isEmpty() : goog.isArrayLike(a) || "string" === typeof a ? goog.array.isEmpty(a) : goog.object.isEmpty(a)
  15102. }
  15103. ;
  15104. goog.structs.clear = function (a) {
  15105. a.clear && "function" == typeof a.clear ? a.clear() : goog.isArrayLike(a) ? goog.array.clear(a) : goog.object.clear(a)
  15106. }
  15107. ;
  15108. goog.structs.forEach = function (a, b, c) {
  15109. if (a.forEach && "function" == typeof a.forEach)
  15110. a.forEach(b, c);
  15111. else if (goog.isArrayLike(a) || "string" === typeof a)
  15112. goog.array.forEach(a, b, c);
  15113. else
  15114. for (var d = goog.structs.getKeys(a), e = goog.structs.getValues(a), f = e.length, g = 0; g < f; g++)
  15115. b.call(c, e[g], d && d[g], a)
  15116. }
  15117. ;
  15118. goog.structs.filter = function (a, b, c) {
  15119. if ("function" == typeof a.filter)
  15120. return a.filter(b, c);
  15121. if (goog.isArrayLike(a) || "string" === typeof a)
  15122. return goog.array.filter(a, b, c);
  15123. var d = goog.structs.getKeys(a)
  15124. , e = goog.structs.getValues(a)
  15125. , f = e.length;
  15126. if (d) {
  15127. var g = {};
  15128. for (var h = 0; h < f; h++)
  15129. b.call(c, e[h], d[h], a) && (g[d[h]] = e[h])
  15130. } else
  15131. for (g = [],
  15132. h = 0; h < f; h++)
  15133. b.call(c, e[h], void 0, a) && g.push(e[h]);
  15134. return g
  15135. }
  15136. ;
  15137. goog.structs.map = function (a, b, c) {
  15138. if ("function" == typeof a.map)
  15139. return a.map(b, c);
  15140. if (goog.isArrayLike(a) || "string" === typeof a)
  15141. return goog.array.map(a, b, c);
  15142. var d = goog.structs.getKeys(a)
  15143. , e = goog.structs.getValues(a)
  15144. , f = e.length;
  15145. if (d) {
  15146. var g = {};
  15147. for (var h = 0; h < f; h++)
  15148. g[d[h]] = b.call(c, e[h], d[h], a)
  15149. } else
  15150. for (g = [],
  15151. h = 0; h < f; h++)
  15152. g[h] = b.call(c, e[h], void 0, a);
  15153. return g
  15154. }
  15155. ;
  15156. goog.structs.some = function (a, b, c) {
  15157. if ("function" == typeof a.some)
  15158. return a.some(b, c);
  15159. if (goog.isArrayLike(a) || "string" === typeof a)
  15160. return goog.array.some(a, b, c);
  15161. for (var d = goog.structs.getKeys(a), e = goog.structs.getValues(a), f = e.length, g = 0; g < f; g++)
  15162. if (b.call(c, e[g], d && d[g], a))
  15163. return !0;
  15164. return !1
  15165. }
  15166. ;
  15167. goog.structs.every = function (a, b, c) {
  15168. if ("function" == typeof a.every)
  15169. return a.every(b, c);
  15170. if (goog.isArrayLike(a) || "string" === typeof a)
  15171. return goog.array.every(a, b, c);
  15172. for (var d = goog.structs.getKeys(a), e = goog.structs.getValues(a), f = e.length, g = 0; g < f; g++)
  15173. if (!b.call(c, e[g], d && d[g], a))
  15174. return !1;
  15175. return !0
  15176. }
  15177. ;
  15178. goog.structs.Trie = function (a) {
  15179. this.value_ = void 0;
  15180. this.childNodes_ = {};
  15181. a && this.setAll(a)
  15182. }
  15183. ;
  15184. goog.structs.Trie.prototype.set = function (a, b) {
  15185. this.setOrAdd_(a, b, !1)
  15186. }
  15187. ;
  15188. goog.structs.Trie.prototype.add = function (a, b) {
  15189. this.setOrAdd_(a, b, !0)
  15190. }
  15191. ;
  15192. goog.structs.Trie.prototype.setOrAdd_ = function (a, b, c) {
  15193. for (var d = this, e = 0; e < a.length; e++) {
  15194. var f = a.charAt(e);
  15195. d.childNodes_[f] || (d.childNodes_[f] = new goog.structs.Trie);
  15196. d = d.childNodes_[f]
  15197. }
  15198. if (c && void 0 !== d.value_)
  15199. throw Error('The collection already contains the key "' + a + '"');
  15200. d.value_ = b
  15201. }
  15202. ;
  15203. goog.structs.Trie.prototype.setAll = function (a) {
  15204. var b = goog.structs.getKeys(a);
  15205. a = goog.structs.getValues(a);
  15206. for (var c = 0; c < b.length; c++)
  15207. this.set(b[c], a[c])
  15208. }
  15209. ;
  15210. goog.structs.Trie.prototype.getChildNode_ = function (a) {
  15211. for (var b = this, c = 0; c < a.length; c++) {
  15212. var d = a.charAt(c);
  15213. b = b.childNodes_[d];
  15214. if (!b)
  15215. return
  15216. }
  15217. return b
  15218. }
  15219. ;
  15220. goog.structs.Trie.prototype.get = function (a) {
  15221. return (a = this.getChildNode_(a)) ? a.value_ : void 0
  15222. }
  15223. ;
  15224. goog.structs.Trie.prototype.getKeyAndPrefixes = function (a, b) {
  15225. var c = this
  15226. , d = {}
  15227. , e = b || 0;
  15228. void 0 !== c.value_ && (d[e] = c.value_);
  15229. for (; e < a.length; e++) {
  15230. var f = a.charAt(e);
  15231. if (!(f in c.childNodes_))
  15232. break;
  15233. c = c.childNodes_[f];
  15234. void 0 !== c.value_ && (d[e] = c.value_)
  15235. }
  15236. return d
  15237. }
  15238. ;
  15239. goog.structs.Trie.prototype.getValues = function () {
  15240. var a = [];
  15241. this.getValuesInternal_(a);
  15242. return a
  15243. }
  15244. ;
  15245. goog.structs.Trie.prototype.getValuesInternal_ = function (a) {
  15246. void 0 !== this.value_ && a.push(this.value_);
  15247. for (var b in this.childNodes_)
  15248. this.childNodes_[b].getValuesInternal_(a)
  15249. }
  15250. ;
  15251. goog.structs.Trie.prototype.getKeys = function (a) {
  15252. var b = [];
  15253. if (a) {
  15254. for (var c = this, d = 0; d < a.length; d++) {
  15255. var e = a.charAt(d);
  15256. if (!c.childNodes_[e])
  15257. return [];
  15258. c = c.childNodes_[e]
  15259. }
  15260. c.getKeysInternal_(a, b)
  15261. } else
  15262. this.getKeysInternal_("", b);
  15263. return b
  15264. }
  15265. ;
  15266. goog.structs.Trie.prototype.getKeysInternal_ = function (a, b) {
  15267. void 0 !== this.value_ && b.push(a);
  15268. for (var c in this.childNodes_)
  15269. this.childNodes_[c].getKeysInternal_(a + c, b)
  15270. }
  15271. ;
  15272. goog.structs.Trie.prototype.containsKey = function (a) {
  15273. return void 0 !== this.get(a)
  15274. }
  15275. ;
  15276. goog.structs.Trie.prototype.containsPrefix = function (a) {
  15277. return 0 == a.length ? !this.isEmpty() : !!this.getChildNode_(a)
  15278. }
  15279. ;
  15280. goog.structs.Trie.prototype.containsValue = function (a) {
  15281. if (this.value_ === a)
  15282. return !0;
  15283. for (var b in this.childNodes_)
  15284. if (this.childNodes_[b].containsValue(a))
  15285. return !0;
  15286. return !1
  15287. }
  15288. ;
  15289. goog.structs.Trie.prototype.clear = function () {
  15290. this.childNodes_ = {};
  15291. this.value_ = void 0
  15292. }
  15293. ;
  15294. goog.structs.Trie.prototype.remove = function (a) {
  15295. for (var b = this, c = [], d = 0; d < a.length; d++) {
  15296. var e = a.charAt(d);
  15297. if (!b.childNodes_[e])
  15298. throw Error('The collection does not have the key "' + a + '"');
  15299. c.push([b, e]);
  15300. b = b.childNodes_[e]
  15301. }
  15302. a = b.value_;
  15303. for (delete b.value_; 0 < c.length;)
  15304. if (e = c.pop(),
  15305. b = e[0],
  15306. e = e[1],
  15307. b.childNodes_[e].isEmpty())
  15308. delete b.childNodes_[e];
  15309. else
  15310. break;
  15311. return a
  15312. }
  15313. ;
  15314. goog.structs.Trie.prototype.clone = function () {
  15315. return new goog.structs.Trie(this)
  15316. }
  15317. ;
  15318. goog.structs.Trie.prototype.getCount = function () {
  15319. return goog.structs.getCount(this.getValues())
  15320. }
  15321. ;
  15322. goog.structs.Trie.prototype.isEmpty = function () {
  15323. return void 0 === this.value_ && goog.object.isEmpty(this.childNodes_)
  15324. }
  15325. ;
  15326. goog.ui.tree.TypeAhead = function () {
  15327. this.nodeMap_ = new goog.structs.Trie;
  15328. this.buffer_ = "";
  15329. this.matchingNodes_ = this.matchingLabels_ = null;
  15330. this.matchingNodeIndex_ = this.matchingLabelIndex_ = 0
  15331. }
  15332. ;
  15333. goog.ui.tree.TypeAhead.Offset = {
  15334. DOWN: 1,
  15335. UP: -1
  15336. };
  15337. goog.ui.tree.TypeAhead.prototype.handleNavigation = function (a) {
  15338. var b = !1;
  15339. switch (a.keyCode) {
  15340. case goog.events.KeyCodes.DOWN:
  15341. case goog.events.KeyCodes.UP:
  15342. a.ctrlKey && (this.jumpTo_(a.keyCode == goog.events.KeyCodes.DOWN ? goog.ui.tree.TypeAhead.Offset.DOWN : goog.ui.tree.TypeAhead.Offset.UP),
  15343. b = !0);
  15344. break;
  15345. case goog.events.KeyCodes.BACKSPACE:
  15346. a = this.buffer_.length - 1;
  15347. b = !0;
  15348. 0 < a ? (this.buffer_ = this.buffer_.substring(0, a),
  15349. this.jumpToLabel_(this.buffer_)) : 0 == a ? this.buffer_ = "" : b = !1;
  15350. break;
  15351. case goog.events.KeyCodes.ESC:
  15352. this.buffer_ = "",
  15353. b = !0
  15354. }
  15355. return b
  15356. }
  15357. ;
  15358. goog.ui.tree.TypeAhead.prototype.handleTypeAheadChar = function (a) {
  15359. var b = !1;
  15360. a.ctrlKey || a.altKey || (a = String.fromCharCode(a.charCode || a.keyCode).toLowerCase(),
  15361. goog.string.isUnicodeChar(a) && (" " != a || this.buffer_) && (this.buffer_ += a,
  15362. b = this.jumpToLabel_(this.buffer_)));
  15363. return b
  15364. }
  15365. ;
  15366. goog.ui.tree.TypeAhead.prototype.setNodeInMap = function (a) {
  15367. var b = a.getText();
  15368. if (b && !goog.string.isEmptyOrWhitespace(goog.string.makeSafe(b))) {
  15369. b = b.toLowerCase();
  15370. var c = this.nodeMap_.get(b);
  15371. c ? c.push(a) : this.nodeMap_.set(b, [a])
  15372. }
  15373. }
  15374. ;
  15375. goog.ui.tree.TypeAhead.prototype.removeNodeFromMap = function (a) {
  15376. var b = a.getText();
  15377. if (b && !goog.string.isEmptyOrWhitespace(goog.string.makeSafe(b))) {
  15378. b = b.toLowerCase();
  15379. var c = this.nodeMap_.get(b);
  15380. if (c) {
  15381. for (var d = a.getChildCount(), e = 0; e < d; e++)
  15382. this.removeNodeFromMap(a.getChildAt(e));
  15383. goog.array.remove(c, a);
  15384. c.length || this.nodeMap_.remove(b)
  15385. }
  15386. }
  15387. }
  15388. ;
  15389. goog.ui.tree.TypeAhead.prototype.jumpToLabel_ = function (a) {
  15390. var b = !1;
  15391. (a = this.nodeMap_.getKeys(a)) && a.length && (this.matchingLabelIndex_ = this.matchingNodeIndex_ = 0,
  15392. b = this.nodeMap_.get(a[0]),
  15393. b = this.selectMatchingNode_(b)) && (this.matchingLabels_ = a);
  15394. return b
  15395. }
  15396. ;
  15397. goog.ui.tree.TypeAhead.prototype.jumpTo_ = function (a) {
  15398. var b = !1
  15399. , c = this.matchingLabels_;
  15400. if (c) {
  15401. b = null;
  15402. var d = !1;
  15403. if (this.matchingNodes_) {
  15404. var e = this.matchingNodeIndex_ + a;
  15405. 0 <= e && e < this.matchingNodes_.length ? (this.matchingNodeIndex_ = e,
  15406. b = this.matchingNodes_) : d = !0
  15407. }
  15408. b || (e = this.matchingLabelIndex_ + a,
  15409. 0 <= e && e < c.length && (this.matchingLabelIndex_ = e),
  15410. c.length > this.matchingLabelIndex_ && (b = this.nodeMap_.get(c[this.matchingLabelIndex_])),
  15411. b && b.length && d && (this.matchingNodeIndex_ = a == goog.ui.tree.TypeAhead.Offset.UP ? b.length - 1 : 0));
  15412. if (b = this.selectMatchingNode_(b))
  15413. this.matchingLabels_ = c
  15414. }
  15415. return b
  15416. }
  15417. ;
  15418. goog.ui.tree.TypeAhead.prototype.selectMatchingNode_ = function (a) {
  15419. if (a) {
  15420. if (this.matchingNodeIndex_ < a.length) {
  15421. var b = a[this.matchingNodeIndex_];
  15422. this.matchingNodes_ = a
  15423. }
  15424. b && (b.reveal(),
  15425. b.select())
  15426. }
  15427. return !!b
  15428. }
  15429. ;
  15430. goog.ui.tree.TypeAhead.prototype.clear = function () {
  15431. this.buffer_ = ""
  15432. }
  15433. ;
  15434. goog.ui.tree.TreeControl = function (a, b, c) {
  15435. goog.ui.tree.BaseNode.call(this, a, b, c);
  15436. this.setExpandedInternal(!0);
  15437. this.setSelectedInternal(!0);
  15438. this.selectedItem_ = this;
  15439. this.typeAhead_ = new goog.ui.tree.TypeAhead;
  15440. this.focusHandler_ = this.keyHandler_ = null;
  15441. this.logger_ = goog.log.getLogger("this");
  15442. this.focused_ = !1;
  15443. this.focusedNode_ = null;
  15444. this.showRootLines_ = this.showRootNode_ = this.showExpandIcons_ = this.showLines_ = !0;
  15445. if (goog.userAgent.IE)
  15446. try {
  15447. document.execCommand("BackgroundImageCache", !1, !0)
  15448. } catch (d) {
  15449. goog.log.warning(this.logger_, "Failed to enable background image cache")
  15450. }
  15451. }
  15452. ;
  15453. goog.inherits(goog.ui.tree.TreeControl, goog.ui.tree.BaseNode);
  15454. goog.ui.tree.TreeControl.prototype.getTree = function () {
  15455. return this
  15456. }
  15457. ;
  15458. goog.ui.tree.TreeControl.prototype.getDepth = function () {
  15459. return 0
  15460. }
  15461. ;
  15462. goog.ui.tree.TreeControl.prototype.reveal = function () { }
  15463. ;
  15464. goog.ui.tree.TreeControl.prototype.handleFocus_ = function (a) {
  15465. this.focused_ = !0;
  15466. goog.dom.classlist.add(goog.asserts.assert(this.getElement()), "focused");
  15467. this.selectedItem_ && this.selectedItem_.select()
  15468. }
  15469. ;
  15470. goog.ui.tree.TreeControl.prototype.handleBlur_ = function (a) {
  15471. this.focused_ = !1;
  15472. goog.dom.classlist.remove(goog.asserts.assert(this.getElement()), "focused")
  15473. }
  15474. ;
  15475. goog.ui.tree.TreeControl.prototype.hasFocus = function () {
  15476. return this.focused_
  15477. }
  15478. ;
  15479. goog.ui.tree.TreeControl.prototype.getExpanded = function () {
  15480. return !this.showRootNode_ || goog.ui.tree.TreeControl.superClass_.getExpanded.call(this)
  15481. }
  15482. ;
  15483. goog.ui.tree.TreeControl.prototype.setExpanded = function (a) {
  15484. this.showRootNode_ ? goog.ui.tree.TreeControl.superClass_.setExpanded.call(this, a) : this.setExpandedInternal(a)
  15485. }
  15486. ;
  15487. goog.ui.tree.TreeControl.prototype.getExpandIconSafeHtml = function () {
  15488. return goog.html.SafeHtml.EMPTY
  15489. }
  15490. ;
  15491. goog.ui.tree.TreeControl.prototype.getIconElement = function () {
  15492. var a = this.getRowElement();
  15493. return a ? a.firstChild : null
  15494. }
  15495. ;
  15496. goog.ui.tree.TreeControl.prototype.getExpandIconElement = function () {
  15497. return null
  15498. }
  15499. ;
  15500. goog.ui.tree.TreeControl.prototype.updateExpandIcon = function () { }
  15501. ;
  15502. goog.ui.tree.TreeControl.prototype.getRowClassName = function () {
  15503. return goog.ui.tree.TreeControl.superClass_.getRowClassName.call(this) + (this.showRootNode_ ? "" : " " + this.getConfig().cssHideRoot)
  15504. }
  15505. ;
  15506. goog.ui.tree.TreeControl.prototype.getCalculatedIconClass = function () {
  15507. var a = this.getExpanded()
  15508. , b = this.getExpandedIconClass();
  15509. if (a && b)
  15510. return b;
  15511. b = this.getIconClass();
  15512. if (!a && b)
  15513. return b;
  15514. b = this.getConfig();
  15515. return a && b.cssExpandedRootIcon ? b.cssTreeIcon + " " + b.cssExpandedRootIcon : !a && b.cssCollapsedRootIcon ? b.cssTreeIcon + " " + b.cssCollapsedRootIcon : ""
  15516. }
  15517. ;
  15518. goog.ui.tree.TreeControl.prototype.setSelectedItem = function (a) {
  15519. if (this.selectedItem_ != a) {
  15520. var b = !1;
  15521. this.selectedItem_ && (b = this.selectedItem_ == this.focusedNode_,
  15522. this.selectedItem_.setSelectedInternal(!1));
  15523. if (this.selectedItem_ = a)
  15524. a.setSelectedInternal(!0),
  15525. b && a.select();
  15526. this.dispatchEvent(goog.events.EventType.CHANGE)
  15527. }
  15528. }
  15529. ;
  15530. goog.ui.tree.TreeControl.prototype.getSelectedItem = function () {
  15531. return this.selectedItem_
  15532. }
  15533. ;
  15534. goog.ui.tree.TreeControl.prototype.setShowLines = function (a) {
  15535. this.showLines_ != a && (this.showLines_ = a,
  15536. this.isInDocument() && this.updateLinesAndExpandIcons_())
  15537. }
  15538. ;
  15539. goog.ui.tree.TreeControl.prototype.getShowLines = function () {
  15540. return this.showLines_
  15541. }
  15542. ;
  15543. goog.ui.tree.TreeControl.prototype.updateLinesAndExpandIcons_ = function () {
  15544. function a(e) {
  15545. var f = e.getChildrenElement();
  15546. if (f) {
  15547. var g = !c || b == e.getParent() && !d ? e.getConfig().cssChildrenNoLines : e.getConfig().cssChildren;
  15548. f.className = g;
  15549. if (f = e.getExpandIconElement())
  15550. f.className = e.getExpandIconClass()
  15551. }
  15552. e.forEachChild(a)
  15553. }
  15554. var b = this
  15555. , c = b.getShowLines()
  15556. , d = b.getShowRootLines();
  15557. a(this)
  15558. }
  15559. ;
  15560. goog.ui.tree.TreeControl.prototype.setShowRootLines = function (a) {
  15561. this.showRootLines_ != a && (this.showRootLines_ = a,
  15562. this.isInDocument() && this.updateLinesAndExpandIcons_())
  15563. }
  15564. ;
  15565. goog.ui.tree.TreeControl.prototype.getShowRootLines = function () {
  15566. return this.showRootLines_
  15567. }
  15568. ;
  15569. goog.ui.tree.TreeControl.prototype.setShowExpandIcons = function (a) {
  15570. this.showExpandIcons_ != a && (this.showExpandIcons_ = a,
  15571. this.isInDocument() && this.updateLinesAndExpandIcons_())
  15572. }
  15573. ;
  15574. goog.ui.tree.TreeControl.prototype.getShowExpandIcons = function () {
  15575. return this.showExpandIcons_
  15576. }
  15577. ;
  15578. goog.ui.tree.TreeControl.prototype.setShowRootNode = function (a) {
  15579. if (this.showRootNode_ != a) {
  15580. this.showRootNode_ = a;
  15581. if (this.isInDocument()) {
  15582. var b = this.getRowElement();
  15583. b && (b.className = this.getRowClassName())
  15584. }
  15585. !a && this.getSelectedItem() == this && this.getFirstChild() && this.setSelectedItem(this.getFirstChild())
  15586. }
  15587. }
  15588. ;
  15589. goog.ui.tree.TreeControl.prototype.getShowRootNode = function () {
  15590. return this.showRootNode_
  15591. }
  15592. ;
  15593. goog.ui.tree.TreeControl.prototype.initAccessibility = function () {
  15594. goog.ui.tree.TreeControl.superClass_.initAccessibility.call(this);
  15595. var a = this.getElement();
  15596. goog.asserts.assert(a, "The DOM element for the tree cannot be null.");
  15597. goog.a11y.aria.setRole(a, "tree");
  15598. goog.a11y.aria.setState(a, "labelledby", this.getLabelElement().id)
  15599. }
  15600. ;
  15601. goog.ui.tree.TreeControl.prototype.enterDocument = function () {
  15602. goog.ui.tree.TreeControl.superClass_.enterDocument.call(this);
  15603. var a = this.getElement();
  15604. a.className = this.getConfig().cssRoot;
  15605. a.setAttribute("hideFocus", "true");
  15606. this.attachEvents_();
  15607. this.initAccessibility()
  15608. }
  15609. ;
  15610. goog.ui.tree.TreeControl.prototype.exitDocument = function () {
  15611. goog.ui.tree.TreeControl.superClass_.exitDocument.call(this);
  15612. this.detachEvents_()
  15613. }
  15614. ;
  15615. goog.ui.tree.TreeControl.prototype.attachEvents_ = function () {
  15616. var a = this.getElement();
  15617. a.tabIndex = 0;
  15618. var b = this.keyHandler_ = new goog.events.KeyHandler(a)
  15619. , c = this.focusHandler_ = new goog.events.FocusHandler(a);
  15620. this.getHandler().listen(c, goog.events.FocusHandler.EventType.FOCUSOUT, this.handleBlur_).listen(c, goog.events.FocusHandler.EventType.FOCUSIN, this.handleFocus_).listen(b, goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent).listen(a, goog.events.EventType.MOUSEDOWN, this.handleMouseEvent_).listen(a, goog.events.EventType.CLICK, this.handleMouseEvent_).listen(a, goog.events.EventType.DBLCLICK, this.handleMouseEvent_)
  15621. }
  15622. ;
  15623. goog.ui.tree.TreeControl.prototype.detachEvents_ = function () {
  15624. this.keyHandler_.dispose();
  15625. this.keyHandler_ = null;
  15626. this.focusHandler_.dispose();
  15627. this.focusHandler_ = null
  15628. }
  15629. ;
  15630. goog.ui.tree.TreeControl.prototype.handleMouseEvent_ = function (a) {
  15631. goog.log.fine(this.logger_, "Received event " + a.type);
  15632. var b = this.getNodeFromEvent_(a);
  15633. if (b)
  15634. switch (a.type) {
  15635. case goog.events.EventType.MOUSEDOWN:
  15636. b.onMouseDown(a);
  15637. break;
  15638. case goog.events.EventType.CLICK:
  15639. b.onClick_(a);
  15640. break;
  15641. case goog.events.EventType.DBLCLICK:
  15642. b.onDoubleClick_(a)
  15643. }
  15644. }
  15645. ;
  15646. goog.ui.tree.TreeControl.prototype.handleKeyEvent = function (a) {
  15647. var b;
  15648. (b = this.typeAhead_.handleNavigation(a) || this.selectedItem_ && this.selectedItem_.onKeyDown(a) || this.typeAhead_.handleTypeAheadChar(a)) && a.preventDefault();
  15649. return b
  15650. }
  15651. ;
  15652. goog.ui.tree.TreeControl.prototype.getNodeFromEvent_ = function (a) {
  15653. for (var b = a.target; null != b;) {
  15654. if (a = goog.ui.tree.BaseNode.allNodes[b.id])
  15655. return a;
  15656. if (b == this.getElement())
  15657. break;
  15658. b = b.parentNode
  15659. }
  15660. return null
  15661. }
  15662. ;
  15663. goog.ui.tree.TreeControl.prototype.createNode = function (a) {
  15664. return new goog.ui.tree.TreeNode(a || goog.html.SafeHtml.EMPTY, this.getConfig(), this.getDomHelper())
  15665. }
  15666. ;
  15667. goog.ui.tree.TreeControl.prototype.setNode = function (a) {
  15668. this.typeAhead_.setNodeInMap(a)
  15669. }
  15670. ;
  15671. goog.ui.tree.TreeControl.prototype.removeNode = function (a) {
  15672. this.typeAhead_.removeNodeFromMap(a)
  15673. }
  15674. ;
  15675. goog.ui.tree.TreeControl.prototype.clearTypeAhead = function () {
  15676. this.typeAhead_.clear()
  15677. }
  15678. ;
  15679. goog.ui.tree.TreeControl.defaultConfig = goog.ui.tree.BaseNode.defaultConfig;
  15680. var Blockly = {
  15681. Blocks: {}
  15682. };
  15683. Blockly.Touch = {};
  15684. Blockly.Touch.touchIdentifier_ = null;
  15685. Blockly.Touch.onTouchUpWrapper_ = null;
  15686. Blockly.Touch.TOUCH_MAP = {};
  15687. goog.events.BrowserFeature.TOUCH_ENABLED && (Blockly.Touch.TOUCH_MAP = {
  15688. mousedown: ["touchstart"],
  15689. mousemove: ["touchmove"],
  15690. mouseup: ["touchend", "touchcancel"]
  15691. });
  15692. Blockly.longPid_ = 0;
  15693. Blockly.longStart_ = function (a, b) {
  15694. Blockly.longStop_();
  15695. Blockly.longPid_ = setTimeout(function () {
  15696. a.button = 2;
  15697. b.onMouseDown_(a)
  15698. }, Blockly.LONGPRESS)
  15699. }
  15700. ;
  15701. Blockly.longStop_ = function () {
  15702. Blockly.longPid_ && (clearTimeout(Blockly.longPid_),
  15703. Blockly.longPid_ = 0)
  15704. }
  15705. ;
  15706. Blockly.onMouseUp_ = function (a) {
  15707. a = Blockly.getMainWorkspace();
  15708. a.dragMode_ != Blockly.DRAG_NONE && (Blockly.Touch.clearTouchIdentifier(),
  15709. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN),
  15710. a.dragMode_ = Blockly.DRAG_NONE,
  15711. Blockly.Touch.onTouchUpWrapper_ && (Blockly.unbindEvent_(Blockly.Touch.onTouchUpWrapper_),
  15712. Blockly.Touch.onTouchUpWrapper_ = null),
  15713. Blockly.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.onMouseMoveWrapper_),
  15714. Blockly.onMouseMoveWrapper_ = null))
  15715. }
  15716. ;
  15717. Blockly.onMouseMove_ = function (a) {
  15718. var b = Blockly.getMainWorkspace();
  15719. if (b.dragMode_ != Blockly.DRAG_NONE) {
  15720. var c = a.clientX - b.startDragMouseX
  15721. , d = a.clientY - b.startDragMouseY
  15722. , e = b.startDragMetrics
  15723. , f = b.startScrollX + c
  15724. , g = b.startScrollY + d;
  15725. f = Math.min(f, -e.contentLeft);
  15726. g = Math.min(g, -e.contentTop);
  15727. f = Math.max(f, e.viewWidth - e.contentLeft - e.contentWidth);
  15728. g = Math.max(g, e.viewHeight - e.contentTop - e.contentHeight);
  15729. b.scrollbar.set(-f - e.contentLeft, -g - e.contentTop);
  15730. Math.sqrt(c * c + d * d) > Blockly.DRAG_RADIUS && (Blockly.longStop_(),
  15731. b.dragMode_ = Blockly.DRAG_FREE);
  15732. a.stopPropagation();
  15733. a.preventDefault()
  15734. }
  15735. }
  15736. ;
  15737. Blockly.Touch.clearTouchIdentifier = function () {
  15738. Blockly.Touch.touchIdentifier_ = null
  15739. }
  15740. ;
  15741. Blockly.Touch.shouldHandleEvent = function (a) {
  15742. return !Blockly.Touch.isMouseOrTouchEvent(a) || Blockly.Touch.checkTouchIdentifier(a)
  15743. }
  15744. ;
  15745. Blockly.Touch.checkTouchIdentifier = function (a) {
  15746. var b = a.changedTouches && a.changedTouches[0] && void 0 != a.changedTouches[0].identifier && null != a.changedTouches[0].identifier ? a.changedTouches[0].identifier : "mouse";
  15747. return void 0 != Blockly.Touch.touchIdentifier_ && null != Blockly.Touch.touchIdentifier_ ? Blockly.Touch.touchIdentifier_ == b : "mousedown" == a.type || "touchstart" == a.type ? (Blockly.Touch.touchIdentifier_ = b,
  15748. !0) : !1
  15749. }
  15750. ;
  15751. Blockly.Touch.setClientFromTouch = function (a) {
  15752. if (goog.string.startsWith(a.type, "touch")) {
  15753. var b = a.changedTouches[0];
  15754. a.clientX = b.clientX;
  15755. a.clientY = b.clientY
  15756. }
  15757. }
  15758. ;
  15759. Blockly.Touch.isMouseOrTouchEvent = function (a) {
  15760. return goog.string.startsWith(a.type, "touch") || goog.string.startsWith(a.type, "mouse")
  15761. }
  15762. ;
  15763. Blockly.Touch.splitEventByTouches = function (a) {
  15764. var b = [];
  15765. if (a.changedTouches)
  15766. for (var c = 0; c < a.changedTouches.length; c++)
  15767. b[c] = {
  15768. type: a.type,
  15769. changedTouches: [a.changedTouches[c]],
  15770. target: a.target,
  15771. stopPropagation: function () {
  15772. a.stopPropagation()
  15773. },
  15774. preventDefault: function () {
  15775. a.preventDefault()
  15776. }
  15777. };
  15778. else
  15779. b.push(a);
  15780. return b
  15781. }
  15782. ;
  15783. Blockly.Workspace = function (a) {
  15784. this.id = Blockly.genUid();
  15785. Blockly.Workspace.WorkspaceDB_[this.id] = this;
  15786. this.options = a || {};
  15787. this.RTL = !!this.options.RTL;
  15788. this.horizontalLayout = !!this.options.horizontalLayout;
  15789. this.toolboxPosition = this.options.toolboxPosition;
  15790. this.topBlocks_ = [];
  15791. this.listeners_ = [];
  15792. this.undoStack_ = [];
  15793. this.redoStack_ = [];
  15794. this.blockDB_ = Object.create(null);
  15795. this.variableList = []
  15796. }
  15797. ;
  15798. Blockly.Workspace.prototype.rendered = !1;
  15799. Blockly.Workspace.prototype.MAX_UNDO = 1024;
  15800. Blockly.Workspace.prototype.dispose = function () {
  15801. this.listeners_.length = 0;
  15802. this.clear();
  15803. delete Blockly.Workspace.WorkspaceDB_[this.id]
  15804. }
  15805. ;
  15806. Blockly.Workspace.SCAN_ANGLE = 3;
  15807. Blockly.Workspace.prototype.addTopBlock = function (a) {
  15808. this.topBlocks_.push(a);
  15809. if (this.isFlyout) {
  15810. a = Blockly.Variables.allUsedVariables(a);
  15811. for (var b = 0; b < a.length; b++)
  15812. -1 == this.variableList.indexOf(a[b]) && this.variableList.push(a[b])
  15813. }
  15814. }
  15815. ;
  15816. Blockly.Workspace.prototype.removeTopBlock = function (a) {
  15817. if (!goog.array.remove(this.topBlocks_, a))
  15818. throw "Block not present in workspace's list of top-most blocks.";
  15819. }
  15820. ;
  15821. Blockly.Workspace.prototype.getTopBlocks = function (a) {
  15822. var b = [].concat(this.topBlocks_);
  15823. if (a && 1 < b.length) {
  15824. var c = Math.sin(goog.math.toRadians(Blockly.Workspace.SCAN_ANGLE));
  15825. this.RTL && (c *= -1);
  15826. b.sort(function (a, b) {
  15827. var d = a.getRelativeToSurfaceXY()
  15828. , e = b.getRelativeToSurfaceXY();
  15829. return d.y + c * d.x - (e.y + c * e.x)
  15830. })
  15831. }
  15832. return b
  15833. }
  15834. ;
  15835. Blockly.Workspace.prototype.getAllBlocks = function () {
  15836. for (var a = this.getTopBlocks(!1), b = 0; b < a.length; b++)
  15837. a.push.apply(a, a[b].getChildren());
  15838. return a
  15839. }
  15840. ;
  15841. Blockly.Workspace.prototype.clear = function () {
  15842. var a = Blockly.Events.getGroup();
  15843. for (a || Blockly.Events.setGroup(!0); this.topBlocks_.length;)
  15844. this.topBlocks_[0].dispose();
  15845. a || Blockly.Events.setGroup(!1);
  15846. this.variableList.length = 0
  15847. }
  15848. ;
  15849. Blockly.Workspace.prototype.updateVariableList = function (a) {
  15850. if (!this.isFlyout) {
  15851. a && (this.variableList.length = 0);
  15852. a = Blockly.Variables.allUsedVariables(this);
  15853. for (var b = 0; b < a.length; b++)
  15854. this.createVariable(a[b])
  15855. }
  15856. }
  15857. ;
  15858. Blockly.Workspace.prototype.renameVariable = function (a, b) {
  15859. var c = this.variableIndexOf(a)
  15860. , d = this.variableIndexOf(b);
  15861. if (-1 != d && this.variableList[d] != b)
  15862. var e = this.variableList[d];
  15863. Blockly.Events.setGroup(!0);
  15864. for (var f = this.getAllBlocks(), g = 0; g < f.length; g++)
  15865. f[g].renameVar(a, b),
  15866. e && f[g].renameVar(e, b);
  15867. Blockly.Events.setGroup(!1);
  15868. c == d || -1 != c && -1 == d ? this.variableList[c] = b : -1 != c && -1 != d ? (this.variableList[d] = b,
  15869. this.variableList.splice(c, 1)) : (this.variableList.push(b),
  15870. console.log("Tried to rename an non-existent variable."))
  15871. }
  15872. ;
  15873. Blockly.Workspace.prototype.createVariable = function (a) {
  15874. -1 == this.variableIndexOf(a) && this.variableList.push(a)
  15875. }
  15876. ;
  15877. Blockly.Workspace.prototype.getVariableUses = function (a) {
  15878. for (var b = [], c = this.getAllBlocks(), d = 0; d < c.length; d++) {
  15879. var e = c[d].getVars();
  15880. if (e)
  15881. for (var f = 0; f < e.length; f++) {
  15882. var g = e[f];
  15883. g && Blockly.Names.equals(g, a) && b.push(c[d])
  15884. }
  15885. }
  15886. return b
  15887. }
  15888. ;
  15889. Blockly.Workspace.prototype.deleteVariable = function (a) {
  15890. var b = this
  15891. , c = this.variableIndexOf(a);
  15892. if (-1 != c) {
  15893. for (var d = function () {
  15894. Blockly.Events.setGroup(!0);
  15895. for (var a = 0; a < e.length; a++)
  15896. e[a].dispose(!0, !1);
  15897. Blockly.Events.setGroup(!1);
  15898. b.variableList.splice(c, 1)
  15899. }, e = this.getVariableUses(a), f = 0, g; g = e[f]; f++)
  15900. if ("procedures_defnoreturn" == g.type || "procedures_defreturn" == g.type || "procedures_defthirdreturn" == g.type) {
  15901. f = g.getFieldValue("NAME");
  15902. Blockly.alert(Blockly.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1", a).replace("%2", f));
  15903. return
  15904. }
  15905. 1 < e.length ? Blockly.confirm(Blockly.Msg.DELETE_VARIABLE_CONFIRMATION.replace("%1", e.length).replace("%2", a), function (a) {
  15906. a && d()
  15907. }) : d()
  15908. }
  15909. }
  15910. ;
  15911. Blockly.Workspace.prototype.variableIndexOf = function (a) {
  15912. for (var b = 0, c; c = this.variableList[b]; b++)
  15913. if (Blockly.Names.equals(c, a))
  15914. return b;
  15915. return -1
  15916. }
  15917. ;
  15918. Blockly.Workspace.prototype.getWidth = function () {
  15919. return 0
  15920. }
  15921. ;
  15922. Blockly.Workspace.prototype.newBlock = function (a, b) {
  15923. return new Blockly.Block(this, a, b)
  15924. }
  15925. ;
  15926. Blockly.Workspace.prototype.remainingCapacity = function () {
  15927. return isNaN(this.options.maxBlocks) ? Infinity : this.options.maxBlocks - this.getAllBlocks().length
  15928. }
  15929. ;
  15930. Blockly.Workspace.prototype.undo = function (a) {
  15931. var b = a ? this.redoStack_ : this.undoStack_
  15932. , c = a ? this.undoStack_ : this.redoStack_
  15933. , d = b.pop();
  15934. if (d) {
  15935. for (var e = [d]; b.length && d.group && d.group == b[b.length - 1].group;)
  15936. e.push(b.pop());
  15937. for (b = 0; d = e[b]; b++)
  15938. c.push(d);
  15939. e = Blockly.Events.filter(e, a);
  15940. Blockly.Events.recordUndo = !1;
  15941. for (b = 0; d = e[b]; b++)
  15942. d.run(a);
  15943. Blockly.Events.recordUndo = !0
  15944. }
  15945. }
  15946. ;
  15947. Blockly.Workspace.prototype.clearUndo = function () {
  15948. this.undoStack_.length = 0;
  15949. this.redoStack_.length = 0;
  15950. Blockly.Events.clearPendingUndo()
  15951. }
  15952. ;
  15953. Blockly.Workspace.prototype.addChangeListener = function (a) {
  15954. this.listeners_.push(a);
  15955. return a
  15956. }
  15957. ;
  15958. Blockly.Workspace.prototype.removeChangeListener = function (a) {
  15959. goog.array.remove(this.listeners_, a)
  15960. }
  15961. ;
  15962. Blockly.Workspace.prototype.fireChangeListener = function (a) {
  15963. a.recordUndo && (this.undoStack_.push(a),
  15964. this.redoStack_.length = 0,
  15965. this.undoStack_.length > this.MAX_UNDO && this.undoStack_.unshift());
  15966. for (var b = 0, c; c = this.listeners_[b]; b++)
  15967. c(a)
  15968. }
  15969. ;
  15970. Blockly.Workspace.prototype.getBlockById = function (a) {
  15971. return this.blockDB_[a] || null
  15972. }
  15973. ;
  15974. Blockly.Workspace.WorkspaceDB_ = Object.create(null);
  15975. Blockly.Workspace.getById = function (a) {
  15976. return Blockly.Workspace.WorkspaceDB_[a] || null
  15977. }
  15978. ;
  15979. Blockly.Workspace.prototype.clear = Blockly.Workspace.prototype.clear;
  15980. Blockly.Workspace.prototype.clearUndo = Blockly.Workspace.prototype.clearUndo;
  15981. Blockly.Workspace.prototype.addChangeListener = Blockly.Workspace.prototype.addChangeListener;
  15982. Blockly.Workspace.prototype.removeChangeListener = Blockly.Workspace.prototype.removeChangeListener;
  15983. Blockly.Bubble = function (a, b, c, d, e, f) {
  15984. this.workspace_ = a;
  15985. this.content_ = b;
  15986. this.shape_ = c;
  15987. c = Blockly.Bubble.ARROW_ANGLE;
  15988. this.workspace_.RTL && (c = -c);
  15989. this.arrow_radians_ = goog.math.toRadians(c);
  15990. a.getBubbleCanvas().appendChild(this.createDom_(b, !(!e || !f)));
  15991. this.setAnchorLocation(d);
  15992. e && f || (b = this.content_.getBBox(),
  15993. e = b.width + 2 * Blockly.Bubble.BORDER_WIDTH,
  15994. f = b.height + 2 * Blockly.Bubble.BORDER_WIDTH);
  15995. this.setBubbleSize(e, f);
  15996. this.positionBubble_();
  15997. this.renderArrow_();
  15998. this.rendered_ = !0;
  15999. a.options.readOnly || (Blockly.bindEventWithChecks_(this.bubbleBack_, "mousedown", this, this.bubbleMouseDown_),
  16000. this.resizeGroup_ && Blockly.bindEventWithChecks_(this.resizeGroup_, "mousedown", this, this.resizeMouseDown_))
  16001. }
  16002. ;
  16003. Blockly.Bubble.BORDER_WIDTH = 6;
  16004. Blockly.Bubble.ARROW_THICKNESS = 5;
  16005. Blockly.Bubble.ARROW_ANGLE = 20;
  16006. Blockly.Bubble.ARROW_BEND = 4;
  16007. Blockly.Bubble.ANCHOR_RADIUS = 8;
  16008. Blockly.Bubble.onMouseUpWrapper_ = null;
  16009. Blockly.Bubble.onMouseMoveWrapper_ = null;
  16010. Blockly.Bubble.prototype.resizeCallback_ = null;
  16011. Blockly.Bubble.unbindDragEvents_ = function () {
  16012. Blockly.Bubble.onMouseUpWrapper_ && (Blockly.unbindEvent_(Blockly.Bubble.onMouseUpWrapper_),
  16013. Blockly.Bubble.onMouseUpWrapper_ = null);
  16014. Blockly.Bubble.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.Bubble.onMouseMoveWrapper_),
  16015. Blockly.Bubble.onMouseMoveWrapper_ = null)
  16016. }
  16017. ;
  16018. Blockly.Bubble.bubbleMouseUp_ = function () {
  16019. Blockly.Touch.clearTouchIdentifier();
  16020. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN);
  16021. Blockly.Bubble.unbindDragEvents_()
  16022. }
  16023. ;
  16024. Blockly.Bubble.prototype.rendered_ = !1;
  16025. Blockly.Bubble.prototype.anchorXY_ = null;
  16026. Blockly.Bubble.prototype.relativeLeft_ = 0;
  16027. Blockly.Bubble.prototype.relativeTop_ = 0;
  16028. Blockly.Bubble.prototype.width_ = 0;
  16029. Blockly.Bubble.prototype.height_ = 0;
  16030. Blockly.Bubble.prototype.autoLayout_ = !0;
  16031. Blockly.Bubble.prototype.createDom_ = function (a, b) {
  16032. this.bubbleGroup_ = Blockly.createSvgElement("g", {}, null);
  16033. var c = {
  16034. filter: "url(#" + this.workspace_.options.embossFilterId + ")"
  16035. };
  16036. -1 != goog.userAgent.getUserAgentString().indexOf("JavaFX") && (c = {});
  16037. c = Blockly.createSvgElement("g", c, this.bubbleGroup_);
  16038. this.bubbleArrow_ = Blockly.createSvgElement("path", {}, c);
  16039. this.bubbleBack_ = Blockly.createSvgElement("rect", {
  16040. "class": "blocklyDraggable",
  16041. x: 0,
  16042. y: 0,
  16043. rx: Blockly.Bubble.BORDER_WIDTH,
  16044. ry: Blockly.Bubble.BORDER_WIDTH
  16045. }, c);
  16046. b ? (this.resizeGroup_ = Blockly.createSvgElement("g", {
  16047. "class": this.workspace_.RTL ? "blocklyResizeSW" : "blocklyResizeSE"
  16048. }, this.bubbleGroup_),
  16049. c = 2 * Blockly.Bubble.BORDER_WIDTH,
  16050. Blockly.createSvgElement("polygon", {
  16051. points: "0,x x,x x,0".replace(/x/g, c.toString())
  16052. }, this.resizeGroup_),
  16053. Blockly.createSvgElement("line", {
  16054. "class": "blocklyResizeLine",
  16055. x1: c / 3,
  16056. y1: c - 1,
  16057. x2: c - 1,
  16058. y2: c / 3
  16059. }, this.resizeGroup_),
  16060. Blockly.createSvgElement("line", {
  16061. "class": "blocklyResizeLine",
  16062. x1: 2 * c / 3,
  16063. y1: c - 1,
  16064. x2: c - 1,
  16065. y2: 2 * c / 3
  16066. }, this.resizeGroup_)) : this.resizeGroup_ = null;
  16067. this.bubbleGroup_.appendChild(a);
  16068. return this.bubbleGroup_
  16069. }
  16070. ;
  16071. Blockly.Bubble.prototype.bubbleMouseDown_ = function (a) {
  16072. this.promote_();
  16073. Blockly.Bubble.unbindDragEvents_();
  16074. Blockly.isRightButton(a) ? a.stopPropagation() : Blockly.isTargetInput_(a) || (Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),
  16075. this.workspace_.startDrag(a, new goog.math.Coordinate(this.workspace_.RTL ? -this.relativeLeft_ : this.relativeLeft_, this.relativeTop_)),
  16076. Blockly.Bubble.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, Blockly.Bubble.bubbleMouseUp_),
  16077. Blockly.Bubble.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.bubbleMouseMove_),
  16078. Blockly.hideChaff(),
  16079. a.stopPropagation())
  16080. }
  16081. ;
  16082. Blockly.Bubble.prototype.bubbleMouseMove_ = function (a) {
  16083. this.autoLayout_ = !1;
  16084. a = this.workspace_.moveDrag(a);
  16085. this.relativeLeft_ = this.workspace_.RTL ? -a.x : a.x;
  16086. this.relativeTop_ = a.y;
  16087. this.positionBubble_();
  16088. this.renderArrow_()
  16089. }
  16090. ;
  16091. Blockly.Bubble.prototype.resizeMouseDown_ = function (a) {
  16092. this.promote_();
  16093. Blockly.Bubble.unbindDragEvents_();
  16094. Blockly.isRightButton(a) || (Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),
  16095. this.workspace_.startDrag(a, new goog.math.Coordinate(this.workspace_.RTL ? -this.width_ : this.width_, this.height_)),
  16096. Blockly.Bubble.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, Blockly.Bubble.bubbleMouseUp_),
  16097. Blockly.Bubble.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.resizeMouseMove_),
  16098. Blockly.hideChaff());
  16099. a.stopPropagation()
  16100. }
  16101. ;
  16102. Blockly.Bubble.prototype.resizeMouseMove_ = function (a) {
  16103. this.autoLayout_ = !1;
  16104. a = this.workspace_.moveDrag(a);
  16105. this.setBubbleSize(this.workspace_.RTL ? -a.x : a.x, a.y);
  16106. this.workspace_.RTL && this.positionBubble_()
  16107. }
  16108. ;
  16109. Blockly.Bubble.prototype.registerResizeEvent = function (a) {
  16110. this.resizeCallback_ = a
  16111. }
  16112. ;
  16113. Blockly.Bubble.prototype.promote_ = function () {
  16114. this.bubbleGroup_.parentNode.appendChild(this.bubbleGroup_)
  16115. }
  16116. ;
  16117. Blockly.Bubble.prototype.setAnchorLocation = function (a) {
  16118. this.anchorXY_ = a;
  16119. this.rendered_ && this.positionBubble_()
  16120. }
  16121. ;
  16122. Blockly.Bubble.prototype.layoutBubble_ = function () {
  16123. var a = -this.width_ / 4
  16124. , b = -this.height_ - Blockly.BlockSvg.MIN_BLOCK_Y
  16125. , c = this.workspace_.getMetrics();
  16126. c.viewWidth /= this.workspace_.scale;
  16127. c.viewLeft /= this.workspace_.scale;
  16128. var d = this.anchorXY_.x;
  16129. this.workspace_.RTL ? d - c.viewLeft - a - this.width_ < Blockly.Scrollbar.scrollbarThickness ? a = d - c.viewLeft - this.width_ - Blockly.Scrollbar.scrollbarThickness : d - c.viewLeft - a > c.viewWidth && (a = d - c.viewLeft - c.viewWidth) : d + a < c.viewLeft ? a = c.viewLeft - d : c.viewLeft + c.viewWidth < d + a + this.width_ + Blockly.BlockSvg.SEP_SPACE_X + Blockly.Scrollbar.scrollbarThickness && (a = c.viewLeft + c.viewWidth - d - this.width_ - Blockly.Scrollbar.scrollbarThickness);
  16130. this.anchorXY_.y + b < c.viewTop && (b = this.shape_.getBBox().height);
  16131. this.relativeLeft_ = a;
  16132. this.relativeTop_ = b
  16133. }
  16134. ;
  16135. Blockly.Bubble.prototype.positionBubble_ = function () {
  16136. var a = this.anchorXY_.x;
  16137. a = this.workspace_.RTL ? a - (this.relativeLeft_ + this.width_) : a + this.relativeLeft_;
  16138. this.bubbleGroup_.setAttribute("transform", "translate(" + a + "," + (this.relativeTop_ + this.anchorXY_.y) + ")")
  16139. }
  16140. ;
  16141. Blockly.Bubble.prototype.getBubbleSize = function () {
  16142. return {
  16143. width: this.width_,
  16144. height: this.height_
  16145. }
  16146. }
  16147. ;
  16148. Blockly.Bubble.prototype.setBubbleSize = function (a, b) {
  16149. var c = 2 * Blockly.Bubble.BORDER_WIDTH;
  16150. a = Math.max(a, c + 45);
  16151. b = Math.max(b, c + 20);
  16152. this.width_ = a;
  16153. this.height_ = b;
  16154. this.bubbleBack_.setAttribute("width", a);
  16155. this.bubbleBack_.setAttribute("height", b);
  16156. this.resizeGroup_ && (this.workspace_.RTL ? this.resizeGroup_.setAttribute("transform", "translate(" + 2 * Blockly.Bubble.BORDER_WIDTH + "," + (b - c) + ") scale(-1 1)") : this.resizeGroup_.setAttribute("transform", "translate(" + (a - c) + "," + (b - c) + ")"));
  16157. this.rendered_ && (this.autoLayout_ && this.layoutBubble_(),
  16158. this.positionBubble_(),
  16159. this.renderArrow_());
  16160. this.resizeCallback_ && this.resizeCallback_()
  16161. }
  16162. ;
  16163. Blockly.Bubble.prototype.renderArrow_ = function () {
  16164. var a = []
  16165. , b = this.width_ / 2
  16166. , c = this.height_ / 2
  16167. , d = -this.relativeLeft_
  16168. , e = -this.relativeTop_;
  16169. if (b == d && c == e)
  16170. a.push("M " + b + "," + c);
  16171. else {
  16172. e -= c;
  16173. d -= b;
  16174. this.workspace_.RTL && (d *= -1);
  16175. var f = Math.sqrt(e * e + d * d)
  16176. , g = Math.acos(d / f);
  16177. 0 > e && (g = 2 * Math.PI - g);
  16178. var h = g + Math.PI / 2;
  16179. h > 2 * Math.PI && (h -= 2 * Math.PI);
  16180. var k = Math.sin(h)
  16181. , m = Math.cos(h)
  16182. , p = this.getBubbleSize();
  16183. h = (p.width + p.height) / Blockly.Bubble.ARROW_THICKNESS;
  16184. h = Math.min(h, p.width, p.height) / 4;
  16185. p = 1 - Blockly.Bubble.ANCHOR_RADIUS / f;
  16186. d = b + p * d;
  16187. e = c + p * e;
  16188. p = b + h * m;
  16189. var l = c + h * k;
  16190. b -= h * m;
  16191. c -= h * k;
  16192. k = g + this.arrow_radians_;
  16193. k > 2 * Math.PI && (k -= 2 * Math.PI);
  16194. g = Math.sin(k) * f / Blockly.Bubble.ARROW_BEND;
  16195. f = Math.cos(k) * f / Blockly.Bubble.ARROW_BEND;
  16196. a.push("M" + p + "," + l);
  16197. a.push("C" + (p + f) + "," + (l + g) + " " + d + "," + e + " " + d + "," + e);
  16198. a.push("C" + d + "," + e + " " + (b + f) + "," + (c + g) + " " + b + "," + c)
  16199. }
  16200. a.push("z");
  16201. this.bubbleArrow_.setAttribute("d", a.join(" "))
  16202. }
  16203. ;
  16204. Blockly.Bubble.prototype.setColour = function (a) {
  16205. this.bubbleBack_.setAttribute("fill", a);
  16206. this.bubbleArrow_.setAttribute("fill", a)
  16207. }
  16208. ;
  16209. Blockly.Bubble.prototype.dispose = function () {
  16210. Blockly.Bubble.unbindDragEvents_();
  16211. goog.dom.removeNode(this.bubbleGroup_);
  16212. this.shape_ = this.content_ = this.workspace_ = this.resizeGroup_ = this.bubbleBack_ = this.bubbleArrow_ = this.bubbleGroup_ = null
  16213. }
  16214. ;
  16215. Blockly.Icon = function (a) {
  16216. this.block_ = a
  16217. }
  16218. ;
  16219. Blockly.Icon.prototype.collapseHidden = !0;
  16220. Blockly.Icon.prototype.SIZE = 17;
  16221. Blockly.Icon.prototype.bubble_ = null;
  16222. Blockly.Icon.prototype.iconXY_ = null;
  16223. Blockly.Icon.prototype.createIcon = function () {
  16224. this.iconGroup_ || (this.iconGroup_ = Blockly.createSvgElement("g", {
  16225. "class": "blocklyIconGroup"
  16226. }, null),
  16227. this.block_.isInFlyout && Blockly.addClass_(this.iconGroup_, "blocklyIconGroupReadonly"),
  16228. this.drawIcon_(this.iconGroup_),
  16229. this.block_.getSvgRoot().appendChild(this.iconGroup_),
  16230. Blockly.bindEventWithChecks_(this.iconGroup_, "mouseup", this, this.iconClick_),
  16231. this.updateEditable())
  16232. }
  16233. ;
  16234. Blockly.Icon.prototype.dispose = function () {
  16235. goog.dom.removeNode(this.iconGroup_);
  16236. this.iconGroup_ = null;
  16237. this.setVisible(!1);
  16238. this.block_ = null
  16239. }
  16240. ;
  16241. Blockly.Icon.prototype.updateEditable = function () { }
  16242. ;
  16243. Blockly.Icon.prototype.isVisible = function () {
  16244. return !!this.bubble_
  16245. }
  16246. ;
  16247. Blockly.Icon.prototype.iconClick_ = function (a) {
  16248. this.block_.workspace.isDragging() || this.block_.isInFlyout || Blockly.isRightButton(a) || this.setVisible(!this.isVisible())
  16249. }
  16250. ;
  16251. Blockly.Icon.prototype.updateColour = function () {
  16252. this.isVisible() && this.bubble_.setColour(this.block_.getColour())
  16253. }
  16254. ;
  16255. Blockly.Icon.prototype.renderIcon = function (a) {
  16256. if (this.collapseHidden && this.block_.isCollapsed())
  16257. return this.iconGroup_.setAttribute("display", "none"),
  16258. a;
  16259. this.iconGroup_.setAttribute("display", "block");
  16260. var b = this.SIZE;
  16261. this.block_.RTL && (a -= b);
  16262. this.iconGroup_.setAttribute("transform", "translate(" + a + ",5)");
  16263. this.computeIconLocation();
  16264. return a = this.block_.RTL ? a - Blockly.BlockSvg.SEP_SPACE_X : a + (b + Blockly.BlockSvg.SEP_SPACE_X)
  16265. }
  16266. ;
  16267. Blockly.Icon.prototype.setIconLocation = function (a) {
  16268. this.iconXY_ = a;
  16269. this.isVisible() && this.bubble_.setAnchorLocation(a)
  16270. }
  16271. ;
  16272. Blockly.Icon.prototype.computeIconLocation = function () {
  16273. var a = this.block_.getRelativeToSurfaceXY()
  16274. , b = Blockly.getRelativeXY_(this.iconGroup_);
  16275. a = new goog.math.Coordinate(a.x + b.x + this.SIZE / 2, a.y + b.y + this.SIZE / 2);
  16276. goog.math.Coordinate.equals(this.getIconLocation(), a) || this.setIconLocation(a)
  16277. }
  16278. ;
  16279. Blockly.Icon.prototype.getIconLocation = function () {
  16280. return this.iconXY_
  16281. }
  16282. ;
  16283. Blockly.Comment = function (a) {
  16284. Blockly.Comment.superClass_.constructor.call(this, a);
  16285. this.createIcon()
  16286. }
  16287. ;
  16288. goog.inherits(Blockly.Comment, Blockly.Icon);
  16289. Blockly.Comment.prototype.text_ = "";
  16290. Blockly.Comment.prototype.width_ = 160;
  16291. Blockly.Comment.prototype.height_ = 80;
  16292. Blockly.Comment.prototype.drawIcon_ = function (a) {
  16293. Blockly.createSvgElement("circle", {
  16294. "class": "blocklyIconShape",
  16295. r: "8",
  16296. cx: "8",
  16297. cy: "8"
  16298. }, a);
  16299. Blockly.createSvgElement("path", {
  16300. "class": "blocklyIconSymbol",
  16301. d: "m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.405 0.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25 -1.201,0.998 -1.201,1.528 -1.204,2.19z"
  16302. }, a);
  16303. Blockly.createSvgElement("rect", {
  16304. "class": "blocklyIconSymbol",
  16305. x: "6.8",
  16306. y: "10.78",
  16307. height: "2",
  16308. width: "2"
  16309. }, a)
  16310. }
  16311. ;
  16312. Blockly.Comment.prototype.createEditor_ = function () {
  16313. this.foreignObject_ = Blockly.createSvgElement("foreignObject", {
  16314. x: Blockly.Bubble.BORDER_WIDTH,
  16315. y: Blockly.Bubble.BORDER_WIDTH
  16316. }, null);
  16317. var a = document.createElementNS(Blockly.HTML_NS, "body");
  16318. a.setAttribute("xmlns", Blockly.HTML_NS);
  16319. a.className = "blocklyMinimalBody";
  16320. var b = document.createElementNS(Blockly.HTML_NS, "textarea");
  16321. b.className = "blocklyCommentTextarea";
  16322. b.setAttribute("dir", this.block_.RTL ? "RTL" : "LTR");
  16323. a.appendChild(b);
  16324. this.textarea_ = b;
  16325. this.foreignObject_.appendChild(a);
  16326. Blockly.bindEventWithChecks_(b, "mouseup", this, this.textareaFocus_);
  16327. Blockly.bindEventWithChecks_(b, "wheel", this, function (a) {
  16328. a.stopPropagation()
  16329. });
  16330. Blockly.bindEventWithChecks_(b, "change", this, function (a) {
  16331. this.text_ != b.value && (Blockly.Events.fire(new Blockly.Events.Change(this.block_, "comment", null, this.text_, b.value)),
  16332. this.text_ = b.value)
  16333. });
  16334. setTimeout(function () {
  16335. b.focus()
  16336. }, 0);
  16337. return this.foreignObject_
  16338. }
  16339. ;
  16340. Blockly.Comment.prototype.updateEditable = function () {
  16341. this.isVisible() && (this.setVisible(!1),
  16342. this.setVisible(!0));
  16343. Blockly.Icon.prototype.updateEditable.call(this)
  16344. }
  16345. ;
  16346. Blockly.Comment.prototype.resizeBubble_ = function () {
  16347. if (this.isVisible()) {
  16348. var a = this.bubble_.getBubbleSize()
  16349. , b = 2 * Blockly.Bubble.BORDER_WIDTH;
  16350. this.foreignObject_.setAttribute("width", a.width - b);
  16351. this.foreignObject_.setAttribute("height", a.height - b);
  16352. this.textarea_.style.width = a.width - b - 4 + "px";
  16353. this.textarea_.style.height = a.height - b - 4 + "px"
  16354. }
  16355. }
  16356. ;
  16357. Blockly.Comment.prototype.setVisible = function (a) {
  16358. if (a != this.isVisible())
  16359. if (Blockly.Events.fire(new Blockly.Events.Ui(this.block_, "commentOpen", !a, a)),
  16360. !this.block_.isEditable() && !this.textarea_ || goog.userAgent.IE)
  16361. Blockly.Warning.prototype.setVisible.call(this, a);
  16362. else {
  16363. var b = this.getText()
  16364. , c = this.getBubbleSize();
  16365. a ? (this.bubble_ = new Blockly.Bubble(this.block_.workspace, this.createEditor_(), this.block_.svgPath_, this.iconXY_, this.width_, this.height_),
  16366. this.bubble_.registerResizeEvent(this.resizeBubble_.bind(this)),
  16367. this.updateColour()) : (this.bubble_.dispose(),
  16368. this.foreignObject_ = this.textarea_ = this.bubble_ = null);
  16369. this.setText(b);
  16370. this.setBubbleSize(c.width, c.height)
  16371. }
  16372. }
  16373. ;
  16374. Blockly.Comment.prototype.textareaFocus_ = function (a) {
  16375. this.bubble_.promote_();
  16376. this.textarea_.focus()
  16377. }
  16378. ;
  16379. Blockly.Comment.prototype.getBubbleSize = function () {
  16380. return this.isVisible() ? this.bubble_.getBubbleSize() : {
  16381. width: this.width_,
  16382. height: this.height_
  16383. }
  16384. }
  16385. ;
  16386. Blockly.Comment.prototype.setBubbleSize = function (a, b) {
  16387. this.textarea_ ? this.bubble_.setBubbleSize(a, b) : (this.width_ = a,
  16388. this.height_ = b)
  16389. }
  16390. ;
  16391. Blockly.Comment.prototype.getText = function () {
  16392. return this.textarea_ ? this.textarea_.value : this.text_
  16393. }
  16394. ;
  16395. Blockly.Comment.prototype.setText = function (a) {
  16396. this.text_ != a && (Blockly.Events.fire(new Blockly.Events.Change(this.block_, "comment", null, this.text_, a)),
  16397. this.text_ = a);
  16398. this.textarea_ && (this.textarea_.value = a)
  16399. }
  16400. ;
  16401. Blockly.Comment.prototype.dispose = function () {
  16402. Blockly.Events.isEnabled() && this.setText("");
  16403. this.block_.comment = null;
  16404. Blockly.Icon.prototype.dispose.call(this)
  16405. }
  16406. ;
  16407. Blockly.Connection = function (a, b) {
  16408. this.sourceBlock_ = a;
  16409. this.type = b;
  16410. a.workspace.connectionDBList && (this.db_ = a.workspace.connectionDBList[b],
  16411. this.dbOpposite_ = a.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[b]],
  16412. this.hidden_ = !this.db_)
  16413. }
  16414. ;
  16415. Blockly.Connection.CAN_CONNECT = 0;
  16416. Blockly.Connection.REASON_SELF_CONNECTION = 1;
  16417. Blockly.Connection.REASON_WRONG_TYPE = 2;
  16418. Blockly.Connection.REASON_TARGET_NULL = 3;
  16419. Blockly.Connection.REASON_CHECKS_FAILED = 4;
  16420. Blockly.Connection.REASON_DIFFERENT_WORKSPACES = 5;
  16421. Blockly.Connection.REASON_SHADOW_PARENT = 6;
  16422. Blockly.Connection.prototype.targetConnection = null;
  16423. Blockly.Connection.prototype.check_ = null;
  16424. Blockly.Connection.prototype.shadowDom_ = null;
  16425. Blockly.Connection.prototype.x_ = 0;
  16426. Blockly.Connection.prototype.y_ = 0;
  16427. Blockly.Connection.prototype.inDB_ = !1;
  16428. Blockly.Connection.prototype.db_ = null;
  16429. Blockly.Connection.prototype.dbOpposite_ = null;
  16430. Blockly.Connection.prototype.hidden_ = null;
  16431. Blockly.Connection.prototype.connect_ = function (a) {
  16432. var b = this
  16433. , c = b.getSourceBlock()
  16434. , d = a.getSourceBlock();
  16435. a.isConnected() && a.disconnect();
  16436. if (b.isConnected()) {
  16437. var e = b.targetBlock()
  16438. , f = b.getShadowDom();
  16439. b.setShadowDom(null);
  16440. if (e.isShadow())
  16441. f = Blockly.Xml.blockToDom(e),
  16442. e.dispose(),
  16443. e = null;
  16444. else if (b.type == Blockly.INPUT_VALUE) {
  16445. if (!e.outputConnection)
  16446. throw "Orphan block does not have an output connection.";
  16447. var g = Blockly.Connection.lastConnectionInRow_(d, e);
  16448. g && (e.outputConnection.connect(g),
  16449. e = null)
  16450. } else if (b.type == Blockly.NEXT_STATEMENT) {
  16451. if (!e.previousConnection)
  16452. throw "Orphan block does not have a previous connection.";
  16453. for (g = d; g.nextConnection;) {
  16454. var h = g.getNextBlock();
  16455. if (h && !h.isShadow())
  16456. g = h;
  16457. else {
  16458. e.previousConnection.checkType_(g.nextConnection) && (g.nextConnection.connect(e.previousConnection),
  16459. e = null);
  16460. break
  16461. }
  16462. }
  16463. }
  16464. if (e && (b.disconnect(),
  16465. Blockly.Events.recordUndo)) {
  16466. var k = Blockly.Events.getGroup();
  16467. setTimeout(function () {
  16468. e.workspace && !e.getParent() && (Blockly.Events.setGroup(k),
  16469. e.outputConnection ? e.outputConnection.bumpAwayFrom_(b) : e.previousConnection && e.previousConnection.bumpAwayFrom_(b),
  16470. Blockly.Events.setGroup(!1))
  16471. }, Blockly.BUMP_DELAY)
  16472. }
  16473. b.setShadowDom(f)
  16474. }
  16475. var m;
  16476. Blockly.Events.isEnabled() && (m = new Blockly.Events.Move(d));
  16477. Blockly.Connection.connectReciprocally_(b, a);
  16478. d.setParent(c);
  16479. m && (m.recordNew(),
  16480. Blockly.Events.fire(m))
  16481. }
  16482. ;
  16483. Blockly.Connection.prototype.dispose = function () {
  16484. if (this.isConnected())
  16485. throw "Disconnect connection before disposing of it.";
  16486. this.inDB_ && this.db_.removeConnection_(this);
  16487. Blockly.highlightedConnection_ == this && (Blockly.highlightedConnection_ = null);
  16488. Blockly.localConnection_ == this && (Blockly.localConnection_ = null);
  16489. this.dbOpposite_ = this.db_ = null
  16490. }
  16491. ;
  16492. Blockly.Connection.prototype.getSourceBlock = function () {
  16493. return this.sourceBlock_
  16494. }
  16495. ;
  16496. Blockly.Connection.prototype.isSuperior = function () {
  16497. return this.type == Blockly.INPUT_VALUE || this.type == Blockly.NEXT_STATEMENT
  16498. }
  16499. ;
  16500. Blockly.Connection.prototype.isConnected = function () {
  16501. return !!this.targetConnection
  16502. }
  16503. ;
  16504. Blockly.Connection.prototype.canConnectWithReason_ = function (a) {
  16505. if (!a)
  16506. return Blockly.Connection.REASON_TARGET_NULL;
  16507. if (this.isSuperior())
  16508. var b = this.sourceBlock_
  16509. , c = a.getSourceBlock();
  16510. else
  16511. c = this.sourceBlock_,
  16512. b = a.getSourceBlock();
  16513. return b && b == c ? Blockly.Connection.REASON_SELF_CONNECTION : a.type != Blockly.OPPOSITE_TYPE[this.type] ? Blockly.Connection.REASON_WRONG_TYPE : b && c && b.workspace !== c.workspace ? Blockly.Connection.REASON_DIFFERENT_WORKSPACES : this.checkType_(a) ? b.isShadow() && !c.isShadow() ? Blockly.Connection.REASON_SHADOW_PARENT : Blockly.Connection.CAN_CONNECT : Blockly.Connection.REASON_CHECKS_FAILED
  16514. }
  16515. ;
  16516. Blockly.Connection.prototype.checkConnection_ = function (a) {
  16517. switch (this.canConnectWithReason_(a)) {
  16518. case Blockly.Connection.CAN_CONNECT:
  16519. break;
  16520. case Blockly.Connection.REASON_SELF_CONNECTION:
  16521. throw "Attempted to connect a block to itself.";
  16522. case Blockly.Connection.REASON_DIFFERENT_WORKSPACES:
  16523. throw "Blocks not on same workspace.";
  16524. case Blockly.Connection.REASON_WRONG_TYPE:
  16525. throw "Attempt to connect incompatible types.";
  16526. case Blockly.Connection.REASON_TARGET_NULL:
  16527. throw "Target connection is null.";
  16528. case Blockly.Connection.REASON_CHECKS_FAILED:
  16529. throw "Connection checks failed.";
  16530. case Blockly.Connection.REASON_SHADOW_PARENT:
  16531. throw "Connecting non-shadow to shadow block.";
  16532. default:
  16533. throw "Unknown connection failure: this should never happen!";
  16534. }
  16535. }
  16536. ;
  16537. Blockly.Connection.prototype.isConnectionAllowed = function (a) {
  16538. if (this.canConnectWithReason_(a) != Blockly.Connection.CAN_CONNECT)
  16539. return !1;
  16540. if (a.type == Blockly.OUTPUT_VALUE || a.type == Blockly.PREVIOUS_STATEMENT)
  16541. if (a.isConnected() || this.isConnected())
  16542. return !1;
  16543. return a.type == Blockly.INPUT_VALUE && a.isConnected() && !a.targetBlock().isMovable() && !a.targetBlock().isShadow() || this.type == Blockly.PREVIOUS_STATEMENT && a.isConnected() && !this.sourceBlock_.nextConnection && !a.targetBlock().isShadow() && a.targetBlock().nextConnection || -1 != Blockly.draggingConnections_.indexOf(a) ? !1 : !0
  16544. }
  16545. ;
  16546. Blockly.Connection.prototype.connect = function (a) {
  16547. this.targetConnection != a && (this.checkConnection_(a),
  16548. this.isSuperior() ? this.connect_(a) : a.connect_(this))
  16549. }
  16550. ;
  16551. Blockly.Connection.connectReciprocally_ = function (a, b) {
  16552. goog.asserts.assert(a && b, "Cannot connect null connections.");
  16553. a.targetConnection = b;
  16554. b.targetConnection = a
  16555. }
  16556. ;
  16557. Blockly.Connection.singleConnection_ = function (a, b) {
  16558. for (var c = !1, d = 0; d < a.inputList.length; d++) {
  16559. var e = a.inputList[d].connection;
  16560. if (e && e.type == Blockly.INPUT_VALUE && b.outputConnection.checkType_(e)) {
  16561. if (c)
  16562. return null;
  16563. c = e
  16564. }
  16565. }
  16566. return c
  16567. }
  16568. ;
  16569. Blockly.Connection.lastConnectionInRow_ = function (a, b) {
  16570. for (var c = a, d; d = Blockly.Connection.singleConnection_(c, b);)
  16571. if (c = d.targetBlock(),
  16572. !c || c.isShadow())
  16573. return d;
  16574. return null
  16575. }
  16576. ;
  16577. Blockly.Connection.prototype.disconnect = function () {
  16578. var a = this.targetConnection;
  16579. goog.asserts.assert(a, "Source connection not connected.");
  16580. goog.asserts.assert(a.targetConnection == this, "Target connection not connected to source connection.");
  16581. if (this.isSuperior()) {
  16582. var b = this.sourceBlock_;
  16583. var c = a.getSourceBlock();
  16584. a = this
  16585. } else
  16586. b = a.getSourceBlock(),
  16587. c = this.sourceBlock_;
  16588. this.disconnectInternal_(b, c);
  16589. a.respawnShadow_()
  16590. }
  16591. ;
  16592. Blockly.Connection.prototype.disconnectInternal_ = function (a, b) {
  16593. var c;
  16594. Blockly.Events.isEnabled() && (c = new Blockly.Events.Move(b));
  16595. this.targetConnection = this.targetConnection.targetConnection = null;
  16596. b.setParent(null);
  16597. c && (c.recordNew(),
  16598. Blockly.Events.fire(c))
  16599. }
  16600. ;
  16601. Blockly.Connection.prototype.respawnShadow_ = function () {
  16602. var a = this.getSourceBlock()
  16603. , b = this.getShadowDom();
  16604. if (a.workspace && b && Blockly.Events.recordUndo)
  16605. if (a = Blockly.Xml.domToBlock(b, a.workspace),
  16606. a.outputConnection)
  16607. this.connect(a.outputConnection);
  16608. else if (a.previousConnection)
  16609. this.connect(a.previousConnection);
  16610. else
  16611. throw "Child block does not have output or previous statement.";
  16612. }
  16613. ;
  16614. Blockly.Connection.prototype.targetBlock = function () {
  16615. return this.isConnected() ? this.targetConnection.getSourceBlock() : null
  16616. }
  16617. ;
  16618. Blockly.Connection.prototype.checkType_ = function (a) {
  16619. if (!this.check_ || !a.check_)
  16620. return !0;
  16621. for (var b = 0; b < this.check_.length; b++)
  16622. if (-1 != a.check_.indexOf(this.check_[b]))
  16623. return !0;
  16624. return !1
  16625. }
  16626. ;
  16627. Blockly.Connection.prototype.setCheck = function (a) {
  16628. a ? (goog.isArray(a) || (a = [a]),
  16629. this.check_ = a,
  16630. this.isConnected() && !this.checkType_(this.targetConnection) && ((this.isSuperior() ? this.targetBlock() : this.sourceBlock_).unplug(),
  16631. this.sourceBlock_.bumpNeighbours_())) : this.check_ = null;
  16632. return this
  16633. }
  16634. ;
  16635. Blockly.Connection.prototype.setShadowDom = function (a) {
  16636. this.shadowDom_ = a
  16637. }
  16638. ;
  16639. Blockly.Connection.prototype.getShadowDom = function () {
  16640. return this.shadowDom_
  16641. }
  16642. ;
  16643. Blockly.Field = function (a, b) {
  16644. this.size_ = new goog.math.Size(0, 25);
  16645. this.setValue(a);
  16646. this.setValidator(b)
  16647. }
  16648. ;
  16649. Blockly.Field.cacheWidths_ = null;
  16650. Blockly.Field.cacheReference_ = 0;
  16651. Blockly.Field.prototype.name = void 0;
  16652. Blockly.Field.prototype.maxDisplayLength = 50;
  16653. Blockly.Field.prototype.text_ = "";
  16654. Blockly.Field.prototype.sourceBlock_ = null;
  16655. Blockly.Field.prototype.visible_ = !0;
  16656. Blockly.Field.prototype.validator_ = null;
  16657. Blockly.Field.NBSP = "\u00a0";
  16658. Blockly.Field.prototype.EDITABLE = !0;
  16659. Blockly.Field.prototype.setSourceBlock = function (a) {
  16660. goog.asserts.assert(!this.sourceBlock_, "Field already bound to a block.");
  16661. this.sourceBlock_ = a
  16662. }
  16663. ;
  16664. Blockly.Field.prototype.init = function () {
  16665. this.fieldGroup_ || (this.fieldGroup_ = Blockly.createSvgElement("g", {}, null),
  16666. this.visible_ || (this.fieldGroup_.style.display = "none"),
  16667. this.borderRect_ = Blockly.createSvgElement("rect", {
  16668. rx: 4,
  16669. ry: 4,
  16670. x: -Blockly.BlockSvg.SEP_SPACE_X / 2,
  16671. y: 0,
  16672. height: 16
  16673. }, this.fieldGroup_, this.sourceBlock_.workspace),
  16674. this.textElement_ = Blockly.createSvgElement("text", {
  16675. "class": "blocklyText",
  16676. y: this.size_.height - 12.5
  16677. }, this.fieldGroup_),
  16678. this.updateEditable(),
  16679. this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),
  16680. this.mouseUpWrapper_ = Blockly.bindEventWithChecks_(this.fieldGroup_, "mouseup", this, this.onMouseUp_),
  16681. this.updateTextNode_())
  16682. }
  16683. ;
  16684. Blockly.Field.prototype.dispose = function () {
  16685. this.mouseUpWrapper_ && (Blockly.unbindEvent_(this.mouseUpWrapper_),
  16686. this.mouseUpWrapper_ = null);
  16687. this.sourceBlock_ = null;
  16688. goog.dom.removeNode(this.fieldGroup_);
  16689. this.validator_ = this.borderRect_ = this.textElement_ = this.fieldGroup_ = null
  16690. }
  16691. ;
  16692. Blockly.Field.prototype.updateEditable = function () {
  16693. var a = this.fieldGroup_;
  16694. this.EDITABLE && a && (this.sourceBlock_.isEditable() ? (Blockly.addClass_(a, "blocklyEditableText"),
  16695. Blockly.removeClass_(a, "blocklyNonEditableText"),
  16696. this.fieldGroup_.style.cursor = this.CURSOR) : (Blockly.addClass_(a, "blocklyNonEditableText"),
  16697. Blockly.removeClass_(a, "blocklyEditableText"),
  16698. this.fieldGroup_.style.cursor = ""))
  16699. }
  16700. ;
  16701. Blockly.Field.prototype.isVisible = function () {
  16702. return this.visible_
  16703. }
  16704. ;
  16705. Blockly.Field.prototype.setVisible = function (a) {
  16706. if (this.visible_ != a) {
  16707. this.visible_ = a;
  16708. var b = this.getSvgRoot();
  16709. b && (b.style.display = a ? "block" : "none",
  16710. this.render_())
  16711. }
  16712. }
  16713. ;
  16714. Blockly.Field.prototype.setValidator = function (a) {
  16715. this.validator_ = a
  16716. }
  16717. ;
  16718. Blockly.Field.prototype.getValidator = function () {
  16719. return this.validator_
  16720. }
  16721. ;
  16722. Blockly.Field.prototype.classValidator = function (a) {
  16723. return a
  16724. }
  16725. ;
  16726. Blockly.Field.prototype.callValidator = function (a) {
  16727. var b = this.classValidator(a);
  16728. if (null === b)
  16729. return null;
  16730. void 0 !== b && (a = b);
  16731. if (b = this.getValidator()) {
  16732. b = b.call(this, a);
  16733. if (null === b)
  16734. return null;
  16735. void 0 !== b && (a = b)
  16736. }
  16737. return a
  16738. }
  16739. ;
  16740. Blockly.Field.prototype.getSvgRoot = function () {
  16741. return this.fieldGroup_
  16742. }
  16743. ;
  16744. Blockly.Field.prototype.render_ = function () {
  16745. if (this.visible_ && this.textElement_) {
  16746. var a = this.textElement_.textContent + "\n" + this.textElement_.className.baseVal;
  16747. if (Blockly.Field.cacheWidths_ && Blockly.Field.cacheWidths_[a])
  16748. var b = Blockly.Field.cacheWidths_[a];
  16749. else {
  16750. try {
  16751. b = this.textElement_.getComputedTextLength()
  16752. } catch (c) {
  16753. b = 8 * this.textElement_.textContent.length
  16754. }
  16755. Blockly.Field.cacheWidths_ && (Blockly.Field.cacheWidths_[a] = b)
  16756. }
  16757. this.borderRect_ && this.borderRect_.setAttribute("width", b + Blockly.BlockSvg.SEP_SPACE_X)
  16758. } else
  16759. b = 0;
  16760. this.size_.width = b
  16761. }
  16762. ;
  16763. Blockly.Field.startCache = function () {
  16764. Blockly.Field.cacheReference_++;
  16765. Blockly.Field.cacheWidths_ || (Blockly.Field.cacheWidths_ = {})
  16766. }
  16767. ;
  16768. Blockly.Field.stopCache = function () {
  16769. Blockly.Field.cacheReference_--;
  16770. Blockly.Field.cacheReference_ || (Blockly.Field.cacheWidths_ = null)
  16771. }
  16772. ;
  16773. Blockly.Field.prototype.getSize = function () {
  16774. this.size_.width || this.render_();
  16775. return this.size_
  16776. }
  16777. ;
  16778. Blockly.Field.prototype.getScaledBBox_ = function () {
  16779. var a = this.borderRect_.getBBox();
  16780. return new goog.math.Size(a.width * this.sourceBlock_.workspace.scale, a.height * this.sourceBlock_.workspace.scale)
  16781. }
  16782. ;
  16783. Blockly.Field.prototype.getText = function () {
  16784. return this.text_
  16785. }
  16786. ;
  16787. Blockly.Field.prototype.setText = function (a) {
  16788. null !== a && (a = String(a),
  16789. a !== this.text_ && (this.text_ = a,
  16790. this.updateTextNode_(),
  16791. this.sourceBlock_ && this.sourceBlock_.rendered && (this.sourceBlock_.render(),
  16792. this.sourceBlock_.bumpNeighbours_())))
  16793. }
  16794. ;
  16795. Blockly.Field.prototype.updateTextNode_ = function () {
  16796. if (this.textElement_) {
  16797. var a = this.text_;
  16798. a.length > this.maxDisplayLength && (a = a.substring(0, this.maxDisplayLength - 2) + "\u2026");
  16799. a = a.replace(/\s/g, Blockly.Field.NBSP);
  16800. this.sourceBlock_.RTL && a && (a += "\u200f");
  16801. a || (a = Blockly.Field.NBSP);
  16802. goog.dom.removeChildren(this.textElement_);
  16803. a = document.createTextNode(a);
  16804. this.textElement_.appendChild(a);
  16805. this.size_.width = 0
  16806. }
  16807. }
  16808. ;
  16809. Blockly.Field.prototype.getValue = function () {
  16810. return this.getText()
  16811. }
  16812. ;
  16813. Blockly.Field.prototype.setValue = function (a) {
  16814. if (null !== a) {
  16815. var b = this.getValue();
  16816. b != a && (this.sourceBlock_ && Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, b, a)),
  16817. this.setText(a))
  16818. }
  16819. }
  16820. ;
  16821. Blockly.Field.prototype.onMouseUp_ = function (a) {
  16822. if (!goog.userAgent.IPHONE && !goog.userAgent.IPAD || goog.userAgent.isVersionOrHigher("537.51.2") || 0 === a.layerX || 0 === a.layerY)
  16823. Blockly.isRightButton(a) || this.sourceBlock_.workspace.isDragging() || this.sourceBlock_.isEditable() && this.showEditor_()
  16824. }
  16825. ;
  16826. Blockly.Field.prototype.setTooltip = function (a) { }
  16827. ;
  16828. Blockly.Field.prototype.getAbsoluteXY_ = function () {
  16829. return goog.style.getPageOffset(this.borderRect_)
  16830. }
  16831. ;
  16832. Blockly.Tooltip = {};
  16833. Blockly.Tooltip.visible = !1;
  16834. Blockly.Tooltip.LIMIT = 50;
  16835. Blockly.Tooltip.mouseOutPid_ = 0;
  16836. Blockly.Tooltip.showPid_ = 0;
  16837. Blockly.Tooltip.lastX_ = 0;
  16838. Blockly.Tooltip.lastY_ = 0;
  16839. Blockly.Tooltip.element_ = null;
  16840. Blockly.Tooltip.poisonedElement_ = null;
  16841. Blockly.Tooltip.OFFSET_X = 0;
  16842. Blockly.Tooltip.OFFSET_Y = 10;
  16843. Blockly.Tooltip.RADIUS_OK = 10;
  16844. Blockly.Tooltip.HOVER_MS = 750;
  16845. Blockly.Tooltip.MARGINS = 5;
  16846. Blockly.Tooltip.DIV = null;
  16847. Blockly.Tooltip.createDom = function () {
  16848. Blockly.Tooltip.DIV || (Blockly.Tooltip.DIV = goog.dom.createDom("DIV", "blocklyTooltipDiv"),
  16849. document.body.appendChild(Blockly.Tooltip.DIV))
  16850. }
  16851. ;
  16852. Blockly.Tooltip.bindMouseEvents = function (a) {
  16853. Blockly.bindEvent_(a, "mouseover", null, Blockly.Tooltip.onMouseOver_);
  16854. Blockly.bindEvent_(a, "mouseout", null, Blockly.Tooltip.onMouseOut_);
  16855. a.addEventListener("mousemove", Blockly.Tooltip.onMouseMove_, !1)
  16856. }
  16857. ;
  16858. Blockly.Tooltip.onMouseOver_ = function (a) {
  16859. for (a = a.target; !goog.isString(a.tooltip) && !goog.isFunction(a.tooltip);)
  16860. a = a.tooltip;
  16861. Blockly.Tooltip.element_ != a && (Blockly.Tooltip.hide(),
  16862. Blockly.Tooltip.poisonedElement_ = null,
  16863. Blockly.Tooltip.element_ = a);
  16864. clearTimeout(Blockly.Tooltip.mouseOutPid_)
  16865. }
  16866. ;
  16867. Blockly.Tooltip.onMouseOut_ = function (a) {
  16868. Blockly.Tooltip.mouseOutPid_ = setTimeout(function () {
  16869. Blockly.Tooltip.element_ = null;
  16870. Blockly.Tooltip.poisonedElement_ = null;
  16871. Blockly.Tooltip.hide()
  16872. }, 1);
  16873. clearTimeout(Blockly.Tooltip.showPid_)
  16874. }
  16875. ;
  16876. Blockly.Tooltip.onMouseMove_ = function (a) {
  16877. if (Blockly.Tooltip.element_ && Blockly.Tooltip.element_.tooltip && Blockly.dragMode_ == Blockly.DRAG_NONE && !Blockly.WidgetDiv.isVisible())
  16878. if (Blockly.Tooltip.visible) {
  16879. var b = Blockly.Tooltip.lastX_ - a.pageX;
  16880. a = Blockly.Tooltip.lastY_ - a.pageY;
  16881. Math.sqrt(b * b + a * a) > Blockly.Tooltip.RADIUS_OK && Blockly.Tooltip.hide()
  16882. } else
  16883. Blockly.Tooltip.poisonedElement_ != Blockly.Tooltip.element_ && (clearTimeout(Blockly.Tooltip.showPid_),
  16884. Blockly.Tooltip.lastX_ = a.pageX,
  16885. Blockly.Tooltip.lastY_ = a.pageY,
  16886. Blockly.Tooltip.showPid_ = setTimeout(Blockly.Tooltip.show_, Blockly.Tooltip.HOVER_MS))
  16887. }
  16888. ;
  16889. Blockly.Tooltip.hide = function () {
  16890. Blockly.Tooltip.visible && (Blockly.Tooltip.visible = !1,
  16891. Blockly.Tooltip.DIV && (Blockly.Tooltip.DIV.style.display = "none"));
  16892. clearTimeout(Blockly.Tooltip.showPid_)
  16893. }
  16894. ;
  16895. Blockly.Tooltip.show_ = function () {
  16896. Blockly.Tooltip.poisonedElement_ = Blockly.Tooltip.element_;
  16897. if (Blockly.Tooltip.DIV) {
  16898. goog.dom.removeChildren(Blockly.Tooltip.DIV);
  16899. for (var a = Blockly.Tooltip.element_.tooltip; goog.isFunction(a);)
  16900. a = a();
  16901. a = Blockly.utils.wrap(a, Blockly.Tooltip.LIMIT);
  16902. a = a.split("\n");
  16903. for (var b = 0; b < a.length; b++) {
  16904. var c = document.createElement("div");
  16905. c.appendChild(document.createTextNode(a[b]));
  16906. Blockly.Tooltip.DIV.appendChild(c)
  16907. }
  16908. a = Blockly.Tooltip.element_.RTL;
  16909. b = goog.dom.getViewportSize();
  16910. Blockly.Tooltip.DIV.style.direction = a ? "rtl" : "ltr";
  16911. Blockly.Tooltip.DIV.style.display = "block";
  16912. Blockly.Tooltip.visible = !0;
  16913. c = Blockly.Tooltip.lastX_;
  16914. c = a ? c - (Blockly.Tooltip.OFFSET_X + Blockly.Tooltip.DIV.offsetWidth) : c + Blockly.Tooltip.OFFSET_X;
  16915. var d = Blockly.Tooltip.lastY_ + Blockly.Tooltip.OFFSET_Y;
  16916. d + Blockly.Tooltip.DIV.offsetHeight > b.height + window.scrollY && (d -= Blockly.Tooltip.DIV.offsetHeight + 2 * Blockly.Tooltip.OFFSET_Y);
  16917. a ? c = Math.max(Blockly.Tooltip.MARGINS - window.scrollX, c) : c + Blockly.Tooltip.DIV.offsetWidth > b.width + window.scrollX - 2 * Blockly.Tooltip.MARGINS && (c = b.width - Blockly.Tooltip.DIV.offsetWidth - 2 * Blockly.Tooltip.MARGINS);
  16918. Blockly.Tooltip.DIV.style.top = d + "px";
  16919. Blockly.Tooltip.DIV.style.left = c + "px"
  16920. }
  16921. }
  16922. ;
  16923. Blockly.FieldLabel = function (a, b) {
  16924. this.size_ = new goog.math.Size(0, 17.5);
  16925. this.class_ = b;
  16926. this.setValue(a)
  16927. }
  16928. ;
  16929. goog.inherits(Blockly.FieldLabel, Blockly.Field);
  16930. Blockly.FieldLabel.prototype.EDITABLE = !1;
  16931. Blockly.FieldLabel.prototype.init = function () {
  16932. this.textElement_ || (this.textElement_ = Blockly.createSvgElement("text", {
  16933. "class": "blocklyText",
  16934. y: this.size_.height - 5
  16935. }, null),
  16936. this.class_ && Blockly.addClass_(this.textElement_, this.class_),
  16937. this.visible_ || (this.textElement_.style.display = "none"),
  16938. this.sourceBlock_.getSvgRoot().appendChild(this.textElement_),
  16939. this.textElement_.tooltip = this.sourceBlock_,
  16940. Blockly.Tooltip.bindMouseEvents(this.textElement_),
  16941. this.updateTextNode_())
  16942. }
  16943. ;
  16944. Blockly.FieldLabel.prototype.dispose = function () {
  16945. goog.dom.removeNode(this.textElement_);
  16946. this.textElement_ = null
  16947. }
  16948. ;
  16949. Blockly.FieldLabel.prototype.getSvgRoot = function () {
  16950. return this.textElement_
  16951. }
  16952. ;
  16953. Blockly.FieldLabel.prototype.setTooltip = function (a) {
  16954. this.textElement_.tooltip = a
  16955. }
  16956. ;
  16957. Blockly.Input = function (a, b, c, d) {
  16958. this.type = a;
  16959. this.name = b;
  16960. this.sourceBlock_ = c;
  16961. this.connection = d;
  16962. this.fieldRow = []
  16963. }
  16964. ;
  16965. Blockly.Input.prototype.align = Blockly.ALIGN_LEFT;
  16966. Blockly.Input.prototype.visible_ = !0;
  16967. Blockly.Input.prototype.appendField = function (a, b) {
  16968. if (!a && !b)
  16969. return this;
  16970. goog.isString(a) && (a = new Blockly.FieldLabel(a));
  16971. a.setSourceBlock(this.sourceBlock_);
  16972. this.sourceBlock_.rendered && a.init();
  16973. a.name = b;
  16974. a.prefixField && this.appendField(a.prefixField);
  16975. this.fieldRow.push(a);
  16976. a.suffixField && this.appendField(a.suffixField);
  16977. this.sourceBlock_.rendered && (this.sourceBlock_.render(),
  16978. this.sourceBlock_.bumpNeighbours_());
  16979. return this
  16980. }
  16981. ;
  16982. Blockly.Input.prototype.appendTitle = function (a, b) {
  16983. console.warn("Deprecated call to appendTitle, use appendField instead.");
  16984. return this.appendField(a, b)
  16985. }
  16986. ;
  16987. Blockly.Input.prototype.removeField = function (a) {
  16988. for (var b = 0, c; c = this.fieldRow[b]; b++)
  16989. if (c.name === a) {
  16990. c.dispose();
  16991. this.fieldRow.splice(b, 1);
  16992. this.sourceBlock_.rendered && (this.sourceBlock_.render(),
  16993. this.sourceBlock_.bumpNeighbours_());
  16994. return
  16995. }
  16996. goog.asserts.fail('Field "%s" not found.', a)
  16997. }
  16998. ;
  16999. Blockly.Input.prototype.isVisible = function () {
  17000. return this.visible_
  17001. }
  17002. ;
  17003. Blockly.Input.prototype.setVisible = function (a) {
  17004. var b = [];
  17005. if (this.visible_ == a)
  17006. return b;
  17007. for (var c = (this.visible_ = a) ? "block" : "none", d = 0, e; e = this.fieldRow[d]; d++)
  17008. e.setVisible(a);
  17009. this.connection && (a ? b = this.connection.unhideAll() : this.connection.hideAll(),
  17010. d = this.connection.targetBlock()) && (d.getSvgRoot().style.display = c,
  17011. a || (d.rendered = !1));
  17012. return b
  17013. }
  17014. ;
  17015. Blockly.Input.prototype.setCheck = function (a) {
  17016. if (!this.connection)
  17017. throw "This input does not have a connection.";
  17018. this.connection.setCheck(a);
  17019. return this
  17020. }
  17021. ;
  17022. Blockly.Input.prototype.setAlign = function (a) {
  17023. this.align = a;
  17024. this.sourceBlock_.rendered && this.sourceBlock_.render();
  17025. return this
  17026. }
  17027. ;
  17028. Blockly.Input.prototype.init = function () {
  17029. if (this.sourceBlock_.workspace.rendered)
  17030. for (var a = 0; a < this.fieldRow.length; a++)
  17031. this.fieldRow[a].init()
  17032. }
  17033. ;
  17034. Blockly.Input.prototype.dispose = function () {
  17035. for (var a = 0, b; b = this.fieldRow[a]; a++)
  17036. b.dispose();
  17037. this.connection && this.connection.dispose();
  17038. this.sourceBlock_ = null
  17039. }
  17040. ;
  17041. Blockly.ConnectionDB = function () { }
  17042. ;
  17043. Blockly.ConnectionDB.prototype = [];
  17044. Blockly.ConnectionDB.constructor = Blockly.ConnectionDB;
  17045. Blockly.ConnectionDB.prototype.addConnection = function (a) {
  17046. if (a.inDB_)
  17047. throw "Connection already in database.";
  17048. if (!a.getSourceBlock().isInFlyout) {
  17049. var b = this.findPositionForConnection_(a);
  17050. this.splice(b, 0, a);
  17051. a.inDB_ = !0
  17052. }
  17053. }
  17054. ;
  17055. Blockly.ConnectionDB.prototype.findConnection = function (a) {
  17056. if (!this.length)
  17057. return -1;
  17058. var b = this.findPositionForConnection_(a);
  17059. if (b >= this.length)
  17060. return -1;
  17061. for (var c = a.y_, d = b; 0 <= d && this[d].y_ == c;) {
  17062. if (this[d] == a)
  17063. return d;
  17064. d--
  17065. }
  17066. for (; b < this.length && this[b].y_ == c;) {
  17067. if (this[b] == a)
  17068. return b;
  17069. b++
  17070. }
  17071. return -1
  17072. }
  17073. ;
  17074. Blockly.ConnectionDB.prototype.findPositionForConnection_ = function (a) {
  17075. if (!this.length)
  17076. return 0;
  17077. for (var b = 0, c = this.length; b < c;) {
  17078. var d = Math.floor((b + c) / 2);
  17079. if (this[d].y_ < a.y_)
  17080. b = d + 1;
  17081. else if (this[d].y_ > a.y_)
  17082. c = d;
  17083. else {
  17084. b = d;
  17085. break
  17086. }
  17087. }
  17088. return b
  17089. }
  17090. ;
  17091. Blockly.ConnectionDB.prototype.removeConnection_ = function (a) {
  17092. if (!a.inDB_)
  17093. throw "Connection not in database.";
  17094. var b = this.findConnection(a);
  17095. if (-1 == b)
  17096. throw "Unable to find connection in connectionDB.";
  17097. a.inDB_ = !1;
  17098. this.splice(b, 1)
  17099. }
  17100. ;
  17101. Blockly.ConnectionDB.prototype.getNeighbours = function (a, b) {
  17102. function c(a) {
  17103. var c = e - d[a].x_
  17104. , g = f - d[a].y_;
  17105. Math.sqrt(c * c + g * g) <= b && m.push(d[a]);
  17106. return g < b
  17107. }
  17108. for (var d = this, e = a.x_, f = a.y_, g = 0, h = d.length - 2, k = h; g < k;)
  17109. d[k].y_ < f ? g = k : h = k,
  17110. k = Math.floor((g + h) / 2);
  17111. var m = [];
  17112. h = g = k;
  17113. if (d.length) {
  17114. for (; 0 <= g && c(g);)
  17115. g--;
  17116. do
  17117. h++;
  17118. while (h < d.length && c(h))
  17119. }
  17120. return m
  17121. }
  17122. ;
  17123. Blockly.ConnectionDB.prototype.isInYRange_ = function (a, b, c) {
  17124. return Math.abs(this[a].y_ - b) <= c
  17125. }
  17126. ;
  17127. Blockly.ConnectionDB.prototype.searchForClosest = function (a, b, c) {
  17128. if (!this.length)
  17129. return {
  17130. connection: null,
  17131. radius: b
  17132. };
  17133. var d = a.y_
  17134. , e = a.x_;
  17135. a.x_ = e + c.x;
  17136. a.y_ = d + c.y;
  17137. var f = this.findPositionForConnection_(a);
  17138. c = null;
  17139. for (var g = b, h, k = f - 1; 0 <= k && this.isInYRange_(k, a.y_, b);)
  17140. h = this[k],
  17141. a.isConnectionAllowed(h, g) && (c = h,
  17142. g = h.distanceFrom(a)),
  17143. k--;
  17144. for (; f < this.length && this.isInYRange_(f, a.y_, b);)
  17145. h = this[f],
  17146. a.isConnectionAllowed(h, g) && (c = h,
  17147. g = h.distanceFrom(a)),
  17148. f++;
  17149. a.x_ = e;
  17150. a.y_ = d;
  17151. return {
  17152. connection: c,
  17153. radius: g
  17154. }
  17155. }
  17156. ;
  17157. Blockly.ConnectionDB.init = function (a) {
  17158. var b = [];
  17159. b[Blockly.INPUT_VALUE] = new Blockly.ConnectionDB;
  17160. b[Blockly.OUTPUT_VALUE] = new Blockly.ConnectionDB;
  17161. b[Blockly.NEXT_STATEMENT] = new Blockly.ConnectionDB;
  17162. b[Blockly.PREVIOUS_STATEMENT] = new Blockly.ConnectionDB;
  17163. a.connectionDBList = b
  17164. }
  17165. ;
  17166. Blockly.constants = {};
  17167. Blockly.DRAG_RADIUS = 5;
  17168. Blockly.SNAP_RADIUS = 20;
  17169. Blockly.BUMP_DELAY = 250;
  17170. Blockly.COLLAPSE_CHARS = 30;
  17171. Blockly.LONGPRESS = 750;
  17172. Blockly.SOUND_LIMIT = 100;
  17173. Blockly.HSV_SATURATION = .45;
  17174. Blockly.HSV_VALUE = .65;
  17175. Blockly.SPRITE = {
  17176. width: 96,
  17177. height: 124,
  17178. url: "sprites.png"
  17179. };
  17180. Blockly.SVG_NS = "http://www.w3.org/2000/svg";
  17181. Blockly.HTML_NS = "http://www.w3.org/1999/xhtml";
  17182. Blockly.INPUT_VALUE = 1;
  17183. Blockly.OUTPUT_VALUE = 2;
  17184. Blockly.NEXT_STATEMENT = 3;
  17185. Blockly.PREVIOUS_STATEMENT = 4;
  17186. Blockly.DUMMY_INPUT = 5;
  17187. Blockly.ALIGN_LEFT = -1;
  17188. Blockly.ALIGN_CENTRE = 0;
  17189. Blockly.ALIGN_RIGHT = 1;
  17190. Blockly.DRAG_NONE = 0;
  17191. Blockly.DRAG_STICKY = 1;
  17192. Blockly.DRAG_BEGIN = 1;
  17193. Blockly.DRAG_FREE = 2;
  17194. Blockly.OPPOSITE_TYPE = [];
  17195. Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE] = Blockly.OUTPUT_VALUE;
  17196. Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE] = Blockly.INPUT_VALUE;
  17197. Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT] = Blockly.PREVIOUS_STATEMENT;
  17198. Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT] = Blockly.NEXT_STATEMENT;
  17199. Blockly.TOOLBOX_AT_TOP = 0;
  17200. Blockly.TOOLBOX_AT_BOTTOM = 1;
  17201. Blockly.TOOLBOX_AT_LEFT = 2;
  17202. Blockly.TOOLBOX_AT_RIGHT = 3;
  17203. Blockly.Options = function (a) {
  17204. var b = !!a.readOnly;
  17205. if (b)
  17206. var c = null
  17207. , d = !1
  17208. , e = !1
  17209. , f = !1
  17210. , g = !1
  17211. , h = !1
  17212. , k = !1;
  17213. else
  17214. c = Blockly.Options.parseToolboxTree(a.toolbox),
  17215. d = !(!c || !c.getElementsByTagName("category").length),
  17216. e = a.trashcan,
  17217. void 0 === e && (e = d),
  17218. f = a.collapse,
  17219. void 0 === f && (f = d),
  17220. g = a.comments,
  17221. void 0 === g && (g = d),
  17222. h = a.disable,
  17223. void 0 === h && (h = d),
  17224. k = a.sounds,
  17225. void 0 === k && (k = !0);
  17226. var m = !!a.rtl
  17227. , p = a.horizontalLayout;
  17228. void 0 === p && (p = !1);
  17229. var l = a.toolboxPosition;
  17230. l = "end" === l ? !1 : !0;
  17231. l = p ? l ? Blockly.TOOLBOX_AT_TOP : Blockly.TOOLBOX_AT_BOTTOM : l == m ? Blockly.TOOLBOX_AT_RIGHT : Blockly.TOOLBOX_AT_LEFT;
  17232. var n = a.scrollbars;
  17233. void 0 === n && (n = d);
  17234. var q = a.css;
  17235. void 0 === q && (q = !0);
  17236. var t = "blockly/media/";
  17237. a.media ? t = a.media : a.path && (t = a.path + "media/");
  17238. var r = void 0 === a.oneBasedIndex ? !0 : !!a.oneBasedIndex;
  17239. this.RTL = m;
  17240. this.oneBasedIndex = r;
  17241. this.collapse = f;
  17242. this.comments = g;
  17243. this.disable = h;
  17244. this.readOnly = b;
  17245. this.maxBlocks = a.maxBlocks || Infinity;
  17246. this.pathToMedia = t;
  17247. this.hasCategories = d;
  17248. this.hasScrollbars = n;
  17249. this.hasTrashcan = e;
  17250. this.hasSounds = k;
  17251. this.hasCss = q;
  17252. this.horizontalLayout = p;
  17253. this.languageTree = c;
  17254. this.gridOptions = Blockly.Options.parseGridOptions_(a);
  17255. this.zoomOptions = Blockly.Options.parseZoomOptions_(a);
  17256. this.toolboxPosition = l
  17257. }
  17258. ;
  17259. Blockly.Options.prototype.parentWorkspace = null;
  17260. Blockly.Options.prototype.setMetrics = null;
  17261. Blockly.Options.prototype.getMetrics = null;
  17262. Blockly.Options.parseZoomOptions_ = function (a) {
  17263. a = a.zoom || {};
  17264. var b = {};
  17265. b.controls = void 0 === a.controls ? !1 : !!a.controls;
  17266. b.wheel = void 0 === a.wheel ? !1 : !!a.wheel;
  17267. b.startScale = void 0 === a.startScale ? 1 : parseFloat(a.startScale);
  17268. b.maxScale = void 0 === a.maxScale ? 3 : parseFloat(a.maxScale);
  17269. b.minScale = void 0 === a.minScale ? .3 : parseFloat(a.minScale);
  17270. b.scaleSpeed = void 0 === a.scaleSpeed ? 1.2 : parseFloat(a.scaleSpeed);
  17271. return b
  17272. }
  17273. ;
  17274. Blockly.Options.parseGridOptions_ = function (a) {
  17275. a = a.grid || {};
  17276. var b = {};
  17277. b.spacing = parseFloat(a.spacing) || 0;
  17278. b.colour = a.colour || "#888";
  17279. b.length = parseFloat(a.length) || 1;
  17280. b.snap = 0 < b.spacing && !!a.snap;
  17281. return b
  17282. }
  17283. ;
  17284. Blockly.Options.parseToolboxTree = function (a) {
  17285. a ? ("string" != typeof a && ("undefined" == typeof XSLTProcessor && a.outerHTML ? a = a.outerHTML : a instanceof Element || (a = null)),
  17286. "string" == typeof a && (a = Blockly.Xml.textToDom(a))) : a = null;
  17287. return a
  17288. }
  17289. ;
  17290. Blockly.ScrollbarPair = function (a) {
  17291. this.workspace_ = a;
  17292. this.hScroll = new Blockly.Scrollbar(a, !0, !0);
  17293. this.vScroll = new Blockly.Scrollbar(a, !1, !0);
  17294. this.corner_ = Blockly.createSvgElement("rect", {
  17295. height: Blockly.Scrollbar.scrollbarThickness,
  17296. width: Blockly.Scrollbar.scrollbarThickness,
  17297. "class": "blocklyScrollbarBackground"
  17298. }, null);
  17299. Blockly.Scrollbar.insertAfter_(this.corner_, a.getBubbleCanvas())
  17300. }
  17301. ;
  17302. Blockly.ScrollbarPair.prototype.oldHostMetrics_ = null;
  17303. Blockly.ScrollbarPair.prototype.dispose = function () {
  17304. goog.dom.removeNode(this.corner_);
  17305. this.oldHostMetrics_ = this.workspace_ = this.corner_ = null;
  17306. this.hScroll.dispose();
  17307. this.hScroll = null;
  17308. this.vScroll.dispose();
  17309. this.vScroll = null
  17310. }
  17311. ;
  17312. Blockly.ScrollbarPair.prototype.resize = function () {
  17313. var a = this.workspace_.getMetrics();
  17314. if (a) {
  17315. var b = !1
  17316. , c = !1;
  17317. this.oldHostMetrics_ && this.oldHostMetrics_.viewWidth == a.viewWidth && this.oldHostMetrics_.viewHeight == a.viewHeight && this.oldHostMetrics_.absoluteTop == a.absoluteTop && this.oldHostMetrics_.absoluteLeft == a.absoluteLeft ? (this.oldHostMetrics_ && this.oldHostMetrics_.contentWidth == a.contentWidth && this.oldHostMetrics_.viewLeft == a.viewLeft && this.oldHostMetrics_.contentLeft == a.contentLeft || (b = !0),
  17318. this.oldHostMetrics_ && this.oldHostMetrics_.contentHeight == a.contentHeight && this.oldHostMetrics_.viewTop == a.viewTop && this.oldHostMetrics_.contentTop == a.contentTop || (c = !0)) : c = b = !0;
  17319. b && this.hScroll.resize(a);
  17320. c && this.vScroll.resize(a);
  17321. this.oldHostMetrics_ && this.oldHostMetrics_.viewWidth == a.viewWidth && this.oldHostMetrics_.absoluteLeft == a.absoluteLeft || this.corner_.setAttribute("x", this.vScroll.position_.x);
  17322. this.oldHostMetrics_ && this.oldHostMetrics_.viewHeight == a.viewHeight && this.oldHostMetrics_.absoluteTop == a.absoluteTop || this.corner_.setAttribute("y", this.hScroll.position_.y);
  17323. this.oldHostMetrics_ = a
  17324. }
  17325. }
  17326. ;
  17327. Blockly.ScrollbarPair.prototype.set = function (a, b) {
  17328. var c = {}
  17329. , d = a * this.hScroll.ratio_
  17330. , e = b * this.vScroll.ratio_
  17331. , f = this.vScroll.scrollViewSize_;
  17332. c.x = this.getRatio_(d, this.hScroll.scrollViewSize_);
  17333. c.y = this.getRatio_(e, f);
  17334. this.workspace_.setMetrics(c);
  17335. this.hScroll.setHandlePosition(d);
  17336. this.vScroll.setHandlePosition(e)
  17337. }
  17338. ;
  17339. Blockly.ScrollbarPair.prototype.getRatio_ = function (a, b) {
  17340. var c = a / b;
  17341. return isNaN(c) ? 0 : c
  17342. }
  17343. ;
  17344. Blockly.Scrollbar = function (a, b, c) {
  17345. this.workspace_ = a;
  17346. this.pair_ = c || !1;
  17347. this.horizontal_ = b;
  17348. this.oldHostMetrics_ = null;
  17349. this.createDom_();
  17350. this.position_ = new goog.math.Coordinate(0, 0);
  17351. b ? (this.svgBackground_.setAttribute("height", Blockly.Scrollbar.scrollbarThickness),
  17352. this.svgHandle_.setAttribute("height", Blockly.Scrollbar.scrollbarThickness - 5),
  17353. this.svgHandle_.setAttribute("y", 2.5),
  17354. this.lengthAttribute_ = "width",
  17355. this.positionAttribute_ = "x") : (this.svgBackground_.setAttribute("width", Blockly.Scrollbar.scrollbarThickness),
  17356. this.svgHandle_.setAttribute("width", Blockly.Scrollbar.scrollbarThickness - 5),
  17357. this.svgHandle_.setAttribute("x", 2.5),
  17358. this.lengthAttribute_ = "height",
  17359. this.positionAttribute_ = "y");
  17360. this.onMouseDownBarWrapper_ = Blockly.bindEventWithChecks_(this.svgBackground_, "mousedown", this, this.onMouseDownBar_);
  17361. this.onMouseDownHandleWrapper_ = Blockly.bindEventWithChecks_(this.svgHandle_, "mousedown", this, this.onMouseDownHandle_)
  17362. }
  17363. ;
  17364. Blockly.Scrollbar.prototype.scrollViewSize_ = 0;
  17365. Blockly.Scrollbar.prototype.handleLength_ = 0;
  17366. Blockly.Scrollbar.prototype.handlePosition_ = 0;
  17367. Blockly.Scrollbar.prototype.isVisible_ = !0;
  17368. Blockly.Scrollbar.scrollbarThickness = 15;
  17369. goog.events.BrowserFeature.TOUCH_ENABLED && (Blockly.Scrollbar.scrollbarThickness = 25);
  17370. Blockly.Scrollbar.metricsAreEquivalent_ = function (a, b) {
  17371. return a && b && a.viewWidth == b.viewWidth && a.viewHeight == b.viewHeight && a.viewLeft == b.viewLeft && a.viewTop == b.viewTop && a.absoluteTop == b.absoluteTop && a.absoluteLeft == b.absoluteLeft && a.contentWidth == b.contentWidth && a.contentHeight == b.contentHeight && a.contentLeft == b.contentLeft && a.contentTop == b.contentTop ? !0 : !1
  17372. }
  17373. ;
  17374. Blockly.Scrollbar.prototype.dispose = function () {
  17375. this.cleanUp_();
  17376. Blockly.unbindEvent_(this.onMouseDownBarWrapper_);
  17377. this.onMouseDownBarWrapper_ = null;
  17378. Blockly.unbindEvent_(this.onMouseDownHandleWrapper_);
  17379. this.onMouseDownHandleWrapper_ = null;
  17380. goog.dom.removeNode(this.svgGroup_);
  17381. this.workspace_ = this.svgHandle_ = this.svgBackground_ = this.svgGroup_ = null
  17382. }
  17383. ;
  17384. Blockly.Scrollbar.prototype.setHandleLength_ = function (a) {
  17385. this.handleLength_ = a;
  17386. this.svgHandle_.setAttribute(this.lengthAttribute_, this.handleLength_)
  17387. }
  17388. ;
  17389. Blockly.Scrollbar.prototype.setHandlePosition = function (a) {
  17390. this.handlePosition_ = a;
  17391. this.svgHandle_.setAttribute(this.positionAttribute_, this.handlePosition_)
  17392. }
  17393. ;
  17394. Blockly.Scrollbar.prototype.setScrollViewSize_ = function (a) {
  17395. this.scrollViewSize_ = a;
  17396. this.svgBackground_.setAttribute(this.lengthAttribute_, this.scrollViewSize_)
  17397. }
  17398. ;
  17399. Blockly.Scrollbar.prototype.setPosition = function (a, b) {
  17400. this.position_.x = a;
  17401. this.position_.y = b;
  17402. this.svgGroup_.setAttribute("transform", "translate(" + this.position_.x + "," + this.position_.y + ")")
  17403. }
  17404. ;
  17405. Blockly.Scrollbar.prototype.resize = function (a) {
  17406. if (!a && (a = this.workspace_.getMetrics(),
  17407. !a))
  17408. return;
  17409. Blockly.Scrollbar.metricsAreEquivalent_(a, this.oldHostMetrics_) || (this.oldHostMetrics_ = a,
  17410. this.horizontal_ ? this.resizeHorizontal_(a) : this.resizeVertical_(a),
  17411. this.onScroll_())
  17412. }
  17413. ;
  17414. Blockly.Scrollbar.prototype.resizeHorizontal_ = function (a) {
  17415. this.resizeViewHorizontal(a)
  17416. }
  17417. ;
  17418. Blockly.Scrollbar.prototype.resizeViewHorizontal = function (a) {
  17419. var b = a.viewWidth - 1;
  17420. this.pair_ && (b -= Blockly.Scrollbar.scrollbarThickness);
  17421. this.setScrollViewSize_(Math.max(0, b));
  17422. b = a.absoluteLeft + .5;
  17423. this.pair_ && this.workspace_.RTL && (b += Blockly.Scrollbar.scrollbarThickness);
  17424. this.setPosition(b, a.absoluteTop + a.viewHeight - Blockly.Scrollbar.scrollbarThickness - .5);
  17425. this.resizeContentHorizontal(a)
  17426. }
  17427. ;
  17428. Blockly.Scrollbar.prototype.resizeContentHorizontal = function (a) {
  17429. this.pair_ || this.setVisible(this.scrollViewSize_ < a.contentWidth);
  17430. this.ratio_ = this.scrollViewSize_ / a.contentWidth;
  17431. if (-Infinity == this.ratio_ || Infinity == this.ratio_ || isNaN(this.ratio_))
  17432. this.ratio_ = 0;
  17433. this.setHandleLength_(Math.max(0, a.viewWidth * this.ratio_));
  17434. this.setHandlePosition(this.constrainHandle_((a.viewLeft - a.contentLeft) * this.ratio_))
  17435. }
  17436. ;
  17437. Blockly.Scrollbar.prototype.resizeVertical_ = function (a) {
  17438. this.resizeViewVertical(a)
  17439. }
  17440. ;
  17441. Blockly.Scrollbar.prototype.resizeViewVertical = function (a) {
  17442. var b = a.viewHeight - 1;
  17443. this.pair_ && (b -= Blockly.Scrollbar.scrollbarThickness);
  17444. this.setScrollViewSize_(Math.max(0, b));
  17445. b = a.absoluteLeft + .5;
  17446. this.workspace_.RTL || (b += a.viewWidth - Blockly.Scrollbar.scrollbarThickness - 1);
  17447. this.setPosition(b, a.absoluteTop + .5);
  17448. this.resizeContentVertical(a)
  17449. }
  17450. ;
  17451. Blockly.Scrollbar.prototype.resizeContentVertical = function (a) {
  17452. this.pair_ || this.setVisible(this.scrollViewSize_ < a.contentHeight);
  17453. this.ratio_ = this.scrollViewSize_ / a.contentHeight;
  17454. if (-Infinity == this.ratio_ || Infinity == this.ratio_ || isNaN(this.ratio_))
  17455. this.ratio_ = 0;
  17456. this.setHandleLength_(Math.max(0, a.viewHeight * this.ratio_));
  17457. this.setHandlePosition(this.constrainHandle_((a.viewTop - a.contentTop) * this.ratio_))
  17458. }
  17459. ;
  17460. Blockly.Scrollbar.prototype.createDom_ = function () {
  17461. this.svgGroup_ = Blockly.createSvgElement("g", {
  17462. "class": "blocklyScrollbar" + (this.horizontal_ ? "Horizontal" : "Vertical")
  17463. }, null);
  17464. this.svgBackground_ = Blockly.createSvgElement("rect", {
  17465. "class": "blocklyScrollbarBackground"
  17466. }, this.svgGroup_);
  17467. var a = Math.floor((Blockly.Scrollbar.scrollbarThickness - 5) / 2);
  17468. this.svgHandle_ = Blockly.createSvgElement("rect", {
  17469. "class": "blocklyScrollbarHandle",
  17470. rx: a,
  17471. ry: a
  17472. }, this.svgGroup_);
  17473. Blockly.Scrollbar.insertAfter_(this.svgGroup_, this.workspace_.getBubbleCanvas())
  17474. }
  17475. ;
  17476. Blockly.Scrollbar.prototype.isVisible = function () {
  17477. return this.isVisible_
  17478. }
  17479. ;
  17480. Blockly.Scrollbar.prototype.setVisible = function (a) {
  17481. if (a != this.isVisible()) {
  17482. if (this.pair_)
  17483. throw "Unable to toggle visibility of paired scrollbars.";
  17484. (this.isVisible_ = a) ? this.svgGroup_.setAttribute("display", "block") : (this.workspace_.setMetrics({
  17485. x: 0,
  17486. y: 0
  17487. }),
  17488. this.svgGroup_.setAttribute("display", "none"))
  17489. }
  17490. }
  17491. ;
  17492. Blockly.Scrollbar.prototype.onMouseDownBar_ = function (a) {
  17493. this.workspace_.markFocused();
  17494. Blockly.Touch.clearTouchIdentifier();
  17495. this.cleanUp_();
  17496. if (Blockly.isRightButton(a))
  17497. a.stopPropagation();
  17498. else {
  17499. var b = Blockly.mouseToSvg(a, this.workspace_.getParentSvg(), this.workspace_.getInverseScreenCTM());
  17500. b = this.horizontal_ ? b.x : b.y;
  17501. var c = Blockly.getSvgXY_(this.svgHandle_, this.workspace_);
  17502. c = this.horizontal_ ? c.x : c.y;
  17503. var d = this.handlePosition_
  17504. , e = .95 * this.handleLength_;
  17505. b <= c ? d -= e : b >= c + this.handleLength_ && (d += e);
  17506. this.setHandlePosition(this.constrainHandle_(d));
  17507. this.onScroll_();
  17508. a.stopPropagation();
  17509. a.preventDefault()
  17510. }
  17511. }
  17512. ;
  17513. Blockly.Scrollbar.prototype.onMouseDownHandle_ = function (a) {
  17514. this.workspace_.markFocused();
  17515. this.cleanUp_();
  17516. Blockly.isRightButton(a) ? a.stopPropagation() : (this.startDragHandle = this.handlePosition_,
  17517. this.startDragMouse = this.horizontal_ ? a.clientX : a.clientY,
  17518. Blockly.Scrollbar.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, this.onMouseUpHandle_),
  17519. Blockly.Scrollbar.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.onMouseMoveHandle_),
  17520. a.stopPropagation(),
  17521. a.preventDefault())
  17522. }
  17523. ;
  17524. Blockly.Scrollbar.prototype.onMouseMoveHandle_ = function (a) {
  17525. this.setHandlePosition(this.constrainHandle_(this.startDragHandle + ((this.horizontal_ ? a.clientX : a.clientY) - this.startDragMouse)));
  17526. this.onScroll_()
  17527. }
  17528. ;
  17529. Blockly.Scrollbar.prototype.onMouseUpHandle_ = function () {
  17530. Blockly.Touch.clearTouchIdentifier();
  17531. this.cleanUp_()
  17532. }
  17533. ;
  17534. Blockly.Scrollbar.prototype.cleanUp_ = function () {
  17535. Blockly.hideChaff(!0);
  17536. Blockly.Scrollbar.onMouseUpWrapper_ && (Blockly.unbindEvent_(Blockly.Scrollbar.onMouseUpWrapper_),
  17537. Blockly.Scrollbar.onMouseUpWrapper_ = null);
  17538. Blockly.Scrollbar.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.Scrollbar.onMouseMoveWrapper_),
  17539. Blockly.Scrollbar.onMouseMoveWrapper_ = null)
  17540. }
  17541. ;
  17542. Blockly.Scrollbar.prototype.constrainHandle_ = function (a) {
  17543. return a = 0 >= a || isNaN(a) || this.scrollViewSize_ < this.handleLength_ ? 0 : Math.min(a, this.scrollViewSize_ - this.handleLength_)
  17544. }
  17545. ;
  17546. Blockly.Scrollbar.prototype.onScroll_ = function () {
  17547. var a = this.handlePosition_ / this.scrollViewSize_;
  17548. isNaN(a) && (a = 0);
  17549. var b = {};
  17550. this.horizontal_ ? b.x = a : b.y = a;
  17551. this.workspace_.setMetrics(b)
  17552. }
  17553. ;
  17554. Blockly.Scrollbar.prototype.set = function (a) {
  17555. this.setHandlePosition(this.constrainHandle_(a * this.ratio_));
  17556. this.onScroll_()
  17557. }
  17558. ;
  17559. Blockly.Scrollbar.insertAfter_ = function (a, b) {
  17560. var c = b.nextSibling
  17561. , d = b.parentNode;
  17562. if (!d)
  17563. throw "Reference node has no parent.";
  17564. c ? d.insertBefore(a, c) : d.appendChild(a)
  17565. }
  17566. ;
  17567. Blockly.Trashcan = function (a) {
  17568. this.workspace_ = a
  17569. }
  17570. ;
  17571. Blockly.Trashcan.prototype.WIDTH_ = 47;
  17572. Blockly.Trashcan.prototype.BODY_HEIGHT_ = 44;
  17573. Blockly.Trashcan.prototype.LID_HEIGHT_ = 16;
  17574. Blockly.Trashcan.prototype.MARGIN_BOTTOM_ = 20;
  17575. Blockly.Trashcan.prototype.MARGIN_SIDE_ = 20;
  17576. Blockly.Trashcan.prototype.MARGIN_HOTSPOT_ = 10;
  17577. Blockly.Trashcan.prototype.SPRITE_LEFT_ = 0;
  17578. Blockly.Trashcan.prototype.SPRITE_TOP_ = 32;
  17579. Blockly.Trashcan.prototype.isOpen = !1;
  17580. Blockly.Trashcan.prototype.svgGroup_ = null;
  17581. Blockly.Trashcan.prototype.svgLid_ = null;
  17582. Blockly.Trashcan.prototype.lidTask_ = 0;
  17583. Blockly.Trashcan.prototype.lidOpen_ = 0;
  17584. Blockly.Trashcan.prototype.left_ = 0;
  17585. Blockly.Trashcan.prototype.top_ = 0;
  17586. Blockly.Trashcan.prototype.init = function (a) {
  17587. this.bottom_ = this.MARGIN_BOTTOM_ + a;
  17588. this.setOpen_(!1);
  17589. return this.bottom_ + this.BODY_HEIGHT_ + this.LID_HEIGHT_
  17590. }
  17591. ;
  17592. Blockly.Trashcan.prototype.dispose = function () {
  17593. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  17594. this.svgGroup_ = null);
  17595. this.workspace_ = this.svgLid_ = null;
  17596. goog.Timer.clear(this.lidTask_)
  17597. }
  17598. ;
  17599. Blockly.Trashcan.prototype.position = function () {
  17600. var a = this.workspace_.getMetrics();
  17601. a && (this.workspace_.RTL ? (this.left_ = this.MARGIN_SIDE_ + Blockly.Scrollbar.scrollbarThickness,
  17602. a.toolboxPosition == Blockly.TOOLBOX_AT_LEFT && (this.left_ += a.flyoutWidth,
  17603. this.workspace_.toolbox_ && (this.left_ += a.absoluteLeft))) : (this.left_ = a.viewWidth + a.absoluteLeft - this.WIDTH_ - this.MARGIN_SIDE_ - Blockly.Scrollbar.scrollbarThickness,
  17604. a.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT && (this.left_ -= a.flyoutWidth)),
  17605. this.top_ = a.viewHeight + a.absoluteTop - (this.BODY_HEIGHT_ + this.LID_HEIGHT_) - this.bottom_,
  17606. a.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM && (this.top_ -= a.flyoutHeight),
  17607. this.svgGroup_.setAttribute("transform", "translate(" + this.left_ + "," + this.top_ + ")"))
  17608. }
  17609. ;
  17610. Blockly.Trashcan.prototype.getClientRect = function () {
  17611. if (!this.svgGroup_)
  17612. return null;
  17613. var a = this.svgGroup_.getBoundingClientRect();
  17614. return new goog.math.Rect(a.left + this.SPRITE_LEFT_ - this.MARGIN_HOTSPOT_, a.top + this.SPRITE_TOP_ - this.MARGIN_HOTSPOT_, this.WIDTH_ + 2 * this.MARGIN_HOTSPOT_, this.LID_HEIGHT_ + this.BODY_HEIGHT_ + 2 * this.MARGIN_HOTSPOT_)
  17615. }
  17616. ;
  17617. Blockly.Trashcan.prototype.setOpen_ = function (a) {
  17618. this.isOpen != a && (goog.Timer.clear(this.lidTask_),
  17619. this.isOpen = a,
  17620. this.animateLid_())
  17621. }
  17622. ;
  17623. Blockly.Trashcan.prototype.animateLid_ = function () {
  17624. this.lidOpen_ += this.isOpen ? .2 : -.2;
  17625. this.lidOpen_ = goog.math.clamp(this.lidOpen_, 0, 1);
  17626. var a = 45 * this.lidOpen_;
  17627. this.svgLid_.setAttribute("transform", "rotate(" + (this.workspace_.RTL ? -a : a) + "," + (this.workspace_.RTL ? 4 : this.WIDTH_ - 4) + "," + (this.LID_HEIGHT_ - 2) + ")");
  17628. a = goog.math.lerp(.4, .8, this.lidOpen_);
  17629. this.svgGroup_.style.opacity = a;
  17630. 0 < this.lidOpen_ && 1 > this.lidOpen_ && (this.lidTask_ = goog.Timer.callOnce(this.animateLid_, 20, this))
  17631. }
  17632. ;
  17633. Blockly.Trashcan.prototype.close = function () {
  17634. this.setOpen_(!1)
  17635. }
  17636. ;
  17637. Blockly.Trashcan.prototype.click = function () {
  17638. var a = this.workspace_.startScrollX - this.workspace_.scrollX
  17639. , b = this.workspace_.startScrollY - this.workspace_.scrollY;
  17640. Math.sqrt(a * a + b * b) > Blockly.DRAG_RADIUS || console.log("TODO: Inspect trash.")
  17641. }
  17642. ;
  17643. Blockly.Xml = {};
  17644. Blockly.Xml.workspaceToDom = function (a, b) {
  17645. for (var c = goog.dom.createDom("xml"), d = a.getTopBlocks(!0), e = 0, f; f = d[e]; e++)
  17646. c.appendChild(Blockly.Xml.blockToDomWithXY(f, b));
  17647. return c
  17648. }
  17649. ;
  17650. Blockly.Xml.blockToDomWithXY = function (a, b) {
  17651. var c;
  17652. a.workspace.RTL && (c = a.workspace.getWidth());
  17653. var d = Blockly.Xml.blockToDom(a, b)
  17654. , e = a.getRelativeToSurfaceXY();
  17655. d.setAttribute("x", Math.round(a.workspace.RTL ? c - e.x : e.x));
  17656. d.setAttribute("y", Math.round(e.y));
  17657. return d
  17658. }
  17659. ;
  17660. Blockly.Xml.blockToDom = function (a, b) {
  17661. var c = goog.dom.createDom(a.isShadow() ? "shadow" : "block");
  17662. c.setAttribute("type", a.type);
  17663. b || c.setAttribute("id", a.id);
  17664. if (a.mutationToDom) {
  17665. var d = a.mutationToDom();
  17666. d && (d.hasChildNodes() || d.hasAttributes()) && c.appendChild(d)
  17667. }
  17668. d = 0;
  17669. for (var e; e = a.inputList[d]; d++)
  17670. for (var f = 0, g; g = e.fieldRow[f]; f++)
  17671. if (g.name && g.EDITABLE) {
  17672. var h = goog.dom.createDom("field", null, g.getValue());
  17673. h.setAttribute("name", g.name);
  17674. c.appendChild(h)
  17675. }
  17676. if (d = a.getCommentText())
  17677. d = goog.dom.createDom("comment", null, d),
  17678. "object" == typeof a.comment && (d.setAttribute("pinned", a.comment.isVisible()),
  17679. e = a.comment.getBubbleSize(),
  17680. d.setAttribute("h", e.height),
  17681. d.setAttribute("w", e.width)),
  17682. c.appendChild(d);
  17683. a.data && (d = goog.dom.createDom("data", null, a.data),
  17684. c.appendChild(d));
  17685. for (d = 0; e = a.inputList[d]; d++) {
  17686. var k;
  17687. g = !0;
  17688. e.type != Blockly.DUMMY_INPUT && (h = e.connection.targetBlock(),
  17689. e.type == Blockly.INPUT_VALUE ? k = goog.dom.createDom("value") : e.type == Blockly.NEXT_STATEMENT && (k = goog.dom.createDom("statement")),
  17690. f = e.connection.getShadowDom(),
  17691. !f || h && h.isShadow() || k.appendChild(Blockly.Xml.cloneShadow_(f)),
  17692. h && (k.appendChild(Blockly.Xml.blockToDom(h, b)),
  17693. g = !1),
  17694. k.setAttribute("name", e.name),
  17695. g || c.appendChild(k))
  17696. }
  17697. a.inputsInlineDefault != a.inputsInline && c.setAttribute("inline", a.inputsInline);
  17698. a.isCollapsed() && c.setAttribute("collapsed", !0);
  17699. a.disabled && c.setAttribute("disabled", !0);
  17700. a.isDeletable() || a.isShadow() || c.setAttribute("deletable", !1);
  17701. a.isMovable() || a.isShadow() || c.setAttribute("movable", !1);
  17702. a.isEditable() || c.setAttribute("editable", !1);
  17703. if (d = a.getNextBlock())
  17704. k = goog.dom.createDom("next", null, Blockly.Xml.blockToDom(d, b)),
  17705. c.appendChild(k);
  17706. f = a.nextConnection && a.nextConnection.getShadowDom();
  17707. !f || d && d.isShadow() || k.appendChild(Blockly.Xml.cloneShadow_(f));
  17708. return c
  17709. }
  17710. ;
  17711. Blockly.Xml.cloneShadow_ = function (a) {
  17712. for (var b = a = a.cloneNode(!0), c; b;)
  17713. if (b.firstChild)
  17714. b = b.firstChild;
  17715. else {
  17716. for (; b && !b.nextSibling;)
  17717. c = b,
  17718. b = b.parentNode,
  17719. 3 == c.nodeType && "" == c.data.trim() && b.firstChild != c && goog.dom.removeNode(c);
  17720. b && (c = b,
  17721. b = b.nextSibling,
  17722. 3 == c.nodeType && "" == c.data.trim() && goog.dom.removeNode(c))
  17723. }
  17724. return a
  17725. }
  17726. ;
  17727. Blockly.Xml.domToText = function (a) {
  17728. return (new XMLSerializer).serializeToString(a)
  17729. }
  17730. ;
  17731. Blockly.Xml.domToPrettyText = function (a) {
  17732. a = Blockly.Xml.domToText(a).split("<");
  17733. for (var b = "", c = 1; c < a.length; c++) {
  17734. var d = a[c];
  17735. "/" == d[0] && (b = b.substring(2));
  17736. a[c] = b + "<" + d;
  17737. "/" != d[0] && "/>" != d.slice(-2) && (b += " ")
  17738. }
  17739. a = a.join("\n");
  17740. a = a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g, "$1</$2>");
  17741. return a.replace(/^\n/, "")
  17742. }
  17743. ;
  17744. Blockly.Xml.textToDom = function (a) {
  17745. (a = (new DOMParser).parseFromString(a, "text/xml")) && a.firstChild && "xml" == a.firstChild.nodeName.toLowerCase() && a.firstChild === a.lastChild || goog.asserts.fail("Blockly.Xml.textToDom did not obtain a valid XML tree.");
  17746. return a.firstChild
  17747. }
  17748. ;
  17749. Blockly.Xml.domToWorkspace = function (a, b) {
  17750. if (a instanceof Blockly.Workspace) {
  17751. var c = a;
  17752. a = b;
  17753. b = c;
  17754. console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")
  17755. }
  17756. var d;
  17757. b.RTL && (d = b.getWidth());
  17758. Blockly.Field.startCache();
  17759. c = a.childNodes.length;
  17760. var e = Blockly.Events.getGroup();
  17761. e || Blockly.Events.setGroup(!0);
  17762. b.setResizesEnabled && b.setResizesEnabled(!1);
  17763. for (var f = 0; f < c; f++) {
  17764. var g = a.childNodes[f]
  17765. , h = g.nodeName.toLowerCase();
  17766. if ("block" == h || "shadow" == h && !Blockly.Events.recordUndo) {
  17767. h = Blockly.Xml.domToBlock(g, b);
  17768. var k = parseInt(g.getAttribute("x"), 10);
  17769. g = parseInt(g.getAttribute("y"), 10);
  17770. isNaN(k) || isNaN(g) || h.moveBy(b.RTL ? d - k : k, g)
  17771. } else
  17772. "shadow" == h && goog.asserts.fail("Shadow block cannot be a top-level block.")
  17773. }
  17774. e || Blockly.Events.setGroup(!1);
  17775. Blockly.Field.stopCache();
  17776. b.updateVariableList(!1);
  17777. b.setResizesEnabled && b.setResizesEnabled(!0)
  17778. }
  17779. ;
  17780. Blockly.Xml.domToBlock = function (a, b) {
  17781. if (a instanceof Blockly.Workspace) {
  17782. var c = a;
  17783. a = b;
  17784. b = c;
  17785. console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")
  17786. }
  17787. Blockly.Events.disable();
  17788. try {
  17789. var d = Blockly.Xml.domToBlockHeadless_(a, b);
  17790. if (b.rendered) {
  17791. d.setConnectionsHidden(!0);
  17792. for (var e = d.getDescendants(), f = e.length - 1; 0 <= f; f--)
  17793. e[f].initSvg();
  17794. for (f = e.length - 1; 0 <= f; f--)
  17795. e[f].render(!1);
  17796. setTimeout(function () {
  17797. d.workspace && d.setConnectionsHidden(!1)
  17798. }, 1);
  17799. d.updateDisabled();
  17800. b.resizeContents()
  17801. }
  17802. } finally {
  17803. Blockly.Events.enable()
  17804. }
  17805. Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Create(d));
  17806. return d
  17807. }
  17808. ;
  17809. Blockly.Xml.domToBlockHeadless_ = function (a, b) {
  17810. var c = null
  17811. , d = a.getAttribute("type");
  17812. goog.asserts.assert(d, "Block type unspecified: %s", a.outerHTML);
  17813. var e = a.getAttribute("id");
  17814. c = b.newBlock(d, e);
  17815. var f = null;
  17816. e = 0;
  17817. for (var g; g = a.childNodes[e]; e++)
  17818. if (3 != g.nodeType) {
  17819. for (var h = f = null, k = 0, m; m = g.childNodes[k]; k++)
  17820. 1 == m.nodeType && ("block" == m.nodeName.toLowerCase() ? f = m : "shadow" == m.nodeName.toLowerCase() && (h = m));
  17821. !f && h && (f = h);
  17822. k = g.getAttribute("name");
  17823. switch (g.nodeName.toLowerCase()) {
  17824. case "mutation":
  17825. c.domToMutation && (c.domToMutation(g),
  17826. c.initSvg && c.initSvg());
  17827. break;
  17828. case "comment":
  17829. c.setCommentText(g.textContent);
  17830. var p = g.getAttribute("pinned");
  17831. p && !c.isInFlyout && setTimeout(function () {
  17832. c.comment && c.comment.setVisible && c.comment.setVisible("true" == p)
  17833. }, 1);
  17834. f = parseInt(g.getAttribute("w"), 10);
  17835. g = parseInt(g.getAttribute("h"), 10);
  17836. !isNaN(f) && !isNaN(g) && c.comment && c.comment.setVisible && c.comment.setBubbleSize(f, g);
  17837. break;
  17838. case "data":
  17839. c.data = g.textContent;
  17840. break;
  17841. case "title":
  17842. case "field":
  17843. f = c.getField(k);
  17844. if (!f) {
  17845. console.warn("Ignoring non-existent field " + k + " in block " + d);
  17846. break
  17847. }
  17848. f.setValue(g.textContent);
  17849. break;
  17850. case "value":
  17851. case "statement":
  17852. g = c.getInput(k);
  17853. if (!g) {
  17854. console.warn("Ignoring non-existent input " + k + " in block " + d);
  17855. break
  17856. }
  17857. h && g.connection.setShadowDom(h);
  17858. f && (f = Blockly.Xml.domToBlockHeadless_(f, b),
  17859. f.outputConnection ? g.connection.connect(f.outputConnection) : f.previousConnection ? g.connection.connect(f.previousConnection) : goog.asserts.fail("Child block does not have output or previous statement."));
  17860. break;
  17861. case "next":
  17862. h && c.nextConnection && c.nextConnection.setShadowDom(h);
  17863. f && (goog.asserts.assert(c.nextConnection, "Next statement does not exist."),
  17864. goog.asserts.assert(!c.nextConnection.isConnected(), "Next statement is already connected."),
  17865. f = Blockly.Xml.domToBlockHeadless_(f, b),
  17866. goog.asserts.assert(f.previousConnection, "Next block does not have previous statement."),
  17867. c.nextConnection.connect(f.previousConnection));
  17868. break;
  17869. default:
  17870. console.warn("Ignoring unknown tag: " + g.nodeName)
  17871. }
  17872. }
  17873. (e = a.getAttribute("inline")) && c.setInputsInline("true" == e);
  17874. (e = a.getAttribute("disabled")) && c.setDisabled("true" == e);
  17875. (e = a.getAttribute("deletable")) && c.setDeletable("true" == e);
  17876. (e = a.getAttribute("movable")) && c.setMovable("true" == e);
  17877. (e = a.getAttribute("editable")) && c.setEditable("true" == e);
  17878. (e = a.getAttribute("collapsed")) && c.setCollapsed("true" == e);
  17879. if ("shadow" == a.nodeName.toLowerCase()) {
  17880. d = c.getChildren();
  17881. for (e = 0; g = d[e]; e++)
  17882. goog.asserts.assert(g.isShadow(), "Shadow block not allowed non-shadow child.");
  17883. goog.asserts.assert(0 == c.getVars().length, "Shadow blocks cannot have variable fields.");
  17884. c.setShadow(!0)
  17885. }
  17886. return c
  17887. }
  17888. ;
  17889. Blockly.Xml.deleteNext = function (a) {
  17890. for (var b = 0, c; c = a.childNodes[b]; b++)
  17891. if ("next" == c.nodeName.toLowerCase()) {
  17892. a.removeChild(c);
  17893. break
  17894. }
  17895. }
  17896. ;
  17897. goog.global.Blockly || (goog.global.Blockly = {});
  17898. goog.global.Blockly.Xml || (goog.global.Blockly.Xml = {});
  17899. goog.global.Blockly.Xml.domToText = Blockly.Xml.domToText;
  17900. goog.global.Blockly.Xml.domToWorkspace = Blockly.Xml.domToWorkspace;
  17901. goog.global.Blockly.Xml.textToDom = Blockly.Xml.textToDom;
  17902. goog.global.Blockly.Xml.workspaceToDom = Blockly.Xml.workspaceToDom;
  17903. Blockly.ZoomControls = function (a) {
  17904. this.workspace_ = a
  17905. }
  17906. ;
  17907. Blockly.ZoomControls.prototype.WIDTH_ = 32;
  17908. Blockly.ZoomControls.prototype.HEIGHT_ = 110;
  17909. Blockly.ZoomControls.prototype.MARGIN_BOTTOM_ = 20;
  17910. Blockly.ZoomControls.prototype.MARGIN_SIDE_ = 20;
  17911. Blockly.ZoomControls.prototype.svgGroup_ = null;
  17912. Blockly.ZoomControls.prototype.left_ = 0;
  17913. Blockly.ZoomControls.prototype.top_ = 0;
  17914. Blockly.Trashcan.prototype.createDom = function () {
  17915. this.svgGroup_ = Blockly.createSvgElement("g", {
  17916. "class": "blocklyTrash"
  17917. }, null);
  17918. var a = String(Math.random()).substring(2)
  17919. , b = Blockly.createSvgElement("clipPath", {
  17920. id: "blocklyTrashBodyClipPath" + a
  17921. }, this.svgGroup_);
  17922. Blockly.createSvgElement("rect", {
  17923. width: this.WIDTH_,
  17924. height: this.BODY_HEIGHT_,
  17925. y: this.LID_HEIGHT_
  17926. }, b);
  17927. Blockly.createSvgElement("image", {
  17928. width: Blockly.SPRITE.width,
  17929. x: -this.SPRITE_LEFT_,
  17930. height: Blockly.SPRITE.height,
  17931. y: -this.SPRITE_TOP_,
  17932. "clip-path": "url(#blocklyTrashBodyClipPath" + a + ")"
  17933. }, this.svgGroup_).setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", this.workspace_.options.pathToMedia + Blockly.SPRITE.url);
  17934. b = Blockly.createSvgElement("clipPath", {
  17935. id: "blocklyTrashLidClipPath" + a
  17936. }, this.svgGroup_);
  17937. Blockly.createSvgElement("rect", {
  17938. width: this.WIDTH_,
  17939. height: this.LID_HEIGHT_
  17940. }, b);
  17941. this.svgLid_ = Blockly.createSvgElement("image", {
  17942. width: Blockly.SPRITE.width,
  17943. x: -this.SPRITE_LEFT_,
  17944. height: Blockly.SPRITE.height,
  17945. y: -this.SPRITE_TOP_,
  17946. "clip-path": "url(#blocklyTrashLidClipPath" + a + ")"
  17947. }, this.svgGroup_);
  17948. this.svgLid_.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", this.workspace_.options.pathToMedia + Blockly.SPRITE.url);
  17949. Blockly.bindEventWithChecks_(this.svgGroup_, "mouseup", this, this.click);
  17950. this.animateLid_();
  17951. return this.svgGroup_
  17952. }
  17953. ;
  17954. Blockly.ZoomControls.prototype.createDom = function () {
  17955. var a = this.workspace_;
  17956. this.svgGroup_ = Blockly.createSvgElement("g", {
  17957. "class": "blocklyZoom"
  17958. }, null);
  17959. var b = String(Math.random()).substring(2)
  17960. , c = Blockly.createSvgElement("clipPath", {
  17961. id: "blocklyZoomoutClipPath" + b
  17962. }, this.svgGroup_);
  17963. Blockly.createSvgElement("rect", {
  17964. width: 32,
  17965. height: 32,
  17966. y: 77
  17967. }, c);
  17968. var d = Blockly.createSvgElement("image", {
  17969. width: Blockly.SPRITE.width,
  17970. height: Blockly.SPRITE.height,
  17971. x: -64,
  17972. y: -15,
  17973. "clip-path": "url(#blocklyZoomoutClipPath" + b + ")"
  17974. }, this.svgGroup_);
  17975. d.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", a.options.pathToMedia + Blockly.SPRITE.url);
  17976. c = Blockly.createSvgElement("clipPath", {
  17977. id: "blocklyZoominClipPath" + b
  17978. }, this.svgGroup_);
  17979. Blockly.createSvgElement("rect", {
  17980. width: 32,
  17981. height: 32,
  17982. y: 43
  17983. }, c);
  17984. var e = Blockly.createSvgElement("image", {
  17985. width: Blockly.SPRITE.width,
  17986. height: Blockly.SPRITE.height,
  17987. x: -32,
  17988. y: -49,
  17989. "clip-path": "url(#blocklyZoominClipPath" + b + ")"
  17990. }, this.svgGroup_);
  17991. e.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", a.options.pathToMedia + Blockly.SPRITE.url);
  17992. c = Blockly.createSvgElement("clipPath", {
  17993. id: "blocklyZoomresetClipPath" + b
  17994. }, this.svgGroup_);
  17995. Blockly.createSvgElement("rect", {
  17996. width: 32,
  17997. height: 32
  17998. }, c);
  17999. b = Blockly.createSvgElement("image", {
  18000. width: Blockly.SPRITE.width,
  18001. height: Blockly.SPRITE.height,
  18002. y: -92,
  18003. "clip-path": "url(#blocklyZoomresetClipPath" + b + ")"
  18004. }, this.svgGroup_);
  18005. b.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", a.options.pathToMedia + Blockly.SPRITE.url);
  18006. Blockly.bindEventWithChecks_(b, "mousedown", null, function (b) {
  18007. a.markFocused();
  18008. a.setScale(a.options.zoomOptions.startScale);
  18009. a.scrollCenter();
  18010. Blockly.Touch.clearTouchIdentifier();
  18011. b.stopPropagation();
  18012. b.preventDefault()
  18013. });
  18014. Blockly.bindEventWithChecks_(e, "mousedown", null, function (b) {
  18015. a.markFocused();
  18016. a.zoomCenter(1);
  18017. Blockly.Touch.clearTouchIdentifier();
  18018. b.stopPropagation();
  18019. b.preventDefault()
  18020. });
  18021. Blockly.bindEventWithChecks_(d, "mousedown", null, function (b) {
  18022. a.markFocused();
  18023. a.zoomCenter(-1);
  18024. Blockly.Touch.clearTouchIdentifier();
  18025. b.stopPropagation();
  18026. b.preventDefault()
  18027. });
  18028. return this.svgGroup_
  18029. }
  18030. ;
  18031. Blockly.ZoomControls.prototype.init = function (a) {
  18032. this.bottom_ = this.MARGIN_BOTTOM_ + a;
  18033. return this.bottom_ + this.HEIGHT_
  18034. }
  18035. ;
  18036. Blockly.ZoomControls.prototype.dispose = function () {
  18037. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  18038. this.svgGroup_ = null);
  18039. this.workspace_ = null
  18040. }
  18041. ;
  18042. Blockly.ZoomControls.prototype.position = function () {
  18043. var a = this.workspace_.getMetrics();
  18044. a && (this.workspace_.RTL ? (this.left_ = this.MARGIN_SIDE_ + Blockly.Scrollbar.scrollbarThickness,
  18045. a.toolboxPosition == Blockly.TOOLBOX_AT_LEFT && (this.left_ += a.flyoutWidth,
  18046. this.workspace_.toolbox_ && (this.left_ += a.absoluteLeft))) : (this.left_ = a.viewWidth + a.absoluteLeft - this.WIDTH_ - this.MARGIN_SIDE_ - Blockly.Scrollbar.scrollbarThickness,
  18047. a.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT && (this.left_ -= a.flyoutWidth)),
  18048. this.top_ = a.viewHeight + a.absoluteTop - this.HEIGHT_ - this.bottom_,
  18049. a.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM && (this.top_ -= a.flyoutHeight),
  18050. this.svgGroup_.setAttribute("transform", "translate(" + this.left_ + "," + this.top_ + ")"))
  18051. }
  18052. ;
  18053. Blockly.WorkspaceSvg = function (a) {
  18054. Blockly.WorkspaceSvg.superClass_.constructor.call(this, a);
  18055. this.getMetrics = a.getMetrics || Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_;
  18056. this.setMetrics = a.setMetrics || Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_;
  18057. Blockly.ConnectionDB.init(this);
  18058. this.SOUNDS_ = Object.create(null);
  18059. this.highlightedBlocks_ = []
  18060. }
  18061. ;
  18062. goog.inherits(Blockly.WorkspaceSvg, Blockly.Workspace);
  18063. Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_ = null;
  18064. Blockly.WorkspaceSvg.prototype.rendered = !0;
  18065. Blockly.WorkspaceSvg.prototype.isFlyout = !1;
  18066. Blockly.WorkspaceSvg.prototype.isMutator = !1;
  18067. Blockly.WorkspaceSvg.prototype.dragMode_ = Blockly.DRAG_NONE;
  18068. Blockly.WorkspaceSvg.prototype.resizesEnabled_ = !0;
  18069. Blockly.WorkspaceSvg.prototype.scrollX = 0;
  18070. Blockly.WorkspaceSvg.prototype.scrollY = 0;
  18071. Blockly.WorkspaceSvg.prototype.startScrollX = 0;
  18072. Blockly.WorkspaceSvg.prototype.startScrollY = 0;
  18073. Blockly.WorkspaceSvg.prototype.dragDeltaXY_ = null;
  18074. Blockly.WorkspaceSvg.prototype.scale = 1;
  18075. Blockly.WorkspaceSvg.prototype.trashcan = null;
  18076. Blockly.WorkspaceSvg.prototype.scrollbar = null;
  18077. Blockly.WorkspaceSvg.prototype.lastSound_ = null;
  18078. Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_ = null;
  18079. Blockly.WorkspaceSvg.prototype.inverseScreenCTM_ = null;
  18080. Blockly.WorkspaceSvg.prototype.getInverseScreenCTM = function () {
  18081. return this.inverseScreenCTM_
  18082. }
  18083. ;
  18084. Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM = function () {
  18085. var a = this.getParentSvg().getScreenCTM();
  18086. a && (this.inverseScreenCTM_ = a.inverse())
  18087. }
  18088. ;
  18089. Blockly.WorkspaceSvg.prototype.setResizeHandlerWrapper = function (a) {
  18090. this.resizeHandlerWrapper_ = a
  18091. }
  18092. ;
  18093. Blockly.WorkspaceSvg.prototype.createDom = function (a) {
  18094. this.svgGroup_ = Blockly.createSvgElement("g", {
  18095. "class": "blocklyWorkspace"
  18096. }, null);
  18097. a && (this.svgBackground_ = Blockly.createSvgElement("rect", {
  18098. height: "100%",
  18099. width: "100%",
  18100. "class": a
  18101. }, this.svgGroup_),
  18102. "blocklyMainBackground" == a && (this.svgBackground_.style.fill = "url(#" + this.options.gridPattern.id + ")"));
  18103. this.svgBlockCanvas_ = Blockly.createSvgElement("g", {
  18104. "class": "blocklyBlockCanvas"
  18105. }, this.svgGroup_, this);
  18106. this.svgBubbleCanvas_ = Blockly.createSvgElement("g", {
  18107. "class": "blocklyBubbleCanvas"
  18108. }, this.svgGroup_, this);
  18109. a = Blockly.Scrollbar.scrollbarThickness;
  18110. this.options.hasTrashcan && (a = this.addTrashcan_(a));
  18111. this.options.zoomOptions && this.options.zoomOptions.controls && (a = this.addZoomControls_(a));
  18112. if (!this.isFlyout) {
  18113. Blockly.bindEventWithChecks_(this.svgGroup_, "mousedown", this, this.onMouseDown_);
  18114. var b = this;
  18115. Blockly.bindEvent_(this.svgGroup_, "touchstart", null, function (a) {
  18116. Blockly.longStart_(a, b)
  18117. });
  18118. this.options.zoomOptions && this.options.zoomOptions.wheel && Blockly.bindEventWithChecks_(this.svgGroup_, "wheel", this, this.onMouseWheel_)
  18119. }
  18120. this.options.hasCategories ? this.toolbox_ = new Blockly.Toolbox(this) : this.options.languageTree && this.addFlyout_();
  18121. this.updateGridPattern_();
  18122. this.recordDeleteAreas();
  18123. return this.svgGroup_
  18124. }
  18125. ;
  18126. Blockly.WorkspaceSvg.prototype.dispose = function () {
  18127. this.rendered = !1;
  18128. Blockly.WorkspaceSvg.superClass_.dispose.call(this);
  18129. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  18130. this.svgGroup_ = null);
  18131. this.svgBubbleCanvas_ = this.svgBlockCanvas_ = null;
  18132. this.toolbox_ && (this.toolbox_.dispose(),
  18133. this.toolbox_ = null);
  18134. this.flyout_ && (this.flyout_.dispose(),
  18135. this.flyout_ = null);
  18136. this.trashcan && (this.trashcan.dispose(),
  18137. this.trashcan = null);
  18138. this.scrollbar && (this.scrollbar.dispose(),
  18139. this.scrollbar = null);
  18140. this.zoomControls_ && (this.zoomControls_.dispose(),
  18141. this.zoomControls_ = null);
  18142. this.options.parentWorkspace || goog.dom.removeNode(this.getParentSvg().parentNode);
  18143. this.resizeHandlerWrapper_ && (Blockly.unbindEvent_(this.resizeHandlerWrapper_),
  18144. this.resizeHandlerWrapper_ = null)
  18145. }
  18146. ;
  18147. Blockly.WorkspaceSvg.prototype.newBlock = function (a, b) {
  18148. return new Blockly.BlockSvg(this, a, b)
  18149. }
  18150. ;
  18151. Blockly.WorkspaceSvg.prototype.addTrashcan_ = function (a) {
  18152. this.trashcan = new Blockly.Trashcan(this);
  18153. var b = this.trashcan.createDom();
  18154. this.svgGroup_.insertBefore(b, this.svgBlockCanvas_);
  18155. return this.trashcan.init(a)
  18156. }
  18157. ;
  18158. Blockly.WorkspaceSvg.prototype.addZoomControls_ = function (a) {
  18159. this.zoomControls_ = new Blockly.ZoomControls(this);
  18160. var b = this.zoomControls_.createDom();
  18161. this.svgGroup_.appendChild(b);
  18162. return this.zoomControls_.init(a)
  18163. }
  18164. ;
  18165. Blockly.WorkspaceSvg.prototype.addFlyout_ = function () {
  18166. this.flyout_ = new Blockly.Flyout({
  18167. disabledPatternId: this.options.disabledPatternId,
  18168. parentWorkspace: this,
  18169. RTL: this.RTL,
  18170. oneBasedIndex: this.options.oneBasedIndex,
  18171. horizontalLayout: this.horizontalLayout,
  18172. toolboxPosition: this.options.toolboxPosition
  18173. });
  18174. this.flyout_.autoClose = !1;
  18175. var a = this.flyout_.createDom();
  18176. this.svgGroup_.insertBefore(a, this.svgBlockCanvas_)
  18177. }
  18178. ;
  18179. Blockly.WorkspaceSvg.prototype.updateScreenCalculations_ = function () {
  18180. this.updateInverseScreenCTM();
  18181. this.recordDeleteAreas()
  18182. }
  18183. ;
  18184. Blockly.WorkspaceSvg.prototype.resizeContents = function () {
  18185. this.resizesEnabled_ && this.rendered && (this.scrollbar && this.scrollbar.resize(),
  18186. this.updateInverseScreenCTM())
  18187. }
  18188. ;
  18189. Blockly.WorkspaceSvg.prototype.resize = function () {
  18190. this.toolbox_ && this.toolbox_.position();
  18191. this.flyout_ && this.flyout_.position();
  18192. this.trashcan && this.trashcan.position();
  18193. this.zoomControls_ && this.zoomControls_.position();
  18194. this.scrollbar && this.scrollbar.resize();
  18195. this.updateScreenCalculations_()
  18196. }
  18197. ;
  18198. Blockly.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled = function () {
  18199. var a = goog.dom.getDocumentScroll();
  18200. goog.math.Coordinate.equals(this.lastRecordedPageScroll_, a) || (this.lastRecordedPageScroll_ = a,
  18201. this.updateScreenCalculations_())
  18202. }
  18203. ;
  18204. Blockly.WorkspaceSvg.prototype.getCanvas = function () {
  18205. return this.svgBlockCanvas_
  18206. }
  18207. ;
  18208. Blockly.WorkspaceSvg.prototype.getBubbleCanvas = function () {
  18209. return this.svgBubbleCanvas_
  18210. }
  18211. ;
  18212. Blockly.WorkspaceSvg.prototype.getParentSvg = function () {
  18213. if (this.cachedParentSvg_)
  18214. return this.cachedParentSvg_;
  18215. for (var a = this.svgGroup_; a;) {
  18216. if ("svg" == a.tagName)
  18217. return this.cachedParentSvg_ = a;
  18218. a = a.parentNode
  18219. }
  18220. return null
  18221. }
  18222. ;
  18223. Blockly.WorkspaceSvg.prototype.translate = function (a, b) {
  18224. var c = "translate(" + a + "," + b + ") scale(" + this.scale + ")";
  18225. this.svgBlockCanvas_.setAttribute("transform", c);
  18226. this.svgBubbleCanvas_.setAttribute("transform", c)
  18227. }
  18228. ;
  18229. Blockly.WorkspaceSvg.prototype.getWidth = function () {
  18230. var a = this.getMetrics();
  18231. return a ? a.viewWidth / this.scale : 0
  18232. }
  18233. ;
  18234. Blockly.WorkspaceSvg.prototype.setVisible = function (a) {
  18235. this.getParentSvg().style.display = a ? "block" : "none";
  18236. this.toolbox_ && (this.toolbox_.HtmlDiv.style.display = a ? "block" : "none");
  18237. a ? (this.render(),
  18238. this.toolbox_ && this.toolbox_.position()) : Blockly.hideChaff(!0)
  18239. }
  18240. ;
  18241. Blockly.WorkspaceSvg.prototype.render = function () {
  18242. for (var a = this.getAllBlocks(), b = a.length - 1; 0 <= b; b--)
  18243. a[b].render(!1)
  18244. }
  18245. ;
  18246. Blockly.WorkspaceSvg.prototype.traceOn = function () {
  18247. console.warn("Deprecated call to traceOn, delete this.")
  18248. }
  18249. ;
  18250. Blockly.WorkspaceSvg.prototype.highlightBlock = function (a, b) {
  18251. if (void 0 === b) {
  18252. for (var c = 0, d; d = this.highlightedBlocks_[c]; c++)
  18253. d.setHighlighted(!1);
  18254. this.highlightedBlocks_.length = 0
  18255. }
  18256. if (d = a ? this.getBlockById(a) : null)
  18257. (c = void 0 === b || b) ? -1 == this.highlightedBlocks_.indexOf(d) && this.highlightedBlocks_.push(d) : goog.array.remove(this.highlightedBlocks_, d),
  18258. d.setHighlighted(c)
  18259. }
  18260. ;
  18261. Blockly.WorkspaceSvg.prototype.paste = function (a) {
  18262. if (this.rendered && !(a.getElementsByTagName("block").length >= this.remainingCapacity())) {
  18263. Blockly.terminateDrag_();
  18264. Blockly.Events.disable();
  18265. try {
  18266. var b = Blockly.Xml.domToBlock(a, this)
  18267. , c = parseInt(a.getAttribute("x"), 10)
  18268. , d = parseInt(a.getAttribute("y"), 10);
  18269. if (!isNaN(c) && !isNaN(d)) {
  18270. this.RTL && (c = -c);
  18271. do {
  18272. a = !1;
  18273. for (var e = this.getAllBlocks(), f = 0, g; g = e[f]; f++) {
  18274. var h = g.getRelativeToSurfaceXY();
  18275. if (1 >= Math.abs(c - h.x) && 1 >= Math.abs(d - h.y)) {
  18276. a = !0;
  18277. break
  18278. }
  18279. }
  18280. if (!a) {
  18281. var k = b.getConnections_(!1);
  18282. f = 0;
  18283. for (var m; m = k[f]; f++)
  18284. if (m.closest(Blockly.SNAP_RADIUS, new goog.math.Coordinate(c, d)).connection) {
  18285. a = !0;
  18286. break
  18287. }
  18288. }
  18289. a && (c = this.RTL ? c - Blockly.SNAP_RADIUS : c + Blockly.SNAP_RADIUS,
  18290. d += 2 * Blockly.SNAP_RADIUS)
  18291. } while (a); b.moveBy(c, d)
  18292. }
  18293. } finally {
  18294. Blockly.Events.enable()
  18295. }
  18296. Blockly.Events.isEnabled() && !b.isShadow() && Blockly.Events.fire(new Blockly.Events.Create(b));
  18297. b.select()
  18298. }
  18299. }
  18300. ;
  18301. Blockly.WorkspaceSvg.prototype.createVariable = function (a) {
  18302. Blockly.WorkspaceSvg.superClass_.createVariable.call(this, a);
  18303. this.toolbox_ && this.toolbox_.flyout_ && !Blockly.Flyout.startFlyout_ && this.toolbox_.refreshSelection()
  18304. }
  18305. ;
  18306. Blockly.WorkspaceSvg.prototype.recordDeleteAreas = function () {
  18307. this.deleteAreaTrash_ = this.trashcan ? this.trashcan.getClientRect() : null;
  18308. this.deleteAreaToolbox_ = this.flyout_ ? this.flyout_.getClientRect() : this.toolbox_ ? this.toolbox_.getClientRect() : null
  18309. }
  18310. ;
  18311. Blockly.WorkspaceSvg.prototype.isDeleteArea = function (a) {
  18312. a = new goog.math.Coordinate(a.clientX, a.clientY);
  18313. if (this.deleteAreaTrash_) {
  18314. if (this.deleteAreaTrash_.contains(a))
  18315. return this.trashcan.setOpen_(!0),
  18316. Blockly.Css.setCursor(Blockly.Css.Cursor.DELETE),
  18317. !0;
  18318. this.trashcan.setOpen_(!1)
  18319. }
  18320. if (this.deleteAreaToolbox_ && this.deleteAreaToolbox_.contains(a))
  18321. return Blockly.Css.setCursor(Blockly.Css.Cursor.DELETE),
  18322. !0;
  18323. Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED);
  18324. return !1
  18325. }
  18326. ;
  18327. Blockly.WorkspaceSvg.prototype.onMouseDown_ = function (a) {
  18328. this.markFocused();
  18329. Blockly.isTargetInput_(a) ? Blockly.Touch.clearTouchIdentifier() : (Blockly.terminateDrag_(),
  18330. Blockly.hideChaff(),
  18331. a.target && a.target.nodeName && ("svg" == a.target.nodeName.toLowerCase() || a.target == this.svgBackground_) && Blockly.selected && !this.options.readOnly && Blockly.selected.unselect(),
  18332. Blockly.isRightButton(a) ? (this.showContextMenu_(a),
  18333. Blockly.Touch.clearTouchIdentifier()) : this.scrollbar ? (this.dragMode_ = Blockly.DRAG_BEGIN,
  18334. this.startDragMouseX = a.clientX,
  18335. this.startDragMouseY = a.clientY,
  18336. this.startDragMetrics = this.getMetrics(),
  18337. this.startScrollX = this.scrollX,
  18338. this.startScrollY = this.scrollY,
  18339. "mouseup" in Blockly.Touch.TOUCH_MAP && (Blockly.Touch.onTouchUpWrapper_ = Blockly.Touch.onTouchUpWrapper_ || [],
  18340. Blockly.Touch.onTouchUpWrapper_ = Blockly.Touch.onTouchUpWrapper_.concat(Blockly.bindEventWithChecks_(document, "mouseup", null, Blockly.onMouseUp_))),
  18341. Blockly.onMouseMoveWrapper_ = Blockly.onMouseMoveWrapper_ || [],
  18342. Blockly.onMouseMoveWrapper_ = Blockly.onMouseMoveWrapper_.concat(Blockly.bindEventWithChecks_(document, "mousemove", null, Blockly.onMouseMove_))) : Blockly.Touch.clearTouchIdentifier(),
  18343. a.stopPropagation(),
  18344. a.preventDefault())
  18345. }
  18346. ;
  18347. Blockly.WorkspaceSvg.prototype.startDrag = function (a, b) {
  18348. var c = Blockly.mouseToSvg(a, this.getParentSvg(), this.getInverseScreenCTM());
  18349. c.x /= this.scale;
  18350. c.y /= this.scale;
  18351. this.dragDeltaXY_ = goog.math.Coordinate.difference(b, c)
  18352. }
  18353. ;
  18354. Blockly.WorkspaceSvg.prototype.moveDrag = function (a) {
  18355. a = Blockly.mouseToSvg(a, this.getParentSvg(), this.getInverseScreenCTM());
  18356. a.x /= this.scale;
  18357. a.y /= this.scale;
  18358. return goog.math.Coordinate.sum(this.dragDeltaXY_, a)
  18359. }
  18360. ;
  18361. Blockly.WorkspaceSvg.prototype.isDragging = function () {
  18362. return Blockly.dragMode_ == Blockly.DRAG_FREE || Blockly.Flyout.startFlyout_ && Blockly.Flyout.startFlyout_.dragMode_ == Blockly.DRAG_FREE || this.dragMode_ == Blockly.DRAG_FREE
  18363. }
  18364. ;
  18365. Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function (a) {
  18366. Blockly.terminateDrag_();
  18367. var b = 0 < a.deltaY ? -1 : 1
  18368. , c = Blockly.mouseToSvg(a, this.getParentSvg(), this.getInverseScreenCTM());
  18369. this.zoom(c.x, c.y, b);
  18370. a.preventDefault()
  18371. }
  18372. ;
  18373. Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox = function () {
  18374. var a = this.getTopBlocks(!1);
  18375. if (!a.length)
  18376. return {
  18377. x: 0,
  18378. y: 0,
  18379. width: 0,
  18380. height: 0
  18381. };
  18382. for (var b = a[0].getBoundingRectangle(), c = 1; c < a.length; c++) {
  18383. var d = a[c].getBoundingRectangle();
  18384. d.topLeft.x < b.topLeft.x && (b.topLeft.x = d.topLeft.x);
  18385. d.bottomRight.x > b.bottomRight.x && (b.bottomRight.x = d.bottomRight.x);
  18386. d.topLeft.y < b.topLeft.y && (b.topLeft.y = d.topLeft.y);
  18387. d.bottomRight.y > b.bottomRight.y && (b.bottomRight.y = d.bottomRight.y)
  18388. }
  18389. return {
  18390. x: b.topLeft.x,
  18391. y: b.topLeft.y,
  18392. width: b.bottomRight.x - b.topLeft.x,
  18393. height: b.bottomRight.y - b.topLeft.y
  18394. }
  18395. }
  18396. ;
  18397. Blockly.WorkspaceSvg.prototype.cleanUp = function () {
  18398. Blockly.Events.setGroup(!0);
  18399. for (var a = this.getTopBlocks(!0), b = 0, c = 0, d; d = a[c]; c++) {
  18400. var e = d.getRelativeToSurfaceXY();
  18401. d.moveBy(-e.x, b - e.y);
  18402. d.snapToGrid();
  18403. b = d.getRelativeToSurfaceXY().y + d.getHeightWidth().height + Blockly.BlockSvg.MIN_BLOCK_Y
  18404. }
  18405. Blockly.Events.setGroup(!1);
  18406. this.resizeContents()
  18407. }
  18408. ;
  18409. Blockly.WorkspaceSvg.prototype.showContextMenu_ = function (a) {
  18410. function b(a) {
  18411. if (a.isDeletable())
  18412. l = l.concat(a.getDescendants());
  18413. else {
  18414. a = a.getChildren();
  18415. for (var c = 0; c < a.length; c++)
  18416. b(a[c])
  18417. }
  18418. }
  18419. function c() {
  18420. Blockly.Events.setGroup(f);
  18421. var a = l.shift();
  18422. a && (a.workspace ? (a.dispose(!1, !0),
  18423. setTimeout(c, 10)) : c());
  18424. Blockly.Events.setGroup(!1)
  18425. }
  18426. if (!this.options.readOnly && !this.isFlyout) {
  18427. var d = []
  18428. , e = this.getTopBlocks(!0)
  18429. , f = Blockly.genUid()
  18430. , g = {};
  18431. g.text = Blockly.Msg.UNDO;
  18432. g.enabled = 0 < this.undoStack_.length;
  18433. g.callback = this.undo.bind(this, !1);
  18434. d.push(g);
  18435. g = {};
  18436. g.text = Blockly.Msg.REDO;
  18437. g.enabled = 0 < this.redoStack_.length;
  18438. g.callback = this.undo.bind(this, !0);
  18439. d.push(g);
  18440. this.scrollbar && (g = {},
  18441. g.text = Blockly.Msg.CLEAN_UP,
  18442. g.enabled = 1 < e.length,
  18443. g.callback = this.cleanUp.bind(this),
  18444. d.push(g));
  18445. if (this.options.collapse) {
  18446. for (var h = g = !1, k = 0; k < e.length; k++)
  18447. for (var m = e[k]; m;)
  18448. m.isCollapsed() ? g = !0 : h = !0,
  18449. m = m.getNextBlock();
  18450. var p = function (a) {
  18451. for (var b = 0, c = 0; c < e.length; c++)
  18452. for (var d = e[c]; d;)
  18453. setTimeout(d.setCollapsed.bind(d, a), b),
  18454. d = d.getNextBlock(),
  18455. b += 10
  18456. };
  18457. h = {
  18458. enabled: h
  18459. };
  18460. h.text = Blockly.Msg.COLLAPSE_ALL;
  18461. h.callback = function () {
  18462. p(!0)
  18463. }
  18464. ;
  18465. d.push(h);
  18466. g = {
  18467. enabled: g
  18468. };
  18469. g.text = Blockly.Msg.EXPAND_ALL;
  18470. g.callback = function () {
  18471. p(!1)
  18472. }
  18473. ;
  18474. d.push(g)
  18475. }
  18476. var l = [];
  18477. for (k = 0; k < e.length; k++)
  18478. b(e[k]);
  18479. g = {
  18480. text: 1 == l.length ? Blockly.Msg.DELETE_BLOCK : Blockly.Msg.DELETE_X_BLOCKS.replace("%1", String(l.length)),
  18481. enabled: 0 < l.length,
  18482. callback: function () {
  18483. 2 > l.length ? c() : Blockly.confirm(Blockly.Msg.DELETE_ALL_BLOCKS.replace("%1", l.length), function (a) {
  18484. a && c()
  18485. })
  18486. }
  18487. };
  18488. d.push(g);
  18489. Blockly.ContextMenu.show(a, d, this.RTL)
  18490. }
  18491. }
  18492. ;
  18493. Blockly.WorkspaceSvg.prototype.loadAudio_ = function (a, b) {
  18494. if (a.length) {
  18495. try {
  18496. var c = new window.Audio
  18497. } catch (h) {
  18498. return
  18499. }
  18500. for (var d, e = 0; e < a.length; e++) {
  18501. var f = a[e]
  18502. , g = f.match(/\.(\w+)$/);
  18503. if (g && c.canPlayType("audio/" + g[1])) {
  18504. d = new window.Audio(f);
  18505. break
  18506. }
  18507. }
  18508. d && d.play && (this.SOUNDS_[b] = d)
  18509. }
  18510. }
  18511. ;
  18512. Blockly.WorkspaceSvg.prototype.preloadAudio_ = function () {
  18513. for (var a in this.SOUNDS_) {
  18514. var b = this.SOUNDS_[a];
  18515. b.volume = .01;
  18516. b.play();
  18517. b.pause();
  18518. if (goog.userAgent.IPAD || goog.userAgent.IPHONE)
  18519. break
  18520. }
  18521. }
  18522. ;
  18523. Blockly.WorkspaceSvg.prototype.playAudio = function (a, b) {
  18524. var c = this.SOUNDS_[a];
  18525. if (c) {
  18526. var d = new Date;
  18527. d - this.lastSound_ < Blockly.SOUND_LIMIT || (this.lastSound_ = d,
  18528. c = goog.userAgent.DOCUMENT_MODE && 9 === goog.userAgent.DOCUMENT_MODE || goog.userAgent.IPAD || goog.userAgent.ANDROID ? c : c.cloneNode(),
  18529. c.volume = void 0 === b ? 1 : b,
  18530. c.play())
  18531. } else
  18532. this.options.parentWorkspace && this.options.parentWorkspace.playAudio(a, b)
  18533. }
  18534. ;
  18535. Blockly.WorkspaceSvg.prototype.updateToolbox = function (a) {
  18536. if (a = Blockly.Options.parseToolboxTree(a)) {
  18537. if (!this.options.languageTree)
  18538. throw "Existing toolbox is null. Can't create new toolbox.";
  18539. if (a.getElementsByTagName("category").length) {
  18540. if (!this.toolbox_)
  18541. throw "Existing toolbox has no categories. Can't change mode.";
  18542. this.options.languageTree = a;
  18543. this.toolbox_.populate_(a);
  18544. this.toolbox_.addColour_()
  18545. } else {
  18546. if (!this.flyout_)
  18547. throw "Existing toolbox has categories. Can't change mode.";
  18548. this.options.languageTree = a;
  18549. this.flyout_.show(a.childNodes)
  18550. }
  18551. } else if (this.options.languageTree)
  18552. throw "Can't nullify an existing toolbox.";
  18553. }
  18554. ;
  18555. Blockly.WorkspaceSvg.prototype.markFocused = function () {
  18556. this.options.parentWorkspace ? this.options.parentWorkspace.markFocused() : Blockly.mainWorkspace = this
  18557. }
  18558. ;
  18559. Blockly.WorkspaceSvg.prototype.zoom = function (a, b, c) {
  18560. var d = this.options.zoomOptions.scaleSpeed
  18561. , e = this.getMetrics()
  18562. , f = this.getParentSvg().createSVGPoint();
  18563. f.x = a;
  18564. f.y = b;
  18565. f = f.matrixTransform(this.getCanvas().getCTM().inverse());
  18566. a = f.x;
  18567. b = f.y;
  18568. f = this.getCanvas();
  18569. d = 1 == c ? d : 1 / d;
  18570. c = this.scale * d;
  18571. c > this.options.zoomOptions.maxScale ? d = this.options.zoomOptions.maxScale / this.scale : c < this.options.zoomOptions.minScale && (d = this.options.zoomOptions.minScale / this.scale);
  18572. this.scale != c && (this.scrollbar && (a = f.getCTM().translate(a * (1 - d), b * (1 - d)).scale(d),
  18573. this.scrollX = a.e - e.absoluteLeft,
  18574. this.scrollY = a.f - e.absoluteTop),
  18575. this.setScale(c))
  18576. }
  18577. ;
  18578. Blockly.WorkspaceSvg.prototype.zoomCenter = function (a) {
  18579. var b = this.getMetrics();
  18580. this.zoom(b.viewWidth / 2, b.viewHeight / 2, a)
  18581. }
  18582. ;
  18583. Blockly.WorkspaceSvg.prototype.zoomToFit = function () {
  18584. var a = this.getMetrics()
  18585. , b = this.getBlocksBoundingBox()
  18586. , c = b.width;
  18587. b = b.height;
  18588. if (c) {
  18589. var d = a.viewWidth
  18590. , e = a.viewHeight;
  18591. this.flyout_ && (d -= this.flyout_.width_);
  18592. this.scrollbar || (c += a.contentLeft,
  18593. b += a.contentTop);
  18594. this.setScale(Math.min(d / c, e / b));
  18595. this.scrollCenter()
  18596. }
  18597. }
  18598. ;
  18599. Blockly.WorkspaceSvg.prototype.scrollCenter = function () {
  18600. if (this.scrollbar) {
  18601. var a = this.getMetrics()
  18602. , b = (a.contentWidth - a.viewWidth) / 2;
  18603. this.flyout_ && (b -= this.flyout_.width_ / 2);
  18604. this.scrollbar.set(b, (a.contentHeight - a.viewHeight) / 2)
  18605. }
  18606. }
  18607. ;
  18608. Blockly.WorkspaceSvg.prototype.setScale = function (a) {
  18609. this.options.zoomOptions.maxScale && a > this.options.zoomOptions.maxScale ? a = this.options.zoomOptions.maxScale : this.options.zoomOptions.minScale && a < this.options.zoomOptions.minScale && (a = this.options.zoomOptions.minScale);
  18610. this.scale = a;
  18611. this.updateGridPattern_();
  18612. this.scrollbar ? this.scrollbar.resize() : this.translate(this.scrollX, this.scrollY);
  18613. Blockly.hideChaff(!1);
  18614. this.flyout_ && this.flyout_.reflow()
  18615. }
  18616. ;
  18617. Blockly.WorkspaceSvg.prototype.updateGridPattern_ = function () {
  18618. if (this.options.gridPattern) {
  18619. var a = this.options.gridOptions.spacing * this.scale || 100;
  18620. this.options.gridPattern.setAttribute("width", a);
  18621. this.options.gridPattern.setAttribute("height", a);
  18622. a = Math.floor(this.options.gridOptions.spacing / 2) + .5;
  18623. var b = a - this.options.gridOptions.length / 2
  18624. , c = a + this.options.gridOptions.length / 2
  18625. , d = this.options.gridPattern.firstChild
  18626. , e = d && d.nextSibling;
  18627. a *= this.scale;
  18628. b *= this.scale;
  18629. c *= this.scale;
  18630. d && (d.setAttribute("stroke-width", this.scale),
  18631. d.setAttribute("x1", b),
  18632. d.setAttribute("y1", a),
  18633. d.setAttribute("x2", c),
  18634. d.setAttribute("y2", a));
  18635. e && (e.setAttribute("stroke-width", this.scale),
  18636. e.setAttribute("x1", a),
  18637. e.setAttribute("y1", b),
  18638. e.setAttribute("x2", a),
  18639. e.setAttribute("y2", c))
  18640. }
  18641. }
  18642. ;
  18643. Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_ = function () {
  18644. var a = Blockly.svgSize(this.getParentSvg());
  18645. if (this.toolbox_)
  18646. if (this.toolboxPosition == Blockly.TOOLBOX_AT_TOP || this.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM)
  18647. a.height -= this.toolbox_.getHeight();
  18648. else if (this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT || this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT)
  18649. a.width -= this.toolbox_.getWidth();
  18650. var b = Blockly.Flyout.prototype.CORNER_RADIUS - 1
  18651. , c = a.width - b
  18652. , d = a.height - b
  18653. , e = this.getBlocksBoundingBox()
  18654. , f = e.width * this.scale
  18655. , g = e.height * this.scale
  18656. , h = e.x * this.scale
  18657. , k = e.y * this.scale;
  18658. this.scrollbar ? (b = Math.min(h - c / 2, h + f - c),
  18659. c = Math.max(h + f + c / 2, h + c),
  18660. f = Math.min(k - d / 2, k + g - d),
  18661. d = Math.max(k + g + d / 2, k + d)) : (b = e.x,
  18662. c = b + e.width,
  18663. f = e.y,
  18664. d = f + e.height);
  18665. e = 0;
  18666. this.toolbox_ && this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT && (e = this.toolbox_.getWidth());
  18667. g = 0;
  18668. this.toolbox_ && this.toolboxPosition == Blockly.TOOLBOX_AT_TOP && (g = this.toolbox_.getHeight());
  18669. return {
  18670. viewHeight: a.height,
  18671. viewWidth: a.width,
  18672. contentHeight: d - f,
  18673. contentWidth: c - b,
  18674. viewTop: -this.scrollY,
  18675. viewLeft: -this.scrollX,
  18676. contentTop: f,
  18677. contentLeft: b,
  18678. absoluteTop: g,
  18679. absoluteLeft: e,
  18680. toolboxWidth: this.toolbox_ ? this.toolbox_.getWidth() : 0,
  18681. toolboxHeight: this.toolbox_ ? this.toolbox_.getHeight() : 0,
  18682. flyoutWidth: this.flyout_ ? this.flyout_.getWidth() : 0,
  18683. flyoutHeight: this.flyout_ ? this.flyout_.getHeight() : 0,
  18684. toolboxPosition: this.toolboxPosition
  18685. }
  18686. }
  18687. ;
  18688. Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_ = function (a) {
  18689. if (!this.scrollbar)
  18690. throw "Attempt to set top level workspace scroll without scrollbars.";
  18691. var b = this.getMetrics();
  18692. goog.isNumber(a.x) && (this.scrollX = -b.contentWidth * a.x - b.contentLeft);
  18693. goog.isNumber(a.y) && (this.scrollY = -b.contentHeight * a.y - b.contentTop);
  18694. a = this.scrollX + b.absoluteLeft;
  18695. b = this.scrollY + b.absoluteTop;
  18696. this.translate(a, b);
  18697. this.options.gridPattern && (this.options.gridPattern.setAttribute("x", a),
  18698. this.options.gridPattern.setAttribute("y", b),
  18699. goog.userAgent.IE && this.updateGridPattern_())
  18700. }
  18701. ;
  18702. Blockly.WorkspaceSvg.prototype.setResizesEnabled = function (a) {
  18703. var b = !this.resizesEnabled_ && a;
  18704. this.resizesEnabled_ = a;
  18705. b && this.resizeContents()
  18706. }
  18707. ;
  18708. Blockly.WorkspaceSvg.prototype.clear = function () {
  18709. this.setResizesEnabled(!1);
  18710. Blockly.WorkspaceSvg.superClass_.clear.call(this);
  18711. this.setResizesEnabled(!0)
  18712. }
  18713. ;
  18714. Blockly.WorkspaceSvg.prototype.setVisible = Blockly.WorkspaceSvg.prototype.setVisible;
  18715. Blockly.Mutator = function (a) {
  18716. Blockly.Mutator.superClass_.constructor.call(this, null);
  18717. this.quarkNames_ = a
  18718. }
  18719. ;
  18720. goog.inherits(Blockly.Mutator, Blockly.Icon);
  18721. Blockly.Mutator.prototype.workspaceWidth_ = 0;
  18722. Blockly.Mutator.prototype.workspaceHeight_ = 0;
  18723. Blockly.Mutator.prototype.drawIcon_ = function (a) {
  18724. Blockly.createSvgElement("rect", {
  18725. "class": "blocklyIconShape",
  18726. rx: "4",
  18727. ry: "4",
  18728. height: "16",
  18729. width: "16"
  18730. }, a);
  18731. Blockly.createSvgElement("path", {
  18732. "class": "blocklyIconSymbol",
  18733. d: "m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"
  18734. }, a);
  18735. Blockly.createSvgElement("circle", {
  18736. "class": "blocklyIconShape",
  18737. r: "2.7",
  18738. cx: "8",
  18739. cy: "8"
  18740. }, a)
  18741. }
  18742. ;
  18743. Blockly.Mutator.prototype.iconClick_ = function (a) {
  18744. this.block_.isEditable() && Blockly.Icon.prototype.iconClick_.call(this, a)
  18745. }
  18746. ;
  18747. Blockly.Mutator.prototype.createEditor_ = function () {
  18748. this.svgDialog_ = Blockly.createSvgElement("svg", {
  18749. x: Blockly.Bubble.BORDER_WIDTH,
  18750. y: Blockly.Bubble.BORDER_WIDTH
  18751. }, null);
  18752. if (this.quarkNames_.length)
  18753. for (var a = goog.dom.createDom("xml"), b = 0, c; c = this.quarkNames_[b]; b++)
  18754. a.appendChild(goog.dom.createDom("block", {
  18755. type: c
  18756. }));
  18757. else
  18758. a = null;
  18759. a = {
  18760. languageTree: a,
  18761. parentWorkspace: this.block_.workspace,
  18762. pathToMedia: this.block_.workspace.options.pathToMedia,
  18763. RTL: this.block_.RTL,
  18764. toolboxPosition: this.block_.RTL ? Blockly.TOOLBOX_AT_RIGHT : Blockly.TOOLBOX_AT_LEFT,
  18765. horizontalLayout: !1,
  18766. getMetrics: this.getFlyoutMetrics_.bind(this),
  18767. setMetrics: null
  18768. };
  18769. this.workspace_ = new Blockly.WorkspaceSvg(a);
  18770. this.workspace_.isMutator = !0;
  18771. this.svgDialog_.appendChild(this.workspace_.createDom("blocklyMutatorBackground"));
  18772. return this.svgDialog_
  18773. }
  18774. ;
  18775. Blockly.Mutator.prototype.updateEditable = function () {
  18776. this.block_.isInFlyout || (this.block_.isEditable() ? this.iconGroup_ && Blockly.removeClass_(this.iconGroup_, "blocklyIconGroupReadonly") : (this.setVisible(!1),
  18777. this.iconGroup_ && Blockly.addClass_(this.iconGroup_, "blocklyIconGroupReadonly")));
  18778. Blockly.Icon.prototype.updateEditable.call(this)
  18779. }
  18780. ;
  18781. Blockly.Mutator.prototype.resizeBubble_ = function () {
  18782. var a = 2 * Blockly.Bubble.BORDER_WIDTH
  18783. , b = this.workspace_.getCanvas().getBBox();
  18784. var c = this.block_.RTL ? -b.x : b.width + b.x;
  18785. b = b.height + 3 * a;
  18786. if (this.workspace_.flyout_) {
  18787. var d = this.workspace_.flyout_.getMetrics_();
  18788. b = Math.max(b, d.contentHeight + 20)
  18789. }
  18790. c += 3 * a;
  18791. if (Math.abs(this.workspaceWidth_ - c) > a || Math.abs(this.workspaceHeight_ - b) > a)
  18792. this.workspaceWidth_ = c,
  18793. this.workspaceHeight_ = b,
  18794. this.bubble_.setBubbleSize(c + a, b + a),
  18795. this.svgDialog_.setAttribute("width", this.workspaceWidth_),
  18796. this.svgDialog_.setAttribute("height", this.workspaceHeight_);
  18797. this.block_.RTL && (a = "translate(" + this.workspaceWidth_ + ",0)",
  18798. this.workspace_.getCanvas().setAttribute("transform", a));
  18799. this.workspace_.resize()
  18800. }
  18801. ;
  18802. Blockly.Mutator.prototype.setVisible = function (a) {
  18803. if (a != this.isVisible())
  18804. if (Blockly.Events.fire(new Blockly.Events.Ui(this.block_, "mutatorOpen", !a, a)),
  18805. a) {
  18806. this.bubble_ = new Blockly.Bubble(this.block_.workspace, this.createEditor_(), this.block_.svgPath_, this.iconXY_, null, null);
  18807. if (a = this.workspace_.options.languageTree)
  18808. this.workspace_.flyout_.init(this.workspace_),
  18809. this.workspace_.flyout_.show(a.childNodes);
  18810. this.rootBlock_ = this.block_.decompose(this.workspace_);
  18811. a = this.rootBlock_.getDescendants();
  18812. for (var b = 0, c; c = a[b]; b++)
  18813. c.render();
  18814. this.rootBlock_.setMovable(!1);
  18815. this.rootBlock_.setDeletable(!1);
  18816. this.workspace_.flyout_ ? (a = 2 * this.workspace_.flyout_.CORNER_RADIUS,
  18817. b = this.workspace_.flyout_.width_ + a) : b = a = 16;
  18818. this.block_.RTL && (b = -b);
  18819. this.rootBlock_.moveBy(b, a);
  18820. if (this.block_.saveConnections) {
  18821. var d = this;
  18822. this.block_.saveConnections(this.rootBlock_);
  18823. this.sourceListener_ = function () {
  18824. d.block_.saveConnections(d.rootBlock_)
  18825. }
  18826. ;
  18827. this.block_.workspace.addChangeListener(this.sourceListener_)
  18828. }
  18829. this.resizeBubble_();
  18830. this.workspace_.addChangeListener(this.workspaceChanged_.bind(this));
  18831. this.updateColour()
  18832. } else
  18833. this.svgDialog_ = null,
  18834. this.workspace_.dispose(),
  18835. this.rootBlock_ = this.workspace_ = null,
  18836. this.bubble_.dispose(),
  18837. this.bubble_ = null,
  18838. this.workspaceHeight_ = this.workspaceWidth_ = 0,
  18839. this.sourceListener_ && (this.block_.workspace.removeChangeListener(this.sourceListener_),
  18840. this.sourceListener_ = null)
  18841. }
  18842. ;
  18843. Blockly.Mutator.prototype.workspaceChanged_ = function () {
  18844. if (Blockly.dragMode_ == Blockly.DRAG_NONE)
  18845. for (var a = this.workspace_.getTopBlocks(!1), b = 0, c; c = a[b]; b++) {
  18846. var d = c.getRelativeToSurfaceXY()
  18847. , e = c.getHeightWidth();
  18848. 20 > d.y + e.height && c.moveBy(0, 20 - e.height - d.y)
  18849. }
  18850. if (this.rootBlock_.workspace == this.workspace_) {
  18851. Blockly.Events.setGroup(!0);
  18852. c = this.block_;
  18853. a = (a = c.mutationToDom()) && Blockly.Xml.domToText(a);
  18854. b = c.rendered;
  18855. c.rendered = !1;
  18856. c.compose(this.rootBlock_);
  18857. c.rendered = b;
  18858. c.initSvg();
  18859. b = (b = c.mutationToDom()) && Blockly.Xml.domToText(b);
  18860. if (a != b) {
  18861. Blockly.Events.fire(new Blockly.Events.Change(c, "mutation", null, a, b));
  18862. var f = Blockly.Events.getGroup();
  18863. setTimeout(function () {
  18864. Blockly.Events.setGroup(f);
  18865. c.bumpNeighbours_();
  18866. Blockly.Events.setGroup(!1)
  18867. }, Blockly.BUMP_DELAY)
  18868. }
  18869. c.rendered && c.render();
  18870. this.resizeBubble_();
  18871. Blockly.Events.setGroup(!1)
  18872. }
  18873. }
  18874. ;
  18875. Blockly.Mutator.prototype.getFlyoutMetrics_ = function () {
  18876. return {
  18877. viewHeight: this.workspaceHeight_,
  18878. viewWidth: this.workspaceWidth_,
  18879. absoluteTop: 0,
  18880. absoluteLeft: 0
  18881. }
  18882. }
  18883. ;
  18884. Blockly.Mutator.prototype.dispose = function () {
  18885. this.block_.mutator = null;
  18886. Blockly.Icon.prototype.dispose.call(this)
  18887. }
  18888. ;
  18889. Blockly.Mutator.reconnect = function (a, b, c) {
  18890. if (!a || !a.getSourceBlock().workspace)
  18891. return !1;
  18892. c = b.getInput(c).connection;
  18893. var d = a.targetBlock();
  18894. return d && d != b || c.targetConnection == a ? !1 : (c.isConnected() && c.disconnect(),
  18895. c.connect(a),
  18896. !0)
  18897. }
  18898. ;
  18899. goog.global.Blockly || (goog.global.Blockly = {});
  18900. goog.global.Blockly.Mutator || (goog.global.Blockly.Mutator = {});
  18901. goog.global.Blockly.Mutator.reconnect = Blockly.Mutator.reconnect;
  18902. Blockly.Warning = function (a) {
  18903. Blockly.Warning.superClass_.constructor.call(this, a);
  18904. this.createIcon();
  18905. this.text_ = {}
  18906. }
  18907. ;
  18908. goog.inherits(Blockly.Warning, Blockly.Icon);
  18909. Blockly.Warning.prototype.collapseHidden = !1;
  18910. Blockly.Warning.prototype.drawIcon_ = function (a) {
  18911. Blockly.createSvgElement("path", {
  18912. "class": "blocklyIconShape",
  18913. d: "M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"
  18914. }, a);
  18915. Blockly.createSvgElement("path", {
  18916. "class": "blocklyIconSymbol",
  18917. d: "m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"
  18918. }, a);
  18919. Blockly.createSvgElement("rect", {
  18920. "class": "blocklyIconSymbol",
  18921. x: "7",
  18922. y: "11",
  18923. height: "2",
  18924. width: "2"
  18925. }, a)
  18926. }
  18927. ;
  18928. Blockly.Warning.textToDom_ = function (a) {
  18929. var b = Blockly.createSvgElement("text", {
  18930. "class": "blocklyText blocklyBubbleText",
  18931. y: Blockly.Bubble.BORDER_WIDTH
  18932. }, null);
  18933. a = a.split("\n");
  18934. for (var c = 0; c < a.length; c++) {
  18935. var d = Blockly.createSvgElement("tspan", {
  18936. dy: "1em",
  18937. x: Blockly.Bubble.BORDER_WIDTH
  18938. }, b)
  18939. , e = document.createTextNode(a[c]);
  18940. d.appendChild(e)
  18941. }
  18942. return b
  18943. }
  18944. ;
  18945. Blockly.Warning.prototype.setVisible = function (a) {
  18946. if (a != this.isVisible())
  18947. if (Blockly.Events.fire(new Blockly.Events.Ui(this.block_, "warningOpen", !a, a)),
  18948. a) {
  18949. a = Blockly.Warning.textToDom_(this.getText());
  18950. this.bubble_ = new Blockly.Bubble(this.block_.workspace, a, this.block_.svgPath_, this.iconXY_, null, null);
  18951. if (this.block_.RTL)
  18952. for (var b = a.getBBox().width, c = 0, d; d = a.childNodes[c]; c++)
  18953. d.setAttribute("text-anchor", "end"),
  18954. d.setAttribute("x", b + Blockly.Bubble.BORDER_WIDTH);
  18955. this.updateColour();
  18956. a = this.bubble_.getBubbleSize();
  18957. this.bubble_.setBubbleSize(a.width, a.height)
  18958. } else
  18959. this.bubble_.dispose(),
  18960. this.body_ = this.bubble_ = null
  18961. }
  18962. ;
  18963. Blockly.Warning.prototype.bodyFocus_ = function (a) {
  18964. this.bubble_.promote_()
  18965. }
  18966. ;
  18967. Blockly.Warning.prototype.setText = function (a, b) {
  18968. this.text_[b] != a && (a ? this.text_[b] = a : delete this.text_[b],
  18969. this.isVisible() && (this.setVisible(!1),
  18970. this.setVisible(!0)))
  18971. }
  18972. ;
  18973. Blockly.Warning.prototype.getText = function () {
  18974. var a = [], b;
  18975. for (b in this.text_)
  18976. a.push(this.text_[b]);
  18977. return a.join("\n")
  18978. }
  18979. ;
  18980. Blockly.Warning.prototype.dispose = function () {
  18981. this.block_.warning = null;
  18982. Blockly.Icon.prototype.dispose.call(this)
  18983. }
  18984. ;
  18985. Blockly.Block = function (a, b, c) {
  18986. this.id = c && !a.getBlockById(c) ? c : Blockly.genUid();
  18987. a.blockDB_[this.id] = this;
  18988. this.previousConnection = this.nextConnection = this.outputConnection = null;
  18989. this.inputList = [];
  18990. this.inputsInline = void 0;
  18991. this.disabled = !1;
  18992. this.tooltip = "";
  18993. this.contextMenu = !0;
  18994. this.parentBlock_ = null;
  18995. this.childBlocks_ = [];
  18996. this.editable_ = this.movable_ = this.deletable_ = !0;
  18997. this.collapsed_ = this.isShadow_ = !1;
  18998. this.comment = null;
  18999. this.xy_ = new goog.math.Coordinate(0, 0);
  19000. this.workspace = a;
  19001. this.isInFlyout = a.isFlyout;
  19002. this.isInMutator = a.isMutator;
  19003. this.RTL = a.RTL;
  19004. b && (this.type = b,
  19005. c = Blockly.Blocks[b],
  19006. goog.asserts.assertObject(c, 'Error: "%s" is an unknown language block.', b),
  19007. goog.mixin(this, c));
  19008. a.addTopBlock(this);
  19009. goog.isFunction(this.init) && this.init();
  19010. this.inputsInlineDefault = this.inputsInline;
  19011. Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Create(this));
  19012. goog.isFunction(this.onchange) && (this.onchangeWrapper_ = this.onchange.bind(this),
  19013. this.workspace.addChangeListener(this.onchangeWrapper_))
  19014. }
  19015. ;
  19016. Blockly.Block.obtain = function (a, b) {
  19017. console.warn("Deprecated call to Blockly.Block.obtain, use workspace.newBlock instead.");
  19018. return a.newBlock(b)
  19019. }
  19020. ;
  19021. Blockly.Block.prototype.data = null;
  19022. Blockly.Block.prototype.colour_ = "#000000";
  19023. Blockly.Block.prototype.dispose = function (a) {
  19024. if (this.workspace) {
  19025. this.onchangeWrapper_ && this.workspace.removeChangeListener(this.onchangeWrapper_);
  19026. this.unplug(a);
  19027. Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Delete(this));
  19028. Blockly.Events.disable();
  19029. try {
  19030. this.workspace && (this.workspace.removeTopBlock(this),
  19031. delete this.workspace.blockDB_[this.id],
  19032. this.workspace = null);
  19033. for (var b = this.childBlocks_.length - 1; 0 <= b; b--)
  19034. this.childBlocks_[b].dispose(!1);
  19035. b = 0;
  19036. for (var c; c = this.inputList[b]; b++)
  19037. c.dispose();
  19038. this.inputList.length = 0;
  19039. var d = this.getConnections_(!0);
  19040. for (b = 0; b < d.length; b++) {
  19041. var e = d[b];
  19042. e.isConnected() && e.disconnect();
  19043. d[b].dispose()
  19044. }
  19045. } finally {
  19046. Blockly.Events.enable()
  19047. }
  19048. }
  19049. }
  19050. ;
  19051. Blockly.Block.prototype.unplug = function (a) {
  19052. if (this.outputConnection)
  19053. this.outputConnection.isConnected() && this.outputConnection.disconnect();
  19054. else if (this.previousConnection) {
  19055. var b = null;
  19056. this.previousConnection.isConnected() && (b = this.previousConnection.targetConnection,
  19057. this.previousConnection.disconnect());
  19058. var c = this.getNextBlock();
  19059. a && c && (a = this.nextConnection.targetConnection,
  19060. a.disconnect(),
  19061. b && b.checkType_(a) && b.connect(a))
  19062. }
  19063. }
  19064. ;
  19065. Blockly.Block.prototype.getConnections_ = function () {
  19066. var a = [];
  19067. this.outputConnection && a.push(this.outputConnection);
  19068. this.previousConnection && a.push(this.previousConnection);
  19069. this.nextConnection && a.push(this.nextConnection);
  19070. for (var b = 0, c; c = this.inputList[b]; b++)
  19071. c.connection && a.push(c.connection);
  19072. return a
  19073. }
  19074. ;
  19075. Blockly.Block.prototype.lastConnectionInStack_ = function () {
  19076. for (var a = this.nextConnection; a;) {
  19077. var b = a.targetBlock();
  19078. if (!b)
  19079. return a;
  19080. a = b.nextConnection
  19081. }
  19082. return null
  19083. }
  19084. ;
  19085. Blockly.Block.prototype.bumpNeighbours_ = function () {
  19086. if (this.workspace && Blockly.dragMode_ == Blockly.DRAG_NONE) {
  19087. var a = this.getRootBlock();
  19088. if (!a.isInFlyout)
  19089. for (var b = this.getConnections_(!1), c = 0, d; d = b[c]; c++) {
  19090. d.isConnected() && d.isSuperior() && d.targetBlock().bumpNeighbours_();
  19091. for (var e = d.neighbours_(Blockly.SNAP_RADIUS), f = 0, g; g = e[f]; f++)
  19092. d.isConnected() && g.isConnected() || g.getSourceBlock().getRootBlock() != a && (d.isSuperior() ? g.bumpAwayFrom_(d) : d.bumpAwayFrom_(g))
  19093. }
  19094. }
  19095. }
  19096. ;
  19097. Blockly.Block.prototype.getParent = function () {
  19098. return this.parentBlock_
  19099. }
  19100. ;
  19101. Blockly.Block.prototype.getInputWithBlock = function (a) {
  19102. for (var b = 0, c; c = this.inputList[b]; b++)
  19103. if (c.connection && c.connection.targetBlock() == a)
  19104. return c;
  19105. return null
  19106. }
  19107. ;
  19108. Blockly.Block.prototype.getSurroundParent = function () {
  19109. var a = this;
  19110. do {
  19111. var b = a;
  19112. a = a.getParent();
  19113. if (!a)
  19114. return null
  19115. } while (a.getNextBlock() == b); return a
  19116. }
  19117. ;
  19118. Blockly.Block.prototype.getNextBlock = function () {
  19119. return this.nextConnection && this.nextConnection.targetBlock()
  19120. }
  19121. ;
  19122. Blockly.Block.prototype.getRootBlock = function () {
  19123. var a = this;
  19124. do {
  19125. var b = a;
  19126. a = b.parentBlock_
  19127. } while (a); return b
  19128. }
  19129. ;
  19130. Blockly.Block.prototype.getChildren = function () {
  19131. return this.childBlocks_
  19132. }
  19133. ;
  19134. Blockly.Block.prototype.setParent = function (a) {
  19135. if (a != this.parentBlock_) {
  19136. if (this.parentBlock_) {
  19137. goog.array.remove(this.parentBlock_.childBlocks_, this);
  19138. if (this.previousConnection && this.previousConnection.isConnected())
  19139. throw "Still connected to previous block.";
  19140. if (this.outputConnection && this.outputConnection.isConnected())
  19141. throw "Still connected to parent block.";
  19142. this.parentBlock_ = null
  19143. } else
  19144. this.workspace.removeTopBlock(this);
  19145. (this.parentBlock_ = a) ? a.childBlocks_.push(this) : this.workspace.addTopBlock(this)
  19146. }
  19147. }
  19148. ;
  19149. Blockly.Block.prototype.getDescendants = function () {
  19150. for (var a = [this], b, c = 0; b = this.childBlocks_[c]; c++)
  19151. a.push.apply(a, b.getDescendants());
  19152. return a
  19153. }
  19154. ;
  19155. Blockly.Block.prototype.isDeletable = function () {
  19156. return this.deletable_ && !this.isShadow_ && !(this.workspace && this.workspace.options.readOnly)
  19157. }
  19158. ;
  19159. Blockly.Block.prototype.setDeletable = function (a) {
  19160. this.deletable_ = a
  19161. }
  19162. ;
  19163. Blockly.Block.prototype.isMovable = function () {
  19164. return this.movable_ && !this.isShadow_ && !(this.workspace && this.workspace.options.readOnly)
  19165. }
  19166. ;
  19167. Blockly.Block.prototype.setMovable = function (a) {
  19168. this.movable_ = a
  19169. }
  19170. ;
  19171. Blockly.Block.prototype.isShadow = function () {
  19172. return this.isShadow_
  19173. }
  19174. ;
  19175. Blockly.Block.prototype.setShadow = function (a) {
  19176. this.isShadow_ = a
  19177. }
  19178. ;
  19179. Blockly.Block.prototype.isEditable = function () {
  19180. return this.editable_ && !(this.workspace && this.workspace.options.readOnly)
  19181. }
  19182. ;
  19183. Blockly.Block.prototype.setEditable = function (a) {
  19184. this.editable_ = a;
  19185. a = 0;
  19186. for (var b; b = this.inputList[a]; a++)
  19187. for (var c = 0, d; d = b.fieldRow[c]; c++)
  19188. d.updateEditable()
  19189. }
  19190. ;
  19191. Blockly.Block.prototype.setConnectionsHidden = function (a) {
  19192. if (!a && this.isCollapsed()) {
  19193. if (this.outputConnection && this.outputConnection.setHidden(a),
  19194. this.previousConnection && this.previousConnection.setHidden(a),
  19195. this.nextConnection) {
  19196. this.nextConnection.setHidden(a);
  19197. var b = this.nextConnection.targetBlock();
  19198. b && b.setConnectionsHidden(a)
  19199. }
  19200. } else
  19201. for (var c = this.getConnections_(!0), d = 0; b = c[d]; d++)
  19202. b.setHidden(a),
  19203. b.isSuperior() && (b = b.targetBlock()) && b.setConnectionsHidden(a)
  19204. }
  19205. ;
  19206. Blockly.Block.prototype.setHelpUrl = function (a) {
  19207. this.helpUrl = a
  19208. }
  19209. ;
  19210. Blockly.Block.prototype.setTooltip = function (a) {
  19211. this.tooltip = a
  19212. }
  19213. ;
  19214. Blockly.Block.prototype.getColour = function () {
  19215. return this.colour_
  19216. }
  19217. ;
  19218. Blockly.Block.prototype.setColour = function (a) {
  19219. var b = parseFloat(a);
  19220. if (isNaN(b))
  19221. if (goog.isString(a) && a.match(/^#[0-9a-fA-F]{6}$/))
  19222. this.colour_ = a;
  19223. else
  19224. throw "Invalid colour: " + a;
  19225. else
  19226. this.colour_ = Blockly.hueToRgb(b)
  19227. }
  19228. ;
  19229. Blockly.Block.prototype.getField = function (a) {
  19230. for (var b = 0, c; c = this.inputList[b]; b++)
  19231. for (var d = 0, e; e = c.fieldRow[d]; d++)
  19232. if (e.name === a)
  19233. return e;
  19234. return null
  19235. }
  19236. ;
  19237. Blockly.Block.prototype.getVars = function () {
  19238. for (var a = [], b = 0, c; c = this.inputList[b]; b++)
  19239. for (var d = 0, e; e = c.fieldRow[d]; d++)
  19240. e instanceof Blockly.FieldVariable && a.push(e.getValue());
  19241. return a
  19242. }
  19243. ;
  19244. Blockly.Block.prototype.renameVar = function (a, b) {
  19245. for (var c = 0, d; d = this.inputList[c]; c++)
  19246. for (var e = 0, f; f = d.fieldRow[e]; e++)
  19247. f instanceof Blockly.FieldVariable && Blockly.Names.equals(a, f.getValue()) && f.setValue(b)
  19248. }
  19249. ;
  19250. Blockly.Block.prototype.getFieldValue = function (a) {
  19251. return (a = this.getField(a)) ? a.getValue() : null
  19252. }
  19253. ;
  19254. Blockly.Block.prototype.getTitleValue = function (a) {
  19255. console.warn("Deprecated call to getTitleValue, use getFieldValue instead.");
  19256. return this.getFieldValue(a)
  19257. }
  19258. ;
  19259. Blockly.Block.prototype.setFieldValue = function (a, b) {
  19260. var c = this.getField(b);
  19261. goog.asserts.assertObject(c, 'Field "%s" not found.', b);
  19262. c.setValue(a)
  19263. }
  19264. ;
  19265. Blockly.Block.prototype.setTitleValue = function (a, b) {
  19266. console.warn("Deprecated call to setTitleValue, use setFieldValue instead.");
  19267. this.setFieldValue(a, b)
  19268. }
  19269. ;
  19270. Blockly.Block.prototype.setPreviousStatement = function (a, b) {
  19271. a ? (void 0 === b && (b = null),
  19272. this.previousConnection || (goog.asserts.assert(!this.outputConnection, "Remove output connection prior to adding previous connection."),
  19273. this.previousConnection = this.makeConnection_(Blockly.PREVIOUS_STATEMENT)),
  19274. this.previousConnection.setCheck(b)) : this.previousConnection && (goog.asserts.assert(!this.previousConnection.isConnected(), "Must disconnect previous statement before removing connection."),
  19275. this.previousConnection.dispose(),
  19276. this.previousConnection = null)
  19277. }
  19278. ;
  19279. Blockly.Block.prototype.setNextStatement = function (a, b) {
  19280. a ? (void 0 === b && (b = null),
  19281. this.nextConnection || (this.nextConnection = this.makeConnection_(Blockly.NEXT_STATEMENT)),
  19282. this.nextConnection.setCheck(b)) : this.nextConnection && (goog.asserts.assert(!this.nextConnection.isConnected(), "Must disconnect next statement before removing connection."),
  19283. this.nextConnection.dispose(),
  19284. this.nextConnection = null)
  19285. }
  19286. ;
  19287. Blockly.Block.prototype.setOutput = function (a, b) {
  19288. a ? (void 0 === b && (b = null),
  19289. this.outputConnection || (goog.asserts.assert(!this.previousConnection, "Remove previous connection prior to adding output connection."),
  19290. this.outputConnection = this.makeConnection_(Blockly.OUTPUT_VALUE)),
  19291. this.outputConnection.setCheck(b)) : this.outputConnection && (goog.asserts.assert(!this.outputConnection.isConnected(), "Must disconnect output value before removing connection."),
  19292. this.outputConnection.dispose(),
  19293. this.outputConnection = null)
  19294. }
  19295. ;
  19296. Blockly.Block.prototype.setInputsInline = function (a) {
  19297. this.inputsInline != a && (Blockly.Events.fire(new Blockly.Events.Change(this, "inline", null, this.inputsInline, a)),
  19298. this.inputsInline = a)
  19299. }
  19300. ;
  19301. Blockly.Block.prototype.getInputsInline = function () {
  19302. if (void 0 != this.inputsInline)
  19303. return this.inputsInline;
  19304. for (var a = 1; a < this.inputList.length; a++)
  19305. if (this.inputList[a - 1].type == Blockly.DUMMY_INPUT && this.inputList[a].type == Blockly.DUMMY_INPUT)
  19306. return !1;
  19307. for (a = 1; a < this.inputList.length; a++)
  19308. if (this.inputList[a - 1].type == Blockly.INPUT_VALUE && this.inputList[a].type == Blockly.DUMMY_INPUT)
  19309. return !0;
  19310. return !1
  19311. }
  19312. ;
  19313. Blockly.Block.prototype.setDisabled = function (a) {
  19314. this.disabled != a && (Blockly.Events.fire(new Blockly.Events.Change(this, "disabled", null, this.disabled, a)),
  19315. this.disabled = a)
  19316. }
  19317. ;
  19318. Blockly.Block.prototype.getInheritedDisabled = function () {
  19319. for (var a = this; ;) {
  19320. a = a.getSurroundParent();
  19321. if (!a)
  19322. return !1;
  19323. if (a.disabled)
  19324. return !0
  19325. }
  19326. }
  19327. ;
  19328. Blockly.Block.prototype.isCollapsed = function () {
  19329. return this.collapsed_
  19330. }
  19331. ;
  19332. Blockly.Block.prototype.setCollapsed = function (a) {
  19333. this.collapsed_ != a && (Blockly.Events.fire(new Blockly.Events.Change(this, "collapsed", null, this.collapsed_, a)),
  19334. this.collapsed_ = a)
  19335. }
  19336. ;
  19337. Blockly.Block.prototype.toString = function (a, b) {
  19338. var c = []
  19339. , d = b || "?";
  19340. if (this.collapsed_)
  19341. c.push(this.getInput("_TEMP_COLLAPSED_INPUT").fieldRow[0].text_);
  19342. else
  19343. for (var e = 0, f; f = this.inputList[e]; e++) {
  19344. for (var g = 0, h; h = f.fieldRow[g]; g++)
  19345. c.push(h.getText());
  19346. f.connection && ((f = f.connection.targetBlock()) ? c.push(f.toString(void 0, b)) : c.push(d))
  19347. }
  19348. c = goog.string.trim(c.join(" ")) || "???";
  19349. a && (c = goog.string.truncate(c, a));
  19350. return c
  19351. }
  19352. ;
  19353. Blockly.Block.prototype.appendValueInput = function (a) {
  19354. return this.appendInput_(Blockly.INPUT_VALUE, a)
  19355. }
  19356. ;
  19357. Blockly.Block.prototype.appendStatementInput = function (a) {
  19358. return this.appendInput_(Blockly.NEXT_STATEMENT, a)
  19359. }
  19360. ;
  19361. Blockly.Block.prototype.appendDummyInput = function (a) {
  19362. return this.appendInput_(Blockly.DUMMY_INPUT, a || "")
  19363. }
  19364. ;
  19365. Blockly.Block.prototype.jsonInit = function (a) {
  19366. goog.asserts.assert(void 0 == a.output || void 0 == a.previousStatement, "Must not have both an output and a previousStatement.");
  19367. void 0 !== a.colour && this.setColour(a.colour);
  19368. for (var b = 0; void 0 !== a["message" + b];)
  19369. this.interpolate_(a["message" + b], a["args" + b] || [], a["lastDummyAlign" + b]),
  19370. b++;
  19371. void 0 !== a.inputsInline && this.setInputsInline(a.inputsInline);
  19372. void 0 !== a.output && this.setOutput(!0, a.output);
  19373. void 0 !== a.previousStatement && this.setPreviousStatement(!0, a.previousStatement);
  19374. void 0 !== a.nextStatement && this.setNextStatement(!0, a.nextStatement);
  19375. void 0 !== a.tooltip && this.setTooltip(a.tooltip);
  19376. void 0 !== a.helpUrl && this.setHelpUrl(a.helpUrl)
  19377. }
  19378. ;
  19379. Blockly.Block.prototype.interpolate_ = function (a, b, c) {
  19380. var d = Blockly.utils.tokenizeInterpolation(a)
  19381. , e = []
  19382. , f = 0;
  19383. a = [];
  19384. for (var g = 0; g < d.length; g++) {
  19385. var h = d[g];
  19386. "number" == typeof h ? (goog.asserts.assert(0 < h && h <= b.length, 'Message index "%s" out of range.', h),
  19387. goog.asserts.assert(!e[h], 'Message index "%s" duplicated.', h),
  19388. e[h] = !0,
  19389. f++,
  19390. a.push(b[h - 1])) : (h = h.trim()) && a.push(h)
  19391. }
  19392. goog.asserts.assert(f == b.length, "Message does not reference all %s arg(s).", b.length);
  19393. a.length && ("string" == typeof a[a.length - 1] || goog.string.startsWith(a[a.length - 1].type, "field_")) && (g = {
  19394. type: "input_dummy"
  19395. },
  19396. c && (g.align = c),
  19397. a.push(g));
  19398. c = {
  19399. LEFT: Blockly.ALIGN_LEFT,
  19400. RIGHT: Blockly.ALIGN_RIGHT,
  19401. CENTRE: Blockly.ALIGN_CENTRE
  19402. };
  19403. b = [];
  19404. for (g = 0; g < a.length; g++)
  19405. if (e = a[g],
  19406. "string" == typeof e)
  19407. b.push([e, void 0]);
  19408. else {
  19409. d = f = null;
  19410. do
  19411. if (h = !1,
  19412. "string" == typeof e)
  19413. f = new Blockly.FieldLabel(e);
  19414. else
  19415. switch (e.type) {
  19416. case "input_value":
  19417. d = this.appendValueInput(e.name);
  19418. break;
  19419. case "input_statement":
  19420. d = this.appendStatementInput(e.name);
  19421. break;
  19422. case "input_dummy":
  19423. d = this.appendDummyInput(e.name);
  19424. break;
  19425. case "field_label":
  19426. f = new Blockly.FieldLabel(e.text, e["class"]);
  19427. break;
  19428. case "field_input":
  19429. f = new Blockly.FieldTextInput(e.text);
  19430. "boolean" == typeof e.spellcheck && f.setSpellcheck(e.spellcheck);
  19431. break;
  19432. case "field_textarea":
  19433. f = new Blockly.FieldTextArea(e.text);
  19434. break;
  19435. case "field_angle":
  19436. f = new Blockly.FieldAngle(e.angle);
  19437. break;
  19438. case "field_checkbox":
  19439. f = new Blockly.FieldCheckbox(e.checked ? "TRUE" : "FALSE");
  19440. break;
  19441. case "field_colour":
  19442. f = new Blockly.FieldColour(e.colour);
  19443. break;
  19444. case "field_variable":
  19445. f = new Blockly.FieldVariable(e.variable);
  19446. break;
  19447. case "field_dropdown":
  19448. f = new Blockly.FieldDropdown(e.options);
  19449. break;
  19450. case "field_image":
  19451. f = new Blockly.FieldImage(e.src, e.width, e.height, e.alt);
  19452. break;
  19453. case "field_number":
  19454. f = new Blockly.FieldNumber(e.value, e.min, e.max, e.precision);
  19455. break;
  19456. case "field_date":
  19457. if (Blockly.FieldDate) {
  19458. f = new Blockly.FieldDate(e.date);
  19459. break
  19460. }
  19461. default:
  19462. e.alt && (e = e.alt,
  19463. h = !0)
  19464. }
  19465. while (h); if (f)
  19466. b.push([f, e.name]);
  19467. else if (d) {
  19468. e.check && d.setCheck(e.check);
  19469. e.align && d.setAlign(c[e.align]);
  19470. for (e = 0; e < b.length; e++)
  19471. d.appendField(b[e][0], b[e][1]);
  19472. b.length = 0
  19473. }
  19474. }
  19475. }
  19476. ;
  19477. Blockly.Block.prototype.appendInput_ = function (a, b) {
  19478. var c = null;
  19479. if (a == Blockly.INPUT_VALUE || a == Blockly.NEXT_STATEMENT)
  19480. c = this.makeConnection_(a);
  19481. c = new Blockly.Input(a, b, this, c);
  19482. this.inputList.push(c);
  19483. return c
  19484. }
  19485. ;
  19486. Blockly.Block.prototype.moveInputBefore = function (a, b) {
  19487. if (a != b) {
  19488. for (var c = -1, d = b ? -1 : this.inputList.length, e = 0, f; f = this.inputList[e]; e++)
  19489. if (f.name == a) {
  19490. if (c = e,
  19491. -1 != d)
  19492. break
  19493. } else if (b && f.name == b && (d = e,
  19494. -1 != c))
  19495. break;
  19496. goog.asserts.assert(-1 != c, 'Named input "%s" not found.', a);
  19497. goog.asserts.assert(-1 != d, 'Reference input "%s" not found.', b);
  19498. this.moveNumberedInputBefore(c, d)
  19499. }
  19500. }
  19501. ;
  19502. Blockly.Block.prototype.moveNumberedInputBefore = function (a, b) {
  19503. goog.asserts.assert(a != b, "Can't move input to itself.");
  19504. goog.asserts.assert(a < this.inputList.length, "Input index " + a + " out of bounds.");
  19505. goog.asserts.assert(b <= this.inputList.length, "Reference input " + b + " out of bounds.");
  19506. var c = this.inputList[a];
  19507. this.inputList.splice(a, 1);
  19508. a < b && b--;
  19509. this.inputList.splice(b, 0, c)
  19510. }
  19511. ;
  19512. Blockly.Block.prototype.removeInput = function (a, b) {
  19513. for (var c = 0, d; d = this.inputList[c]; c++)
  19514. if (d.name == a) {
  19515. if (d.connection && d.connection.isConnected()) {
  19516. d.connection.setShadowDom(null);
  19517. var e = d.connection.targetBlock();
  19518. e.isShadow() ? e.dispose() : e.unplug()
  19519. }
  19520. d.dispose();
  19521. this.inputList.splice(c, 1);
  19522. return
  19523. }
  19524. b || goog.asserts.fail('Input "%s" not found.', a)
  19525. }
  19526. ;
  19527. Blockly.Block.prototype.getInput = function (a) {
  19528. for (var b = 0, c; c = this.inputList[b]; b++)
  19529. if (c.name == a)
  19530. return c;
  19531. return null
  19532. }
  19533. ;
  19534. Blockly.Block.prototype.getInputTargetBlock = function (a) {
  19535. return (a = this.getInput(a)) && a.connection && a.connection.targetBlock()
  19536. }
  19537. ;
  19538. Blockly.Block.prototype.getCommentText = function () {
  19539. return this.comment || ""
  19540. }
  19541. ;
  19542. Blockly.Block.prototype.setCommentText = function (a) {
  19543. this.comment != a && (Blockly.Events.fire(new Blockly.Events.Change(this, "comment", null, this.comment, a || "")),
  19544. this.comment = a)
  19545. }
  19546. ;
  19547. Blockly.Block.prototype.setWarningText = function (a) { }
  19548. ;
  19549. Blockly.Block.prototype.setMutator = function (a) { }
  19550. ;
  19551. Blockly.Block.prototype.getRelativeToSurfaceXY = function () {
  19552. return this.xy_
  19553. }
  19554. ;
  19555. Blockly.Block.prototype.moveBy = function (a, b) {
  19556. goog.asserts.assert(!this.parentBlock_, "Block has parent.");
  19557. var c = new Blockly.Events.Move(this);
  19558. this.xy_.translate(a, b);
  19559. c.recordNew();
  19560. Blockly.Events.fire(c)
  19561. }
  19562. ;
  19563. Blockly.Block.prototype.makeConnection_ = function (a) {
  19564. return new Blockly.Connection(this, a)
  19565. }
  19566. ;
  19567. Blockly.ContextMenu = {};
  19568. Blockly.ContextMenu.currentBlock = null;
  19569. Blockly.ContextMenu.show = function (a, b, c) {
  19570. Blockly.WidgetDiv.show(Blockly.ContextMenu, c, null);
  19571. if (b.length) {
  19572. var d = new goog.ui.Menu;
  19573. d.setRightToLeft(c);
  19574. for (var e = 0, f; f = b[e]; e++) {
  19575. var g = new goog.ui.MenuItem(f.text);
  19576. g.setRightToLeft(c);
  19577. d.addChild(g, !0);
  19578. g.setEnabled(f.enabled);
  19579. f.enabled && (goog.events.listen(g, goog.ui.Component.EventType.ACTION, f.callback),
  19580. g.handleContextMenu = function (a) {
  19581. goog.events.dispatchEvent(this, goog.ui.Component.EventType.ACTION)
  19582. }
  19583. )
  19584. }
  19585. goog.events.listen(d, goog.ui.Component.EventType.ACTION, Blockly.ContextMenu.hide);
  19586. b = goog.dom.getViewportSize();
  19587. e = goog.style.getViewportPageOffset(document);
  19588. d.render(Blockly.WidgetDiv.DIV);
  19589. var h = d.getElement();
  19590. Blockly.addClass_(h, "blocklyContextMenu");
  19591. Blockly.bindEventWithChecks_(h, "contextmenu", null, Blockly.noEvent);
  19592. f = goog.style.getSize(h);
  19593. g = a.clientX + e.x;
  19594. var k = a.clientY + e.y;
  19595. a.clientY + f.height >= b.height && (k -= f.height);
  19596. c ? f.width >= a.clientX && (g += f.width) : a.clientX + f.width >= b.width && (g -= f.width);
  19597. Blockly.WidgetDiv.position(g, k, b, e, c);
  19598. d.setAllowAutoFocus(!0);
  19599. setTimeout(function () {
  19600. h.focus()
  19601. }, 1);
  19602. Blockly.ContextMenu.currentBlock = null
  19603. } else
  19604. Blockly.ContextMenu.hide()
  19605. }
  19606. ;
  19607. Blockly.ContextMenu.hide = function () {
  19608. Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu);
  19609. Blockly.ContextMenu.currentBlock = null
  19610. }
  19611. ;
  19612. Blockly.ContextMenu.callbackFactory = function (a, b) {
  19613. return function () {
  19614. Blockly.Events.disable();
  19615. try {
  19616. var c = Blockly.Xml.domToBlock(b, a.workspace)
  19617. , d = a.getRelativeToSurfaceXY();
  19618. d.x = a.RTL ? d.x - Blockly.SNAP_RADIUS : d.x + Blockly.SNAP_RADIUS;
  19619. d.y += 2 * Blockly.SNAP_RADIUS;
  19620. c.moveBy(d.x, d.y)
  19621. } finally {
  19622. Blockly.Events.enable()
  19623. }
  19624. Blockly.Events.isEnabled() && !c.isShadow() && Blockly.Events.fire(new Blockly.Events.Create(c));
  19625. c.select()
  19626. }
  19627. }
  19628. ;
  19629. Blockly.RenderedConnection = function (a, b) {
  19630. Blockly.RenderedConnection.superClass_.constructor.call(this, a, b);
  19631. this.offsetInBlock_ = new goog.math.Coordinate(0, 0)
  19632. }
  19633. ;
  19634. goog.inherits(Blockly.RenderedConnection, Blockly.Connection);
  19635. Blockly.RenderedConnection.prototype.distanceFrom = function (a) {
  19636. var b = this.x_ - a.x_;
  19637. a = this.y_ - a.y_;
  19638. return Math.sqrt(b * b + a * a)
  19639. }
  19640. ;
  19641. Blockly.RenderedConnection.prototype.bumpAwayFrom_ = function (a) {
  19642. if (Blockly.dragMode_ == Blockly.DRAG_NONE) {
  19643. var b = this.sourceBlock_.getRootBlock();
  19644. if (!b.isInFlyout) {
  19645. var c = !1;
  19646. if (!b.isMovable()) {
  19647. b = a.getSourceBlock().getRootBlock();
  19648. if (!b.isMovable())
  19649. return;
  19650. a = this;
  19651. c = !0
  19652. }
  19653. var d = Blockly.selected == b;
  19654. d || b.addSelect();
  19655. var e = a.x_ + Blockly.SNAP_RADIUS - this.x_;
  19656. a = a.y_ + Blockly.SNAP_RADIUS - this.y_;
  19657. c && (a = -a);
  19658. b.RTL && (e = -e);
  19659. b.moveBy(e, a);
  19660. d || b.removeSelect()
  19661. }
  19662. }
  19663. }
  19664. ;
  19665. Blockly.RenderedConnection.prototype.moveTo = function (a, b) {
  19666. this.inDB_ && this.db_.removeConnection_(this);
  19667. this.x_ = a;
  19668. this.y_ = b;
  19669. this.hidden_ || this.db_.addConnection(this)
  19670. }
  19671. ;
  19672. Blockly.RenderedConnection.prototype.moveBy = function (a, b) {
  19673. this.moveTo(this.x_ + a, this.y_ + b)
  19674. }
  19675. ;
  19676. Blockly.RenderedConnection.prototype.moveToOffset = function (a) {
  19677. this.moveTo(a.x + this.offsetInBlock_.x, a.y + this.offsetInBlock_.y)
  19678. }
  19679. ;
  19680. Blockly.RenderedConnection.prototype.setOffsetInBlock = function (a, b) {
  19681. this.offsetInBlock_.x = a;
  19682. this.offsetInBlock_.y = b
  19683. }
  19684. ;
  19685. Blockly.RenderedConnection.prototype.tighten_ = function () {
  19686. var a = this.targetConnection.x_ - this.x_
  19687. , b = this.targetConnection.y_ - this.y_;
  19688. if (0 != a || 0 != b) {
  19689. var c = this.targetBlock()
  19690. , d = c.getSvgRoot();
  19691. if (!d)
  19692. throw "block is not rendered.";
  19693. d = Blockly.getRelativeXY_(d);
  19694. c.getSvgRoot().setAttribute("transform", "translate(" + (d.x - a) + "," + (d.y - b) + ")");
  19695. c.moveConnections_(-a, -b)
  19696. }
  19697. }
  19698. ;
  19699. Blockly.RenderedConnection.prototype.closest = function (a, b, c) {
  19700. return this.dbOpposite_.searchForClosest(this, a, b, c)
  19701. }
  19702. ;
  19703. Blockly.RenderedConnection.prototype.highlight = function () {
  19704. var a = this.type == Blockly.INPUT_VALUE || this.type == Blockly.OUTPUT_VALUE ? "m 0,0 " + Blockly.BlockSvg.TAB_PATH_DOWN + " v 5" : "m -20,0 h 5 " + Blockly.BlockSvg.NOTCH_PATH_LEFT + " h 5";
  19705. var b = this.sourceBlock_.getRelativeToSurfaceXY();
  19706. Blockly.Connection.highlightedPath_ = Blockly.createSvgElement("path", {
  19707. "class": "blocklyHighlightedConnectionPath",
  19708. d: a,
  19709. transform: "translate(" + (this.x_ - b.x) + "," + (this.y_ - b.y) + ")" + (this.sourceBlock_.RTL ? " scale(-1 1)" : "")
  19710. }, this.sourceBlock_.getSvgRoot())
  19711. }
  19712. ;
  19713. Blockly.RenderedConnection.prototype.unhideAll = function () {
  19714. this.setHidden(!1);
  19715. var a = [];
  19716. if (this.type != Blockly.INPUT_VALUE && this.type != Blockly.NEXT_STATEMENT)
  19717. return a;
  19718. var b = this.targetBlock();
  19719. if (b) {
  19720. if (b.isCollapsed()) {
  19721. var c = [];
  19722. b.outputConnection && c.push(b.outputConnection);
  19723. b.nextConnection && c.push(b.nextConnection);
  19724. b.previousConnection && c.push(b.previousConnection)
  19725. } else
  19726. c = b.getConnections_(!0);
  19727. for (var d = 0; d < c.length; d++)
  19728. a.push.apply(a, c[d].unhideAll());
  19729. a.length || (a[0] = b)
  19730. }
  19731. return a
  19732. }
  19733. ;
  19734. Blockly.RenderedConnection.prototype.unhighlight = function () {
  19735. goog.dom.removeNode(Blockly.Connection.highlightedPath_);
  19736. delete Blockly.Connection.highlightedPath_
  19737. }
  19738. ;
  19739. Blockly.RenderedConnection.prototype.setHidden = function (a) {
  19740. (this.hidden_ = a) && this.inDB_ ? this.db_.removeConnection_(this) : a || this.inDB_ || this.db_.addConnection(this)
  19741. }
  19742. ;
  19743. Blockly.RenderedConnection.prototype.hideAll = function () {
  19744. this.setHidden(!0);
  19745. if (this.targetConnection)
  19746. for (var a = this.targetBlock().getDescendants(), b = 0; b < a.length; b++) {
  19747. for (var c = a[b], d = c.getConnections_(!0), e = 0; e < d.length; e++)
  19748. d[e].setHidden(!0);
  19749. c = c.getIcons();
  19750. for (e = 0; e < c.length; e++)
  19751. c[e].setVisible(!1)
  19752. }
  19753. }
  19754. ;
  19755. Blockly.RenderedConnection.prototype.isConnectionAllowed = function (a, b) {
  19756. return this.distanceFrom(a) > b ? !1 : Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this, a)
  19757. }
  19758. ;
  19759. Blockly.RenderedConnection.prototype.disconnectInternal_ = function (a, b) {
  19760. Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this, a, b);
  19761. a.rendered && a.render();
  19762. b.rendered && (b.updateDisabled(),
  19763. b.render())
  19764. }
  19765. ;
  19766. Blockly.RenderedConnection.prototype.respawnShadow_ = function () {
  19767. var a = this.getSourceBlock()
  19768. , b = this.getShadowDom();
  19769. if (a.workspace && b && Blockly.Events.recordUndo) {
  19770. Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);
  19771. b = this.targetBlock();
  19772. if (!b)
  19773. throw "Couldn't respawn the shadow block that should exist here.";
  19774. b.initSvg();
  19775. b.render(!1);
  19776. a.rendered && a.render()
  19777. }
  19778. }
  19779. ;
  19780. Blockly.RenderedConnection.prototype.neighbours_ = function (a) {
  19781. return this.dbOpposite_.getNeighbours(this, a)
  19782. }
  19783. ;
  19784. Blockly.RenderedConnection.prototype.connect_ = function (a) {
  19785. Blockly.RenderedConnection.superClass_.connect_.call(this, a);
  19786. var b = this.getSourceBlock();
  19787. a = a.getSourceBlock();
  19788. b.rendered && b.updateDisabled();
  19789. a.rendered && a.updateDisabled();
  19790. b.rendered && a.rendered && (this.type == Blockly.NEXT_STATEMENT || this.type == Blockly.PREVIOUS_STATEMENT ? a.render() : b.render())
  19791. }
  19792. ;
  19793. Blockly.BlockSvg = function (a, b, c) {
  19794. this.svgGroup_ = Blockly.createSvgElement("g", {}, null);
  19795. this.svgPathDark_ = Blockly.createSvgElement("path", {
  19796. "class": "blocklyPathDark",
  19797. transform: "translate(1,1)"
  19798. }, this.svgGroup_);
  19799. this.svgPath_ = Blockly.createSvgElement("path", {
  19800. "class": "blocklyPath"
  19801. }, this.svgGroup_);
  19802. this.svgPathLight_ = Blockly.createSvgElement("path", {
  19803. "class": "blocklyPathLight"
  19804. }, this.svgGroup_);
  19805. this.svgPath_.tooltip = this;
  19806. this.rendered = !1;
  19807. Blockly.Tooltip.bindMouseEvents(this.svgPath_);
  19808. Blockly.BlockSvg.superClass_.constructor.call(this, a, b, c)
  19809. }
  19810. ;
  19811. goog.inherits(Blockly.BlockSvg, Blockly.Block);
  19812. Blockly.BlockSvg.prototype.height = 0;
  19813. Blockly.BlockSvg.prototype.width = 0;
  19814. Blockly.BlockSvg.prototype.dragStartXY_ = null;
  19815. Blockly.BlockSvg.INLINE = -1;
  19816. Blockly.BlockSvg.prototype.initSvg = function () {
  19817. goog.asserts.assert(this.workspace.rendered, "Workspace is headless.");
  19818. for (var a = 0, b; b = this.inputList[a]; a++)
  19819. b.init();
  19820. b = this.getIcons();
  19821. for (a = 0; a < b.length; a++)
  19822. b[a].createIcon();
  19823. this.updateColour();
  19824. this.updateMovable();
  19825. if (!this.workspace.options.readOnly && !this.eventsInit_) {
  19826. Blockly.bindEventWithChecks_(this.getSvgRoot(), "mousedown", this, this.onMouseDown_);
  19827. var c = this;
  19828. Blockly.bindEvent_(this.getSvgRoot(), "touchstart", null, function (a) {
  19829. Blockly.longStart_(a, c)
  19830. })
  19831. }
  19832. this.eventsInit_ = !0;
  19833. this.getSvgRoot().parentNode || this.workspace.getCanvas().appendChild(this.getSvgRoot())
  19834. }
  19835. ;
  19836. Blockly.BlockSvg.prototype.select = function () {
  19837. if (this.isShadow() && this.getParent())
  19838. this.getParent().select();
  19839. else if (Blockly.selected != this) {
  19840. var a = null;
  19841. if (Blockly.selected) {
  19842. a = Blockly.selected.id;
  19843. Blockly.Events.disable();
  19844. try {
  19845. Blockly.selected.unselect()
  19846. } finally {
  19847. Blockly.Events.enable()
  19848. }
  19849. }
  19850. a = new Blockly.Events.Ui(null, "selected", a, this.id);
  19851. a.workspaceId = this.workspace.id;
  19852. Blockly.Events.fire(a);
  19853. Blockly.selected = this;
  19854. this.addSelect()
  19855. }
  19856. }
  19857. ;
  19858. Blockly.BlockSvg.prototype.unselect = function () {
  19859. if (Blockly.selected == this) {
  19860. var a = new Blockly.Events.Ui(null, "selected", this.id, null);
  19861. a.workspaceId = this.workspace.id;
  19862. Blockly.Events.fire(a);
  19863. Blockly.selected = null;
  19864. this.removeSelect()
  19865. }
  19866. }
  19867. ;
  19868. Blockly.BlockSvg.prototype.mutator = null;
  19869. Blockly.BlockSvg.prototype.comment = null;
  19870. Blockly.BlockSvg.prototype.warning = null;
  19871. Blockly.BlockSvg.prototype.getIcons = function () {
  19872. var a = [];
  19873. this.mutator && a.push(this.mutator);
  19874. this.comment && a.push(this.comment);
  19875. this.warning && a.push(this.warning);
  19876. return a
  19877. }
  19878. ;
  19879. Blockly.BlockSvg.onMouseUpWrapper_ = null;
  19880. Blockly.BlockSvg.onMouseMoveWrapper_ = null;
  19881. Blockly.BlockSvg.terminateDrag = function () {
  19882. Blockly.BlockSvg.disconnectUiStop_();
  19883. Blockly.BlockSvg.onMouseUpWrapper_ && (Blockly.unbindEvent_(Blockly.BlockSvg.onMouseUpWrapper_),
  19884. Blockly.BlockSvg.onMouseUpWrapper_ = null);
  19885. Blockly.BlockSvg.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.BlockSvg.onMouseMoveWrapper_),
  19886. Blockly.BlockSvg.onMouseMoveWrapper_ = null);
  19887. var a = Blockly.selected;
  19888. if (Blockly.dragMode_ == Blockly.DRAG_FREE && a) {
  19889. var b = a.getRelativeToSurfaceXY();
  19890. b = goog.math.Coordinate.difference(b, a.dragStartXY_);
  19891. var c = new Blockly.Events.Move(a);
  19892. c.oldCoordinate = a.dragStartXY_;
  19893. c.recordNew();
  19894. Blockly.Events.fire(c);
  19895. a.moveConnections_(b.x, b.y);
  19896. delete a.draggedBubbles_;
  19897. a.setDragging_(!1);
  19898. a.render();
  19899. a.workspace.setResizesEnabled(!0);
  19900. var d = Blockly.Events.getGroup();
  19901. setTimeout(function () {
  19902. Blockly.Events.setGroup(d);
  19903. a.snapToGrid();
  19904. Blockly.Events.setGroup(!1)
  19905. }, Blockly.BUMP_DELAY / 2);
  19906. setTimeout(function () {
  19907. Blockly.Events.setGroup(d);
  19908. a.bumpNeighbours_();
  19909. Blockly.Events.setGroup(!1)
  19910. }, Blockly.BUMP_DELAY)
  19911. }
  19912. Blockly.dragMode_ = Blockly.DRAG_NONE;
  19913. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)
  19914. }
  19915. ;
  19916. Blockly.BlockSvg.prototype.setParent = function (a) {
  19917. if (a != this.parentBlock_) {
  19918. var b = this.getSvgRoot();
  19919. if (this.parentBlock_ && b) {
  19920. var c = this.getRelativeToSurfaceXY();
  19921. this.workspace.getCanvas().appendChild(b);
  19922. b.setAttribute("transform", "translate(" + c.x + "," + c.y + ")")
  19923. }
  19924. Blockly.Field.startCache();
  19925. Blockly.BlockSvg.superClass_.setParent.call(this, a);
  19926. Blockly.Field.stopCache();
  19927. a && (c = this.getRelativeToSurfaceXY(),
  19928. a.getSvgRoot().appendChild(b),
  19929. a = this.getRelativeToSurfaceXY(),
  19930. this.moveConnections_(a.x - c.x, a.y - c.y))
  19931. }
  19932. }
  19933. ;
  19934. Blockly.BlockSvg.prototype.getRelativeToSurfaceXY = function () {
  19935. var a = 0
  19936. , b = 0
  19937. , c = this.getSvgRoot();
  19938. if (c) {
  19939. do {
  19940. var d = Blockly.getRelativeXY_(c);
  19941. a += d.x;
  19942. b += d.y;
  19943. c = c.parentNode
  19944. } while (c && c != this.workspace.getCanvas())
  19945. }
  19946. return new goog.math.Coordinate(a, b)
  19947. }
  19948. ;
  19949. Blockly.BlockSvg.prototype.moveBy = function (a, b) {
  19950. goog.asserts.assert(!this.parentBlock_, "Block has parent.");
  19951. var c = new Blockly.Events.Move(this)
  19952. , d = this.getRelativeToSurfaceXY();
  19953. this.getSvgRoot().setAttribute("transform", "translate(" + (d.x + a) + "," + (d.y + b) + ")");
  19954. this.moveConnections_(a, b);
  19955. c.recordNew();
  19956. this.workspace.resizeContents();
  19957. Blockly.Events.fire(c)
  19958. }
  19959. ;
  19960. Blockly.BlockSvg.prototype.snapToGrid = function () {
  19961. if (this.workspace && Blockly.dragMode_ == Blockly.DRAG_NONE && !this.getParent() && !this.isInFlyout && this.workspace.options.gridOptions && this.workspace.options.gridOptions.snap) {
  19962. var a = this.workspace.options.gridOptions.spacing
  19963. , b = a / 2
  19964. , c = this.getRelativeToSurfaceXY()
  19965. , d = Math.round((c.x - b) / a) * a + b - c.x;
  19966. a = Math.round((c.y - b) / a) * a + b - c.y;
  19967. d = Math.round(d);
  19968. a = Math.round(a);
  19969. 0 == d && 0 == a || this.moveBy(d, a)
  19970. }
  19971. }
  19972. ;
  19973. Blockly.BlockSvg.prototype.getHeightWidth = function () {
  19974. var a = this.height
  19975. , b = this.width
  19976. , c = this.getNextBlock();
  19977. c ? (c = c.getHeightWidth(),
  19978. a += c.height - 4,
  19979. b = Math.max(b, c.width)) : this.nextConnection || this.outputConnection || (a += 2);
  19980. return {
  19981. height: a,
  19982. width: b
  19983. }
  19984. }
  19985. ;
  19986. Blockly.BlockSvg.prototype.getBoundingRectangle = function () {
  19987. var a = this.getRelativeToSurfaceXY(this)
  19988. , b = this.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0
  19989. , c = this.getHeightWidth();
  19990. if (this.RTL) {
  19991. var d = new goog.math.Coordinate(a.x - (c.width - b), a.y);
  19992. a = new goog.math.Coordinate(a.x + b, a.y + c.height)
  19993. } else
  19994. d = new goog.math.Coordinate(a.x - b, a.y),
  19995. a = new goog.math.Coordinate(a.x + c.width - b, a.y + c.height);
  19996. return {
  19997. topLeft: d,
  19998. bottomRight: a
  19999. }
  20000. }
  20001. ;
  20002. Blockly.BlockSvg.prototype.setCollapsed = function (a) {
  20003. if (this.collapsed_ != a) {
  20004. for (var b = [], c = 0, d; d = this.inputList[c]; c++)
  20005. b.push.apply(b, d.setVisible(!a));
  20006. if (a) {
  20007. d = this.getIcons();
  20008. for (c = 0; c < d.length; c++)
  20009. d[c].setVisible(!1);
  20010. c = this.toString(Blockly.COLLAPSE_CHARS);
  20011. this.appendDummyInput("_TEMP_COLLAPSED_INPUT").appendField(c).init()
  20012. } else
  20013. this.removeInput("_TEMP_COLLAPSED_INPUT"),
  20014. this.setWarningText(null);
  20015. Blockly.BlockSvg.superClass_.setCollapsed.call(this, a);
  20016. b.length || (b[0] = this);
  20017. if (this.rendered)
  20018. for (c = 0; a = b[c]; c++)
  20019. a.render()
  20020. }
  20021. }
  20022. ;
  20023. Blockly.BlockSvg.prototype.tab = function (a, b) {
  20024. for (var c = [], d = 0, e; e = this.inputList[d]; d++) {
  20025. for (var f = 0, g; g = e.fieldRow[f]; f++)
  20026. g instanceof Blockly.FieldTextInput && c.push(g);
  20027. e.connection && (e = e.connection.targetBlock()) && c.push(e)
  20028. }
  20029. d = c.indexOf(a);
  20030. -1 == d && (d = b ? -1 : c.length);
  20031. (c = c[b ? d + 1 : d - 1]) ? c instanceof Blockly.Field ? c.showEditor_() : c.tab(null, b) : (c = this.getParent()) && c.tab(this, b)
  20032. }
  20033. ;
  20034. Blockly.BlockSvg.prototype.onMouseDown_ = function (a) {
  20035. if (!this.workspace.options.readOnly)
  20036. if (this.isInFlyout)
  20037. "touchstart" == a.type && Blockly.isRightButton(a) && (Blockly.Flyout.blockRightClick_(a, this),
  20038. a.stopPropagation(),
  20039. a.preventDefault());
  20040. else {
  20041. this.isInMutator && this.workspace.resize();
  20042. this.workspace.updateScreenCalculationsIfScrolled();
  20043. this.workspace.markFocused();
  20044. Blockly.terminateDrag_();
  20045. this.select();
  20046. Blockly.hideChaff();
  20047. if (Blockly.isRightButton(a))
  20048. this.showContextMenu_(a),
  20049. Blockly.Touch.clearTouchIdentifier();
  20050. else if (this.isMovable()) {
  20051. Blockly.Events.getGroup() || Blockly.Events.setGroup(!0);
  20052. Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED);
  20053. this.dragStartXY_ = this.getRelativeToSurfaceXY();
  20054. this.workspace.startDrag(a, this.dragStartXY_);
  20055. Blockly.dragMode_ = Blockly.DRAG_STICKY;
  20056. Blockly.BlockSvg.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, this.onMouseUp_);
  20057. Blockly.BlockSvg.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.onMouseMove_);
  20058. this.draggedBubbles_ = [];
  20059. for (var b = this.getDescendants(), c = 0, d; d = b[c]; c++) {
  20060. d = d.getIcons();
  20061. for (var e = 0; e < d.length; e++) {
  20062. var f = d[e].getIconLocation();
  20063. f.bubble = d[e];
  20064. this.draggedBubbles_.push(f)
  20065. }
  20066. }
  20067. } else
  20068. return;
  20069. a.stopPropagation();
  20070. a.preventDefault()
  20071. }
  20072. }
  20073. ;
  20074. Blockly.BlockSvg.prototype.onMouseUp_ = function (a) {
  20075. Blockly.Touch.clearTouchIdentifier();
  20076. Blockly.dragMode_ == Blockly.DRAG_FREE || Blockly.WidgetDiv.isVisible() || Blockly.Events.fire(new Blockly.Events.Ui(this, "click", void 0, void 0));
  20077. Blockly.terminateDrag_();
  20078. Blockly.selected && Blockly.highlightedConnection_ ? (Blockly.localConnection_.connect(Blockly.highlightedConnection_),
  20079. this.rendered && (Blockly.localConnection_.isSuperior() ? Blockly.highlightedConnection_ : Blockly.localConnection_).getSourceBlock().connectionUiEffect(),
  20080. this.workspace.trashcan && this.workspace.trashcan.close()) : !this.getParent() && Blockly.selected.isDeletable() && this.workspace.isDeleteArea(a) && ((a = this.workspace.trashcan) && goog.Timer.callOnce(a.close, 100, a),
  20081. Blockly.selected.dispose(!1, !0));
  20082. Blockly.highlightedConnection_ && (Blockly.highlightedConnection_.unhighlight(),
  20083. Blockly.highlightedConnection_ = null);
  20084. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN);
  20085. Blockly.WidgetDiv.isVisible() || Blockly.Events.setGroup(!1)
  20086. }
  20087. ;
  20088. Blockly.BlockSvg.prototype.showHelp_ = function () {
  20089. var a = goog.isFunction(this.helpUrl) ? this.helpUrl() : this.helpUrl;
  20090. a && window.open(a)
  20091. }
  20092. ;
  20093. Blockly.BlockSvg.prototype.showContextMenu_ = function (a) {
  20094. if (!this.workspace.options.readOnly && this.contextMenu) {
  20095. var b = this
  20096. , c = [];
  20097. if (this.isDeletable() && this.isMovable() && !b.isInFlyout) {
  20098. var d = {
  20099. text: Blockly.Msg.DUPLICATE_BLOCK,
  20100. enabled: !0,
  20101. callback: function () {
  20102. Blockly.duplicate_(b)
  20103. }
  20104. };
  20105. this.getDescendants().length > this.workspace.remainingCapacity() && (d.enabled = !1);
  20106. c.push(d);
  20107. this.isEditable() && !this.collapsed_ && this.workspace.options.comments && (d = {
  20108. enabled: !goog.userAgent.IE
  20109. },
  20110. this.comment ? (d.text = Blockly.Msg.REMOVE_COMMENT,
  20111. d.callback = function () {
  20112. b.setCommentText(null)
  20113. }
  20114. ) : (d.text = Blockly.Msg.ADD_COMMENT,
  20115. d.callback = function () {
  20116. b.setCommentText("")
  20117. }
  20118. ),
  20119. c.push(d));
  20120. if (!this.collapsed_)
  20121. for (d = 1; d < this.inputList.length; d++)
  20122. if (this.inputList[d - 1].type != Blockly.NEXT_STATEMENT && this.inputList[d].type != Blockly.NEXT_STATEMENT) {
  20123. d = {
  20124. enabled: !0
  20125. };
  20126. var e = this.getInputsInline();
  20127. d.text = e ? Blockly.Msg.EXTERNAL_INPUTS : Blockly.Msg.INLINE_INPUTS;
  20128. d.callback = function () {
  20129. b.setInputsInline(!e)
  20130. }
  20131. ;
  20132. c.push(d);
  20133. break
  20134. }
  20135. this.workspace.options.collapse && (this.collapsed_ ? (d = {
  20136. enabled: !0
  20137. },
  20138. d.text = Blockly.Msg.EXPAND_BLOCK,
  20139. d.callback = function () {
  20140. b.setCollapsed(!1)
  20141. }
  20142. ,
  20143. c.push(d)) : (d = {
  20144. enabled: !0
  20145. },
  20146. d.text = Blockly.Msg.COLLAPSE_BLOCK,
  20147. d.callback = function () {
  20148. b.setCollapsed(!0)
  20149. }
  20150. ,
  20151. c.push(d)));
  20152. this.workspace.options.disable && (d = {
  20153. text: this.disabled ? Blockly.Msg.ENABLE_BLOCK : Blockly.Msg.DISABLE_BLOCK,
  20154. enabled: !this.getInheritedDisabled(),
  20155. callback: function () {
  20156. b.setDisabled(!b.disabled)
  20157. }
  20158. },
  20159. c.push(d));
  20160. d = this.getDescendants().length;
  20161. var f = this.getNextBlock();
  20162. f && (d -= f.getDescendants().length);
  20163. d = {
  20164. text: 1 == d ? Blockly.Msg.DELETE_BLOCK : Blockly.Msg.DELETE_X_BLOCKS.replace("%1", String(d)),
  20165. enabled: !0,
  20166. callback: function () {
  20167. Blockly.Events.setGroup(!0);
  20168. b.dispose(!0, !0);
  20169. Blockly.Events.setGroup(!1)
  20170. }
  20171. };
  20172. c.push(d)
  20173. }
  20174. d = {
  20175. enabled: !(goog.isFunction(this.helpUrl) ? !this.helpUrl() : !this.helpUrl)
  20176. };
  20177. d.text = Blockly.Msg.HELP;
  20178. d.callback = function () {
  20179. b.showHelp_()
  20180. }
  20181. ;
  20182. c.push(d);
  20183. this.customContextMenu && !b.isInFlyout && this.customContextMenu(c);
  20184. Blockly.ContextMenu.show(a, c, this.RTL);
  20185. Blockly.ContextMenu.currentBlock = this
  20186. }
  20187. }
  20188. ;
  20189. Blockly.BlockSvg.prototype.moveConnections_ = function (a, b) {
  20190. if (this.rendered) {
  20191. for (var c = this.getConnections_(!1), d = 0; d < c.length; d++)
  20192. c[d].moveBy(a, b);
  20193. c = this.getIcons();
  20194. for (d = 0; d < c.length; d++)
  20195. c[d].computeIconLocation();
  20196. for (d = 0; d < this.childBlocks_.length; d++)
  20197. this.childBlocks_[d].moveConnections_(a, b)
  20198. }
  20199. }
  20200. ;
  20201. Blockly.BlockSvg.prototype.setDragging_ = function (a) {
  20202. if (a) {
  20203. var b = this.getSvgRoot();
  20204. b.translate_ = "";
  20205. b.skew_ = "";
  20206. Blockly.draggingConnections_ = Blockly.draggingConnections_.concat(this.getConnections_(!0));
  20207. Blockly.addClass_(this.svgGroup_, "blocklyDragging")
  20208. } else
  20209. Blockly.draggingConnections_ = [],
  20210. Blockly.removeClass_(this.svgGroup_, "blocklyDragging");
  20211. for (b = 0; b < this.childBlocks_.length; b++)
  20212. this.childBlocks_[b].setDragging_(a)
  20213. }
  20214. ;
  20215. Blockly.BlockSvg.prototype.onMouseMove_ = function (a) {
  20216. if ("mousemove" == a.type && 1 >= a.clientX && 0 == a.clientY && 0 == a.button)
  20217. a.stopPropagation();
  20218. else {
  20219. var b = this.getRelativeToSurfaceXY()
  20220. , c = this.workspace.moveDrag(a);
  20221. if (Blockly.dragMode_ == Blockly.DRAG_STICKY && goog.math.Coordinate.distance(b, c) * this.workspace.scale > Blockly.DRAG_RADIUS) {
  20222. Blockly.dragMode_ = Blockly.DRAG_FREE;
  20223. Blockly.longStop_();
  20224. this.workspace.setResizesEnabled(!1);
  20225. if (this.parentBlock_) {
  20226. this.unplug();
  20227. var d = this.getSvgRoot();
  20228. d.translate_ = "translate(" + c.x + "," + c.y + ")";
  20229. this.disconnectUiEffect()
  20230. }
  20231. this.setDragging_(!0)
  20232. }
  20233. if (Blockly.dragMode_ == Blockly.DRAG_FREE) {
  20234. b = goog.math.Coordinate.difference(b, this.dragStartXY_);
  20235. d = this.getSvgRoot();
  20236. d.translate_ = "translate(" + c.x + "," + c.y + ")";
  20237. d.setAttribute("transform", d.translate_ + d.skew_);
  20238. for (c = 0; c < this.draggedBubbles_.length; c++)
  20239. d = this.draggedBubbles_[c],
  20240. d.bubble.setIconLocation(goog.math.Coordinate.sum(d, b));
  20241. d = this.getConnections_(!1);
  20242. (c = this.lastConnectionInStack_()) && c != this.nextConnection && d.push(c);
  20243. var e = null
  20244. , f = null
  20245. , g = Blockly.SNAP_RADIUS;
  20246. for (c = 0; c < d.length; c++) {
  20247. var h = d[c]
  20248. , k = h.closest(g, b);
  20249. k.connection && (e = k.connection,
  20250. f = h,
  20251. g = k.radius)
  20252. }
  20253. Blockly.highlightedConnection_ && Blockly.highlightedConnection_ != e && (Blockly.highlightedConnection_.unhighlight(),
  20254. Blockly.highlightedConnection_ = null,
  20255. Blockly.localConnection_ = null);
  20256. e && e != Blockly.highlightedConnection_ && (e.highlight(),
  20257. Blockly.highlightedConnection_ = e,
  20258. Blockly.localConnection_ = f);
  20259. this.isDeletable() && this.workspace.isDeleteArea(a)
  20260. }
  20261. a.stopPropagation();
  20262. a.preventDefault()
  20263. }
  20264. }
  20265. ;
  20266. Blockly.BlockSvg.prototype.updateMovable = function () {
  20267. this.isMovable() ? Blockly.addClass_(this.svgGroup_, "blocklyDraggable") : Blockly.removeClass_(this.svgGroup_, "blocklyDraggable")
  20268. }
  20269. ;
  20270. Blockly.BlockSvg.prototype.setMovable = function (a) {
  20271. Blockly.BlockSvg.superClass_.setMovable.call(this, a);
  20272. this.updateMovable()
  20273. }
  20274. ;
  20275. Blockly.BlockSvg.prototype.setEditable = function (a) {
  20276. Blockly.BlockSvg.superClass_.setEditable.call(this, a);
  20277. a = this.getIcons();
  20278. for (var b = 0; b < a.length; b++)
  20279. a[b].updateEditable()
  20280. }
  20281. ;
  20282. Blockly.BlockSvg.prototype.setShadow = function (a) {
  20283. Blockly.BlockSvg.superClass_.setShadow.call(this, a);
  20284. this.updateColour()
  20285. }
  20286. ;
  20287. Blockly.BlockSvg.prototype.getSvgRoot = function () {
  20288. return this.svgGroup_
  20289. }
  20290. ;
  20291. Blockly.BlockSvg.prototype.dispose = function (a, b) {
  20292. if (this.workspace) {
  20293. Blockly.Tooltip.hide();
  20294. Blockly.Field.startCache();
  20295. var c = this.workspace;
  20296. Blockly.selected == this && (this.unselect(),
  20297. Blockly.terminateDrag_());
  20298. Blockly.ContextMenu.currentBlock == this && Blockly.ContextMenu.hide();
  20299. b && this.rendered && (this.unplug(a),
  20300. this.disposeUiEffect());
  20301. this.rendered = !1;
  20302. Blockly.Events.disable();
  20303. try {
  20304. for (var d = this.getIcons(), e = 0; e < d.length; e++)
  20305. d[e].dispose()
  20306. } finally {
  20307. Blockly.Events.enable()
  20308. }
  20309. Blockly.BlockSvg.superClass_.dispose.call(this, a);
  20310. goog.dom.removeNode(this.svgGroup_);
  20311. c.resizeContents();
  20312. this.svgPathDark_ = this.svgPathLight_ = this.svgPath_ = this.svgGroup_ = null;
  20313. Blockly.Field.stopCache()
  20314. }
  20315. }
  20316. ;
  20317. Blockly.BlockSvg.prototype.disposeUiEffect = function () {
  20318. this.workspace.playAudio("delete");
  20319. var a = Blockly.getSvgXY_(this.svgGroup_, this.workspace)
  20320. , b = this.svgGroup_.cloneNode(!0);
  20321. b.translateX_ = a.x;
  20322. b.translateY_ = a.y;
  20323. b.setAttribute("transform", "translate(" + b.translateX_ + "," + b.translateY_ + ")");
  20324. this.workspace.getParentSvg().appendChild(b);
  20325. b.bBox_ = b.getBBox();
  20326. Blockly.BlockSvg.disposeUiStep_(b, this.RTL, new Date, this.workspace.scale)
  20327. }
  20328. ;
  20329. Blockly.BlockSvg.disposeUiStep_ = function (a, b, c, d) {
  20330. var e = (new Date - c) / 150;
  20331. 1 < e ? goog.dom.removeNode(a) : (a.setAttribute("transform", "translate(" + (a.translateX_ + (b ? -1 : 1) * a.bBox_.width * d / 2 * e) + "," + (a.translateY_ + a.bBox_.height * d * e) + ") scale(" + (1 - e) * d + ")"),
  20332. setTimeout(function () {
  20333. Blockly.BlockSvg.disposeUiStep_(a, b, c, d)
  20334. }, 10))
  20335. }
  20336. ;
  20337. Blockly.BlockSvg.prototype.connectionUiEffect = function () {
  20338. this.workspace.playAudio("click");
  20339. if (!(1 > this.workspace.scale)) {
  20340. var a = Blockly.getSvgXY_(this.svgGroup_, this.workspace);
  20341. this.outputConnection ? (a.x += (this.RTL ? 3 : -3) * this.workspace.scale,
  20342. a.y += 13 * this.workspace.scale) : this.previousConnection && (a.x += (this.RTL ? -23 : 23) * this.workspace.scale,
  20343. a.y += 3 * this.workspace.scale);
  20344. a = Blockly.createSvgElement("circle", {
  20345. cx: a.x,
  20346. cy: a.y,
  20347. r: 0,
  20348. fill: "none",
  20349. stroke: "#888",
  20350. "stroke-width": 10
  20351. }, this.workspace.getParentSvg());
  20352. Blockly.BlockSvg.connectionUiStep_(a, new Date, this.workspace.scale)
  20353. }
  20354. }
  20355. ;
  20356. Blockly.BlockSvg.connectionUiStep_ = function (a, b, c) {
  20357. var d = (new Date - b) / 150;
  20358. 1 < d ? goog.dom.removeNode(a) : (a.setAttribute("r", 25 * d * c),
  20359. a.style.opacity = 1 - d,
  20360. Blockly.BlockSvg.disconnectUiStop_.pid_ = setTimeout(function () {
  20361. Blockly.BlockSvg.connectionUiStep_(a, b, c)
  20362. }, 10))
  20363. }
  20364. ;
  20365. Blockly.BlockSvg.prototype.disconnectUiEffect = function () {
  20366. this.workspace.playAudio("disconnect");
  20367. if (!(1 > this.workspace.scale)) {
  20368. var a = this.getHeightWidth().height;
  20369. a = Math.atan(10 / a) / Math.PI * 180;
  20370. this.RTL || (a *= -1);
  20371. Blockly.BlockSvg.disconnectUiStep_(this.svgGroup_, a, new Date)
  20372. }
  20373. }
  20374. ;
  20375. Blockly.BlockSvg.disconnectUiStep_ = function (a, b, c) {
  20376. var d = (new Date - c) / 200;
  20377. 1 < d ? a.skew_ = "" : (a.skew_ = "skewX(" + Math.round(Math.sin(d * Math.PI * 3) * (1 - d) * b) + ")",
  20378. Blockly.BlockSvg.disconnectUiStop_.group = a,
  20379. Blockly.BlockSvg.disconnectUiStop_.pid = setTimeout(function () {
  20380. Blockly.BlockSvg.disconnectUiStep_(a, b, c)
  20381. }, 10));
  20382. a.setAttribute("transform", a.translate_ + a.skew_)
  20383. }
  20384. ;
  20385. Blockly.BlockSvg.disconnectUiStop_ = function () {
  20386. if (Blockly.BlockSvg.disconnectUiStop_.group) {
  20387. clearTimeout(Blockly.BlockSvg.disconnectUiStop_.pid);
  20388. var a = Blockly.BlockSvg.disconnectUiStop_.group;
  20389. a.skew_ = "";
  20390. a.setAttribute("transform", a.translate_);
  20391. Blockly.BlockSvg.disconnectUiStop_.group = null
  20392. }
  20393. }
  20394. ;
  20395. Blockly.BlockSvg.disconnectUiStop_.pid = 0;
  20396. Blockly.BlockSvg.disconnectUiStop_.group = null;
  20397. Blockly.BlockSvg.prototype.updateColour = function () {
  20398. if (!this.disabled) {
  20399. var a = this.getColour()
  20400. , b = goog.color.hexToRgb(a);
  20401. if (this.isShadow())
  20402. b = goog.color.lighten(b, .6),
  20403. a = goog.color.rgbArrayToHex(b),
  20404. this.svgPathLight_.style.display = "none",
  20405. this.svgPathDark_.setAttribute("fill", a);
  20406. else {
  20407. this.svgPathLight_.style.display = "";
  20408. var c = goog.color.rgbArrayToHex(goog.color.lighten(b, .3));
  20409. b = goog.color.rgbArrayToHex(goog.color.darken(b, .2));
  20410. this.svgPathLight_.setAttribute("stroke", c);
  20411. this.svgPathDark_.setAttribute("fill", b)
  20412. }
  20413. this.svgPath_.setAttribute("fill", a);
  20414. a = this.getIcons();
  20415. for (c = 0; c < a.length; c++)
  20416. a[c].updateColour();
  20417. for (a = 0; c = this.inputList[a]; a++) {
  20418. b = 0;
  20419. for (var d; d = c.fieldRow[b]; b++)
  20420. d.setText(null)
  20421. }
  20422. }
  20423. }
  20424. ;
  20425. Blockly.BlockSvg.prototype.updateDisabled = function () {
  20426. var a = Blockly.hasClass_(this.svgGroup_, "blocklyDisabled");
  20427. this.disabled || this.getInheritedDisabled() ? a || (Blockly.addClass_(this.svgGroup_, "blocklyDisabled"),
  20428. this.svgPath_.setAttribute("fill", "url(#" + this.workspace.options.disabledPatternId + ")")) : a && (Blockly.removeClass_(this.svgGroup_, "blocklyDisabled"),
  20429. this.updateColour());
  20430. a = this.getChildren();
  20431. for (var b = 0, c; c = a[b]; b++)
  20432. c.updateDisabled()
  20433. }
  20434. ;
  20435. Blockly.BlockSvg.prototype.getCommentText = function () {
  20436. return this.comment ? this.comment.getText().replace(/\s+$/, "").replace(/ +\n/g, "\n") : ""
  20437. }
  20438. ;
  20439. Blockly.BlockSvg.prototype.setCommentText = function (a) {
  20440. var b = !1;
  20441. goog.isString(a) ? (this.comment || (this.comment = new Blockly.Comment(this),
  20442. b = !0),
  20443. this.comment.setText(a)) : this.comment && (this.comment.dispose(),
  20444. b = !0);
  20445. b && this.rendered && (this.render(),
  20446. this.bumpNeighbours_())
  20447. }
  20448. ;
  20449. Blockly.BlockSvg.prototype.setWarningText = function (a, b) {
  20450. this.setWarningText.pid_ || (this.setWarningText.pid_ = Object.create(null));
  20451. var c = b || "";
  20452. if (c)
  20453. this.setWarningText.pid_[c] && (clearTimeout(this.setWarningText.pid_[c]),
  20454. delete this.setWarningText.pid_[c]);
  20455. else
  20456. for (var d in this.setWarningText.pid_)
  20457. clearTimeout(this.setWarningText.pid_[d]),
  20458. delete this.setWarningText.pid_[d];
  20459. if (Blockly.dragMode_ == Blockly.DRAG_FREE) {
  20460. var e = this;
  20461. this.setWarningText.pid_[c] = setTimeout(function () {
  20462. e.workspace && (delete e.setWarningText.pid_[c],
  20463. e.setWarningText(a, c))
  20464. }, 100)
  20465. } else {
  20466. this.isInFlyout && (a = null);
  20467. d = this.getSurroundParent();
  20468. for (var f = null; d;)
  20469. d.isCollapsed() && (f = d),
  20470. d = d.getSurroundParent();
  20471. f && f.setWarningText(a, "collapsed " + this.id + " " + c);
  20472. d = !1;
  20473. goog.isString(a) ? (this.warning || (this.warning = new Blockly.Warning(this),
  20474. d = !0),
  20475. this.warning.setText(a, c)) : this.warning && !c ? (this.warning.dispose(),
  20476. d = !0) : this.warning && (d = this.warning.getText(),
  20477. this.warning.setText("", c),
  20478. (f = this.warning.getText()) || this.warning.dispose(),
  20479. d = d == f);
  20480. d && this.rendered && (this.render(),
  20481. this.bumpNeighbours_())
  20482. }
  20483. }
  20484. ;
  20485. Blockly.BlockSvg.prototype.setMutator = function (a) {
  20486. this.mutator && this.mutator !== a && this.mutator.dispose();
  20487. a && (a.block_ = this,
  20488. this.mutator = a,
  20489. a.createIcon())
  20490. }
  20491. ;
  20492. Blockly.BlockSvg.prototype.setDisabled = function (a) {
  20493. this.disabled != a && (Blockly.BlockSvg.superClass_.setDisabled.call(this, a),
  20494. this.rendered && this.updateDisabled())
  20495. }
  20496. ;
  20497. Blockly.BlockSvg.prototype.setHighlighted = function (a) {
  20498. if (!this.rendered) {
  20499. return;
  20500. }
  20501. if (a) {
  20502. this.svgPath_.setAttribute('filter',
  20503. 'url(#' + this.workspace.options.embossFilterId + ')');
  20504. this.svgPathLight_.style.display = 'none';
  20505. } else {
  20506. this.svgPath_.removeAttribute('filter');
  20507. this.svgPathLight_.style.display = 'block';
  20508. }
  20509. }
  20510. ;
  20511. Blockly.BlockSvg.prototype.addSelect = function () {
  20512. Blockly.addClass_(this.svgGroup_, "blocklySelected");
  20513. var a = this;
  20514. do {
  20515. var b = a.getSvgRoot();
  20516. b.parentNode.appendChild(b);
  20517. a = a.getParent()
  20518. } while (a)
  20519. }
  20520. ;
  20521. Blockly.BlockSvg.prototype.removeSelect = function () {
  20522. Blockly.removeClass_(this.svgGroup_, "blocklySelected")
  20523. }
  20524. ;
  20525. Blockly.BlockSvg.prototype.setColour = function (a) {
  20526. Blockly.BlockSvg.superClass_.setColour.call(this, a);
  20527. this.rendered && this.updateColour()
  20528. }
  20529. ;
  20530. Blockly.BlockSvg.prototype.setPreviousStatement = function (a, b) {
  20531. Blockly.BlockSvg.superClass_.setPreviousStatement.call(this, a, b);
  20532. this.rendered && (this.render(),
  20533. this.bumpNeighbours_())
  20534. }
  20535. ;
  20536. Blockly.BlockSvg.prototype.setNextStatement = function (a, b) {
  20537. Blockly.BlockSvg.superClass_.setNextStatement.call(this, a, b);
  20538. this.rendered && (this.render(),
  20539. this.bumpNeighbours_())
  20540. }
  20541. ;
  20542. Blockly.BlockSvg.prototype.setOutput = function (a, b) {
  20543. Blockly.BlockSvg.superClass_.setOutput.call(this, a, b);
  20544. this.rendered && (this.render(),
  20545. this.bumpNeighbours_())
  20546. }
  20547. ;
  20548. Blockly.BlockSvg.prototype.setInputsInline = function (a) {
  20549. Blockly.BlockSvg.superClass_.setInputsInline.call(this, a);
  20550. this.rendered && (this.render(),
  20551. this.bumpNeighbours_())
  20552. }
  20553. ;
  20554. Blockly.BlockSvg.prototype.removeInput = function (a, b) {
  20555. Blockly.BlockSvg.superClass_.removeInput.call(this, a, b);
  20556. this.rendered && (this.render(),
  20557. this.bumpNeighbours_())
  20558. }
  20559. ;
  20560. Blockly.BlockSvg.prototype.moveNumberedInputBefore = function (a, b) {
  20561. Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this, a, b);
  20562. this.rendered && (this.render(),
  20563. this.bumpNeighbours_())
  20564. }
  20565. ;
  20566. Blockly.BlockSvg.prototype.appendInput_ = function (a, b) {
  20567. var c = Blockly.BlockSvg.superClass_.appendInput_.call(this, a, b);
  20568. this.rendered && (this.render(),
  20569. this.bumpNeighbours_());
  20570. return c
  20571. }
  20572. ;
  20573. Blockly.BlockSvg.prototype.getConnections_ = function (a) {
  20574. var b = [];
  20575. if (a || this.rendered)
  20576. if (this.outputConnection && b.push(this.outputConnection),
  20577. this.previousConnection && b.push(this.previousConnection),
  20578. this.nextConnection && b.push(this.nextConnection),
  20579. a || !this.collapsed_) {
  20580. a = 0;
  20581. for (var c; c = this.inputList[a]; a++)
  20582. c.connection && b.push(c.connection)
  20583. }
  20584. return b
  20585. }
  20586. ;
  20587. Blockly.BlockSvg.prototype.makeConnection_ = function (a) {
  20588. return new Blockly.RenderedConnection(this, a)
  20589. }
  20590. ;
  20591. Blockly.BlockSvg.render = {};
  20592. Blockly.BlockSvg.SEP_SPACE_X = 10;
  20593. Blockly.BlockSvg.SEP_SPACE_Y = 10;
  20594. Blockly.BlockSvg.INLINE_PADDING_Y = 5;
  20595. Blockly.BlockSvg.MIN_BLOCK_Y = 25;
  20596. Blockly.BlockSvg.TAB_HEIGHT = 20;
  20597. Blockly.BlockSvg.TAB_WIDTH = 8;
  20598. Blockly.BlockSvg.NOTCH_WIDTH = 30;
  20599. Blockly.BlockSvg.CORNER_RADIUS = 8;
  20600. Blockly.BlockSvg.START_HAT = !1;
  20601. Blockly.BlockSvg.START_HAT_HEIGHT = 15;
  20602. Blockly.BlockSvg.START_HAT_PATH = "c 30,-" + Blockly.BlockSvg.START_HAT_HEIGHT + " 70,-" + Blockly.BlockSvg.START_HAT_HEIGHT + " 100,0";
  20603. Blockly.BlockSvg.START_HAT_HIGHLIGHT_LTR = "c 17.8,-9.2 45.3,-14.9 75,-8.7 M 100.5,0.5";
  20604. Blockly.BlockSvg.START_HAT_HIGHLIGHT_RTL = "m 25,-8.7 c 29.7,-6.2 57.2,-0.5 75,8.7";
  20605. Blockly.BlockSvg.DISTANCE_45_INSIDE = (1 - Math.SQRT1_2) * (Blockly.BlockSvg.CORNER_RADIUS - .5) + .5;
  20606. Blockly.BlockSvg.DISTANCE_45_OUTSIDE = (1 - Math.SQRT1_2) * (Blockly.BlockSvg.CORNER_RADIUS + .5) - .5;
  20607. Blockly.BlockSvg.NOTCH_PATH_LEFT = "l 6,4 3,0 6,-4";
  20608. Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT = "l 6,4 3,0 6,-4";
  20609. Blockly.BlockSvg.NOTCH_PATH_RIGHT = "l -6,4 -3,0 -6,-4";
  20610. Blockly.BlockSvg.JAGGED_TEETH = "l 8,0 0,4 8,4 -16,8 8,4";
  20611. Blockly.BlockSvg.JAGGED_TEETH_HEIGHT = 20;
  20612. Blockly.BlockSvg.JAGGED_TEETH_WIDTH = 15;
  20613. Blockly.BlockSvg.TAB_PATH_DOWN = "v 5 c 0,10 -" + Blockly.BlockSvg.TAB_WIDTH + ",-8 -" + Blockly.BlockSvg.TAB_WIDTH + ",7.5 s " + Blockly.BlockSvg.TAB_WIDTH + ",-2.5 " + Blockly.BlockSvg.TAB_WIDTH + ",7.5";
  20614. Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL = "v 6.5 m -" + .97 * Blockly.BlockSvg.TAB_WIDTH + ",3 q -" + .05 * Blockly.BlockSvg.TAB_WIDTH + ",10 " + .3 * Blockly.BlockSvg.TAB_WIDTH + ",9.5 m " + .67 * Blockly.BlockSvg.TAB_WIDTH + ",-1.9 v 1.4";
  20615. Blockly.BlockSvg.TOP_LEFT_CORNER_START = "m 0," + Blockly.BlockSvg.CORNER_RADIUS;
  20616. Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL = "m " + Blockly.BlockSvg.DISTANCE_45_INSIDE + "," + Blockly.BlockSvg.DISTANCE_45_INSIDE;
  20617. Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR = "m 0.5," + (Blockly.BlockSvg.CORNER_RADIUS - .5);
  20618. Blockly.BlockSvg.TOP_LEFT_CORNER = "A " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,1 " + Blockly.BlockSvg.CORNER_RADIUS + ",0";
  20619. Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT = "A " + (Blockly.BlockSvg.CORNER_RADIUS - .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS - .5) + " 0 0,1 " + Blockly.BlockSvg.CORNER_RADIUS + ",0.5";
  20620. Blockly.BlockSvg.INNER_TOP_LEFT_CORNER = Blockly.BlockSvg.NOTCH_PATH_RIGHT + " h -" + (Blockly.BlockSvg.NOTCH_WIDTH - 15 - Blockly.BlockSvg.CORNER_RADIUS) + " a " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,0 -" + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS;
  20621. Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER = "a " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,0 " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS;
  20622. Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL = "a " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,0 " + (-Blockly.BlockSvg.DISTANCE_45_OUTSIDE - .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS - Blockly.BlockSvg.DISTANCE_45_OUTSIDE);
  20623. Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL = "a " + (Blockly.BlockSvg.CORNER_RADIUS + .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS + .5) + " 0 0,0 " + (Blockly.BlockSvg.CORNER_RADIUS + .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS + .5);
  20624. Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR = "a " + (Blockly.BlockSvg.CORNER_RADIUS + .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS + .5) + " 0 0,0 " + (Blockly.BlockSvg.CORNER_RADIUS - Blockly.BlockSvg.DISTANCE_45_OUTSIDE) + "," + (Blockly.BlockSvg.DISTANCE_45_OUTSIDE + .5);
  20625. Blockly.BlockSvg.prototype.render = function (a) {
  20626. Blockly.Field.startCache();
  20627. this.rendered = !0;
  20628. var b = Blockly.BlockSvg.SEP_SPACE_X;
  20629. this.RTL && (b = -b);
  20630. for (var c = this.getIcons(), d = 0; d < c.length; d++)
  20631. b = c[d].renderIcon(b);
  20632. b += this.RTL ? Blockly.BlockSvg.SEP_SPACE_X : -Blockly.BlockSvg.SEP_SPACE_X;
  20633. c = this.renderCompute_(b);
  20634. this.renderDraw_(b, c);
  20635. this.renderMoveConnections_();
  20636. !1 !== a && ((a = this.getParent()) ? a.render(!0) : this.workspace.resizeContents());
  20637. Blockly.Field.stopCache()
  20638. }
  20639. ;
  20640. Blockly.BlockSvg.prototype.renderFields_ = function (a, b, c) {
  20641. c += Blockly.BlockSvg.INLINE_PADDING_Y;
  20642. this.RTL && (b = -b);
  20643. for (var d = 0, e; e = a[d]; d++) {
  20644. var f = e.getSvgRoot();
  20645. f && (this.RTL ? (b -= e.renderSep + e.renderWidth,
  20646. f.setAttribute("transform", "translate(" + b + "," + c + ")"),
  20647. e.renderWidth && (b -= Blockly.BlockSvg.SEP_SPACE_X)) : (f.setAttribute("transform", "translate(" + (b + e.renderSep) + "," + c + ")"),
  20648. e.renderWidth && (b += e.renderSep + e.renderWidth + Blockly.BlockSvg.SEP_SPACE_X)))
  20649. }
  20650. return this.RTL ? -b : b
  20651. }
  20652. ;
  20653. Blockly.BlockSvg.prototype.renderCompute_ = function (a) {
  20654. var b = this.inputList
  20655. , c = [];
  20656. c.rightEdge = a + 2 * Blockly.BlockSvg.SEP_SPACE_X;
  20657. if (this.previousConnection || this.nextConnection)
  20658. c.rightEdge = Math.max(c.rightEdge, Blockly.BlockSvg.NOTCH_WIDTH + Blockly.BlockSvg.SEP_SPACE_X);
  20659. for (var d = 0, e = 0, f = !1, g = !1, h = !1, k = void 0, m = this.getInputsInline() && !this.isCollapsed(), p = 0, l; l = b[p]; p++)
  20660. if (l.isVisible()) {
  20661. if (m && k && k != Blockly.NEXT_STATEMENT && l.type != Blockly.NEXT_STATEMENT)
  20662. var n = c[c.length - 1];
  20663. else
  20664. k = l.type,
  20665. n = [],
  20666. n.type = m && l.type != Blockly.NEXT_STATEMENT ? Blockly.BlockSvg.INLINE : l.type,
  20667. n.height = 0,
  20668. c.push(n);
  20669. n.push(l);
  20670. l.renderHeight = Blockly.BlockSvg.MIN_BLOCK_Y;
  20671. l.renderWidth = m && l.type == Blockly.INPUT_VALUE ? Blockly.BlockSvg.TAB_WIDTH + 1.25 * Blockly.BlockSvg.SEP_SPACE_X : 0;
  20672. if (l.connection && l.connection.isConnected()) {
  20673. var q = l.connection.targetBlock().getHeightWidth();
  20674. l.renderHeight = Math.max(l.renderHeight, q.height);
  20675. l.renderWidth = Math.max(l.renderWidth, q.width)
  20676. }
  20677. m || p != b.length - 1 ? !m && l.type == Blockly.INPUT_VALUE && b[p + 1] && b[p + 1].type == Blockly.NEXT_STATEMENT && l.renderHeight-- : l.renderHeight--;
  20678. n.height = Math.max(n.height, l.renderHeight);
  20679. l.fieldWidth = 0;
  20680. 1 == c.length && (l.fieldWidth += this.RTL ? -a : a);
  20681. q = !1;
  20682. for (var t = 0, r; r = l.fieldRow[t]; t++) {
  20683. 0 != t && (l.fieldWidth += Blockly.BlockSvg.SEP_SPACE_X);
  20684. var u = r.getSize();
  20685. r.renderWidth = u.width;
  20686. r.renderSep = q && r.EDITABLE ? Blockly.BlockSvg.SEP_SPACE_X : 0;
  20687. l.fieldWidth += r.renderWidth + r.renderSep;
  20688. n.height = Math.max(n.height, u.height);
  20689. q = r.EDITABLE
  20690. }
  20691. n.type != Blockly.BlockSvg.INLINE && (n.type == Blockly.NEXT_STATEMENT ? (g = !0,
  20692. e = Math.max(e, l.fieldWidth)) : (n.type == Blockly.INPUT_VALUE ? f = !0 : n.type == Blockly.DUMMY_INPUT && (h = !0),
  20693. d = Math.max(d, l.fieldWidth)))
  20694. }
  20695. for (a = 0; n = c[a]; a++)
  20696. if (n.thicker = !1,
  20697. n.type == Blockly.BlockSvg.INLINE)
  20698. for (b = 0; l = n[b]; b++)
  20699. if (l.type == Blockly.INPUT_VALUE) {
  20700. n.height += 2 * Blockly.BlockSvg.INLINE_PADDING_Y;
  20701. n.thicker = !0;
  20702. break
  20703. }
  20704. c.statementEdge = 2 * Blockly.BlockSvg.SEP_SPACE_X + e;
  20705. g && (c.rightEdge = Math.max(c.rightEdge, c.statementEdge + Blockly.BlockSvg.NOTCH_WIDTH));
  20706. f ? c.rightEdge = Math.max(c.rightEdge, d + 2 * Blockly.BlockSvg.SEP_SPACE_X + Blockly.BlockSvg.TAB_WIDTH) : h && (c.rightEdge = Math.max(c.rightEdge, d + 2 * Blockly.BlockSvg.SEP_SPACE_X));
  20707. c.hasValue = f;
  20708. c.hasStatement = g;
  20709. c.hasDummy = h;
  20710. return c
  20711. }
  20712. ;
  20713. Blockly.BlockSvg.prototype.renderDraw_ = function (a, b) {
  20714. this.startHat_ = !1;
  20715. this.height = 0;
  20716. if (this.outputConnection)
  20717. this.squareBottomLeftCorner_ = this.squareTopLeftCorner_ = !0;
  20718. else {
  20719. this.squareBottomLeftCorner_ = this.squareTopLeftCorner_ = !1;
  20720. if (this.previousConnection) {
  20721. var c = this.previousConnection.targetBlock();
  20722. c && c.getNextBlock() == this && (this.squareTopLeftCorner_ = !0)
  20723. } else
  20724. Blockly.BlockSvg.START_HAT && (this.startHat_ = this.squareTopLeftCorner_ = !0,
  20725. this.height += Blockly.BlockSvg.START_HAT_HEIGHT,
  20726. b.rightEdge = Math.max(b.rightEdge, 100));
  20727. this.getNextBlock() && (this.squareBottomLeftCorner_ = !0)
  20728. }
  20729. var d = []
  20730. , e = [];
  20731. c = [];
  20732. var f = [];
  20733. this.renderDrawTop_(d, c, b.rightEdge);
  20734. var g = this.renderDrawRight_(d, c, e, f, b, a);
  20735. this.renderDrawBottom_(d, c, g);
  20736. this.renderDrawLeft_(d, c);
  20737. d = d.join(" ") + "\n" + e.join(" ");
  20738. this.svgPath_.setAttribute("d", d);
  20739. this.svgPathDark_.setAttribute("d", d);
  20740. d = c.join(" ") + "\n" + f.join(" ");
  20741. this.svgPathLight_.setAttribute("d", d);
  20742. this.RTL && (this.svgPath_.setAttribute("transform", "scale(-1 1)"),
  20743. this.svgPathLight_.setAttribute("transform", "scale(-1 1)"),
  20744. this.svgPathDark_.setAttribute("transform", "translate(1,1) scale(-1 1)"))
  20745. }
  20746. ;
  20747. Blockly.BlockSvg.prototype.renderMoveConnections_ = function () {
  20748. var a = this.getRelativeToSurfaceXY();
  20749. this.previousConnection && this.previousConnection.moveToOffset(a);
  20750. this.outputConnection && this.outputConnection.moveToOffset(a);
  20751. for (var b = 0; b < this.inputList.length; b++) {
  20752. var c = this.inputList[b].connection;
  20753. c && (c.moveToOffset(a),
  20754. c.isConnected() && c.tighten_())
  20755. }
  20756. this.nextConnection && (this.nextConnection.moveToOffset(a),
  20757. this.nextConnection.isConnected() && this.nextConnection.tighten_())
  20758. }
  20759. ;
  20760. Blockly.BlockSvg.prototype.renderDrawTop_ = function (a, b, c) {
  20761. this.squareTopLeftCorner_ ? (a.push("m 0,0"),
  20762. b.push("m 0.5,0.5"),
  20763. this.startHat_ && (a.push(Blockly.BlockSvg.START_HAT_PATH),
  20764. b.push(this.RTL ? Blockly.BlockSvg.START_HAT_HIGHLIGHT_RTL : Blockly.BlockSvg.START_HAT_HIGHLIGHT_LTR))) : (a.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),
  20765. b.push(this.RTL ? Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL : Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR),
  20766. a.push(Blockly.BlockSvg.TOP_LEFT_CORNER),
  20767. b.push(Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT));
  20768. this.previousConnection && (a.push("H", Blockly.BlockSvg.NOTCH_WIDTH - 15),
  20769. b.push("H", Blockly.BlockSvg.NOTCH_WIDTH - 15),
  20770. a.push(Blockly.BlockSvg.NOTCH_PATH_LEFT),
  20771. b.push(Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT),
  20772. this.previousConnection.setOffsetInBlock(this.RTL ? -Blockly.BlockSvg.NOTCH_WIDTH : Blockly.BlockSvg.NOTCH_WIDTH, 0));
  20773. a.push("H", c);
  20774. b.push("H", c - .5);
  20775. this.width = c
  20776. }
  20777. ;
  20778. Blockly.BlockSvg.prototype.renderDrawRight_ = function (a, b, c, d, e, f) {
  20779. for (var g, h = 0, k, m, p = 0, l; l = e[p]; p++) {
  20780. g = Blockly.BlockSvg.SEP_SPACE_X;
  20781. 0 == p && (g += this.RTL ? -f : f);
  20782. b.push("M", e.rightEdge - .5 + "," + (h + .5));
  20783. if (this.isCollapsed()) {
  20784. var n = l[0];
  20785. k = h;
  20786. this.renderFields_(n.fieldRow, g, k);
  20787. a.push(Blockly.BlockSvg.JAGGED_TEETH);
  20788. b.push("h 8");
  20789. n = l.height - Blockly.BlockSvg.JAGGED_TEETH_HEIGHT;
  20790. a.push("v", n);
  20791. this.RTL && (b.push("v 3.9 l 7.2,3.4 m -14.5,8.9 l 7.3,3.5"),
  20792. b.push("v", n - .7));
  20793. this.width += Blockly.BlockSvg.JAGGED_TEETH_WIDTH
  20794. } else if (l.type == Blockly.BlockSvg.INLINE) {
  20795. for (var q = 0; n = l[q]; q++)
  20796. k = h,
  20797. l.thicker && (k += Blockly.BlockSvg.INLINE_PADDING_Y),
  20798. g = this.renderFields_(n.fieldRow, g, k),
  20799. n.type != Blockly.DUMMY_INPUT && (g += n.renderWidth + Blockly.BlockSvg.SEP_SPACE_X),
  20800. n.type == Blockly.INPUT_VALUE && (c.push("M", g - Blockly.BlockSvg.SEP_SPACE_X + "," + (h + Blockly.BlockSvg.INLINE_PADDING_Y)),
  20801. c.push("h", Blockly.BlockSvg.TAB_WIDTH - 2 - n.renderWidth),
  20802. c.push(Blockly.BlockSvg.TAB_PATH_DOWN),
  20803. c.push("v", n.renderHeight + 1 - Blockly.BlockSvg.TAB_HEIGHT),
  20804. c.push("h", n.renderWidth + 2 - Blockly.BlockSvg.TAB_WIDTH),
  20805. c.push("z"),
  20806. this.RTL ? (d.push("M", g - Blockly.BlockSvg.SEP_SPACE_X - 2.5 + Blockly.BlockSvg.TAB_WIDTH - n.renderWidth + "," + (h + Blockly.BlockSvg.INLINE_PADDING_Y + .5)),
  20807. d.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),
  20808. d.push("v", n.renderHeight - Blockly.BlockSvg.TAB_HEIGHT + 2.5),
  20809. d.push("h", n.renderWidth - Blockly.BlockSvg.TAB_WIDTH + 2)) : (d.push("M", g - Blockly.BlockSvg.SEP_SPACE_X + .5 + "," + (h + Blockly.BlockSvg.INLINE_PADDING_Y + .5)),
  20810. d.push("v", n.renderHeight + 1),
  20811. d.push("h", Blockly.BlockSvg.TAB_WIDTH - 2 - n.renderWidth),
  20812. d.push("M", g - n.renderWidth - Blockly.BlockSvg.SEP_SPACE_X + .9 + "," + (h + Blockly.BlockSvg.INLINE_PADDING_Y + Blockly.BlockSvg.TAB_HEIGHT - .7)),
  20813. d.push("l", .46 * Blockly.BlockSvg.TAB_WIDTH + ",-2.1")),
  20814. k = this.RTL ? -g - Blockly.BlockSvg.TAB_WIDTH + Blockly.BlockSvg.SEP_SPACE_X + n.renderWidth + 1 : g + Blockly.BlockSvg.TAB_WIDTH - Blockly.BlockSvg.SEP_SPACE_X - n.renderWidth - 1,
  20815. m = h + Blockly.BlockSvg.INLINE_PADDING_Y + 1,
  20816. n.connection.setOffsetInBlock(k, m));
  20817. g = Math.max(g, e.rightEdge);
  20818. this.width = Math.max(this.width, g);
  20819. a.push("H", g);
  20820. b.push("H", g - .5);
  20821. a.push("v", l.height);
  20822. this.RTL && b.push("v", l.height - 1)
  20823. } else
  20824. l.type == Blockly.INPUT_VALUE ? (n = l[0],
  20825. k = h,
  20826. n.align != Blockly.ALIGN_LEFT && (q = e.rightEdge - n.fieldWidth - Blockly.BlockSvg.TAB_WIDTH - 2 * Blockly.BlockSvg.SEP_SPACE_X,
  20827. n.align == Blockly.ALIGN_RIGHT ? g += q : n.align == Blockly.ALIGN_CENTRE && (g += q / 2)),
  20828. this.renderFields_(n.fieldRow, g, k),
  20829. a.push(Blockly.BlockSvg.TAB_PATH_DOWN),
  20830. q = l.height - Blockly.BlockSvg.TAB_HEIGHT,
  20831. a.push("v", q),
  20832. this.RTL ? (b.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),
  20833. b.push("v", q + .5)) : (b.push("M", e.rightEdge - 5 + "," + (h + Blockly.BlockSvg.TAB_HEIGHT - .7)),
  20834. b.push("l", .46 * Blockly.BlockSvg.TAB_WIDTH + ",-2.1")),
  20835. k = this.RTL ? -e.rightEdge - 1 : e.rightEdge + 1,
  20836. n.connection.setOffsetInBlock(k, h),
  20837. n.connection.isConnected() && (this.width = Math.max(this.width, e.rightEdge + n.connection.targetBlock().getHeightWidth().width - Blockly.BlockSvg.TAB_WIDTH + 1))) : l.type == Blockly.DUMMY_INPUT ? (n = l[0],
  20838. k = h,
  20839. n.align != Blockly.ALIGN_LEFT && (q = e.rightEdge - n.fieldWidth - 2 * Blockly.BlockSvg.SEP_SPACE_X,
  20840. e.hasValue && (q -= Blockly.BlockSvg.TAB_WIDTH),
  20841. n.align == Blockly.ALIGN_RIGHT ? g += q : n.align == Blockly.ALIGN_CENTRE && (g += q / 2)),
  20842. this.renderFields_(n.fieldRow, g, k),
  20843. a.push("v", l.height),
  20844. this.RTL && b.push("v", l.height - 1)) : l.type == Blockly.NEXT_STATEMENT && (n = l[0],
  20845. 0 == p && (a.push("v", Blockly.BlockSvg.SEP_SPACE_Y),
  20846. this.RTL && b.push("v", Blockly.BlockSvg.SEP_SPACE_Y - 1),
  20847. h += Blockly.BlockSvg.SEP_SPACE_Y),
  20848. k = h,
  20849. n.align != Blockly.ALIGN_LEFT && (q = e.statementEdge - n.fieldWidth - 2 * Blockly.BlockSvg.SEP_SPACE_X,
  20850. n.align == Blockly.ALIGN_RIGHT ? g += q : n.align == Blockly.ALIGN_CENTRE && (g += q / 2)),
  20851. this.renderFields_(n.fieldRow, g, k),
  20852. g = e.statementEdge + Blockly.BlockSvg.NOTCH_WIDTH,
  20853. a.push("H", g),
  20854. a.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER),
  20855. a.push("v", l.height - 2 * Blockly.BlockSvg.CORNER_RADIUS),
  20856. a.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER),
  20857. a.push("H", e.rightEdge),
  20858. this.RTL ? (b.push("M", g - Blockly.BlockSvg.NOTCH_WIDTH + Blockly.BlockSvg.DISTANCE_45_OUTSIDE + "," + (h + Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),
  20859. b.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL),
  20860. b.push("v", l.height - 2 * Blockly.BlockSvg.CORNER_RADIUS),
  20861. b.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL)) : (b.push("M", g - Blockly.BlockSvg.NOTCH_WIDTH + Blockly.BlockSvg.DISTANCE_45_OUTSIDE + "," + (h + l.height - Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),
  20862. b.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR)),
  20863. b.push("H", e.rightEdge - .5),
  20864. k = this.RTL ? -g : g + 1,
  20865. n.connection.setOffsetInBlock(k, h + 1),
  20866. n.connection.isConnected() && (this.width = Math.max(this.width, e.statementEdge + n.connection.targetBlock().getHeightWidth().width)),
  20867. p == e.length - 1 || e[p + 1].type == Blockly.NEXT_STATEMENT) && (a.push("v", Blockly.BlockSvg.SEP_SPACE_Y),
  20868. this.RTL && b.push("v", Blockly.BlockSvg.SEP_SPACE_Y - 1),
  20869. h += Blockly.BlockSvg.SEP_SPACE_Y);
  20870. h += l.height
  20871. }
  20872. e.length || (h = Blockly.BlockSvg.MIN_BLOCK_Y,
  20873. a.push("V", h),
  20874. this.RTL && b.push("V", h - 1));
  20875. return h
  20876. }
  20877. ;
  20878. Blockly.BlockSvg.prototype.renderDrawBottom_ = function (a, b, c) {
  20879. this.height += c + 1;
  20880. this.nextConnection && (a.push("H", Blockly.BlockSvg.NOTCH_WIDTH + (this.RTL ? .5 : -.5) + " " + Blockly.BlockSvg.NOTCH_PATH_RIGHT),
  20881. this.nextConnection.setOffsetInBlock(this.RTL ? -Blockly.BlockSvg.NOTCH_WIDTH : Blockly.BlockSvg.NOTCH_WIDTH, c + 1),
  20882. this.height += 4);
  20883. this.squareBottomLeftCorner_ ? (a.push("H 0"),
  20884. this.RTL || b.push("M", "0.5," + (c - .5))) : (a.push("H", Blockly.BlockSvg.CORNER_RADIUS),
  20885. a.push("a", Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,1 -" + Blockly.BlockSvg.CORNER_RADIUS + ",-" + Blockly.BlockSvg.CORNER_RADIUS),
  20886. this.RTL || (b.push("M", Blockly.BlockSvg.DISTANCE_45_INSIDE + "," + (c - Blockly.BlockSvg.DISTANCE_45_INSIDE)),
  20887. b.push("A", Blockly.BlockSvg.CORNER_RADIUS - .5 + "," + (Blockly.BlockSvg.CORNER_RADIUS - .5) + " 0 0,1 0.5," + (c - Blockly.BlockSvg.CORNER_RADIUS))))
  20888. }
  20889. ;
  20890. Blockly.BlockSvg.prototype.renderDrawLeft_ = function (a, b) {
  20891. this.outputConnection ? (this.outputConnection.setOffsetInBlock(0, 0),
  20892. a.push("V", Blockly.BlockSvg.TAB_HEIGHT),
  20893. a.push("c 0,-10 -" + Blockly.BlockSvg.TAB_WIDTH + ",8 -" + Blockly.BlockSvg.TAB_WIDTH + ",-7.5 s " + Blockly.BlockSvg.TAB_WIDTH + ",2.5 " + Blockly.BlockSvg.TAB_WIDTH + ",-7.5"),
  20894. this.RTL ? (b.push("M", -.25 * Blockly.BlockSvg.TAB_WIDTH + ",8.4"),
  20895. b.push("l", -.45 * Blockly.BlockSvg.TAB_WIDTH + ",-2.1")) : (b.push("V", Blockly.BlockSvg.TAB_HEIGHT - 1.5),
  20896. b.push("m", -.92 * Blockly.BlockSvg.TAB_WIDTH + ",-0.5 q " + -.19 * Blockly.BlockSvg.TAB_WIDTH + ",-5.5 0,-11"),
  20897. b.push("m", .92 * Blockly.BlockSvg.TAB_WIDTH + ",1 V 0.5 H 1")),
  20898. this.width += Blockly.BlockSvg.TAB_WIDTH) : this.RTL || (this.squareTopLeftCorner_ ? b.push("V", .5) : b.push("V", Blockly.BlockSvg.CORNER_RADIUS));
  20899. a.push("z")
  20900. }
  20901. ;
  20902. Blockly.Events = {};
  20903. Blockly.Events.group_ = "";
  20904. Blockly.Events.recordUndo = !0;
  20905. Blockly.Events.disabled_ = 0;
  20906. Blockly.Events.CREATE = "create";
  20907. Blockly.Events.DELETE = "delete";
  20908. Blockly.Events.CHANGE = "change";
  20909. Blockly.Events.MOVE = "move";
  20910. Blockly.Events.UI = "ui";
  20911. Blockly.Events.FIRE_QUEUE_ = [];
  20912. Blockly.Events.fire = function (a) {
  20913. Blockly.Events.isEnabled() && (Blockly.Events.FIRE_QUEUE_.length || setTimeout(Blockly.Events.fireNow_, 0),
  20914. Blockly.Events.FIRE_QUEUE_.push(a))
  20915. }
  20916. ;
  20917. Blockly.Events.fireNow_ = function () {
  20918. for (var a = Blockly.Events.filter(Blockly.Events.FIRE_QUEUE_, !0), b = Blockly.Events.FIRE_QUEUE_.length = 0, c; c = a[b]; b++) {
  20919. var d = Blockly.Workspace.getById(c.workspaceId);
  20920. d && d.fireChangeListener(c)
  20921. }
  20922. }
  20923. ;
  20924. Blockly.Events.filter = function (a, b) {
  20925. var c = goog.array.clone(a);
  20926. b || c.reverse();
  20927. for (var d = 0, e; e = c[d]; d++)
  20928. for (var f = d + 1, g; g = c[f]; f++)
  20929. e.type == g.type && e.blockId == g.blockId && e.workspaceId == g.workspaceId && (e.type == Blockly.Events.MOVE ? (e.newParentId = g.newParentId,
  20930. e.newInputName = g.newInputName,
  20931. e.newCoordinate = g.newCoordinate,
  20932. c.splice(f, 1),
  20933. f--) : e.type == Blockly.Events.CHANGE && e.element == g.element && e.name == g.name ? (e.newValue = g.newValue,
  20934. c.splice(f, 1),
  20935. f--) : e.type != Blockly.Events.UI || "click" != g.element || "commentOpen" != e.element && "mutatorOpen" != e.element && "warningOpen" != e.element || (e.newValue = g.newValue,
  20936. c.splice(f, 1),
  20937. f--));
  20938. for (d = c.length - 1; 0 <= d; d--)
  20939. c[d].isNull() && c.splice(d, 1);
  20940. b || c.reverse();
  20941. for (d = 1; e = c[d]; d++)
  20942. e.type == Blockly.Events.CHANGE && "mutation" == e.element && c.unshift(c.splice(d, 1)[0]);
  20943. return c
  20944. }
  20945. ;
  20946. Blockly.Events.clearPendingUndo = function () {
  20947. for (var a = 0, b; b = Blockly.Events.FIRE_QUEUE_[a]; a++)
  20948. b.recordUndo = !1
  20949. }
  20950. ;
  20951. Blockly.Events.disable = function () {
  20952. Blockly.Events.disabled_++
  20953. }
  20954. ;
  20955. Blockly.Events.enable = function () {
  20956. Blockly.Events.disabled_--
  20957. }
  20958. ;
  20959. Blockly.Events.isEnabled = function () {
  20960. return 0 == Blockly.Events.disabled_
  20961. }
  20962. ;
  20963. Blockly.Events.getGroup = function () {
  20964. return Blockly.Events.group_
  20965. }
  20966. ;
  20967. Blockly.Events.setGroup = function (a) {
  20968. Blockly.Events.group_ = "boolean" == typeof a ? a ? Blockly.genUid() : "" : a
  20969. }
  20970. ;
  20971. Blockly.Events.getDescendantIds_ = function (a) {
  20972. var b = [];
  20973. a = a.getDescendants();
  20974. for (var c = 0, d; d = a[c]; c++)
  20975. b[c] = d.id;
  20976. return b
  20977. }
  20978. ;
  20979. Blockly.Events.fromJson = function (a, b) {
  20980. switch (a.type) {
  20981. case Blockly.Events.CREATE:
  20982. var c = new Blockly.Events.Create(null);
  20983. break;
  20984. case Blockly.Events.DELETE:
  20985. c = new Blockly.Events.Delete(null);
  20986. break;
  20987. case Blockly.Events.CHANGE:
  20988. c = new Blockly.Events.Change(null);
  20989. break;
  20990. case Blockly.Events.MOVE:
  20991. c = new Blockly.Events.Move(null);
  20992. break;
  20993. case Blockly.Events.UI:
  20994. c = new Blockly.Events.Ui(null);
  20995. break;
  20996. default:
  20997. throw "Unknown event type.";
  20998. }
  20999. c.fromJson(a);
  21000. c.workspaceId = b.id;
  21001. return c
  21002. }
  21003. ;
  21004. Blockly.Events.Abstract = function (a) {
  21005. a && (this.blockId = a.id,
  21006. this.workspaceId = a.workspace.id);
  21007. this.group = Blockly.Events.group_;
  21008. this.recordUndo = Blockly.Events.recordUndo
  21009. }
  21010. ;
  21011. Blockly.Events.Abstract.prototype.toJson = function () {
  21012. var a = {
  21013. type: this.type
  21014. };
  21015. this.blockId && (a.blockId = this.blockId);
  21016. this.group && (a.group = this.group);
  21017. return a
  21018. }
  21019. ;
  21020. Blockly.Events.Abstract.prototype.fromJson = function (a) {
  21021. this.blockId = a.blockId;
  21022. this.group = a.group
  21023. }
  21024. ;
  21025. Blockly.Events.Abstract.prototype.isNull = function () {
  21026. return !1
  21027. }
  21028. ;
  21029. Blockly.Events.Abstract.prototype.run = function (a) { }
  21030. ;
  21031. Blockly.Events.Create = function (a) {
  21032. a && (Blockly.Events.Create.superClass_.constructor.call(this, a),
  21033. this.xml = Blockly.Xml.blockToDomWithXY(a),
  21034. this.ids = Blockly.Events.getDescendantIds_(a))
  21035. }
  21036. ;
  21037. goog.inherits(Blockly.Events.Create, Blockly.Events.Abstract);
  21038. Blockly.Events.Create.prototype.type = Blockly.Events.CREATE;
  21039. Blockly.Events.Create.prototype.toJson = function () {
  21040. var a = Blockly.Events.Create.superClass_.toJson.call(this);
  21041. a.xml = Blockly.Xml.domToText(this.xml);
  21042. a.ids = this.ids;
  21043. return a
  21044. }
  21045. ;
  21046. Blockly.Events.Create.prototype.fromJson = function (a) {
  21047. Blockly.Events.Create.superClass_.fromJson.call(this, a);
  21048. this.xml = Blockly.Xml.textToDom("<xml>" + a.xml + "</xml>").firstChild;
  21049. this.ids = a.ids
  21050. }
  21051. ;
  21052. Blockly.Events.Create.prototype.run = function (a) {
  21053. var b = Blockly.Workspace.getById(this.workspaceId);
  21054. if (a)
  21055. a = goog.dom.createDom("xml"),
  21056. a.appendChild(this.xml),
  21057. Blockly.Xml.domToWorkspace(a, b);
  21058. else {
  21059. a = 0;
  21060. for (var c; c = this.ids[a]; a++) {
  21061. var d = b.getBlockById(c);
  21062. d ? d.dispose(!1, !1) : c == this.blockId && console.warn("Can't uncreate non-existant block: " + c)
  21063. }
  21064. }
  21065. }
  21066. ;
  21067. Blockly.Events.Delete = function (a) {
  21068. if (a) {
  21069. if (a.getParent())
  21070. throw "Connected blocks cannot be deleted.";
  21071. Blockly.Events.Delete.superClass_.constructor.call(this, a);
  21072. this.oldXml = Blockly.Xml.blockToDomWithXY(a);
  21073. this.ids = Blockly.Events.getDescendantIds_(a)
  21074. }
  21075. }
  21076. ;
  21077. goog.inherits(Blockly.Events.Delete, Blockly.Events.Abstract);
  21078. Blockly.Events.Delete.prototype.type = Blockly.Events.DELETE;
  21079. Blockly.Events.Delete.prototype.toJson = function () {
  21080. var a = Blockly.Events.Delete.superClass_.toJson.call(this);
  21081. a.ids = this.ids;
  21082. return a
  21083. }
  21084. ;
  21085. Blockly.Events.Delete.prototype.fromJson = function (a) {
  21086. Blockly.Events.Delete.superClass_.fromJson.call(this, a);
  21087. this.ids = a.ids
  21088. }
  21089. ;
  21090. Blockly.Events.Delete.prototype.run = function (a) {
  21091. var b = Blockly.Workspace.getById(this.workspaceId);
  21092. if (a) {
  21093. a = 0;
  21094. for (var c; c = this.ids[a]; a++) {
  21095. var d = b.getBlockById(c);
  21096. d ? d.dispose(!1, !1) : c == this.blockId && console.warn("Can't delete non-existant block: " + c)
  21097. }
  21098. } else
  21099. a = goog.dom.createDom("xml"),
  21100. a.appendChild(this.oldXml),
  21101. Blockly.Xml.domToWorkspace(a, b)
  21102. }
  21103. ;
  21104. Blockly.Events.Change = function (a, b, c, d, e) {
  21105. a && (Blockly.Events.Change.superClass_.constructor.call(this, a),
  21106. this.element = b,
  21107. this.name = c,
  21108. this.oldValue = d,
  21109. this.newValue = e)
  21110. }
  21111. ;
  21112. goog.inherits(Blockly.Events.Change, Blockly.Events.Abstract);
  21113. Blockly.Events.Change.prototype.type = Blockly.Events.CHANGE;
  21114. Blockly.Events.Change.prototype.toJson = function () {
  21115. var a = Blockly.Events.Change.superClass_.toJson.call(this);
  21116. a.element = this.element;
  21117. this.name && (a.name = this.name);
  21118. a.newValue = this.newValue;
  21119. return a
  21120. }
  21121. ;
  21122. Blockly.Events.Change.prototype.fromJson = function (a) {
  21123. Blockly.Events.Change.superClass_.fromJson.call(this, a);
  21124. this.element = a.element;
  21125. this.name = a.name;
  21126. this.newValue = a.newValue
  21127. }
  21128. ;
  21129. Blockly.Events.Change.prototype.isNull = function () {
  21130. return this.oldValue == this.newValue
  21131. }
  21132. ;
  21133. Blockly.Events.Change.prototype.run = function (a) {
  21134. var b = Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId);
  21135. if (b)
  21136. switch (b.mutator && b.mutator.setVisible(!1),
  21137. a = a ? this.newValue : this.oldValue,
  21138. this.element) {
  21139. case "field":
  21140. (b = b.getField(this.name)) ? (b.callValidator(a),
  21141. b.setValue(a)) : console.warn("Can't set non-existant field: " + this.name);
  21142. break;
  21143. case "comment":
  21144. b.setCommentText(a || null);
  21145. break;
  21146. case "collapsed":
  21147. b.setCollapsed(a);
  21148. break;
  21149. case "disabled":
  21150. b.setDisabled(a);
  21151. break;
  21152. case "inline":
  21153. b.setInputsInline(a);
  21154. break;
  21155. case "mutation":
  21156. var c = "";
  21157. b.mutationToDom && (c = (c = b.mutationToDom()) && Blockly.Xml.domToText(c));
  21158. if (b.domToMutation) {
  21159. a = a || "<mutation></mutation>";
  21160. var d = Blockly.Xml.textToDom("<xml>" + a + "</xml>");
  21161. b.domToMutation(d.firstChild)
  21162. }
  21163. Blockly.Events.fire(new Blockly.Events.Change(b, "mutation", null, c, a));
  21164. break;
  21165. default:
  21166. console.warn("Unknown change type: " + this.element)
  21167. }
  21168. else
  21169. console.warn("Can't change non-existant block: " + this.blockId)
  21170. }
  21171. ;
  21172. Blockly.Events.Move = function (a) {
  21173. a && (Blockly.Events.Move.superClass_.constructor.call(this, a),
  21174. a = this.currentLocation_(),
  21175. this.oldParentId = a.parentId,
  21176. this.oldInputName = a.inputName,
  21177. this.oldCoordinate = a.coordinate)
  21178. }
  21179. ;
  21180. goog.inherits(Blockly.Events.Move, Blockly.Events.Abstract);
  21181. Blockly.Events.Move.prototype.type = Blockly.Events.MOVE;
  21182. Blockly.Events.Move.prototype.toJson = function () {
  21183. var a = Blockly.Events.Move.superClass_.toJson.call(this);
  21184. this.newParentId && (a.newParentId = this.newParentId);
  21185. this.newInputName && (a.newInputName = this.newInputName);
  21186. this.newCoordinate && (a.newCoordinate = Math.round(this.newCoordinate.x) + "," + Math.round(this.newCoordinate.y));
  21187. return a
  21188. }
  21189. ;
  21190. Blockly.Events.Move.prototype.fromJson = function (a) {
  21191. Blockly.Events.Move.superClass_.fromJson.call(this, a);
  21192. this.newParentId = a.newParentId;
  21193. this.newInputName = a.newInputName;
  21194. a.newCoordinate && (a = a.newCoordinate.split(","),
  21195. this.newCoordinate = new goog.math.Coordinate(parseFloat(a[0]), parseFloat(a[1])))
  21196. }
  21197. ;
  21198. Blockly.Events.Move.prototype.recordNew = function () {
  21199. var a = this.currentLocation_();
  21200. this.newParentId = a.parentId;
  21201. this.newInputName = a.inputName;
  21202. this.newCoordinate = a.coordinate
  21203. }
  21204. ;
  21205. Blockly.Events.Move.prototype.currentLocation_ = function () {
  21206. var a = Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId)
  21207. , b = {}
  21208. , c = a.getParent();
  21209. if (c) {
  21210. if (b.parentId = c.id,
  21211. a = c.getInputWithBlock(a))
  21212. b.inputName = a.name
  21213. } else
  21214. b.coordinate = a.getRelativeToSurfaceXY();
  21215. return b
  21216. }
  21217. ;
  21218. Blockly.Events.Move.prototype.isNull = function () {
  21219. return this.oldParentId == this.newParentId && this.oldInputName == this.newInputName && goog.math.Coordinate.equals(this.oldCoordinate, this.newCoordinate)
  21220. }
  21221. ;
  21222. Blockly.Events.Move.prototype.run = function (a) {
  21223. var b = Blockly.Workspace.getById(this.workspaceId)
  21224. , c = b.getBlockById(this.blockId);
  21225. if (c) {
  21226. var d = a ? this.newParentId : this.oldParentId
  21227. , e = a ? this.newInputName : this.oldInputName;
  21228. a = a ? this.newCoordinate : this.oldCoordinate;
  21229. var f = null;
  21230. if (d && (f = b.getBlockById(d),
  21231. !f)) {
  21232. console.warn("Can't connect to non-existant block: " + d);
  21233. return
  21234. }
  21235. c.getParent() && c.unplug();
  21236. if (a)
  21237. e = c.getRelativeToSurfaceXY(),
  21238. c.moveBy(a.x - e.x, a.y - e.y);
  21239. else {
  21240. c = c.outputConnection || c.previousConnection;
  21241. if (e) {
  21242. if (b = f.getInput(e))
  21243. var g = b.connection
  21244. } else
  21245. c.type == Blockly.PREVIOUS_STATEMENT && (g = f.nextConnection);
  21246. g ? c.connect(g) : console.warn("Can't connect to non-existant input: " + e)
  21247. }
  21248. } else
  21249. console.warn("Can't move non-existant block: " + this.blockId)
  21250. }
  21251. ;
  21252. Blockly.Events.Ui = function (a, b, c, d) {
  21253. Blockly.Events.Ui.superClass_.constructor.call(this, a);
  21254. this.element = b;
  21255. this.oldValue = c;
  21256. this.newValue = d;
  21257. this.recordUndo = !1
  21258. }
  21259. ;
  21260. goog.inherits(Blockly.Events.Ui, Blockly.Events.Abstract);
  21261. Blockly.Events.Ui.prototype.type = Blockly.Events.UI;
  21262. Blockly.Events.Ui.prototype.toJson = function () {
  21263. var a = Blockly.Events.Ui.superClass_.toJson.call(this);
  21264. a.element = this.element;
  21265. void 0 !== this.newValue && (a.newValue = this.newValue);
  21266. return a
  21267. }
  21268. ;
  21269. Blockly.Events.Ui.prototype.fromJson = function (a) {
  21270. Blockly.Events.Ui.superClass_.fromJson.call(this, a);
  21271. this.element = a.element;
  21272. this.newValue = a.newValue
  21273. }
  21274. ;
  21275. Blockly.Events.disableOrphans = function (a) {
  21276. if (a.type == Blockly.Events.MOVE || a.type == Blockly.Events.CREATE) {
  21277. Blockly.Events.disable();
  21278. if (a = Blockly.Workspace.getById(a.workspaceId).getBlockById(a.blockId))
  21279. if (a.getParent() && !a.getParent().disabled) {
  21280. a = a.getDescendants();
  21281. for (var b = 0, c; c = a[b]; b++)
  21282. c.setDisabled(!1)
  21283. } else if ((a.outputConnection || a.previousConnection) && Blockly.dragMode_ == Blockly.DRAG_NONE) {
  21284. do
  21285. a.setDisabled(!0),
  21286. a = a.getNextBlock();
  21287. while (a)
  21288. }
  21289. Blockly.Events.enable()
  21290. }
  21291. }
  21292. ;
  21293. Blockly.Msg = {};
  21294. goog.getMsgOrig = goog.getMsg;
  21295. goog.getMsg = function (a, b) {
  21296. var c = goog.getMsg.blocklyMsgMap[a];
  21297. c && (a = Blockly.Msg[c]);
  21298. return goog.getMsgOrig(a, b)
  21299. }
  21300. ;
  21301. goog.getMsg.blocklyMsgMap = {
  21302. Today: "TODAY"
  21303. };
  21304. Blockly.FieldTextInput = function (a, b) {
  21305. Blockly.FieldTextInput.superClass_.constructor.call(this, a, b)
  21306. }
  21307. ;
  21308. goog.inherits(Blockly.FieldTextInput, Blockly.Field);
  21309. Blockly.FieldTextInput.FONTSIZE = 11;
  21310. Blockly.FieldTextInput.prototype.CURSOR = "text";
  21311. Blockly.FieldTextInput.prototype.spellcheck_ = !0;
  21312. Blockly.FieldTextInput.prototype.dispose = function () {
  21313. Blockly.WidgetDiv.hideIfOwner(this);
  21314. Blockly.FieldTextInput.superClass_.dispose.call(this)
  21315. }
  21316. ;
  21317. Blockly.FieldTextInput.prototype.setValue = function (a) {
  21318. if (null !== a) {
  21319. if (this.sourceBlock_) {
  21320. var b = this.callValidator(a);
  21321. null !== b && (a = b)
  21322. }
  21323. Blockly.Field.prototype.setValue.call(this, a)
  21324. }
  21325. }
  21326. ;
  21327. Blockly.FieldTextInput.prototype.setSpellcheck = function (a) {
  21328. this.spellcheck_ = a
  21329. }
  21330. ;
  21331. Blockly.FieldTextInput.prototype.showEditor_ = function (a) {
  21332. this.workspace_ = this.sourceBlock_.workspace;
  21333. a = a || !1;
  21334. if (!a && (goog.userAgent.MOBILE || goog.userAgent.ANDROID || goog.userAgent.IPAD)) {
  21335. var b = this;
  21336. Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE, this.text_, function (a) {
  21337. b.sourceBlock_ && (a = b.callValidator(a));
  21338. b.setValue(a)
  21339. })
  21340. } else {
  21341. Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, this.widgetDispose_());
  21342. var c = Blockly.WidgetDiv.DIV
  21343. , d = goog.dom.createDom("INPUT", "blocklyHtmlInput");
  21344. d.setAttribute("spellcheck", this.spellcheck_);
  21345. var e = Blockly.FieldTextInput.FONTSIZE * this.workspace_.scale + "pt";
  21346. c.style.fontSize = e;
  21347. d.style.fontSize = e;
  21348. Blockly.FieldTextInput.htmlInput_ = d;
  21349. c.appendChild(d);
  21350. d.value = d.defaultValue = this.text_;
  21351. d.oldValue_ = null;
  21352. this.validate_();
  21353. this.resizeEditor_();
  21354. a || (d.focus(),
  21355. d.select());
  21356. d.onKeyDownWrapper_ = Blockly.bindEventWithChecks_(d, "keydown", this, this.onHtmlInputKeyDown_);
  21357. d.onKeyUpWrapper_ = Blockly.bindEventWithChecks_(d, "keyup", this, this.onHtmlInputChange_);
  21358. d.onKeyPressWrapper_ = Blockly.bindEventWithChecks_(d, "keypress", this, this.onHtmlInputChange_);
  21359. d.onWorkspaceChangeWrapper_ = this.resizeEditor_.bind(this);
  21360. this.workspace_.addChangeListener(d.onWorkspaceChangeWrapper_)
  21361. }
  21362. }
  21363. ;
  21364. Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_ = function (a) {
  21365. var b = Blockly.FieldTextInput.htmlInput_;
  21366. 13 == a.keyCode ? Blockly.WidgetDiv.hide() : 27 == a.keyCode ? (b.value = b.defaultValue,
  21367. Blockly.WidgetDiv.hide()) : 9 == a.keyCode && (Blockly.WidgetDiv.hide(),
  21368. this.sourceBlock_.tab(this, !a.shiftKey),
  21369. a.preventDefault())
  21370. }
  21371. ;
  21372. Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function (a) {
  21373. a = Blockly.FieldTextInput.htmlInput_;
  21374. var b = a.value;
  21375. b !== a.oldValue_ ? (a.oldValue_ = b,
  21376. this.setValue(b),
  21377. this.validate_()) : goog.userAgent.WEBKIT && this.sourceBlock_.render();
  21378. this.resizeEditor_();
  21379. Blockly.svgResize(this.sourceBlock_.workspace)
  21380. }
  21381. ;
  21382. Blockly.FieldTextInput.prototype.validate_ = function () {
  21383. var a = !0;
  21384. goog.asserts.assertObject(Blockly.FieldTextInput.htmlInput_);
  21385. var b = Blockly.FieldTextInput.htmlInput_;
  21386. this.sourceBlock_ && (a = this.callValidator(b.value));
  21387. null === a ? Blockly.addClass_(b, "blocklyInvalidInput") : Blockly.removeClass_(b, "blocklyInvalidInput")
  21388. }
  21389. ;
  21390. Blockly.FieldTextInput.prototype.resizeEditor_ = function () {
  21391. var a = Blockly.WidgetDiv.DIV
  21392. , b = this.fieldGroup_.getBBox();
  21393. a.style.width = b.width * this.workspace_.scale + "px";
  21394. a.style.height = b.height * this.workspace_.scale + "px";
  21395. b = this.getAbsoluteXY_();
  21396. if (this.sourceBlock_.RTL) {
  21397. var c = this.getScaledBBox_();
  21398. b.x += c.width;
  21399. b.x -= a.offsetWidth
  21400. }
  21401. b.y += 1;
  21402. goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top && (--b.x,
  21403. --b.y);
  21404. goog.userAgent.WEBKIT && (b.y -= 3);
  21405. a.style.left = b.x + "px";
  21406. a.style.top = b.y + "px"
  21407. }
  21408. ;
  21409. Blockly.FieldTextInput.prototype.widgetDispose_ = function () {
  21410. var a = this;
  21411. return function () {
  21412. var b = Blockly.FieldTextInput.htmlInput_
  21413. , c = b.value;
  21414. if (a.sourceBlock_)
  21415. if (c = a.callValidator(c),
  21416. null === c)
  21417. c = b.defaultValue;
  21418. else if (a.onFinishEditing_)
  21419. a.onFinishEditing_(c);
  21420. a.setValue(c);
  21421. a.sourceBlock_.rendered && a.sourceBlock_.render();
  21422. Blockly.unbindEvent_(b.onKeyDownWrapper_);
  21423. Blockly.unbindEvent_(b.onKeyUpWrapper_);
  21424. Blockly.unbindEvent_(b.onKeyPressWrapper_);
  21425. a.workspace_.removeChangeListener(b.onWorkspaceChangeWrapper_);
  21426. Blockly.FieldTextInput.htmlInput_ = null;
  21427. b = Blockly.WidgetDiv.DIV.style;
  21428. b.width = "auto";
  21429. b.height = "auto";
  21430. b.fontSize = ""
  21431. }
  21432. }
  21433. ;
  21434. Blockly.FieldTextInput.numberValidator = function (a) {
  21435. console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");
  21436. if (null === a)
  21437. return null;
  21438. a = String(a);
  21439. a = a.replace(/O/ig, "0");
  21440. a = a.replace(/,/g, "");
  21441. a = parseFloat(a || 0);
  21442. return isNaN(a) ? null : String(a)
  21443. }
  21444. ;
  21445. Blockly.FieldTextInput.nonnegativeIntegerValidator = function (a) {
  21446. (a = Blockly.FieldTextInput.numberValidator(a)) && (a = String(Math.max(0, Math.floor(a))));
  21447. return a
  21448. }
  21449. ;
  21450. Blockly.FieldAngle = function (a, b) {
  21451. this.symbol_ = Blockly.createSvgElement("tspan", {}, null);
  21452. this.symbol_.appendChild(document.createTextNode("\u00b0"));
  21453. Blockly.FieldAngle.superClass_.constructor.call(this, a, b)
  21454. }
  21455. ;
  21456. goog.inherits(Blockly.FieldAngle, Blockly.FieldTextInput);
  21457. Blockly.FieldAngle.ROUND = 15;
  21458. Blockly.FieldAngle.HALF = 50;
  21459. Blockly.FieldAngle.CLOCKWISE = !1;
  21460. Blockly.FieldAngle.OFFSET = 0;
  21461. Blockly.FieldAngle.WRAP = 360;
  21462. Blockly.FieldAngle.RADIUS = Blockly.FieldAngle.HALF - 1;
  21463. Blockly.FieldAngle.prototype.dispose_ = function () {
  21464. var a = this;
  21465. return function () {
  21466. Blockly.FieldAngle.superClass_.dispose_.call(a)();
  21467. a.gauge_ = null;
  21468. a.clickWrapper_ && Blockly.unbindEvent_(a.clickWrapper_);
  21469. a.moveWrapper1_ && Blockly.unbindEvent_(a.moveWrapper1_);
  21470. a.moveWrapper2_ && Blockly.unbindEvent_(a.moveWrapper2_)
  21471. }
  21472. }
  21473. ;
  21474. Blockly.FieldAngle.prototype.showEditor_ = function () {
  21475. Blockly.FieldAngle.superClass_.showEditor_.call(this, goog.userAgent.MOBILE || goog.userAgent.ANDROID || goog.userAgent.IPAD);
  21476. var a = Blockly.WidgetDiv.DIV;
  21477. if (a.firstChild) {
  21478. a = Blockly.createSvgElement("svg", {
  21479. xmlns: "http://www.w3.org/2000/svg",
  21480. "xmlns:html": "http://www.w3.org/1999/xhtml",
  21481. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  21482. version: "1.1",
  21483. height: 2 * Blockly.FieldAngle.HALF + "px",
  21484. width: 2 * Blockly.FieldAngle.HALF + "px"
  21485. }, a);
  21486. var b = Blockly.createSvgElement("circle", {
  21487. cx: Blockly.FieldAngle.HALF,
  21488. cy: Blockly.FieldAngle.HALF,
  21489. r: Blockly.FieldAngle.RADIUS,
  21490. "class": "blocklyAngleCircle"
  21491. }, a);
  21492. this.gauge_ = Blockly.createSvgElement("path", {
  21493. "class": "blocklyAngleGauge"
  21494. }, a);
  21495. this.line_ = Blockly.createSvgElement("line", {
  21496. x1: Blockly.FieldAngle.HALF,
  21497. y1: Blockly.FieldAngle.HALF,
  21498. "class": "blocklyAngleLine"
  21499. }, a);
  21500. for (var c = 0; 360 > c; c += 15)
  21501. Blockly.createSvgElement("line", {
  21502. x1: Blockly.FieldAngle.HALF + Blockly.FieldAngle.RADIUS,
  21503. y1: Blockly.FieldAngle.HALF,
  21504. x2: Blockly.FieldAngle.HALF + Blockly.FieldAngle.RADIUS - (0 == c % 45 ? 10 : 5),
  21505. y2: Blockly.FieldAngle.HALF,
  21506. "class": "blocklyAngleMarks",
  21507. transform: "rotate(" + c + "," + Blockly.FieldAngle.HALF + "," + Blockly.FieldAngle.HALF + ")"
  21508. }, a);
  21509. a.style.marginLeft = 15 - Blockly.FieldAngle.RADIUS + "px";
  21510. this.clickWrapper_ = Blockly.bindEvent_(a, "click", this, Blockly.WidgetDiv.hide);
  21511. this.moveWrapper1_ = Blockly.bindEvent_(b, "mousemove", this, this.onMouseMove);
  21512. this.moveWrapper2_ = Blockly.bindEvent_(this.gauge_, "mousemove", this, this.onMouseMove);
  21513. this.updateGraph_()
  21514. }
  21515. }
  21516. ;
  21517. Blockly.FieldAngle.prototype.onMouseMove = function (a) {
  21518. var b = this.gauge_.ownerSVGElement.getBoundingClientRect()
  21519. , c = a.clientX - b.left - Blockly.FieldAngle.HALF;
  21520. a = a.clientY - b.top - Blockly.FieldAngle.HALF;
  21521. b = Math.atan(-a / c);
  21522. isNaN(b) || (b = goog.math.toDegrees(b),
  21523. 0 > c ? b += 180 : 0 < a && (b += 360),
  21524. b = Blockly.FieldAngle.CLOCKWISE ? Blockly.FieldAngle.OFFSET + 360 - b : b - Blockly.FieldAngle.OFFSET,
  21525. Blockly.FieldAngle.ROUND && (b = Math.round(b / Blockly.FieldAngle.ROUND) * Blockly.FieldAngle.ROUND),
  21526. b = this.callValidator(b),
  21527. Blockly.FieldTextInput.htmlInput_.value = b,
  21528. this.setValue(b),
  21529. this.validate_(),
  21530. this.resizeEditor_())
  21531. }
  21532. ;
  21533. Blockly.FieldAngle.prototype.setText = function (a) {
  21534. Blockly.FieldAngle.superClass_.setText.call(this, a);
  21535. this.textElement_ && (this.updateGraph_(),
  21536. this.sourceBlock_.RTL ? this.textElement_.insertBefore(this.symbol_, this.textElement_.firstChild) : this.textElement_.appendChild(this.symbol_),
  21537. this.size_.width = 0)
  21538. }
  21539. ;
  21540. Blockly.FieldAngle.prototype.updateGraph_ = function () {
  21541. if (this.gauge_) {
  21542. var a = Number(this.getText()) + Blockly.FieldAngle.OFFSET
  21543. , b = goog.math.toRadians(a);
  21544. a = ["M ", Blockly.FieldAngle.HALF, ",", Blockly.FieldAngle.HALF];
  21545. var c = Blockly.FieldAngle.HALF
  21546. , d = Blockly.FieldAngle.HALF;
  21547. if (!isNaN(b)) {
  21548. var e = goog.math.toRadians(Blockly.FieldAngle.OFFSET)
  21549. , f = Math.cos(e) * Blockly.FieldAngle.RADIUS
  21550. , g = Math.sin(e) * -Blockly.FieldAngle.RADIUS;
  21551. Blockly.FieldAngle.CLOCKWISE && (b = 2 * e - b);
  21552. c += Math.cos(b) * Blockly.FieldAngle.RADIUS;
  21553. d -= Math.sin(b) * Blockly.FieldAngle.RADIUS;
  21554. b = Math.abs(Math.floor((b - e) / Math.PI) % 2);
  21555. Blockly.FieldAngle.CLOCKWISE && (b = 1 - b);
  21556. a.push(" l ", f, ",", g, " A ", Blockly.FieldAngle.RADIUS, ",", Blockly.FieldAngle.RADIUS, " 0 ", b, " ", Number(Blockly.FieldAngle.CLOCKWISE), " ", c, ",", d, " z")
  21557. }
  21558. this.gauge_.setAttribute("d", a.join(""));
  21559. this.line_.setAttribute("x2", c);
  21560. this.line_.setAttribute("y2", d)
  21561. }
  21562. }
  21563. ;
  21564. Blockly.FieldAngle.prototype.classValidator = function (a) {
  21565. if (null === a)
  21566. return null;
  21567. a = parseFloat(a || 0);
  21568. if (isNaN(a))
  21569. return null;
  21570. a %= 360;
  21571. 0 > a && (a += 360);
  21572. a > Blockly.FieldAngle.WRAP && (a -= 360);
  21573. return String(a)
  21574. }
  21575. ;
  21576. Blockly.FieldCheckbox = function (a, b) {
  21577. Blockly.FieldCheckbox.superClass_.constructor.call(this, "", b);
  21578. this.setValue(a)
  21579. }
  21580. ;
  21581. goog.inherits(Blockly.FieldCheckbox, Blockly.Field);
  21582. Blockly.FieldCheckbox.CHECK_CHAR = "\u2713";
  21583. Blockly.FieldCheckbox.prototype.CURSOR = "default";
  21584. Blockly.FieldCheckbox.prototype.init = function () {
  21585. if (!this.fieldGroup_) {
  21586. Blockly.FieldCheckbox.superClass_.init.call(this);
  21587. this.checkElement_ = Blockly.createSvgElement("text", {
  21588. "class": "blocklyText blocklyCheckbox",
  21589. x: -3,
  21590. y: 14
  21591. }, this.fieldGroup_);
  21592. var a = document.createTextNode(Blockly.FieldCheckbox.CHECK_CHAR);
  21593. this.checkElement_.appendChild(a);
  21594. this.checkElement_.style.display = this.state_ ? "block" : "none"
  21595. }
  21596. }
  21597. ;
  21598. Blockly.FieldCheckbox.prototype.getValue = function () {
  21599. return String(this.state_).toUpperCase()
  21600. }
  21601. ;
  21602. Blockly.FieldCheckbox.prototype.setValue = function (a) {
  21603. a = "TRUE" == a.toUpperCase();
  21604. this.state_ !== a && (this.sourceBlock_ && Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, this.state_, a)),
  21605. this.state_ = a,
  21606. this.checkElement_ && (this.checkElement_.style.display = a ? "block" : "none"))
  21607. }
  21608. ;
  21609. Blockly.FieldCheckbox.prototype.showEditor_ = function () {
  21610. var a = !this.state_;
  21611. this.sourceBlock_ && (a = this.callValidator(a));
  21612. null !== a && this.setValue(String(a).toUpperCase())
  21613. }
  21614. ;
  21615. Blockly.FieldColour = function (a, b) {
  21616. Blockly.FieldColour.superClass_.constructor.call(this, a, b);
  21617. this.setText(Blockly.Field.NBSP + Blockly.Field.NBSP + Blockly.Field.NBSP)
  21618. }
  21619. ;
  21620. goog.inherits(Blockly.FieldColour, Blockly.Field);
  21621. Blockly.FieldColour.prototype.colours_ = null;
  21622. Blockly.FieldColour.prototype.columns_ = 0;
  21623. Blockly.FieldColour.prototype.init = function () {
  21624. Blockly.FieldColour.superClass_.init.call(this);
  21625. this.borderRect_.style.fillOpacity = 1;
  21626. this.setValue(this.getValue())
  21627. }
  21628. ;
  21629. Blockly.FieldColour.prototype.CURSOR = "default";
  21630. Blockly.FieldColour.prototype.dispose = function () {
  21631. Blockly.WidgetDiv.hideIfOwner(this);
  21632. Blockly.FieldColour.superClass_.dispose.call(this)
  21633. }
  21634. ;
  21635. Blockly.FieldColour.prototype.getValue = function () {
  21636. return this.colour_
  21637. }
  21638. ;
  21639. Blockly.FieldColour.prototype.setValue = function (a) {
  21640. this.sourceBlock_ && Blockly.Events.isEnabled() && this.colour_ != a && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, this.colour_, a));
  21641. this.colour_ = a;
  21642. this.borderRect_ && (this.borderRect_.style.fill = a)
  21643. }
  21644. ;
  21645. Blockly.FieldColour.prototype.getText = function () {
  21646. var a = this.colour_
  21647. , b = a.match(/^#(.)\1(.)\2(.)\3$/);
  21648. b && (a = "#" + b[1] + b[2] + b[3]);
  21649. return a
  21650. }
  21651. ;
  21652. Blockly.FieldColour.COLOURS = goog.ui.ColorPicker.SIMPLE_GRID_COLORS;
  21653. Blockly.FieldColour.COLUMNS = 7;
  21654. Blockly.FieldColour.prototype.setColours = function (a) {
  21655. this.colours_ = a;
  21656. return this
  21657. }
  21658. ;
  21659. Blockly.FieldColour.prototype.setColumns = function (a) {
  21660. this.columns_ = a;
  21661. return this
  21662. }
  21663. ;
  21664. Blockly.FieldColour.prototype.showEditor_ = function () {
  21665. Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, Blockly.FieldColour.widgetDispose_);
  21666. var a = new goog.ui.ColorPicker;
  21667. a.setSize(this.columns_ || Blockly.FieldColour.COLUMNS);
  21668. a.setColors(this.colours_ || Blockly.FieldColour.COLOURS);
  21669. var b = goog.dom.getViewportSize()
  21670. , c = goog.style.getViewportPageOffset(document)
  21671. , d = this.getAbsoluteXY_()
  21672. , e = this.getScaledBBox_();
  21673. a.render(Blockly.WidgetDiv.DIV);
  21674. a.setSelectedColor(this.getValue());
  21675. var f = goog.style.getSize(a.getElement());
  21676. d.y = d.y + f.height + e.height >= b.height + c.y ? d.y - (f.height - 1) : d.y + (e.height - 1);
  21677. this.sourceBlock_.RTL ? (d.x += e.width,
  21678. d.x -= f.width,
  21679. d.x < c.x && (d.x = c.x)) : d.x > b.width + c.x - f.width && (d.x = b.width + c.x - f.width);
  21680. Blockly.WidgetDiv.position(d.x, d.y, b, c, this.sourceBlock_.RTL);
  21681. var g = this;
  21682. Blockly.FieldColour.changeEventKey_ = goog.events.listen(a, goog.ui.ColorPicker.EventType.CHANGE, function (a) {
  21683. a = a.target.getSelectedColor() || "#000000";
  21684. Blockly.WidgetDiv.hide();
  21685. g.sourceBlock_ && (a = g.callValidator(a));
  21686. null !== a && g.setValue(a)
  21687. })
  21688. }
  21689. ;
  21690. Blockly.FieldColour.widgetDispose_ = function () {
  21691. Blockly.FieldColour.changeEventKey_ && goog.events.unlistenByKey(Blockly.FieldColour.changeEventKey_)
  21692. }
  21693. ;
  21694. Blockly.FieldDropdown = function (a, b) {
  21695. this.menuGenerator_ = a;
  21696. this.trimOptions_();
  21697. var c = this.getOptions_()[0];
  21698. Blockly.FieldDropdown.superClass_.constructor.call(this, c[1], b)
  21699. }
  21700. ;
  21701. goog.inherits(Blockly.FieldDropdown, Blockly.Field);
  21702. Blockly.FieldDropdown.CHECKMARK_OVERHANG = 25;
  21703. Blockly.FieldDropdown.ARROW_CHAR = goog.userAgent.ANDROID ? "\u25bc" : "\u25be";
  21704. Blockly.FieldDropdown.prototype.CURSOR = "default";
  21705. Blockly.FieldDropdown.prototype.value_ = "";
  21706. Blockly.FieldDropdown.prototype.init = function () {
  21707. if (!this.fieldGroup_) {
  21708. this.arrow_ = Blockly.createSvgElement("tspan", {}, null);
  21709. this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL ? Blockly.FieldDropdown.ARROW_CHAR + " " : " " + Blockly.FieldDropdown.ARROW_CHAR));
  21710. Blockly.FieldDropdown.superClass_.init.call(this);
  21711. var a = this.text_;
  21712. this.text_ = null;
  21713. this.setText(a)
  21714. }
  21715. }
  21716. ;
  21717. Blockly.FieldDropdown.prototype.showEditor_ = function () {
  21718. Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, null);
  21719. var a = this
  21720. , b = new goog.ui.Menu;
  21721. b.setRightToLeft(this.sourceBlock_.RTL);
  21722. let isOptionId = false
  21723. for (var c = this.getOptions_(), d = 0; d < c.length; d++) {
  21724. console.log("c[d]", c[d])
  21725. var e = c[d][1]
  21726. , f = null
  21727. if (c[d][2]) {
  21728. isOptionId = true
  21729. let m = document.createElement("div")
  21730. m.innerHTML = `<span>${c[d][0]}</span>:<input type="text" id="${c[d][2]}" placeholder="${c[d][0]}" />`
  21731. f = new goog.ui.MenuItem(m);
  21732. } else {
  21733. f = new goog.ui.MenuItem(c[d][0]);
  21734. f.setRightToLeft(this.sourceBlock_.RTL);
  21735. f.setValue(e);
  21736. f.setCheckable(!0);
  21737. f.setChecked(e == this.value_)
  21738. }
  21739. b.addChild(f, !0);
  21740. }
  21741. if (!isOptionId) {
  21742. goog.events.listen(b, goog.ui.Component.EventType.ACTION, function (b) {
  21743. if (b = b.target)
  21744. a.onItemSelected(this, b);
  21745. Blockly.WidgetDiv.hideIfOwner(a)
  21746. });
  21747. b.getHandler().listen(b.getElement(), goog.events.EventType.TOUCHSTART, function (a) {
  21748. this.getOwnerControl(a.target).handleMouseDown(a)
  21749. });
  21750. b.getHandler().listen(b.getElement(), goog.events.EventType.TOUCHEND, function (a) {
  21751. this.getOwnerControl(a.target).performActionInternal(a)
  21752. });
  21753. } else {
  21754. goog.events.listen(b, goog.ui.Component.EventType.ACTION, function (b) {
  21755. console.log("ACTION", b)
  21756. console.log(document.getElementById("img"))
  21757. document.getElementById("img").onchange = function (e) {
  21758. console.log("e", e)
  21759. }
  21760. if (b = b.target)
  21761. a.onItemSelected(this, b);
  21762. // Blockly.WidgetDiv.hideIfOwner(a)
  21763. });
  21764. }
  21765. c = goog.dom.getViewportSize();
  21766. d = goog.style.getViewportPageOffset(document);
  21767. e = this.getAbsoluteXY_();
  21768. f = this.getScaledBBox_();
  21769. b.render(Blockly.WidgetDiv.DIV);
  21770. var g = b.getElement();
  21771. Blockly.addClass_(g, "blocklyDropdownMenu");
  21772. var h = goog.style.getSize(g);
  21773. h.height = g.scrollHeight;
  21774. e.y = e.y + h.height + f.height >= c.height + d.y ? e.y - (h.height + 2) : e.y + f.height;
  21775. this.sourceBlock_.RTL ? (e.x += f.width,
  21776. e.x += Blockly.FieldDropdown.CHECKMARK_OVERHANG,
  21777. e.x < d.x + h.width && (e.x = d.x + h.width)) : (e.x -= Blockly.FieldDropdown.CHECKMARK_OVERHANG,
  21778. e.x > c.width + d.x - h.width && (e.x = c.width + d.x - h.width));
  21779. Blockly.WidgetDiv.position(e.x, e.y, c, d, this.sourceBlock_.RTL);
  21780. b.setAllowAutoFocus(!0);
  21781. g.focus()
  21782. }
  21783. ;
  21784. Blockly.FieldDropdown.prototype.onItemSelected = function (a, b) {
  21785. var c = b.getValue();
  21786. this.sourceBlock_ && (c = this.callValidator(c));
  21787. null !== c && this.setValue(c)
  21788. }
  21789. ;
  21790. Blockly.FieldDropdown.prototype.trimOptions_ = function () {
  21791. this.suffixField = this.prefixField = null;
  21792. var a = this.menuGenerator_;
  21793. if (goog.isArray(a) && !(2 > a.length)) {
  21794. var b = a.map(function (a) {
  21795. return a[0]
  21796. })
  21797. , c = Blockly.shortestStringLength(b)
  21798. , d = Blockly.commonWordPrefix(b, c)
  21799. , e = Blockly.commonWordSuffix(b, c);
  21800. if ((d || e) && !(c <= d + e)) {
  21801. d && (this.prefixField = b[0].substring(0, d - 1));
  21802. e && (this.suffixField = b[0].substr(1 - e));
  21803. b = [];
  21804. for (c = 0; c < a.length; c++) {
  21805. var f = a[c][0]
  21806. , g = a[c][1];
  21807. f = f.substring(d, f.length - e);
  21808. b[c] = [f, g]
  21809. }
  21810. this.menuGenerator_ = b
  21811. }
  21812. }
  21813. }
  21814. ;
  21815. Blockly.FieldDropdown.prototype.getOptions_ = function () {
  21816. return goog.isFunction(this.menuGenerator_) ? this.menuGenerator_.call(this) : this.menuGenerator_
  21817. }
  21818. ;
  21819. Blockly.FieldDropdown.prototype.getValue = function () {
  21820. return this.value_
  21821. }
  21822. ;
  21823. Blockly.FieldDropdown.prototype.setValue = function (a) {
  21824. if (null !== a && a !== this.value_) {
  21825. this.sourceBlock_ && Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, this.value_, a));
  21826. this.value_ = a;
  21827. for (var b = this.getOptions_(), c = 0; c < b.length; c++)
  21828. if (b[c][1] == a) {
  21829. this.setText(b[c][0]);
  21830. return
  21831. }
  21832. this.setText(a)
  21833. }
  21834. }
  21835. ;
  21836. Blockly.FieldDropdown.prototype.setText = function (a) {
  21837. this.sourceBlock_ && this.arrow_ && (this.arrow_.style.fill = this.sourceBlock_.getColour());
  21838. null !== a && a !== this.text_ && (this.text_ = a,
  21839. this.updateTextNode_(),
  21840. this.textElement_ && (this.sourceBlock_.RTL ? this.textElement_.insertBefore(this.arrow_, this.textElement_.firstChild) : this.textElement_.appendChild(this.arrow_)),
  21841. this.sourceBlock_ && this.sourceBlock_.rendered && (this.sourceBlock_.render(),
  21842. this.sourceBlock_.bumpNeighbours_()))
  21843. }
  21844. ;
  21845. Blockly.FieldDropdown.prototype.dispose = function () {
  21846. Blockly.WidgetDiv.hideIfOwner(this);
  21847. Blockly.FieldDropdown.superClass_.dispose.call(this)
  21848. }
  21849. ;
  21850. Blockly.FieldImage = function (a, b, c, d) {
  21851. this.sourceBlock_ = null;
  21852. this.height_ = Number(c);
  21853. this.width_ = Number(b);
  21854. this.size_ = new goog.math.Size(this.width_, this.height_ + 2 * Blockly.BlockSvg.INLINE_PADDING_Y);
  21855. this.text_ = d || "";
  21856. this.setValue(a)
  21857. }
  21858. ;
  21859. goog.inherits(Blockly.FieldImage, Blockly.Field);
  21860. Blockly.FieldImage.prototype.rectElement_ = null;
  21861. Blockly.FieldImage.prototype.EDITABLE = !1;
  21862. Blockly.FieldImage.prototype.init = function () {
  21863. if (!this.fieldGroup_) {
  21864. this.fieldGroup_ = Blockly.createSvgElement("g", {}, null);
  21865. this.visible_ || (this.fieldGroup_.style.display = "none");
  21866. this.imageElement_ = Blockly.createSvgElement("image", {
  21867. height: this.height_ + "px",
  21868. width: this.width_ + "px"
  21869. }, this.fieldGroup_);
  21870. this.setValue(this.src_);
  21871. goog.userAgent.GECKO && (this.rectElement_ = Blockly.createSvgElement("rect", {
  21872. height: this.height_ + "px",
  21873. width: this.width_ + "px",
  21874. "fill-opacity": 0
  21875. }, this.fieldGroup_));
  21876. this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);
  21877. var a = this.rectElement_ || this.imageElement_;
  21878. a.tooltip = this.sourceBlock_;
  21879. Blockly.Tooltip.bindMouseEvents(a)
  21880. }
  21881. }
  21882. ;
  21883. Blockly.FieldImage.prototype.dispose = function () {
  21884. goog.dom.removeNode(this.fieldGroup_);
  21885. this.rectElement_ = this.imageElement_ = this.fieldGroup_ = null
  21886. }
  21887. ;
  21888. Blockly.FieldImage.prototype.setTooltip = function (a) {
  21889. (this.rectElement_ || this.imageElement_).tooltip = a
  21890. }
  21891. ;
  21892. Blockly.FieldImage.prototype.getValue = function () {
  21893. return this.src_
  21894. }
  21895. ;
  21896. Blockly.FieldImage.prototype.setValue = function (a) {
  21897. null !== a && (this.src_ = a,
  21898. this.imageElement_ && this.imageElement_.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", goog.isString(a) ? a : ""))
  21899. }
  21900. ;
  21901. Blockly.FieldImage.prototype.setText = function (a) {
  21902. null !== a && (this.text_ = a)
  21903. }
  21904. ;
  21905. Blockly.FieldImage.prototype.render_ = function () { }
  21906. ;
  21907. Blockly.FieldTextArea = function (a, b) {
  21908. Blockly.FieldTextArea.superClass_.constructor.call(this, a, b)
  21909. }
  21910. ;
  21911. goog.inherits(Blockly.FieldTextArea, Blockly.FieldTextInput);
  21912. Blockly.FieldTextArea.prototype.updateTextNode_ = function () {
  21913. if (this.textElement_) {
  21914. var a = this.text_;
  21915. goog.dom.removeChildren(this.textElement_);
  21916. a = a.replace(/ /g, Blockly.Field.NBSP);
  21917. this.sourceBlock_.RTL && a && (a += "\u200f");
  21918. a || (a = Blockly.Field.NBSP);
  21919. a = a.split("\n");
  21920. for (var b = "0em", c = 0; c < a.length; c++) {
  21921. var d = Blockly.createSvgElement("tspan", {
  21922. dy: b,
  21923. x: 0
  21924. }, this.textElement_);
  21925. b = "1em";
  21926. "" == a[c] && (a[c] = "\u3000");
  21927. var e = document.createTextNode(a[c]);
  21928. d.appendChild(e)
  21929. }
  21930. this.size_.width = 0
  21931. }
  21932. }
  21933. ;
  21934. Blockly.FieldTextArea.prototype.render_ = function () {
  21935. this.text_ = this.text_.replace(/\s+$/, "");
  21936. this.size_.width = this.textElement_.getBBox().width + 5;
  21937. this.size_.height = 20 * (this.text_.split(/\n/).length || 1) + (Blockly.BlockSvg.SEP_SPACE_Y + 5);
  21938. this.minWidth_ && this.size_.width < this.minWidth_ && (this.size_.width = this.minWidth_);
  21939. this.borderRect_ && (this.borderRect_.setAttribute("width", this.size_.width + Blockly.BlockSvg.SEP_SPACE_X),
  21940. this.borderRect_.setAttribute("height", this.size_.height - (Blockly.BlockSvg.SEP_SPACE_Y + 5)))
  21941. }
  21942. ;
  21943. Blockly.FieldTextArea.prototype.showEditor_ = function (a) {
  21944. var b = a || !1;
  21945. if (!b && (goog.userAgent.MOBILE || goog.userAgent.ANDROID || goog.userAgent.IPAD))
  21946. a = window.prompt(Blockly.Msg.CHANGE_VALUE_TITLE, this.text_),
  21947. this.changeHandler_ && (b = this.changeHandler_(a),
  21948. void 0 !== b && (a = b)),
  21949. null !== a && this.setText(a);
  21950. else {
  21951. Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, this.widgetDispose_());
  21952. var c = Blockly.WidgetDiv.DIV;
  21953. a = goog.dom.createDom("textarea", "blocklyHtmlInput");
  21954. Blockly.FieldTextInput.htmlInput_ = a;
  21955. a.style.resize = "none";
  21956. a.style["line-height"] = "20px";
  21957. a.style.height = "100%";
  21958. c.appendChild(a);
  21959. a.value = a.defaultValue = this.text_;
  21960. a.oldValue_ = null;
  21961. this.validate_();
  21962. this.resizeEditor_();
  21963. b || (a.focus(),
  21964. a.select());
  21965. a.onKeyDownWrapper_ = Blockly.bindEvent_(a, "keydown", this, this.onHtmlInputKeyDown_);
  21966. a.onKeyUpWrapper_ = Blockly.bindEvent_(a, "keyup", this, this.onHtmlInputChange_);
  21967. a.onKeyPressWrapper_ = Blockly.bindEvent_(a, "keypress", this, this.onHtmlInputChange_);
  21968. b = this.sourceBlock_.workspace.getCanvas();
  21969. a.onWorkspaceChangeWrapper_ = Blockly.bindEvent_(b, "blocklyWorkspaceChange", this, this.resizeEditor_)
  21970. }
  21971. }
  21972. ;
  21973. Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_ = function (a) {
  21974. var b = Blockly.FieldTextInput.htmlInput_;
  21975. a.keyCode == goog.events.KeyCodes.ESC && (this.setText(b.defaultValue),
  21976. Blockly.WidgetDiv.hide())
  21977. }
  21978. ;
  21979. Blockly.FieldTextArea.prototype.onHtmlInputChange_ = function (a) {
  21980. Blockly.FieldTextInput.prototype.onHtmlInputChange_.call(this, a);
  21981. var b = Blockly.FieldTextInput.htmlInput_;
  21982. a.keyCode == goog.events.KeyCodes.ESC ? (this.setText(b.defaultValue),
  21983. Blockly.WidgetDiv.hide()) : (Blockly.FieldTextInput.prototype.onHtmlInputChange_.call(this, a),
  21984. this.resizeEditor_())
  21985. }
  21986. ;
  21987. Blockly.FieldTextArea.prototype.resizeEditor_ = function () {
  21988. var a = Blockly.WidgetDiv.DIV
  21989. , b = this.fieldGroup_.getBBox();
  21990. a.style.width = b.width + "px";
  21991. a.style.height = b.height + "px";
  21992. b = this.getAbsoluteXY_();
  21993. if (this.RTL) {
  21994. var c = this.borderRect_.getBBox();
  21995. b.x += c.width;
  21996. b.x -= a.offsetWidth
  21997. }
  21998. b.y += 1;
  21999. goog.userAgent.WEBKIT && (b.y -= 3);
  22000. a.style.left = b.x + "px";
  22001. a.style.top = b.y + "px"
  22002. }
  22003. ;
  22004. Blockly.FieldTextArea.prototype.widgetDispose_ = function () {
  22005. var a = this;
  22006. return function () {
  22007. var b = Blockly.FieldTextInput.htmlInput_
  22008. , c = b.value;
  22009. a.changeHandler_ && (c = a.changeHandler_(c),
  22010. null === c && (c = b.defaultValue));
  22011. c = c.replace(/\s+$/, "");
  22012. a.setText(c);
  22013. a.sourceBlock_.rendered && a.sourceBlock_.render();
  22014. Blockly.unbindEvent_(b.onKeyUpWrapper_);
  22015. Blockly.unbindEvent_(b.onKeyPressWrapper_);
  22016. try {
  22017. a.sourceBlock_.workspace.removeChangeListener(b.onWorkspaceChangeWrapper_)
  22018. } catch (d) { }
  22019. Blockly.FieldTextInput.htmlInput_ = null;
  22020. b = Blockly.WidgetDiv.DIV.style;
  22021. b.width = "auto";
  22022. b.height = "auto";
  22023. b.fontSize = ""
  22024. }
  22025. }
  22026. ;
  22027. Blockly.FieldNumber = function (a, b, c, d, e) {
  22028. a = String(a);
  22029. Blockly.FieldNumber.superClass_.constructor.call(this, a, e);
  22030. this.setConstraints(b, c, d)
  22031. }
  22032. ;
  22033. goog.inherits(Blockly.FieldNumber, Blockly.FieldTextInput);
  22034. Blockly.FieldNumber.prototype.setConstraints = function (a, b, c) {
  22035. c = parseFloat(c);
  22036. this.precision_ = isNaN(c) ? 0 : c;
  22037. a = parseFloat(a);
  22038. this.min_ = isNaN(a) ? -Infinity : a;
  22039. b = parseFloat(b);
  22040. this.max_ = isNaN(b) ? Infinity : b;
  22041. this.setValue(this.callValidator(this.getValue()))
  22042. }
  22043. ;
  22044. Blockly.FieldNumber.prototype.classValidator = function (a) {
  22045. if (null === a)
  22046. return null;
  22047. a = String(a);
  22048. a = a.replace(/O/ig, "0");
  22049. a = a.replace(/,/g, "");
  22050. a = parseFloat(a || 0);
  22051. if (isNaN(a))
  22052. return null;
  22053. this.precision_ && isFinite(a) && (a = Math.round(a / this.precision_) * this.precision_);
  22054. a = goog.math.clamp(a, this.min_, this.max_);
  22055. return String(a)
  22056. }
  22057. ;
  22058. Blockly.Variables = {};
  22059. Blockly.Variables.NAME_TYPE = "VARIABLE";
  22060. Blockly.Variables.allUsedVariables = function (a) {
  22061. if (a instanceof Blockly.Block)
  22062. var b = a.getDescendants();
  22063. else if (a.getAllBlocks)
  22064. b = a.getAllBlocks();
  22065. else
  22066. throw "Not Block or Workspace: " + a;
  22067. a = Object.create(null);
  22068. for (var c = 0; c < b.length; c++) {
  22069. var d = b[c].getVars();
  22070. if (d)
  22071. for (var e = 0; e < d.length; e++) {
  22072. var f = d[e];
  22073. f && (a[f.toLowerCase()] = f)
  22074. }
  22075. }
  22076. b = [];
  22077. for (var g in a)
  22078. b.push(a[g]);
  22079. return b
  22080. }
  22081. ;
  22082. Blockly.Variables.allVariables = function (a) {
  22083. a instanceof Blockly.Block && console.warn("Deprecated call to Blockly.Variables.allVariables with a block instead of a workspace. You may want Blockly.Variables.allUsedVariables");
  22084. return a.variableList
  22085. }
  22086. ;
  22087. Blockly.Variables.flyoutCategory = function (a) {
  22088. a = a.variableList;
  22089. a.sort(goog.string.caseInsensitiveCompare);
  22090. var b = []
  22091. , c = goog.dom.createDom("button");
  22092. c.setAttribute("text", Blockly.Msg.NEW_VARIABLE);
  22093. c.setAttribute("callbackKey", "CREATE_VARIABLE");
  22094. Blockly.registerButtonCallback("CREATE_VARIABLE", function (a) {
  22095. Blockly.Variables.createVariable(a.getTargetWorkspace())
  22096. });
  22097. b.push(c);
  22098. if (0 < a.length) {
  22099. if (Blockly.Blocks.variables_set) {
  22100. c = goog.dom.createDom("block");
  22101. c.setAttribute("type", "variables_set");
  22102. Blockly.Blocks.math_change ? c.setAttribute("gap", 8) : c.setAttribute("gap", 24);
  22103. var d = goog.dom.createDom("field", null, a[0]);
  22104. d.setAttribute("name", "VAR");
  22105. c.appendChild(d);
  22106. var e = goog.dom.createDom("value");
  22107. e.setAttribute("name", "VALUE");
  22108. c.appendChild(e);
  22109. d = goog.dom.createDom("shadow");
  22110. d.setAttribute("type", "math_number");
  22111. e.appendChild(d);
  22112. e = goog.dom.createDom("field", null, "0");
  22113. e.setAttribute("name", "NUM");
  22114. d.appendChild(e);
  22115. b.push(c)
  22116. }
  22117. Blockly.Blocks.math_change && (c = goog.dom.createDom("block"),
  22118. c.setAttribute("type", "math_change"),
  22119. Blockly.Blocks.variables_get && c.setAttribute("gap", 20),
  22120. e = goog.dom.createDom("value"),
  22121. e.setAttribute("name", "DELTA"),
  22122. c.appendChild(e),
  22123. d = goog.dom.createDom("field", null, a[0]),
  22124. d.setAttribute("name", "VAR"),
  22125. c.appendChild(d),
  22126. d = goog.dom.createDom("shadow"),
  22127. d.setAttribute("type", "math_number"),
  22128. e.appendChild(d),
  22129. e = goog.dom.createDom("field", null, "1"),
  22130. e.setAttribute("name", "NUM"),
  22131. d.appendChild(e),
  22132. b.push(c));
  22133. for (e = 0; e < a.length; e++)
  22134. Blockly.Blocks.variables_get && (c = goog.dom.createDom("block"),
  22135. c.setAttribute("type", "variables_get"),
  22136. Blockly.Blocks.variables_set && c.setAttribute("gap", 8),
  22137. d = goog.dom.createDom("field", null, a[e]),
  22138. d.setAttribute("name", "VAR"),
  22139. c.appendChild(d),
  22140. b.push(c))
  22141. }
  22142. return b
  22143. }
  22144. ;
  22145. Blockly.Variables.generateUniqueName = function (a) {
  22146. a = a.variableList;
  22147. var b = "";
  22148. if (a.length)
  22149. for (var c = 1, d = 0, e = "ijkmnopqrstuvwxyzabcdefgh".charAt(d); !b;) {
  22150. for (var f = !1, g = 0; g < a.length; g++)
  22151. if (a[g].toLowerCase() == e) {
  22152. f = !0;
  22153. break
  22154. }
  22155. f ? (d++,
  22156. 25 == d && (d = 0,
  22157. c++),
  22158. e = "ijkmnopqrstuvwxyzabcdefgh".charAt(d),
  22159. 1 < c && (e += c)) : b = e
  22160. }
  22161. else
  22162. b = "i";
  22163. return b
  22164. }
  22165. ;
  22166. Blockly.Variables.createVariable = function (a, b) {
  22167. var c = function (d) {
  22168. Blockly.Variables.promptName(Blockly.Msg.NEW_VARIABLE_TITLE, d, function (d) {
  22169. d ? -1 != a.variableIndexOf(d) ? Blockly.alert(Blockly.Msg.VARIABLE_ALREADY_EXISTS.replace("%1", d.toLowerCase()), function () {
  22170. c(d)
  22171. }) : (a.createVariable(d),
  22172. b && b(d)) : b && b(null)
  22173. })
  22174. };
  22175. c("")
  22176. }
  22177. ;
  22178. Blockly.Variables.promptName = function (a, b, c) {
  22179. Blockly.prompt(a, b, function (a) {
  22180. a && (a = a.replace(/[\s\xa0]+/g, " ").replace(/^ | $/g, ""),
  22181. a == Blockly.Msg.RENAME_VARIABLE || a == Blockly.Msg.NEW_VARIABLE) && (a = null);
  22182. c(a)
  22183. })
  22184. }
  22185. ;
  22186. Blockly.FieldVariable = function (a, b) {
  22187. Blockly.FieldVariable.superClass_.constructor.call(this, Blockly.FieldVariable.dropdownCreate, b);
  22188. this.setValue(a || "")
  22189. }
  22190. ;
  22191. goog.inherits(Blockly.FieldVariable, Blockly.FieldDropdown);
  22192. Blockly.FieldVariable.prototype.renameVarItemIndex_ = -1;
  22193. Blockly.FieldVariable.prototype.deleteVarItemIndex_ = -1;
  22194. Blockly.FieldVariable.prototype.init = function () {
  22195. this.fieldGroup_ || (Blockly.FieldVariable.superClass_.init.call(this),
  22196. this.getValue() || this.setValue(Blockly.Variables.generateUniqueName(this.sourceBlock_.isInFlyout ? this.sourceBlock_.workspace.targetWorkspace : this.sourceBlock_.workspace)),
  22197. this.sourceBlock_.isInFlyout || this.sourceBlock_.workspace.createVariable(this.getValue()))
  22198. }
  22199. ;
  22200. Blockly.FieldVariable.prototype.setSourceBlock = function (a) {
  22201. goog.asserts.assert(!a.isShadow(), "Variable fields are not allowed to exist on shadow blocks.");
  22202. Blockly.FieldVariable.superClass_.setSourceBlock.call(this, a)
  22203. }
  22204. ;
  22205. Blockly.FieldVariable.prototype.getValue = function () {
  22206. return this.getText()
  22207. }
  22208. ;
  22209. Blockly.FieldVariable.prototype.setValue = function (a) {
  22210. this.sourceBlock_ && Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, this.value_, a));
  22211. this.value_ = a;
  22212. this.setText(a)
  22213. }
  22214. ;
  22215. Blockly.FieldVariable.dropdownCreate = function () {
  22216. var a = this.sourceBlock_ && this.sourceBlock_.workspace ? this.sourceBlock_.workspace.variableList.slice(0) : []
  22217. , b = this.getText();
  22218. b && -1 == a.indexOf(b) && a.push(b);
  22219. a.sort(goog.string.caseInsensitiveCompare);
  22220. this.renameVarItemIndex_ = a.length;
  22221. a.push(Blockly.Msg.RENAME_VARIABLE);
  22222. this.deleteVarItemIndex_ = a.length;
  22223. a.push(Blockly.Msg.DELETE_VARIABLE.replace("%1", b));
  22224. b = [];
  22225. for (var c = 0; c < a.length; c++)
  22226. b[c] = [a[c], a[c]];
  22227. return b
  22228. }
  22229. ;
  22230. Blockly.FieldVariable.prototype.onItemSelected = function (a, b) {
  22231. a.getChildCount();
  22232. var c = b.getValue();
  22233. if (this.sourceBlock_) {
  22234. var d = this.sourceBlock_.workspace;
  22235. if (0 <= this.renameVarItemIndex_ && a.getChildAt(this.renameVarItemIndex_) === b) {
  22236. var e = this.getText();
  22237. Blockly.hideChaff();
  22238. Blockly.Variables.promptName(Blockly.Msg.RENAME_VARIABLE_TITLE.replace("%1", e), e, function (a) {
  22239. a && d.renameVariable(e, a)
  22240. });
  22241. return
  22242. }
  22243. if (0 <= this.deleteVarItemIndex_ && a.getChildAt(this.deleteVarItemIndex_) === b) {
  22244. d.deleteVariable(this.getText());
  22245. return
  22246. }
  22247. c = this.callValidator(c)
  22248. }
  22249. null !== c && this.setValue(c)
  22250. }
  22251. ;
  22252. Blockly.Generator = function (a) {
  22253. this.name_ = a;
  22254. this.FUNCTION_NAME_PLACEHOLDER_REGEXP_ = new RegExp(this.FUNCTION_NAME_PLACEHOLDER_, "g")
  22255. }
  22256. ;
  22257. Blockly.Generator.NAME_TYPE = "generated_function";
  22258. Blockly.Generator.prototype.INFINITE_LOOP_TRAP = null;
  22259. Blockly.Generator.prototype.STATEMENT_PREFIX = null;
  22260. Blockly.Generator.prototype.INDENT = " ";
  22261. Blockly.Generator.prototype.COMMENT_WRAP = 60;
  22262. Blockly.Generator.prototype.ORDER_OVERRIDES = [];
  22263. Blockly.Generator.prototype.workspaceToCode = function (a) {
  22264. a || (console.warn("No workspace specified in workspaceToCode call. Guessing."),
  22265. a = Blockly.getMainWorkspace());
  22266. var b = [];
  22267. this.init(a);
  22268. a = a.getTopBlocks(!0);
  22269. for (var c = 0, d; d = a[c]; c++) {
  22270. var e = this.blockToCode(d);
  22271. goog.isArray(e) && (e = e[0]);
  22272. e && (d.outputConnection && this.scrubNakedValue && (e = this.scrubNakedValue(e)),
  22273. b.push(e))
  22274. }
  22275. b = b.join("\n");
  22276. b = this.finish(b);
  22277. b = b.replace(/^\s+\n/, "");
  22278. b = b.replace(/\n\s+$/, "\n");
  22279. return b = b.replace(/[ \t]+\n/g, "\n")
  22280. }
  22281. ;
  22282. Blockly.Generator.prototype.prefixLines = function (a, b) {
  22283. return b + a.replace(/(?!\n$)\n/g, "\n" + b)
  22284. }
  22285. ;
  22286. Blockly.Generator.prototype.allNestedComments = function (a) {
  22287. var b = [];
  22288. a = a.getDescendants();
  22289. for (var c = 0; c < a.length; c++) {
  22290. var d = a[c].getCommentText();
  22291. d && b.push(d)
  22292. }
  22293. b.length && b.push("");
  22294. return b.join("\n")
  22295. }
  22296. ;
  22297. Blockly.Generator.prototype.blockToCode = function (a) {
  22298. if (!a)
  22299. return "";
  22300. if (a.disabled)
  22301. return this.blockToCode(a.getNextBlock());
  22302. var b = this[a.type];
  22303. goog.asserts.assertFunction(b, 'Language "%s" does not know how to generate code for block type "%s".', this.name_, a.type);
  22304. b = b.call(a, a);
  22305. if (goog.isArray(b))
  22306. return goog.asserts.assert(a.outputConnection, 'Expecting string from statement block "%s".', a.type),
  22307. [this.scrub_(a, b[0]), b[1]];
  22308. if (goog.isString(b)) {
  22309. var c = a.id.replace(/\$/g, "$$$$");
  22310. this.STATEMENT_PREFIX && (b = this.STATEMENT_PREFIX.replace(/%1/g, "'" + c + "'") + b);
  22311. return this.scrub_(a, b)
  22312. }
  22313. if (null === b)
  22314. return "";
  22315. goog.asserts.fail("Invalid code generated: %s", b)
  22316. }
  22317. ;
  22318. Blockly.Generator.prototype.valueToCode = function (a, b, c) {
  22319. isNaN(c) && goog.asserts.fail('Expecting valid order from block "%s".', a.type);
  22320. var d = a.getInputTargetBlock(b);
  22321. if (!d)
  22322. return "";
  22323. b = this.blockToCode(d);
  22324. if ("" === b)
  22325. return "";
  22326. goog.asserts.assertArray(b, 'Expecting tuple from value block "%s".', d.type);
  22327. a = b[0];
  22328. b = b[1];
  22329. isNaN(b) && goog.asserts.fail('Expecting valid order from value block "%s".', d.type);
  22330. if (!a)
  22331. return "";
  22332. d = !1;
  22333. var e = Math.floor(c)
  22334. , f = Math.floor(b);
  22335. if (e <= f && (e != f || 0 != e && 99 != e))
  22336. for (d = !0,
  22337. e = 0; e < this.ORDER_OVERRIDES.length; e++)
  22338. if (this.ORDER_OVERRIDES[e][0] == c && this.ORDER_OVERRIDES[e][1] == b) {
  22339. d = !1;
  22340. break
  22341. }
  22342. d && (a = "(" + a + ")");
  22343. return a
  22344. }
  22345. ;
  22346. Blockly.Generator.prototype.statementToCode = function (a, b) {
  22347. var c = a.getInputTargetBlock(b)
  22348. , d = this.blockToCode(c);
  22349. goog.asserts.assertString(d, 'Expecting code from statement block "%s".', c && c.type);
  22350. d && (d = this.prefixLines(d, this.INDENT));
  22351. return d
  22352. }
  22353. ;
  22354. Blockly.Generator.prototype.addLoopTrap = function (a, b) {
  22355. b = b.replace(/\$/g, "$$$$");
  22356. this.INFINITE_LOOP_TRAP && (a = this.INFINITE_LOOP_TRAP.replace(/%1/g, "'" + b + "'") + a);
  22357. this.STATEMENT_PREFIX && (a += this.prefixLines(this.STATEMENT_PREFIX.replace(/%1/g, "'" + b + "'"), this.INDENT));
  22358. return a
  22359. }
  22360. ;
  22361. Blockly.Generator.prototype.RESERVED_WORDS_ = "";
  22362. Blockly.Generator.prototype.addReservedWords = function (a) {
  22363. this.RESERVED_WORDS_ += a + ","
  22364. }
  22365. ;
  22366. Blockly.Generator.prototype.FUNCTION_NAME_PLACEHOLDER_ = "{leCUI8hutHZI4480Dc}";
  22367. Blockly.Generator.prototype.provideFunction_ = function (a, b) {
  22368. if (!this.definitions_[a]) {
  22369. var c = this.variableDB_.getDistinctName(a, Blockly.Procedures.NAME_TYPE);
  22370. this.functionNames_[a] = c;
  22371. c = b.join("\n").replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_, c);
  22372. for (var d; d != c;)
  22373. d = c,
  22374. c = c.replace(/^(( )*) /gm, "$1\x00");
  22375. c = c.replace(/\0/g, this.INDENT);
  22376. this.definitions_[a] = c
  22377. }
  22378. return this.functionNames_[a]
  22379. }
  22380. ;
  22381. Blockly.Names = function (a, b) {
  22382. this.variablePrefix_ = b || "";
  22383. this.reservedDict_ = Object.create(null);
  22384. if (a)
  22385. for (var c = a.split(","), d = 0; d < c.length; d++)
  22386. this.reservedDict_[c[d]] = !0;
  22387. this.reset()
  22388. }
  22389. ;
  22390. Blockly.Names.prototype.reset = function () {
  22391. this.db_ = Object.create(null);
  22392. this.dbReverse_ = Object.create(null)
  22393. }
  22394. ;
  22395. Blockly.Names.prototype.getName = function (a, b) {
  22396. var c = a.toLowerCase() + "_" + b
  22397. , d = b == Blockly.Variables.NAME_TYPE ? this.variablePrefix_ : "";
  22398. if (c in this.db_)
  22399. return d + this.db_[c];
  22400. var e = this.getDistinctName(a, b);
  22401. this.db_[c] = e.substr(d.length);
  22402. return e
  22403. }
  22404. ;
  22405. Blockly.Names.prototype.getDistinctName = function (a, b) {
  22406. var c = this.safeName_(a);
  22407. this.dbReverse_[c] = !0;
  22408. return (b == Blockly.Variables.NAME_TYPE ? this.variablePrefix_ : "") + c
  22409. }
  22410. ;
  22411. Blockly.Names.prototype.safeName_ = function (a) {
  22412. a ? (a = encodeURI(a.replace(/ /g, "_")).replace(/[^\w]/g, "_"),
  22413. -1 != "0123456789".indexOf(a[0]) && (a = "my_" + a)) : a = "unnamed";
  22414. return a
  22415. }
  22416. ;
  22417. Blockly.Names.equals = function (a, b) {
  22418. return a.toLowerCase() == b.toLowerCase()
  22419. }
  22420. ;
  22421. Blockly.Procedures = {};
  22422. Blockly.Procedures.NAME_TYPE = "PROCEDURE";
  22423. Blockly.Procedures.allProcedures = function (a) {
  22424. a = a.getAllBlocks()
  22425. for (var b = [], c = [], f = [], d = 0; d < a.length; d++)
  22426. if (a[d].getProcedureDef) {
  22427. var e = a[d].getProcedureDef();
  22428. console.log("11111111", e)
  22429. e && (e[2] == 0 ? b.push(e) : e[2] == "1" ? c.push(e) : f.push(e))
  22430. }
  22431. c.sort(Blockly.Procedures.procTupleComparator_);
  22432. b.sort(Blockly.Procedures.procTupleComparator_);
  22433. f.sort(Blockly.Procedures.procTupleComparator_);
  22434. return [c, b, f]
  22435. }
  22436. ;
  22437. Blockly.Procedures.procTupleComparator_ = function (a, b) {
  22438. return a[0].toLowerCase().localeCompare(b[0].toLowerCase())
  22439. }
  22440. ;
  22441. Blockly.Procedures.findLegalName = function (a, b) {
  22442. if (b.isInFlyout)
  22443. return a;
  22444. for (; !Blockly.Procedures.isLegalName_(a, b.workspace, b);) {
  22445. var c = a.match(/^(.*?)(\d+)$/);
  22446. a = c ? c[1] + (parseInt(c[2], 10) + 1) : a + "2"
  22447. }
  22448. return a
  22449. }
  22450. ;
  22451. Blockly.Procedures.isLegalName_ = function (a, b, c) {
  22452. b = b.getAllBlocks();
  22453. for (var d = 0; d < b.length; d++)
  22454. if (b[d] != c && b[d].getProcedureDef) {
  22455. var e = b[d].getProcedureDef();
  22456. if (Blockly.Names.equals(e[0], a))
  22457. return !1
  22458. }
  22459. return !0
  22460. }
  22461. ;
  22462. Blockly.Procedures.rename = function (a) {
  22463. a = a.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "");
  22464. var b = Blockly.Procedures.findLegalName(a, this.sourceBlock_)
  22465. , c = this.text_;
  22466. if (c != a && c != b) {
  22467. a = this.sourceBlock_.workspace.getAllBlocks();
  22468. for (var d = 0; d < a.length; d++)
  22469. a[d].renameProcedure && a[d].renameProcedure(c, b)
  22470. }
  22471. return b
  22472. }
  22473. ;
  22474. Blockly.Procedures.flyoutCategory = function (a) {
  22475. function b(a, b) {
  22476. for (var d = 0; d < a.length; d++) {
  22477. var e = a[d][0]
  22478. , f = a[d][1]
  22479. , m = goog.dom.createDom("block");
  22480. m.setAttribute("type", b);
  22481. m.setAttribute("gap", 16);
  22482. var p = goog.dom.createDom("mutation");
  22483. p.setAttribute("name", e);
  22484. m.appendChild(p);
  22485. for (e = 0; e < f.length; e++) {
  22486. var l = goog.dom.createDom("arg");
  22487. l.setAttribute("name", f[e]);
  22488. p.appendChild(l)
  22489. }
  22490. c.push(m)
  22491. }
  22492. }
  22493. var c = [];
  22494. if (Blockly.Blocks.procedures_defnoreturn) {
  22495. var d = goog.dom.createDom("block");
  22496. d.setAttribute("type", "procedures_defnoreturn");
  22497. d.setAttribute("gap", 16);
  22498. c.push(d)
  22499. }
  22500. Blockly.Blocks.procedures_defreturn && (d = goog.dom.createDom("block"),
  22501. d.setAttribute("type", "procedures_defreturn"),
  22502. d.setAttribute("gap", 16),
  22503. c.push(d));
  22504. Blockly.Blocks.procedures_ifreturn && (d = goog.dom.createDom("block"),
  22505. d.setAttribute("type", "procedures_ifreturn"),
  22506. d.setAttribute("gap", 16),
  22507. c.push(d));
  22508. c.length && c[c.length - 1].setAttribute("gap", 24);
  22509. a = Blockly.Procedures.allProcedures(a);
  22510. b(a[0], "procedures_callnoreturn");
  22511. b(a[1], "procedures_callreturn");
  22512. b(a[2], "procedures_callNothirdreturn");
  22513. return c
  22514. }
  22515. ;
  22516. Blockly.Procedures.getCallers = function (a, b) {
  22517. for (var c = [], d = b.getAllBlocks(), e = 0; e < d.length; e++)
  22518. if (d[e].getProcedureCall) {
  22519. var f = d[e].getProcedureCall();
  22520. f && Blockly.Names.equals(f, a) && c.push(d[e])
  22521. }
  22522. return c
  22523. }
  22524. ;
  22525. Blockly.Procedures.mutateCallers = function (a) {
  22526. var b = Blockly.Events.recordUndo
  22527. , c = a.getProcedureDef()[0]
  22528. , d = a.mutationToDom(!0);
  22529. a = Blockly.Procedures.getCallers(c, a.workspace);
  22530. c = 0;
  22531. for (var e; e = a[c]; c++) {
  22532. var f = e.mutationToDom();
  22533. f = f && Blockly.Xml.domToText(f);
  22534. e.domToMutation(d);
  22535. var g = e.mutationToDom();
  22536. g = g && Blockly.Xml.domToText(g);
  22537. f != g && (Blockly.Events.recordUndo = !1,
  22538. Blockly.Events.fire(new Blockly.Events.Change(e, "mutation", null, f, g)),
  22539. Blockly.Events.recordUndo = b)
  22540. }
  22541. }
  22542. ;
  22543. Blockly.Procedures.getDefinition = function (a, b) {
  22544. for (var c = b.getTopBlocks(!1), d = 0; d < c.length; d++)
  22545. if (c[d].getProcedureDef) {
  22546. var e = c[d].getProcedureDef();
  22547. if (e && Blockly.Names.equals(e[0], a))
  22548. return c[d]
  22549. }
  22550. return null
  22551. }
  22552. ;
  22553. Blockly.FlyoutButton = function (a, b, c, d, e) {
  22554. this.workspace_ = a;
  22555. this.targetWorkspace_ = b;
  22556. this.text_ = c;
  22557. this.position_ = new goog.math.Coordinate(0, 0);
  22558. this.callback_ = Blockly.flyoutButtonCallbacks_[d];
  22559. this.isLabel_ = e
  22560. }
  22561. ;
  22562. Blockly.FlyoutButton.MARGIN = 5;
  22563. Blockly.FlyoutButton.prototype.width = 0;
  22564. Blockly.FlyoutButton.prototype.height = 0;
  22565. Blockly.FlyoutButton.prototype.createDom = function () {
  22566. this.svgGroup_ = Blockly.createSvgElement("g", {
  22567. "class": this.isLabel_ ? "blocklyFlyoutLabel" : "blocklyFlyoutButton"
  22568. }, this.workspace_.getCanvas());
  22569. if (!this.isLabel_)
  22570. var a = Blockly.createSvgElement("rect", {
  22571. "class": "blocklyFlyoutButtonShadow",
  22572. rx: 4,
  22573. ry: 4,
  22574. x: 1,
  22575. y: 1
  22576. }, this.svgGroup_);
  22577. var b = Blockly.createSvgElement("rect", {
  22578. "class": this.isLabel_ ? "blocklyFlyoutLabelBackground" : "blocklyFlyoutButtonBackground",
  22579. rx: 4,
  22580. ry: 4
  22581. }, this.svgGroup_)
  22582. , c = Blockly.createSvgElement("text", {
  22583. "class": this.isLabel_ ? "blocklyFlyoutLabelText" : "blocklyText",
  22584. x: 0,
  22585. y: 0,
  22586. "text-anchor": "middle"
  22587. }, this.svgGroup_);
  22588. c.textContent = this.text_;
  22589. this.width = c.getComputedTextLength() + 2 * Blockly.FlyoutButton.MARGIN;
  22590. this.height = 20;
  22591. this.isLabel_ || (a.setAttribute("width", this.width),
  22592. a.setAttribute("height", this.height));
  22593. b.setAttribute("width", this.width);
  22594. b.setAttribute("height", this.height);
  22595. c.setAttribute("x", this.width / 2);
  22596. c.setAttribute("y", this.height - Blockly.FlyoutButton.MARGIN);
  22597. this.updateTransform_();
  22598. return this.svgGroup_
  22599. }
  22600. ;
  22601. Blockly.FlyoutButton.prototype.show = function () {
  22602. this.updateTransform_();
  22603. this.svgGroup_.setAttribute("display", "block")
  22604. }
  22605. ;
  22606. Blockly.FlyoutButton.prototype.updateTransform_ = function () {
  22607. this.svgGroup_.setAttribute("transform", "translate(" + this.position_.x + "," + this.position_.y + ")")
  22608. }
  22609. ;
  22610. Blockly.FlyoutButton.prototype.moveTo = function (a, b) {
  22611. this.position_.x = a;
  22612. this.position_.y = b;
  22613. this.updateTransform_()
  22614. }
  22615. ;
  22616. Blockly.FlyoutButton.prototype.getTargetWorkspace = function () {
  22617. return this.targetWorkspace_
  22618. }
  22619. ;
  22620. Blockly.FlyoutButton.prototype.dispose = function () {
  22621. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  22622. this.svgGroup_ = null);
  22623. this.targetWorkspace_ = this.workspace_ = null
  22624. }
  22625. ;
  22626. Blockly.FlyoutButton.prototype.onMouseUp = function (a) {
  22627. a.preventDefault();
  22628. a.stopPropagation();
  22629. Blockly.Flyout.terminateDrag_();
  22630. this.callback_ && this.callback_(this)
  22631. }
  22632. ;
  22633. Blockly.Flyout = function (a) {
  22634. a.getMetrics = this.getMetrics_.bind(this);
  22635. a.setMetrics = this.setMetrics_.bind(this);
  22636. this.workspace_ = new Blockly.WorkspaceSvg(a);
  22637. this.workspace_.isFlyout = !0;
  22638. this.RTL = !!a.RTL;
  22639. this.horizontalLayout_ = a.horizontalLayout;
  22640. this.toolboxPosition_ = a.toolboxPosition;
  22641. this.eventWrappers_ = [];
  22642. this.backgroundButtons_ = [];
  22643. this.buttons_ = [];
  22644. this.listeners_ = [];
  22645. this.permanentlyDisabled_ = [];
  22646. this.startDragMouseX_ = this.startDragMouseY_ = 0
  22647. }
  22648. ;
  22649. Blockly.Flyout.startFlyout_ = null;
  22650. Blockly.Flyout.startDownEvent_ = null;
  22651. Blockly.Flyout.startBlock_ = null;
  22652. Blockly.Flyout.onMouseUpWrapper_ = null;
  22653. Blockly.Flyout.onMouseMoveWrapper_ = null;
  22654. Blockly.Flyout.onMouseMoveBlockWrapper_ = null;
  22655. Blockly.Flyout.prototype.autoClose = !0;
  22656. Blockly.Flyout.prototype.CORNER_RADIUS = 8;
  22657. Blockly.Flyout.prototype.DRAG_RADIUS = 10;
  22658. Blockly.Flyout.prototype.MARGIN = Blockly.Flyout.prototype.CORNER_RADIUS;
  22659. Blockly.Flyout.prototype.GAP_X = 3 * Blockly.Flyout.prototype.MARGIN;
  22660. Blockly.Flyout.prototype.GAP_Y = 3 * Blockly.Flyout.prototype.MARGIN;
  22661. Blockly.Flyout.prototype.SCROLLBAR_PADDING = 2;
  22662. Blockly.Flyout.prototype.width_ = 0;
  22663. Blockly.Flyout.prototype.height_ = 0;
  22664. Blockly.Flyout.prototype.dragMode_ = Blockly.DRAG_NONE;
  22665. Blockly.Flyout.prototype.dragAngleRange_ = 70;
  22666. Blockly.Flyout.prototype.createDom = function () {
  22667. this.svgGroup_ = Blockly.createSvgElement("g", {
  22668. "class": "blocklyFlyout"
  22669. }, null);
  22670. this.svgBackground_ = Blockly.createSvgElement("path", {
  22671. "class": "blocklyFlyoutBackground"
  22672. }, this.svgGroup_);
  22673. this.svgGroup_.appendChild(this.workspace_.createDom());
  22674. return this.svgGroup_
  22675. }
  22676. ;
  22677. Blockly.Flyout.prototype.init = function (a) {
  22678. this.targetWorkspace_ = a;
  22679. this.workspace_.targetWorkspace = a;
  22680. this.scrollbar_ = new Blockly.Scrollbar(this.workspace_, this.horizontalLayout_, !1);
  22681. this.hide();
  22682. Array.prototype.push.apply(this.eventWrappers_, Blockly.bindEventWithChecks_(this.svgGroup_, "wheel", this, this.wheel_));
  22683. this.autoClose || (this.filterWrapper_ = this.filterForCapacity_.bind(this),
  22684. this.targetWorkspace_.addChangeListener(this.filterWrapper_));
  22685. Array.prototype.push.apply(this.eventWrappers_, Blockly.bindEventWithChecks_(this.svgGroup_, "mousedown", this, this.onMouseDown_))
  22686. }
  22687. ;
  22688. Blockly.Flyout.prototype.dispose = function () {
  22689. this.hide();
  22690. Blockly.unbindEvent_(this.eventWrappers_);
  22691. this.filterWrapper_ && (this.targetWorkspace_.removeChangeListener(this.filterWrapper_),
  22692. this.filterWrapper_ = null);
  22693. this.scrollbar_ && (this.scrollbar_.dispose(),
  22694. this.scrollbar_ = null);
  22695. this.workspace_ && (this.workspace_.targetWorkspace = null,
  22696. this.workspace_.dispose(),
  22697. this.workspace_ = null);
  22698. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  22699. this.svgGroup_ = null);
  22700. this.targetWorkspace_ = this.svgBackground_ = null
  22701. }
  22702. ;
  22703. Blockly.Flyout.prototype.getWidth = function () {
  22704. return this.width_
  22705. }
  22706. ;
  22707. Blockly.Flyout.prototype.getHeight = function () {
  22708. return this.height_
  22709. }
  22710. ;
  22711. Blockly.Flyout.prototype.getMetrics_ = function () {
  22712. if (!this.isVisible())
  22713. return null;
  22714. try {
  22715. var a = this.workspace_.getCanvas().getBBox()
  22716. } catch (f) {
  22717. a = {
  22718. height: 0,
  22719. y: 0,
  22720. width: 0,
  22721. x: 0
  22722. }
  22723. }
  22724. var b = this.SCROLLBAR_PADDING
  22725. , c = this.SCROLLBAR_PADDING;
  22726. if (this.horizontalLayout_) {
  22727. this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM && (b = 0);
  22728. var d = this.height_;
  22729. this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP && (d -= this.SCROLLBAR_PADDING);
  22730. var e = this.width_ - 2 * this.SCROLLBAR_PADDING
  22731. } else
  22732. c = 0,
  22733. d = this.height_ - 2 * this.SCROLLBAR_PADDING,
  22734. e = this.width_,
  22735. this.RTL || (e -= this.SCROLLBAR_PADDING);
  22736. return {
  22737. viewHeight: d,
  22738. viewWidth: e,
  22739. contentHeight: (a.height + 2 * this.MARGIN) * this.workspace_.scale,
  22740. contentWidth: (a.width + 2 * this.MARGIN) * this.workspace_.scale,
  22741. viewTop: -this.workspace_.scrollY,
  22742. viewLeft: -this.workspace_.scrollX,
  22743. contentTop: a.y,
  22744. contentLeft: a.x,
  22745. absoluteTop: b,
  22746. absoluteLeft: c
  22747. }
  22748. }
  22749. ;
  22750. Blockly.Flyout.prototype.setMetrics_ = function (a) {
  22751. var b = this.getMetrics_();
  22752. b && (!this.horizontalLayout_ && goog.isNumber(a.y) ? this.workspace_.scrollY = -b.contentHeight * a.y : this.horizontalLayout_ && goog.isNumber(a.x) && (this.workspace_.scrollX = -b.contentWidth * a.x),
  22753. this.workspace_.translate(this.workspace_.scrollX + b.absoluteLeft, this.workspace_.scrollY + b.absoluteTop))
  22754. }
  22755. ;
  22756. Blockly.Flyout.prototype.position = function () {
  22757. if (this.isVisible()) {
  22758. var a = this.targetWorkspace_.getMetrics();
  22759. if (a) {
  22760. this.setBackgroundPath_(this.horizontalLayout_ ? a.viewWidth - 2 * this.CORNER_RADIUS : this.width_ - this.CORNER_RADIUS, this.horizontalLayout_ ? this.height_ - this.CORNER_RADIUS : a.viewHeight - 2 * this.CORNER_RADIUS);
  22761. var b = a.absoluteLeft;
  22762. this.toolboxPosition_ == Blockly.TOOLBOX_AT_RIGHT && (b += a.viewWidth,
  22763. b -= this.width_);
  22764. var c = a.absoluteTop;
  22765. this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM && (c += a.viewHeight,
  22766. c -= this.height_);
  22767. this.svgGroup_.setAttribute("transform", "translate(" + b + "," + c + ")");
  22768. this.horizontalLayout_ ? this.width_ = a.viewWidth : this.height_ = a.viewHeight;
  22769. this.scrollbar_ && this.scrollbar_.resize()
  22770. }
  22771. }
  22772. }
  22773. ;
  22774. Blockly.Flyout.prototype.setBackgroundPath_ = function (a, b) {
  22775. this.horizontalLayout_ ? this.setBackgroundPathHorizontal_(a, b) : this.setBackgroundPathVertical_(a, b)
  22776. }
  22777. ;
  22778. Blockly.Flyout.prototype.setBackgroundPathVertical_ = function (a, b) {
  22779. var c = this.toolboxPosition_ == Blockly.TOOLBOX_AT_RIGHT
  22780. , d = a + this.CORNER_RADIUS;
  22781. d = ["M " + (c ? d : 0) + ",0"];
  22782. d.push("h", c ? -a : a);
  22783. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, c ? 0 : 1, c ? -this.CORNER_RADIUS : this.CORNER_RADIUS, this.CORNER_RADIUS);
  22784. d.push("v", Math.max(0, b));
  22785. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, c ? 0 : 1, c ? this.CORNER_RADIUS : -this.CORNER_RADIUS, this.CORNER_RADIUS);
  22786. d.push("h", c ? a : -a);
  22787. d.push("z");
  22788. this.svgBackground_.setAttribute("d", d.join(" "))
  22789. }
  22790. ;
  22791. Blockly.Flyout.prototype.setBackgroundPathHorizontal_ = function (a, b) {
  22792. var c = this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP
  22793. , d = ["M 0," + (c ? 0 : this.CORNER_RADIUS)];
  22794. c ? (d.push("h", a + 2 * this.CORNER_RADIUS),
  22795. d.push("v", b),
  22796. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1, -this.CORNER_RADIUS, this.CORNER_RADIUS),
  22797. d.push("h", -1 * a),
  22798. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1, -this.CORNER_RADIUS, -this.CORNER_RADIUS)) : (d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1, this.CORNER_RADIUS, -this.CORNER_RADIUS),
  22799. d.push("h", a),
  22800. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1, this.CORNER_RADIUS, this.CORNER_RADIUS),
  22801. d.push("v", b),
  22802. d.push("h", -a - 2 * this.CORNER_RADIUS));
  22803. d.push("z");
  22804. this.svgBackground_.setAttribute("d", d.join(" "))
  22805. }
  22806. ;
  22807. Blockly.Flyout.prototype.scrollToStart = function () {
  22808. this.scrollbar_.set(this.horizontalLayout_ && this.RTL ? Infinity : 0)
  22809. }
  22810. ;
  22811. Blockly.Flyout.prototype.wheel_ = function (a) {
  22812. var b = this.horizontalLayout_ ? a.deltaX : a.deltaY;
  22813. if (b) {
  22814. goog.userAgent.GECKO && (b *= 10);
  22815. var c = this.getMetrics_();
  22816. b = this.horizontalLayout_ ? c.viewLeft + b : c.viewTop + b;
  22817. b = Math.min(b, this.horizontalLayout_ ? c.contentWidth - c.viewWidth : c.contentHeight - c.viewHeight);
  22818. b = Math.max(b, 0);
  22819. this.scrollbar_.set(b)
  22820. }
  22821. a.preventDefault();
  22822. a.stopPropagation()
  22823. }
  22824. ;
  22825. Blockly.Flyout.prototype.isVisible = function () {
  22826. return this.svgGroup_ && "block" == this.svgGroup_.style.display
  22827. }
  22828. ;
  22829. Blockly.Flyout.prototype.hide = function () {
  22830. if (this.isVisible()) {
  22831. this.svgGroup_.style.display = "none";
  22832. for (var a = 0, b; b = this.listeners_[a]; a++)
  22833. Blockly.unbindEvent_(b);
  22834. this.listeners_.length = 0;
  22835. this.reflowWrapper_ && (this.workspace_.removeChangeListener(this.reflowWrapper_),
  22836. this.reflowWrapper_ = null)
  22837. }
  22838. }
  22839. ;
  22840. Blockly.Flyout.prototype.show = function (a) {
  22841. this.hide();
  22842. this.clearOldBlocks_();
  22843. a == Blockly.Variables.NAME_TYPE ? a = Blockly.Variables.flyoutCategory(this.workspace_.targetWorkspace) : a == Blockly.Procedures.NAME_TYPE && (a = Blockly.Procedures.flyoutCategory(this.workspace_.targetWorkspace));
  22844. this.svgGroup_.style.display = "block";
  22845. for (var b = [], c = [], d = this.permanentlyDisabled_.length = 0, e; e = a[d]; d++)
  22846. if (e.tagName) {
  22847. var f = e.tagName.toUpperCase()
  22848. , g = this.horizontalLayout_ ? this.GAP_X : this.GAP_Y;
  22849. if ("BLOCK" == f)
  22850. f = Blockly.Xml.domToBlock(e, this.workspace_),
  22851. f.disabled && this.permanentlyDisabled_.push(f),
  22852. b.push({
  22853. type: "block",
  22854. block: f
  22855. }),
  22856. e = parseInt(e.getAttribute("gap"), 10),
  22857. c.push(isNaN(e) ? g : e);
  22858. else if ("SEP" == e.tagName.toUpperCase())
  22859. e = parseInt(e.getAttribute("gap"), 10),
  22860. !isNaN(e) && 0 < c.length ? c[c.length - 1] = e : c.push(g);
  22861. else if ("BUTTON" == f || "LABEL" == f) {
  22862. f = "LABEL" == f;
  22863. var h = e.getAttribute("text");
  22864. e = e.getAttribute("callbackKey");
  22865. e = new Blockly.FlyoutButton(this.workspace_, this.targetWorkspace_, h, e, f);
  22866. b.push({
  22867. type: "button",
  22868. button: e
  22869. });
  22870. c.push(g)
  22871. }
  22872. }
  22873. this.layout_(b, c);
  22874. this.listeners_.push(Blockly.bindEventWithChecks_(this.svgBackground_, "mouseover", this, function () {
  22875. for (var a = this.workspace_.getTopBlocks(!1), b = 0, c; c = a[b]; b++)
  22876. c.removeSelect()
  22877. }));
  22878. this.horizontalLayout_ ? this.height_ = 0 : this.width_ = 0;
  22879. this.reflow();
  22880. this.filterForCapacity_();
  22881. this.position();
  22882. this.reflowWrapper_ = this.reflow.bind(this);
  22883. this.workspace_.addChangeListener(this.reflowWrapper_)
  22884. }
  22885. ;
  22886. Blockly.Flyout.prototype.layout_ = function (a, b) {
  22887. this.workspace_.scale = this.targetWorkspace_.scale;
  22888. var c = this.MARGIN
  22889. , d = this.RTL ? c : c + Blockly.BlockSvg.TAB_WIDTH;
  22890. this.horizontalLayout_ && this.RTL && (a = a.reverse());
  22891. for (var e = 0, f; f = a[e]; e++)
  22892. if ("block" == f.type) {
  22893. f = f.block;
  22894. for (var g = f.getDescendants(), h = 0, k; k = g[h]; h++)
  22895. k.isInFlyout = !0;
  22896. f.render();
  22897. g = f.getSvgRoot();
  22898. h = f.getHeightWidth();
  22899. k = f.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0;
  22900. this.horizontalLayout_ && (d += k);
  22901. f.moveBy(this.horizontalLayout_ && this.RTL ? d + h.width - k : d, c);
  22902. this.horizontalLayout_ ? d += h.width + b[e] - k : c += h.height + b[e];
  22903. h = Blockly.createSvgElement("rect", {
  22904. "fill-opacity": 0
  22905. }, null);
  22906. h.tooltip = f;
  22907. Blockly.Tooltip.bindMouseEvents(h);
  22908. this.workspace_.getCanvas().insertBefore(h, f.getSvgRoot());
  22909. f.flyoutRect_ = h;
  22910. this.backgroundButtons_[e] = h;
  22911. this.addBlockListeners_(g, f, h)
  22912. } else
  22913. "button" == f.type && (f = f.button,
  22914. g = f.createDom(),
  22915. f.moveTo(d, c),
  22916. f.show(),
  22917. Blockly.bindEventWithChecks_(g, "mouseup", f, f.onMouseUp),
  22918. this.buttons_.push(f),
  22919. this.horizontalLayout_ ? d += f.width + b[e] : c += f.height + b[e])
  22920. }
  22921. ;
  22922. Blockly.Flyout.prototype.clearOldBlocks_ = function () {
  22923. for (var a = this.workspace_.getTopBlocks(!1), b = 0, c; c = a[b]; b++)
  22924. c.workspace == this.workspace_ && c.dispose(!1, !1);
  22925. for (b = 0; b < this.backgroundButtons_.length; b++) {
  22926. if (a = this.backgroundButtons_[b]) {
  22927. goog.dom.removeNode(a);
  22928. }
  22929. }
  22930. for (b = this.backgroundButtons_.length = 0; b < this.buttons_.length; b++) {
  22931. if (a = this.buttons_[b]) {
  22932. a.dispose();
  22933. }
  22934. }
  22935. this.buttons_.length = 0
  22936. }
  22937. ;
  22938. Blockly.Flyout.prototype.addBlockListeners_ = function (a, b, c) {
  22939. this.listeners_.push(Blockly.bindEventWithChecks_(a, "mousedown", null, this.blockMouseDown_(b)));
  22940. this.listeners_.push(Blockly.bindEventWithChecks_(c, "mousedown", null, this.blockMouseDown_(b)));
  22941. this.listeners_.push(Blockly.bindEvent_(a, "mouseover", b, b.addSelect));
  22942. this.listeners_.push(Blockly.bindEvent_(a, "mouseout", b, b.removeSelect));
  22943. this.listeners_.push(Blockly.bindEvent_(c, "mouseover", b, b.addSelect));
  22944. this.listeners_.push(Blockly.bindEvent_(c, "mouseout", b, b.removeSelect))
  22945. }
  22946. ;
  22947. Blockly.Flyout.blockRightClick_ = function (a, b) {
  22948. Blockly.terminateDrag_();
  22949. Blockly.hideChaff(!0);
  22950. b.showContextMenu_(a);
  22951. Blockly.Touch.clearTouchIdentifier()
  22952. }
  22953. ;
  22954. Blockly.Flyout.prototype.blockMouseDown_ = function (a) {
  22955. var b = this;
  22956. return function (c) {
  22957. Blockly.isRightButton(c) ? Blockly.Flyout.blockRightClick_(c, a) : (Blockly.terminateDrag_(),
  22958. Blockly.hideChaff(!0),
  22959. Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),
  22960. b.startDragMouseY_ = c.clientY,
  22961. b.startDragMouseX_ = c.clientX,
  22962. Blockly.Flyout.startDownEvent_ = c,
  22963. Blockly.Flyout.startBlock_ = a,
  22964. Blockly.Flyout.startFlyout_ = b,
  22965. Blockly.Flyout.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", b, b.onMouseUp_),
  22966. Blockly.Flyout.onMouseMoveBlockWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", b, b.onMouseMoveBlock_));
  22967. c.stopPropagation();
  22968. c.preventDefault()
  22969. }
  22970. }
  22971. ;
  22972. Blockly.Flyout.prototype.onMouseDown_ = function (a) {
  22973. Blockly.isRightButton(a) ? Blockly.Touch.clearTouchIdentifier() : (Blockly.hideChaff(!0),
  22974. this.dragMode_ = Blockly.DRAG_FREE,
  22975. this.startDragMouseY_ = a.clientY,
  22976. this.startDragMouseX_ = a.clientX,
  22977. Blockly.Flyout.startFlyout_ = this,
  22978. Blockly.Flyout.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.onMouseMove_),
  22979. Blockly.Flyout.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, Blockly.Flyout.terminateDrag_),
  22980. a.preventDefault(),
  22981. a.stopPropagation())
  22982. }
  22983. ;
  22984. Blockly.Flyout.prototype.onMouseUp_ = function (a) {
  22985. this.workspace_.isDragging() || (Blockly.Touch.clearTouchIdentifier(),
  22986. this.autoClose ? this.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_) : Blockly.WidgetDiv.isVisible() || Blockly.Events.fire(new Blockly.Events.Ui(Blockly.Flyout.startBlock_, "click", void 0, void 0)));
  22987. Blockly.terminateDrag_()
  22988. }
  22989. ;
  22990. Blockly.Flyout.prototype.onMouseMove_ = function (a) {
  22991. var b = this.getMetrics_();
  22992. if (this.horizontalLayout_) {
  22993. if (!(0 > b.contentWidth - b.viewWidth)) {
  22994. var c = a.clientX - this.startDragMouseX_;
  22995. this.startDragMouseX_ = a.clientX;
  22996. a = b.viewLeft - c;
  22997. a = goog.math.clamp(a, 0, b.contentWidth - b.viewWidth);
  22998. this.scrollbar_.set(a)
  22999. }
  23000. } else
  23001. 0 > b.contentHeight - b.viewHeight || (c = a.clientY - this.startDragMouseY_,
  23002. this.startDragMouseY_ = a.clientY,
  23003. a = b.viewTop - c,
  23004. a = goog.math.clamp(a, 0, b.contentHeight - b.viewHeight),
  23005. this.scrollbar_.set(a))
  23006. }
  23007. ;
  23008. Blockly.Flyout.prototype.onMouseMoveBlock_ = function (a) {
  23009. "mousemove" == a.type && 1 >= a.clientX && 0 == a.clientY && 0 == a.button || (this.determineDragIntention_(a.clientX - Blockly.Flyout.startDownEvent_.clientX, a.clientY - Blockly.Flyout.startDownEvent_.clientY) ? (Blockly.longStop_(),
  23010. this.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_)) : this.dragMode_ == Blockly.DRAG_FREE && (Blockly.longStop_(),
  23011. this.onMouseMove_(a)));
  23012. a.stopPropagation()
  23013. }
  23014. ;
  23015. Blockly.Flyout.prototype.determineDragIntention_ = function (a, b) {
  23016. if (this.dragMode_ == Blockly.DRAG_FREE)
  23017. return !1;
  23018. if (Math.sqrt(a * a + b * b) < this.DRAG_RADIUS)
  23019. return this.dragMode_ = Blockly.DRAG_STICKY,
  23020. !1;
  23021. if (this.isDragTowardWorkspace_(a, b) || !this.scrollbar_.isVisible())
  23022. return !0;
  23023. this.dragMode_ = Blockly.DRAG_FREE;
  23024. return !1
  23025. }
  23026. ;
  23027. Blockly.Flyout.prototype.isDragTowardWorkspace_ = function (a, b) {
  23028. var c = Math.atan2(b, a) / Math.PI * 180
  23029. , d = this.dragAngleRange_;
  23030. if (this.horizontalLayout_) {
  23031. if (c < 90 + d && c > 90 - d || c > -90 - d && c < -90 + d)
  23032. return !0
  23033. } else if (c < d && c > -d || c < -180 + d || c > 180 - d)
  23034. return !0;
  23035. return !1
  23036. }
  23037. ;
  23038. Blockly.Flyout.prototype.createBlockFunc_ = function (a) {
  23039. var b = this;
  23040. return function (c) {
  23041. if (!Blockly.isRightButton(c) && !a.disabled) {
  23042. Blockly.Events.disable();
  23043. try {
  23044. var d = b.placeNewBlock_(a)
  23045. } finally {
  23046. Blockly.Events.enable()
  23047. }
  23048. Blockly.Events.isEnabled() && (Blockly.Events.setGroup(!0),
  23049. Blockly.Events.fire(new Blockly.Events.Create(d)));
  23050. b.autoClose ? b.hide() : b.filterForCapacity_();
  23051. d.onMouseDown_(c);
  23052. Blockly.dragMode_ = Blockly.DRAG_FREE;
  23053. d.setDragging_(!0);
  23054. b.targetWorkspace_.setResizesEnabled(!1)
  23055. }
  23056. }
  23057. }
  23058. ;
  23059. Blockly.Flyout.prototype.placeNewBlock_ = function (a) {
  23060. var b = this.targetWorkspace_
  23061. , c = a.getSvgRoot();
  23062. if (!c)
  23063. throw "originBlock is not rendered.";
  23064. c = Blockly.getSvgXY_(c, b);
  23065. var d = this.workspace_.scrollX
  23066. , e = this.workspace_.scale;
  23067. c.x += d / e - d;
  23068. this.toolboxPosition_ == Blockly.TOOLBOX_AT_RIGHT && (d = b.getMetrics().viewWidth - this.width_,
  23069. e = b.scale,
  23070. c.x += d / e - d);
  23071. d = this.workspace_.scrollY;
  23072. e = this.workspace_.scale;
  23073. c.y += d / e - d;
  23074. this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM && (d = b.getMetrics().viewHeight - this.height_,
  23075. e = b.scale,
  23076. c.y += d / e - d);
  23077. a = Blockly.Xml.blockToDom(a);
  23078. a = Blockly.Xml.domToBlock(a, b);
  23079. e = a.getSvgRoot();
  23080. if (!e)
  23081. throw "block is not rendered.";
  23082. e = Blockly.getSvgXY_(e, b);
  23083. e.x += b.scrollX / b.scale - b.scrollX;
  23084. e.y += b.scrollY / b.scale - b.scrollY;
  23085. b.toolbox_ && !b.scrollbar && (e.x += b.toolbox_.getWidth() / b.scale,
  23086. e.y += b.toolbox_.getHeight() / b.scale);
  23087. a.moveBy(c.x - e.x, c.y - e.y);
  23088. return a
  23089. }
  23090. ;
  23091. Blockly.Flyout.prototype.filterForCapacity_ = function () {
  23092. for (var a = this.targetWorkspace_.remainingCapacity(), b = this.workspace_.getTopBlocks(!1), c = 0, d; d = b[c]; c++)
  23093. if (-1 == this.permanentlyDisabled_.indexOf(d)) {
  23094. var e = d.getDescendants();
  23095. d.setDisabled(e.length > a)
  23096. }
  23097. }
  23098. ;
  23099. Blockly.Flyout.prototype.getClientRect = function () {
  23100. if (!this.svgGroup_)
  23101. return null;
  23102. var a = this.svgGroup_.getBoundingClientRect()
  23103. , b = a.left
  23104. , c = a.top
  23105. , d = a.width;
  23106. a = a.height;
  23107. return this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP ? new goog.math.Rect(-1E9, c - 1E9, 2E9, 1E9 + a) : this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM ? new goog.math.Rect(-1E9, c, 2E9, 1E9 + a) : this.toolboxPosition_ == Blockly.TOOLBOX_AT_LEFT ? new goog.math.Rect(b - 1E9, -1E9, 1E9 + d, 2E9) : new goog.math.Rect(b, -1E9, 1E9 + d, 2E9)
  23108. }
  23109. ;
  23110. Blockly.Flyout.terminateDrag_ = function () {
  23111. Blockly.Flyout.startFlyout_ && (Blockly.Flyout.startFlyout_.dragMode_ == Blockly.DRAG_FREE && Blockly.Touch.clearTouchIdentifier(),
  23112. Blockly.Flyout.startFlyout_.dragMode_ = Blockly.DRAG_NONE,
  23113. Blockly.Flyout.startFlyout_ = null);
  23114. Blockly.Flyout.onMouseUpWrapper_ && (Blockly.unbindEvent_(Blockly.Flyout.onMouseUpWrapper_),
  23115. Blockly.Flyout.onMouseUpWrapper_ = null);
  23116. Blockly.Flyout.onMouseMoveBlockWrapper_ && (Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveBlockWrapper_),
  23117. Blockly.Flyout.onMouseMoveBlockWrapper_ = null);
  23118. Blockly.Flyout.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveWrapper_),
  23119. Blockly.Flyout.onMouseMoveWrapper_ = null);
  23120. Blockly.Flyout.startDownEvent_ = null;
  23121. Blockly.Flyout.startBlock_ = null
  23122. }
  23123. ;
  23124. Blockly.Flyout.prototype.reflowHorizontal = function (a) {
  23125. this.workspace_.scale = this.targetWorkspace_.scale;
  23126. for (var b = 0, c = 0, d; d = a[c]; c++)
  23127. b = Math.max(b, d.getHeightWidth().height);
  23128. b += 1.5 * this.MARGIN;
  23129. b *= this.workspace_.scale;
  23130. b += Blockly.Scrollbar.scrollbarThickness;
  23131. if (this.height_ != b) {
  23132. for (c = 0; d = a[c]; c++) {
  23133. var e = d.getHeightWidth();
  23134. if (d.flyoutRect_) {
  23135. d.flyoutRect_.setAttribute("width", e.width);
  23136. d.flyoutRect_.setAttribute("height", e.height);
  23137. var f = d.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0
  23138. , g = d.getRelativeToSurfaceXY();
  23139. d.flyoutRect_.setAttribute("y", g.y);
  23140. d.flyoutRect_.setAttribute("x", this.RTL ? g.x - e.width + f : g.x - f);
  23141. (e = d.startHat_ ? Blockly.BlockSvg.START_HAT_HEIGHT : 0) && d.moveBy(0, e);
  23142. d.flyoutRect_.setAttribute("y", g.y)
  23143. }
  23144. }
  23145. this.height_ = b;
  23146. this.targetWorkspace_.resize()
  23147. }
  23148. }
  23149. ;
  23150. Blockly.Flyout.prototype.reflowVertical = function (a) {
  23151. this.workspace_.scale = this.targetWorkspace_.scale;
  23152. for (var b = 0, c = 0, d; d = a[c]; c++) {
  23153. var e = d.getHeightWidth().width;
  23154. d.outputConnection && (e -= Blockly.BlockSvg.TAB_WIDTH);
  23155. b = Math.max(b, e)
  23156. }
  23157. for (c = 0; d = this.buttons_[c]; c++)
  23158. b = Math.max(b, d.width);
  23159. b += 1.5 * this.MARGIN + Blockly.BlockSvg.TAB_WIDTH;
  23160. b *= this.workspace_.scale;
  23161. b += Blockly.Scrollbar.scrollbarThickness;
  23162. if (this.width_ != b) {
  23163. for (c = 0; d = a[c]; c++) {
  23164. e = d.getHeightWidth();
  23165. if (this.RTL) {
  23166. var f = d.getRelativeToSurfaceXY().x
  23167. , g = b / this.workspace_.scale - this.MARGIN;
  23168. g -= Blockly.BlockSvg.TAB_WIDTH;
  23169. d.moveBy(g - f, 0)
  23170. }
  23171. d.flyoutRect_ && (d.flyoutRect_.setAttribute("width", e.width),
  23172. d.flyoutRect_.setAttribute("height", e.height),
  23173. g = d.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0,
  23174. f = d.getRelativeToSurfaceXY(),
  23175. d.flyoutRect_.setAttribute("x", this.RTL ? f.x - e.width + g : f.x - g),
  23176. (e = d.startHat_ ? Blockly.BlockSvg.START_HAT_HEIGHT : 0) && d.moveBy(0, e),
  23177. d.flyoutRect_.setAttribute("y", f.y))
  23178. }
  23179. this.width_ = b;
  23180. this.targetWorkspace_.resize()
  23181. }
  23182. }
  23183. ;
  23184. Blockly.Flyout.prototype.reflow = function () {
  23185. this.reflowWrapper_ && this.workspace_.removeChangeListener(this.reflowWrapper_);
  23186. var a = this.workspace_.getTopBlocks(!1);
  23187. this.horizontalLayout_ ? this.reflowHorizontal(a) : this.reflowVertical(a);
  23188. this.reflowWrapper_ && this.workspace_.addChangeListener(this.reflowWrapper_)
  23189. }
  23190. ;
  23191. Blockly.Toolbox = function (a) {
  23192. this.workspace_ = a;
  23193. this.RTL = a.options.RTL;
  23194. this.horizontalLayout_ = a.options.horizontalLayout;
  23195. this.toolboxPosition = a.options.toolboxPosition;
  23196. this.config_ = {
  23197. indentWidth: 19,
  23198. cssRoot: "blocklyTreeRoot",
  23199. cssHideRoot: "blocklyHidden",
  23200. cssItem: "",
  23201. cssTreeRow: "blocklyTreeRow",
  23202. cssItemLabel: "blocklyTreeLabel",
  23203. cssTreeIcon: "blocklyTreeIcon",
  23204. cssExpandedFolderIcon: "blocklyTreeIconOpen",
  23205. cssFileIcon: "blocklyTreeIconNone",
  23206. cssSelectedRow: "blocklyTreeSelected"
  23207. };
  23208. this.treeSeparatorConfig_ = {
  23209. cssTreeRow: "blocklyTreeSeparator"
  23210. };
  23211. this.horizontalLayout_ && (this.config_.cssTreeRow += a.RTL ? " blocklyHorizontalTreeRtl" : " blocklyHorizontalTree",
  23212. this.treeSeparatorConfig_.cssTreeRow = "blocklyTreeSeparatorHorizontal " + (a.RTL ? "blocklyHorizontalTreeRtl" : "blocklyHorizontalTree"),
  23213. this.config_.cssTreeIcon = "")
  23214. }
  23215. ;
  23216. Blockly.Toolbox.prototype.width = 0;
  23217. Blockly.Toolbox.prototype.height = 0;
  23218. Blockly.Toolbox.prototype.selectedOption_ = null;
  23219. Blockly.Toolbox.prototype.lastCategory_ = null;
  23220. Blockly.Toolbox.prototype.init = function () {
  23221. var a = this.workspace_
  23222. , b = this.workspace_.getParentSvg();
  23223. this.HtmlDiv = goog.dom.createDom("DIV", "blocklyToolboxDiv");
  23224. this.HtmlDiv.setAttribute("dir", a.RTL ? "RTL" : "LTR");
  23225. b.parentNode.insertBefore(this.HtmlDiv, b);
  23226. Blockly.bindEventWithChecks_(this.HtmlDiv, "mousedown", this, function (a) {
  23227. Blockly.isRightButton(a) || a.target == this.HtmlDiv ? Blockly.hideChaff(!1) : Blockly.hideChaff(!0);
  23228. Blockly.Touch.clearTouchIdentifier()
  23229. });
  23230. this.flyout_ = new Blockly.Flyout({
  23231. disabledPatternId: a.options.disabledPatternId,
  23232. parentWorkspace: a,
  23233. RTL: a.RTL,
  23234. oneBasedIndex: a.options.oneBasedIndex,
  23235. horizontalLayout: a.horizontalLayout,
  23236. toolboxPosition: a.options.toolboxPosition
  23237. });
  23238. goog.dom.insertSiblingAfter(this.flyout_.createDom(), a.svgGroup_);
  23239. this.flyout_.init(a);
  23240. this.config_.cleardotPath = a.options.pathToMedia + "1x1.gif";
  23241. this.config_.cssCollapsedFolderIcon = "blocklyTreeIconClosed" + (a.RTL ? "Rtl" : "Ltr");
  23242. this.tree_ = b = new Blockly.Toolbox.TreeControl(this, this.config_);
  23243. b.setShowRootNode(!1);
  23244. b.setShowLines(!1);
  23245. b.setShowExpandIcons(!1);
  23246. b.setSelectedItem(null);
  23247. a = this.populate_(a.options.languageTree);
  23248. b.render(this.HtmlDiv);
  23249. a && b.setSelectedItem(a);
  23250. this.addColour_();
  23251. this.position()
  23252. }
  23253. ;
  23254. Blockly.Toolbox.prototype.dispose = function () {
  23255. this.flyout_.dispose();
  23256. this.tree_.dispose();
  23257. goog.dom.removeNode(this.HtmlDiv);
  23258. this.lastCategory_ = this.workspace_ = null
  23259. }
  23260. ;
  23261. Blockly.Toolbox.prototype.getWidth = function () {
  23262. return this.width
  23263. }
  23264. ;
  23265. Blockly.Toolbox.prototype.getHeight = function () {
  23266. return this.height
  23267. }
  23268. ;
  23269. Blockly.Toolbox.prototype.position = function () {
  23270. var a = this.HtmlDiv;
  23271. if (a) {
  23272. var b = this.workspace_.getParentSvg();
  23273. goog.style.getPageOffset(b);
  23274. b = Blockly.svgSize(b);
  23275. this.horizontalLayout_ ? (a.style.left = "0",
  23276. a.style.height = "auto",
  23277. a.style.width = b.width + "px",
  23278. this.height = a.offsetHeight,
  23279. this.toolboxPosition == Blockly.TOOLBOX_AT_TOP ? a.style.top = "0" : a.style.bottom = "0") : (this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT ? a.style.right = "0" : a.style.left = "0",
  23280. a.style.height = b.height + "px",
  23281. this.width = a.offsetWidth);
  23282. this.flyout_.position()
  23283. }
  23284. }
  23285. ;
  23286. Blockly.Toolbox.prototype.populate_ = function (a) {
  23287. this.tree_.removeChildren();
  23288. this.tree_.blocks = [];
  23289. this.hasColours_ = !1;
  23290. a = this.syncTrees_(a, this.tree_, this.workspace_.options.pathToMedia);
  23291. if (this.tree_.blocks.length)
  23292. throw "Toolbox cannot have both blocks and categories in the root level.";
  23293. this.workspace_.resizeContents();
  23294. return a
  23295. }
  23296. ;
  23297. Blockly.Toolbox.prototype.syncTrees_ = function (a, b, c) {
  23298. for (var d = null, e = null, f = 0, g; g = a.childNodes[f]; f++)
  23299. if (g.tagName)
  23300. switch (g.tagName.toUpperCase()) {
  23301. case "CATEGORY":
  23302. e = this.tree_.createNode(g.getAttribute("name"));
  23303. e.blocks = [];
  23304. var h = g.getAttribute("custom");
  23305. h ? e.blocks = h : (h = this.syncTrees_(g, e, c)) && (d = h);
  23306. h = g.getAttribute("colour");
  23307. goog.isString(h) ? (h.match(/^#[0-9a-fA-F]{6}$/) ? e.hexColour = h : e.hexColour = Blockly.hueToRgb(h),
  23308. this.hasColours_ = !0) : e.hexColour = "";
  23309. "true" == g.getAttribute("expanded") ? (e.blocks.length && (d = e),
  23310. e.setExpanded(!0)) : e.setExpanded(!1);
  23311. b.add(e);
  23312. e = g;
  23313. break;
  23314. case "SEP":
  23315. e && ("CATEGORY" == e.tagName.toUpperCase() ? b.add(new Blockly.Toolbox.TreeSeparator(this.treeSeparatorConfig_)) : (g = parseFloat(g.getAttribute("gap")),
  23316. !isNaN(g) && e && e.setAttribute("gap", g)));
  23317. break;
  23318. case "BLOCK":
  23319. case "SHADOW":
  23320. case "LABEL":
  23321. case "BUTTON":
  23322. b.blocks.push(g),
  23323. e = g
  23324. }
  23325. return d
  23326. }
  23327. ;
  23328. Blockly.Toolbox.prototype.addColour_ = function (a) {
  23329. a = (a || this.tree_).getChildren();
  23330. for (var b = 0, c; c = a[b]; b++) {
  23331. var d = c.getRowElement();
  23332. if (d) {
  23333. var e = this.hasColours_ ? "8px solid " + (c.hexColour || "#ddd") : "none";
  23334. this.workspace_.RTL ? d.style.borderRight = e : d.style.borderLeft = e
  23335. }
  23336. this.addColour_(c)
  23337. }
  23338. }
  23339. ;
  23340. Blockly.Toolbox.prototype.clearSelection = function () {
  23341. this.tree_.setSelectedItem(null)
  23342. }
  23343. ;
  23344. Blockly.Toolbox.prototype.getClientRect = function () {
  23345. if (!this.HtmlDiv)
  23346. return null;
  23347. var a = this.HtmlDiv.getBoundingClientRect()
  23348. , b = a.left
  23349. , c = a.top
  23350. , d = a.width;
  23351. a = a.height;
  23352. return this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT ? new goog.math.Rect(-1E7, -1E7, 1E7 + b + d, 2E7) : this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT ? new goog.math.Rect(b, -1E7, 1E7 + d, 2E7) : this.toolboxPosition == Blockly.TOOLBOX_AT_TOP ? new goog.math.Rect(-1E7, -1E7, 2E7, 1E7 + c + a) : new goog.math.Rect(0, c, 2E7, 1E7 + d)
  23353. }
  23354. ;
  23355. Blockly.Toolbox.prototype.refreshSelection = function () {
  23356. var a = this.tree_.getSelectedItem();
  23357. a && a.blocks && this.flyout_.show(a.blocks)
  23358. }
  23359. ;
  23360. Blockly.Toolbox.TreeControl = function (a, b) {
  23361. this.toolbox_ = a;
  23362. goog.ui.tree.TreeControl.call(this, goog.html.SafeHtml.EMPTY, b)
  23363. }
  23364. ;
  23365. goog.inherits(Blockly.Toolbox.TreeControl, goog.ui.tree.TreeControl);
  23366. Blockly.Toolbox.TreeControl.prototype.enterDocument = function () {
  23367. Blockly.Toolbox.TreeControl.superClass_.enterDocument.call(this);
  23368. var a = this.getElement();
  23369. goog.events.BrowserFeature.TOUCH_ENABLED && Blockly.bindEventWithChecks_(a, goog.events.EventType.TOUCHSTART, this, this.handleTouchEvent_)
  23370. }
  23371. ;
  23372. Blockly.Toolbox.TreeControl.prototype.handleTouchEvent_ = function (a) {
  23373. a.preventDefault();
  23374. var b = this.getNodeFromEvent_(a);
  23375. b && a.type === goog.events.EventType.TOUCHSTART && setTimeout(function () {
  23376. b.onMouseDown(a)
  23377. }, 1)
  23378. }
  23379. ;
  23380. Blockly.Toolbox.TreeControl.prototype.createNode = function (a) {
  23381. return new Blockly.Toolbox.TreeNode(this.toolbox_, a ? goog.html.SafeHtml.htmlEscape(a) : goog.html.SafeHtml.EMPTY, this.getConfig(), this.getDomHelper())
  23382. }
  23383. ;
  23384. Blockly.Toolbox.TreeControl.prototype.setSelectedItem = function (a) {
  23385. var b = this.toolbox_;
  23386. if (a != this.selectedItem_ && a != b.tree_) {
  23387. b.lastCategory_ && (b.lastCategory_.children_ == null) && (b.lastCategory_.getRowElement().style.backgroundColor = "");
  23388. if (a) {
  23389. var c = a.hexColour || "#57e";
  23390. a.getRowElement().style.backgroundColor = c;
  23391. b.addColour_(a)
  23392. }
  23393. c = this.getSelectedItem();
  23394. goog.ui.tree.TreeControl.prototype.setSelectedItem.call(this, a);
  23395. a && a.blocks && a.blocks.length ? (b.flyout_.show(a.blocks),
  23396. b.lastCategory_ != a && b.flyout_.scrollToStart()) : b.flyout_.hide();
  23397. c != a && c != this && (c = new Blockly.Events.Ui(null, "category", c && c.getHtml(), a && a.getHtml()),
  23398. c.workspaceId = b.workspace_.id,
  23399. Blockly.Events.fire(c));
  23400. a && (b.lastCategory_ = a)
  23401. }
  23402. }
  23403. ;
  23404. Blockly.Toolbox.TreeNode = function (a, b, c, d) {
  23405. goog.ui.tree.TreeNode.call(this, b, c, d);
  23406. a && (b = function () {
  23407. Blockly.svgResize(a.workspace_)
  23408. }
  23409. ,
  23410. goog.events.listen(a.tree_, goog.ui.tree.BaseNode.EventType.EXPAND, b),
  23411. goog.events.listen(a.tree_, goog.ui.tree.BaseNode.EventType.COLLAPSE, b))
  23412. }
  23413. ;
  23414. goog.inherits(Blockly.Toolbox.TreeNode, goog.ui.tree.TreeNode);
  23415. Blockly.Toolbox.TreeNode.prototype.getExpandIconSafeHtml = function () {
  23416. return goog.html.SafeHtml.create("span")
  23417. }
  23418. ;
  23419. Blockly.Toolbox.TreeNode.prototype.onMouseDown = function (a) {
  23420. this.hasChildren() && this.isUserCollapsible_ ? (this.toggle(),
  23421. this.select()) : this.isSelected() ? this.getTree().setSelectedItem(null) : this.select();
  23422. this.updateRow()
  23423. }
  23424. ;
  23425. Blockly.Toolbox.TreeNode.prototype.onDoubleClick_ = function (a) { }
  23426. ;
  23427. Blockly.Toolbox.TreeNode.prototype.onKeyDown = function (a) {
  23428. if (this.tree.toolbox_.horizontalLayout_) {
  23429. var b = {}
  23430. , c = goog.events.KeyCodes.DOWN
  23431. , d = goog.events.KeyCodes.UP;
  23432. b[goog.events.KeyCodes.RIGHT] = this.rightToLeft_ ? d : c;
  23433. b[goog.events.KeyCodes.LEFT] = this.rightToLeft_ ? c : d;
  23434. b[goog.events.KeyCodes.UP] = goog.events.KeyCodes.LEFT;
  23435. b[goog.events.KeyCodes.DOWN] = goog.events.KeyCodes.RIGHT;
  23436. a.keyCode = b[a.keyCode] || a.keyCode
  23437. }
  23438. return Blockly.Toolbox.TreeNode.superClass_.onKeyDown.call(this, a)
  23439. }
  23440. ;
  23441. Blockly.Toolbox.TreeSeparator = function (a) {
  23442. Blockly.Toolbox.TreeNode.call(this, null, "", a)
  23443. }
  23444. ;
  23445. goog.inherits(Blockly.Toolbox.TreeSeparator, Blockly.Toolbox.TreeNode);
  23446. Blockly.Css = {};
  23447. Blockly.Css.Cursor = {
  23448. OPEN: "handopen",
  23449. CLOSED: "handclosed",
  23450. DELETE: "handdelete"
  23451. };
  23452. Blockly.Css.currentCursor_ = "";
  23453. Blockly.Css.styleSheet_ = null;
  23454. Blockly.Css.mediaPath_ = "";
  23455. Blockly.Css.inject = function (a, b) {
  23456. if (!Blockly.Css.styleSheet_) {
  23457. var c = ".blocklyDraggable {}\n";
  23458. a && (c += Blockly.Css.CONTENT.join("\n"),
  23459. Blockly.FieldDate && (c += Blockly.FieldDate.CSS.join("\n")));
  23460. Blockly.Css.mediaPath_ = b.replace(/[\\\/]$/, "");
  23461. c = c.replace(/<<<PATH>>>/g, Blockly.Css.mediaPath_);
  23462. var d = document.createElement("style");
  23463. document.head.insertBefore(d, document.head.firstChild);
  23464. c = document.createTextNode(c);
  23465. d.appendChild(c);
  23466. Blockly.Css.styleSheet_ = d.sheet;
  23467. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)
  23468. }
  23469. }
  23470. ;
  23471. Blockly.Css.setCursor = function (a) {
  23472. if (Blockly.Css.currentCursor_ != a) {
  23473. Blockly.Css.currentCursor_ = a;
  23474. var b = "url(" + Blockly.Css.mediaPath_ + "/" + a + ".cur), auto"
  23475. , c = ".blocklyDraggable {\n cursor: " + b + ";\n}\n";
  23476. Blockly.Css.styleSheet_.deleteRule(0);
  23477. Blockly.Css.styleSheet_.insertRule(c, 0);
  23478. c = document.getElementsByClassName("blocklyToolboxDiv");
  23479. for (var d = 0, e; e = c[d]; d++)
  23480. e.style.cursor = a == Blockly.Css.Cursor.DELETE ? b : "";
  23481. document.body.parentNode.style.cursor = a == Blockly.Css.Cursor.OPEN ? "" : b
  23482. }
  23483. }
  23484. ;
  23485. Blockly.Css.CONTENT = [".blocklySvg {", "background-color: #fff;", "outline: none;", "overflow: hidden;", "display: block;", "}", ".blocklyWidgetDiv {", "display: none;", "position: absolute;", "z-index: 99999;", "}", ".injectionDiv {", "height: 100%;", "position: relative;", "}", ".blocklyNonSelectable {", "user-select: none;", "-moz-user-select: none;", "-webkit-user-select: none;", "-ms-user-select: none;", "}", ".blocklyTooltipDiv {", "background-color: #ffffc7;", "border: 1px solid #ddc;", "box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);", "color: #000;", "display: none;", "font-family: sans-serif;", "font-size: 9pt;", "opacity: 0.9;", "padding: 2px;", "position: absolute;", "z-index: 100000;", "}", ".blocklyResizeSE {", "cursor: se-resize;", "fill: #aaa;", "}", ".blocklyResizeSW {", "cursor: sw-resize;", "fill: #aaa;", "}", ".blocklyResizeLine {", "stroke: #888;", "stroke-width: 1;", "}", ".blocklyHighlightedConnectionPath {", "fill: none;", "stroke: #fc3;", "stroke-width: 4px;", "}", ".blocklyPathLight {", "fill: none;", "stroke-linecap: round;", "stroke-width: 1;", "}", ".blocklySelected>.blocklyPath {", "stroke: #fc3;", "stroke-width: 3px;", "}", ".blocklySelected>.blocklyPathLight {", "display: none;", "}", ".blocklyDragging>.blocklyPath,", ".blocklyDragging>.blocklyPathLight {", "fill-opacity: .8;", "stroke-opacity: .8;", "}", ".blocklyDragging>.blocklyPathDark {", "display: none;", "}", ".blocklyDisabled>.blocklyPath {", "fill-opacity: .5;", "stroke-opacity: .5;", "}", ".blocklyDisabled>.blocklyPathLight,", ".blocklyDisabled>.blocklyPathDark {", "display: none;", "}", ".blocklyText {", "cursor: default;", "fill: #fff;", "font-family: sans-serif;", "font-size: 11pt;", "}", ".blocklyNonEditableText>text {", "pointer-events: none;", "}", ".blocklyNonEditableText>rect,", ".blocklyEditableText>rect {", "fill: #fff;", "fill-opacity: .6;", "}", ".blocklyNonEditableText>text,", ".blocklyEditableText>text {", "fill: #000;", "}", ".blocklyEditableText:hover>rect {", "stroke: #fff;", "stroke-width: 2;", "}", ".blocklyBubbleText {", "fill: #000;", "}", ".blocklyFlyoutButton {", "fill: #888;", "cursor: default;", "}", ".blocklyFlyoutButtonShadow {", "fill: #666;", "}", ".blocklyFlyoutButton:hover {", "fill: #aaa;", "}", ".blocklyFlyoutLabel {", "cursor: default;", "}", ".blocklyFlyoutLabelBackground {", "opacity: 0;", "}", ".blocklyFlyoutLabelText {", "fill: #000;", "}", ".blocklyFlyoutLabelText:hover {", "fill: #aaa;", "}", ".blocklySvg text {", "user-select: none;", "-moz-user-select: none;", "-webkit-user-select: none;", "cursor: inherit;", "}", ".blocklyHidden {", "display: none;", "}", ".blocklyFieldDropdown:not(.blocklyHidden) {", "display: block;", "}", ".blocklyIconGroup {", "cursor: default;", "}", ".blocklyIconGroup:not(:hover),", ".blocklyIconGroupReadonly {", "opacity: .6;", "}", ".blocklyIconShape {", "fill: #00f;", "stroke: #fff;", "stroke-width: 1px;", "}", ".blocklyIconSymbol {", "fill: #fff;", "}", ".blocklyMinimalBody {", "margin: 0;", "padding: 0;", "}", ".blocklyCommentTextarea {", "background-color: #ffc;", "border: 0;", "margin: 0;", "padding: 2px;", "resize: none;", "}", ".blocklyHtmlInput {", "border: none;", "border-radius: 4px;", "font-family: sans-serif;", "height: 100%;", "margin: 0;", "outline: none;", "padding: 0 1px;", "width: 100%", "}", ".blocklyMainBackground {", "stroke-width: 1;", "stroke: #c6c6c6;", "}", ".blocklyMutatorBackground {", "fill: #fff;", "stroke: #ddd;", "stroke-width: 1;", "}", ".blocklyFlyoutBackground {", "fill: #ddd;", "fill-opacity: .8;", "}", ".blocklyScrollbarBackground {", "opacity: 0;", "}", ".blocklyScrollbarHandle {", "fill: #ccc;", "}", ".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyScrollbarHandle:hover {", "fill: #bbb;", "}", ".blocklyZoom>image {", "opacity: .4;", "}", ".blocklyZoom>image:hover {", "opacity: .6;", "}", ".blocklyZoom>image:active {", "opacity: .8;", "}", ".blocklyFlyout .blocklyScrollbarHandle {", "fill: #bbb;", "}", ".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyFlyout .blocklyScrollbarHandle:hover {", "fill: #aaa;", "}", ".blocklyInvalidInput {", "background: #faa;", "}", ".blocklyAngleCircle {", "stroke: #444;", "stroke-width: 1;", "fill: #ddd;", "fill-opacity: .8;", "}", ".blocklyAngleMarks {", "stroke: #444;", "stroke-width: 1;", "}", ".blocklyAngleGauge {", "fill: #f88;", "fill-opacity: .8;", "}", ".blocklyAngleLine {", "stroke: #f00;", "stroke-width: 2;", "stroke-linecap: round;", "}", ".blocklyContextMenu {", "border-radius: 4px;", "}", ".blocklyDropdownMenu {", "padding: 0 !important;", "}", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {", "background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;", "}", ".blocklyToolboxDiv {", "background-color: #ddd;", "overflow-x: visible;", "overflow-y: auto;", "position: absolute;", "}", ".blocklyTreeRoot {", "padding: 4px 0;", "}", ".blocklyTreeRoot:focus {", "outline: none;", "}", ".blocklyTreeRow {", "height: 22px;", "line-height: 22px;", "margin-bottom: 3px;", "padding-right: 8px;", "white-space: nowrap;", "}", ".blocklyHorizontalTree {", "float: left;", "margin: 1px 5px 8px 0;", "}", ".blocklyHorizontalTreeRtl {", "float: right;", "margin: 1px 0 8px 5px;", "}", '.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {', "margin-left: 8px;", "}", ".blocklyTreeRow:not(.blocklyTreeSelected):hover {", "background-color: #e4e4e4;", "}", ".blocklyTreeSeparator {", "border-bottom: solid #e5e5e5 1px;", "height: 0;", "margin: 5px 0;", "}", ".blocklyTreeSeparatorHorizontal {", "border-right: solid #e5e5e5 1px;", "width: 0;", "padding: 5px 0;", "margin: 0 5px;", "}", ".blocklyTreeIcon {", "background-image: url(<<<PATH>>>/sprites.png);", "height: 16px;", "vertical-align: middle;", "width: 16px;", "}", ".blocklyTreeIconClosedLtr {", "background-position: -32px -1px;", "}", ".blocklyTreeIconClosedRtl {", "background-position: 0px -1px;", "}", ".blocklyTreeIconOpen {", "background-position: -16px -1px;", "}", ".blocklyTreeSelected>.blocklyTreeIconClosedLtr {", "background-position: -32px -17px;", "}", ".blocklyTreeSelected>.blocklyTreeIconClosedRtl {", "background-position: 0px -17px;", "}", ".blocklyTreeSelected>.blocklyTreeIconOpen {", "background-position: -16px -17px;", "}", ".blocklyTreeIconNone,", ".blocklyTreeSelected>.blocklyTreeIconNone {", "background-position: -48px -1px;", "}", ".blocklyTreeLabel {", "cursor: default;", "font-family: sans-serif;", "font-size: 16px;", "padding: 0 3px;", "vertical-align: middle;", "}", ".blocklyTreeSelected .blocklyTreeLabel {", "color: #fff;", "}", ".blocklyWidgetDiv .goog-palette {", "outline: none;", "cursor: default;", "}", ".blocklyWidgetDiv .goog-palette-table {", "border: 1px solid #666;", "border-collapse: collapse;", "}", ".blocklyWidgetDiv .goog-palette-cell {", "height: 13px;", "width: 15px;", "margin: 0;", "border: 0;", "text-align: center;", "vertical-align: middle;", "border-right: 1px solid #666;", "font-size: 1px;", "}", ".blocklyWidgetDiv .goog-palette-colorswatch {", "position: relative;", "height: 13px;", "width: 15px;", "border: 1px solid #666;", "}", ".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {", "border: 1px solid #FFF;", "}", ".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {", "border: 1px solid #000;", "color: #fff;", "}", ".blocklyWidgetDiv .goog-menu {", "background: #fff;", "border-color: #ccc #666 #666 #ccc;", "border-style: solid;", "border-width: 1px;", "cursor: default;", "font: normal 13px Arial, sans-serif;", "margin: 0;", "outline: none;", "padding: 4px 0;", "position: absolute;", "overflow-y: auto;", "overflow-x: hidden;", "max-height: 100%;", "z-index: 20000;", "}", ".blocklyWidgetDiv .goog-menuitem {", "color: #000;", "font: normal 13px Arial, sans-serif;", "list-style: none;", "margin: 0;", "padding: 4px 7em 4px 28px;", "white-space: nowrap;", "}", ".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {", "padding-left: 7em;", "padding-right: 28px;", "}", ".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,", ".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {", "padding-left: 12px;", "}", ".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {", "padding-right: 20px;", "}", ".blocklyWidgetDiv .goog-menuitem-content {", "color: #000;", "font: normal 13px Arial, sans-serif;", "}", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {", "color: #ccc !important;", "}", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {", "opacity: 0.3;", "-moz-opacity: 0.3;", "filter: alpha(opacity=30);", "}", ".blocklyWidgetDiv .goog-menuitem-highlight,", ".blocklyWidgetDiv .goog-menuitem-hover {", "background-color: #d6e9f8;", "border-color: #d6e9f8;", "border-style: dotted;", "border-width: 1px 0;", "padding-bottom: 3px;", "padding-top: 3px;", "}", ".blocklyWidgetDiv .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-menuitem-icon {", "background-repeat: no-repeat;", "height: 16px;", "left: 6px;", "position: absolute;", "right: auto;", "vertical-align: middle;", "width: 16px;", "}", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon {", "left: auto;", "right: 6px;", "}", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {", "background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;", "}", ".blocklyWidgetDiv .goog-menuitem-accel {", "color: #999;", "direction: ltr;", "left: auto;", "padding: 0 6px;", "position: absolute;", "right: 0;", "text-align: right;", "}", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel {", "left: 0;", "right: auto;", "text-align: left;", "}", ".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {", "text-decoration: underline;", "}", ".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {", "color: #999;", "font-size: 12px;", "padding-left: 4px;", "}", ".blocklyWidgetDiv .goog-menuseparator {", "border-top: 1px solid #ccc;", "margin: 4px 0;", "padding: 0;", "}", ""];
  23486. Blockly.Css.CONTENT = [".blocklySvg {", "background-color: #fff;", "outline: none;", "overflow: hidden;", "display: block;", "}", ".blocklyWidgetDiv {", "display: none;", "position: absolute;", "z-index: 99999;", "}", ".injectionDiv {", "height: 100%;", "position: relative;", "}", ".blocklyNonSelectable {", "user-select: none;", "-moz-user-select: none;", "-webkit-user-select: none;", "-ms-user-select: none;", "}", ".blocklyTooltipDiv {", "background-color: #ffffc7;", "border: 1px solid #ddc;", "box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);",
  23487. "color: #000;", "display: none;", "font-family: sans-serif;", "font-size: 9pt;", "opacity: 0.9;", "padding: 2px;", "position: absolute;", "z-index: 100000;", "}", ".blocklyResizeSE {", "cursor: se-resize;", "fill: #aaa;", "}", ".blocklyResizeSW {", "cursor: sw-resize;", "fill: #aaa;", "}", ".blocklyResizeLine {", "stroke: #888;", "stroke-width: 1;", "}", ".blocklyHighlightedConnectionPath {", "fill: none;", "stroke: #fc3;", "stroke-width: 4px;", "}", ".blocklyPathLight {", "fill: none;", "stroke-linecap: round;", "stroke-width: 1;",
  23488. "}", ".blocklySelected>.blocklyPath {", "stroke: #fc3;", "stroke-width: 3px;", "}", ".blocklySelected>.blocklyPathLight {", "display: none;", "}", ".blocklyDragging>.blocklyPath,", ".blocklyDragging>.blocklyPathLight {", "fill-opacity: .8;", "stroke-opacity: .8;", "}", ".blocklyDragging>.blocklyPathDark {", "display: none;", "}", ".blocklyDisabled>.blocklyPath {", "fill-opacity: .5;", "stroke-opacity: .5;", "}", ".blocklyDisabled>.blocklyPathLight,", ".blocklyDisabled>.blocklyPathDark {", "display: none;", "}", ".blocklyText {",
  23489. "cursor: default;", "fill: #fff;", "font-family: sans-serif;", "font-size: 11pt;", "}", ".blocklyTextCode {", " font-family: monospace;", "}", ".blocklyNonEditableText>text {", "pointer-events: none;", "}", ".blocklyNonEditableText>rect,", ".blocklyEditableText>rect {", "fill: #fff;", "fill-opacity: .6;", "}", ".blocklyNonEditableText>text,", ".blocklyEditableText>text {", "fill: #000;", "}", ".blocklyEditableText:hover>rect {", "stroke: #fff;", "stroke-width: 2;", "}", ".blocklyBubbleText {", "fill: #000;", "}", ".blocklyFlyoutButton {",
  23490. "fill: #888;", "cursor: default;", "}", ".blocklyFlyoutButtonShadow {", "fill: #666;", "}", ".blocklyFlyoutButton:hover {", "fill: #aaa;", "}", ".blocklyFlyoutLabel {", "cursor: default;", "}", ".blocklyFlyoutLabelBackground {", "opacity: 0;", "}", ".blocklyFlyoutLabelText {", "fill: #000;", "}", ".blocklyFlyoutLabelText:hover {", "fill: #aaa;", "}", ".blocklySvg text {", "user-select: none;", "-moz-user-select: none;", "-webkit-user-select: none;", "cursor: inherit;", "}", ".blocklyHidden {", "display: none;", "}", ".blocklyFieldDropdown:not(.blocklyHidden) {",
  23491. "display: block;", "}", ".blocklyIconGroup {", "cursor: default;", "}", ".blocklyIconGroup:not(:hover),", ".blocklyIconGroupReadonly {", "opacity: .6;", "}", ".blocklyIconShape {", "fill: #00f;", "stroke: #fff;", "stroke-width: 1px;", "}", ".blocklyIconSymbol {", "fill: #fff;", "}", ".blocklyMinimalBody {", "margin: 0;", "padding: 0;", "}", ".blocklyCommentTextarea {", "background-color: #ffc;", "border: 0;", "margin: 0;", "padding: 2px;", "resize: none;", "}", ".blocklyHtmlInput {", "border: none;", "border-radius: 4px;", "font-family: sans-serif;",
  23492. "height: 100%;", "margin: 0;", "outline: none;", "padding: 0 1px;", "width: 100%", "}", ".blocklyMainBackground {", "stroke-width: 1;", "stroke: #c6c6c6;", "}", ".blocklyMutatorBackground {", "fill: #fff;", "stroke: #ddd;", "stroke-width: 1;", "}", ".blocklyFlyoutBackground {", "fill: #ddd;", "fill-opacity: .8;", "}", ".blocklyScrollbarBackground {", "opacity: 0;", "}", ".blocklyScrollbarHandle {", "fill: #ccc;", "}", ".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyScrollbarHandle:hover {", "fill: #bbb;",
  23493. "}", ".blocklyZoom>image {", "opacity: .4;", "}", ".blocklyZoom>image:hover {", "opacity: .6;", "}", ".blocklyZoom>image:active {", "opacity: .8;", "}", ".blocklyFlyout .blocklyScrollbarHandle {", "fill: #bbb;", "}", ".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyFlyout .blocklyScrollbarHandle:hover {", "fill: #aaa;", "}", ".blocklyInvalidInput {", "background: #faa;", "}", ".blocklyAngleCircle {", "stroke: #444;", "stroke-width: 1;", "fill: #ddd;", "fill-opacity: .8;", "}", ".blocklyAngleMarks {",
  23494. "stroke: #444;", "stroke-width: 1;", "}", ".blocklyAngleGauge {", "fill: #f88;", "fill-opacity: .8;", "}", ".blocklyAngleLine {", "stroke: #f00;", "stroke-width: 2;", "stroke-linecap: round;", "}", ".blocklyContextMenu {", "border-radius: 4px;", "}", ".blocklyDropdownMenu {", "padding: 0 !important;", "}", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {", "background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;", "}",
  23495. ".blocklyToolboxDiv {", "background-color: #ddd;", "overflow-x: visible;", "overflow-y: auto;", "position: absolute;", "}", ".blocklyTreeRoot {", "padding: 4px 0;", "}", ".blocklyTreeRoot:focus {", "outline: none;", "}", ".blocklyTreeRow {", "height: 22px;", "line-height: 22px;", "margin-bottom: 3px;", "padding-right: 8px;", "white-space: nowrap;", "}", ".blocklyHorizontalTree {", "float: left;", "margin: 1px 5px 8px 0;", "}", ".blocklyHorizontalTreeRtl {", "float: right;", "margin: 1px 0 8px 5px;", "}", '.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',
  23496. "margin-left: 8px;", "}", ".blocklyTreeRow:not(.blocklyTreeSelected):hover {", "background-color: #e4e4e4;", "}", ".blocklyTreeSeparator {", "border-bottom: solid #e5e5e5 1px;", "height: 0;", "margin: 5px 0;", "}", ".blocklyTreeSeparatorHorizontal {", "border-right: solid #e5e5e5 1px;", "width: 0;", "padding: 5px 0;", "margin: 0 5px;", "}", ".blocklyTreeIcon {", "background-image: url(<<<PATH>>>/sprites.png);", "height: 16px;", "vertical-align: middle;", "width: 16px;", "}", ".blocklyTreeIconClosedLtr {", "background-position: -32px -1px;",
  23497. "}", ".blocklyTreeIconClosedRtl {", "background-position: 0px -1px;", "}", ".blocklyTreeIconOpen {", "background-position: -16px -1px;", "}", ".blocklyTreeSelected>.blocklyTreeIconClosedLtr {", "background-position: -32px -17px;", "}", ".blocklyTreeSelected>.blocklyTreeIconClosedRtl {", "background-position: 0px -17px;", "}", ".blocklyTreeSelected>.blocklyTreeIconOpen {", "background-position: -16px -17px;", "}", ".blocklyTreeIconNone,", ".blocklyTreeSelected>.blocklyTreeIconNone {", "background-position: -48px -1px;",
  23498. "}", ".blocklyTreeLabel {", "cursor: default;", "font-family: sans-serif;", "font-size: 16px;", "padding: 0 3px;", "vertical-align: middle;", "}", ".blocklyTreeSelected .blocklyTreeLabel {", "color: #fff;", "}", ".blocklyWidgetDiv .goog-palette {", "outline: none;", "cursor: default;", "}", ".blocklyWidgetDiv .goog-palette-table {", "border: 1px solid #666;", "border-collapse: collapse;", "}", ".blocklyWidgetDiv .goog-palette-cell {", "height: 13px;", "width: 15px;", "margin: 0;", "border: 0;", "text-align: center;", "vertical-align: middle;",
  23499. "border-right: 1px solid #666;", "font-size: 1px;", "}", ".blocklyWidgetDiv .goog-palette-colorswatch {", "position: relative;", "height: 13px;", "width: 15px;", "border: 1px solid #666;", "}", ".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {", "border: 1px solid #FFF;", "}", ".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {", "border: 1px solid #000;", "color: #fff;", "}", ".blocklyWidgetDiv .goog-menu {", "background: #fff;", "border-color: #ccc #666 #666 #ccc;", "border-style: solid;",
  23500. "border-width: 1px;", "cursor: default;", "font: normal 13px Arial, sans-serif;", "margin: 0;", "outline: none;", "padding: 4px 0;", "position: absolute;", "overflow-y: auto;", "overflow-x: hidden;", "max-height: 100%;", "z-index: 20000;", "}", ".blocklyWidgetDiv .goog-menuitem {", "color: #000;", "font: normal 13px Arial, sans-serif;", "list-style: none;", "margin: 0;", "padding: 4px 7em 4px 28px;", "white-space: nowrap;", "}", ".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {", "padding-left: 7em;", "padding-right: 28px;",
  23501. "}", ".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,", ".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {", "padding-left: 12px;", "}", ".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {", "padding-right: 20px;", "}", ".blocklyWidgetDiv .goog-menuitem-content {", "color: #000;", "font: normal 13px Arial, sans-serif;", "}", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {", "color: #ccc !important;", "}", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {",
  23502. "opacity: 0.3;", "-moz-opacity: 0.3;", "filter: alpha(opacity=30);", "}", ".blocklyWidgetDiv .goog-menuitem-highlight,", ".blocklyWidgetDiv .goog-menuitem-hover {", "background-color: #d6e9f8;", "border-color: #d6e9f8;", "border-style: dotted;", "border-width: 1px 0;", "padding-bottom: 3px;", "padding-top: 3px;", "}", ".blocklyWidgetDiv .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-menuitem-icon {", "background-repeat: no-repeat;", "height: 16px;", "left: 6px;", "position: absolute;", "right: auto;", "vertical-align: middle;",
  23503. "width: 16px;", "}", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon {", "left: auto;", "right: 6px;", "}", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {", "background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;", "}", ".blocklyWidgetDiv .goog-menuitem-accel {", "color: #999;", "direction: ltr;", "left: auto;", "padding: 0 6px;",
  23504. "position: absolute;", "right: 0;", "text-align: right;", "}", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel {", "left: 0;", "right: auto;", "text-align: left;", "}", ".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {", "text-decoration: underline;", "}", ".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {", "color: #999;", "font-size: 12px;", "padding-left: 4px;", "}", ".blocklyWidgetDiv .goog-menuseparator {", "border-top: 1px solid #ccc;", "margin: 4px 0;", "padding: 0;", "}", ""];
  23505. Blockly.WidgetDiv = {};
  23506. Blockly.WidgetDiv.DIV = null;
  23507. Blockly.WidgetDiv.owner_ = null;
  23508. Blockly.WidgetDiv.dispose_ = null;
  23509. Blockly.WidgetDiv.createDom = function () {
  23510. Blockly.WidgetDiv.DIV || (Blockly.WidgetDiv.DIV = goog.dom.createDom("DIV", "blocklyWidgetDiv"),
  23511. document.body.appendChild(Blockly.WidgetDiv.DIV))
  23512. }
  23513. ;
  23514. Blockly.WidgetDiv.show = function (a, b, c) {
  23515. Blockly.WidgetDiv.hide();
  23516. Blockly.WidgetDiv.owner_ = a;
  23517. Blockly.WidgetDiv.dispose_ = c;
  23518. a = goog.style.getViewportPageOffset(document);
  23519. Blockly.WidgetDiv.DIV.style.top = a.y + "px";
  23520. Blockly.WidgetDiv.DIV.style.direction = b ? "rtl" : "ltr";
  23521. Blockly.WidgetDiv.DIV.style.display = "block"
  23522. }
  23523. ;
  23524. Blockly.WidgetDiv.hide = function () {
  23525. Blockly.WidgetDiv.owner_ && (Blockly.WidgetDiv.owner_ = null,
  23526. Blockly.WidgetDiv.DIV.style.display = "none",
  23527. Blockly.WidgetDiv.DIV.style.left = "",
  23528. Blockly.WidgetDiv.DIV.style.top = "",
  23529. Blockly.WidgetDiv.dispose_ && Blockly.WidgetDiv.dispose_(),
  23530. Blockly.WidgetDiv.dispose_ = null,
  23531. goog.dom.removeChildren(Blockly.WidgetDiv.DIV))
  23532. }
  23533. ;
  23534. Blockly.WidgetDiv.isVisible = function () {
  23535. return !!Blockly.WidgetDiv.owner_
  23536. }
  23537. ;
  23538. Blockly.WidgetDiv.hideIfOwner = function (a) {
  23539. Blockly.WidgetDiv.owner_ == a && Blockly.WidgetDiv.hide()
  23540. }
  23541. ;
  23542. Blockly.WidgetDiv.position = function (a, b, c, d, e) {
  23543. b < d.y && (b = d.y);
  23544. e ? a > c.width + d.x && (a = c.width + d.x) : a < d.x && (a = d.x);
  23545. Blockly.WidgetDiv.DIV.style.left = a + "px";
  23546. Blockly.WidgetDiv.DIV.style.top = b + "px";
  23547. Blockly.WidgetDiv.DIV.style.height = c.height - b + "px"
  23548. }
  23549. ;
  23550. Blockly.inject = function (a, b) {
  23551. goog.isString(a) && (a = document.getElementById(a) || document.querySelector(a));
  23552. if (!goog.dom.contains(document, a))
  23553. throw "Error: container is not in current document.";
  23554. var c = new Blockly.Options(b || {})
  23555. , d = goog.dom.createDom("div", "injectionDiv");
  23556. a.appendChild(d);
  23557. d = Blockly.createDom_(d, c);
  23558. c = Blockly.createMainWorkspace_(d, c);
  23559. Blockly.init_(c);
  23560. c.markFocused();
  23561. Blockly.bindEventWithChecks_(d, "focus", c, c.markFocused);
  23562. Blockly.svgResize(c);
  23563. return c
  23564. }
  23565. ;
  23566. Blockly.createDom_ = function (a, b) {
  23567. a.setAttribute("dir", "LTR");
  23568. goog.ui.Component.setDefaultRightToLeft(b.RTL);
  23569. Blockly.Css.inject(b.hasCss, b.pathToMedia);
  23570. var c = Blockly.createSvgElement("svg", {
  23571. xmlns: "http://www.w3.org/2000/svg",
  23572. "xmlns:html": "http://www.w3.org/1999/xhtml",
  23573. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  23574. version: "1.1",
  23575. "class": "blocklySvg"
  23576. }, a)
  23577. , d = Blockly.createSvgElement("defs", {}, c)
  23578. , e = String(Math.random()).substring(2)
  23579. , f = Blockly.createSvgElement("filter", {
  23580. id: "blocklyEmbossFilter" + e
  23581. }, d);
  23582. Blockly.createSvgElement("feGaussianBlur", {
  23583. "in": "SourceAlpha",
  23584. stdDeviation: 1,
  23585. result: "blur"
  23586. }, f);
  23587. var g = Blockly.createSvgElement("feSpecularLighting", {
  23588. "in": "blur",
  23589. surfaceScale: 1,
  23590. specularConstant: .5,
  23591. specularExponent: 10,
  23592. "lighting-color": "white",
  23593. result: "specOut"
  23594. }, f);
  23595. Blockly.createSvgElement("fePointLight", {
  23596. x: -5E3,
  23597. y: -1E4,
  23598. z: 2E4
  23599. }, g);
  23600. Blockly.createSvgElement("feComposite", {
  23601. "in": "specOut",
  23602. in2: "SourceAlpha",
  23603. operator: "in",
  23604. result: "specOut"
  23605. }, f);
  23606. Blockly.createSvgElement("feComposite", {
  23607. "in": "SourceGraphic",
  23608. in2: "specOut",
  23609. operator: "arithmetic",
  23610. k1: 0,
  23611. k2: 1,
  23612. k3: 1,
  23613. k4: 0
  23614. }, f);
  23615. b.embossFilterId = f.id;
  23616. f = Blockly.createSvgElement("pattern", {
  23617. id: "blocklyDisabledPattern" + e,
  23618. patternUnits: "userSpaceOnUse",
  23619. width: 10,
  23620. height: 10
  23621. }, d);
  23622. Blockly.createSvgElement("rect", {
  23623. width: 10,
  23624. height: 10,
  23625. fill: "#aaa"
  23626. }, f);
  23627. Blockly.createSvgElement("path", {
  23628. d: "M 0 0 L 10 10 M 10 0 L 0 10",
  23629. stroke: "#cc0"
  23630. }, f);
  23631. b.disabledPatternId = f.id;
  23632. d = Blockly.createSvgElement("pattern", {
  23633. id: "blocklyGridPattern" + e,
  23634. patternUnits: "userSpaceOnUse"
  23635. }, d);
  23636. 0 < b.gridOptions.length && 0 < b.gridOptions.spacing && (Blockly.createSvgElement("line", {
  23637. stroke: b.gridOptions.colour
  23638. }, d),
  23639. 1 < b.gridOptions.length && Blockly.createSvgElement("line", {
  23640. stroke: b.gridOptions.colour
  23641. }, d));
  23642. b.gridPattern = d;
  23643. return c
  23644. }
  23645. ;
  23646. Blockly.createMainWorkspace_ = function (a, b) {
  23647. b.parentWorkspace = null;
  23648. var c = new Blockly.WorkspaceSvg(b);
  23649. c.scale = b.zoomOptions.startScale;
  23650. a.appendChild(c.createDom("blocklyMainBackground"));
  23651. c.translate(0, 0);
  23652. c.markFocused();
  23653. b.readOnly || b.hasScrollbars || c.addChangeListener(function () {
  23654. if (Blockly.dragMode_ == Blockly.DRAG_NONE) {
  23655. var a = c.getMetrics()
  23656. , e = a.viewLeft + a.absoluteLeft
  23657. , f = a.viewTop + a.absoluteTop;
  23658. if (a.contentTop < f || a.contentTop + a.contentHeight > a.viewHeight + f || a.contentLeft < (b.RTL ? a.viewLeft : e) || a.contentLeft + a.contentWidth > (b.RTL ? a.viewWidth : a.viewWidth + e))
  23659. for (var g = c.getTopBlocks(!1), h = 0, k; k = g[h]; h++) {
  23660. var m = k.getRelativeToSurfaceXY()
  23661. , p = k.getHeightWidth()
  23662. , l = f + 25 - p.height - m.y;
  23663. 0 < l && k.moveBy(0, l);
  23664. l = f + a.viewHeight - 25 - m.y;
  23665. 0 > l && k.moveBy(0, l);
  23666. l = 25 + e - m.x - (b.RTL ? 0 : p.width);
  23667. 0 < l && k.moveBy(l, 0);
  23668. m = e + a.viewWidth - 25 - m.x + (b.RTL ? p.width : 0);
  23669. 0 > m && k.moveBy(m, 0)
  23670. }
  23671. }
  23672. });
  23673. Blockly.svgResize(c);
  23674. Blockly.WidgetDiv.createDom();
  23675. Blockly.Tooltip.createDom();
  23676. return c
  23677. }
  23678. ;
  23679. Blockly.init_ = function (a) {
  23680. var b = a.options
  23681. , c = a.getParentSvg();
  23682. Blockly.bindEventWithChecks_(c, "contextmenu", null, function (a) {
  23683. Blockly.isTargetInput_(a) || a.preventDefault()
  23684. });
  23685. c = Blockly.bindEventWithChecks_(window, "resize", null, function () {
  23686. Blockly.hideChaff(!0);
  23687. Blockly.svgResize(a)
  23688. });
  23689. a.setResizeHandlerWrapper(c);
  23690. Blockly.inject.bindDocumentEvents_();
  23691. b.languageTree && (a.toolbox_ ? a.toolbox_.init(a) : a.flyout_ && (a.flyout_.init(a),
  23692. a.flyout_.show(b.languageTree.childNodes),
  23693. a.flyout_.scrollToStart(),
  23694. a.scrollX = a.flyout_.width_,
  23695. b.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT && (a.scrollX *= -1),
  23696. a.translate(a.scrollX, 0)));
  23697. b.hasScrollbars && (a.scrollbar = new Blockly.ScrollbarPair(a),
  23698. a.scrollbar.resize());
  23699. b.hasSounds && Blockly.inject.loadSounds_(b.pathToMedia, a)
  23700. }
  23701. ;
  23702. Blockly.inject.bindDocumentEvents_ = function () {
  23703. Blockly.documentEventsBound_ || (Blockly.bindEventWithChecks_(document, "keydown", null, Blockly.onKeyDown_),
  23704. Blockly.bindEventWithChecks_(document, "touchend", null, Blockly.longStop_),
  23705. Blockly.bindEventWithChecks_(document, "touchcancel", null, Blockly.longStop_),
  23706. document.addEventListener("mouseup", Blockly.onMouseUp_, !1),
  23707. goog.userAgent.IPAD && Blockly.bindEventWithChecks_(window, "orientationchange", document, function () {
  23708. Blockly.svgResize(Blockly.getMainWorkspace())
  23709. }));
  23710. Blockly.documentEventsBound_ = !0
  23711. }
  23712. ;
  23713. Blockly.inject.loadSounds_ = function (a, b) {
  23714. b.loadAudio_([a + "click.mp3", a + "click.wav", a + "click.ogg"], "click");
  23715. b.loadAudio_([a + "disconnect.wav", a + "disconnect.mp3", a + "disconnect.ogg"], "disconnect");
  23716. b.loadAudio_([a + "delete.mp3", a + "delete.ogg", a + "delete.wav"], "delete");
  23717. var c = []
  23718. , d = function () {
  23719. for (; c.length;)
  23720. Blockly.unbindEvent_(c.pop());
  23721. b.preloadAudio_()
  23722. };
  23723. c.push(Blockly.bindEventWithChecks_(document, "mousemove", null, d, !0));
  23724. c.push(Blockly.bindEventWithChecks_(document, "touchstart", null, d, !0))
  23725. }
  23726. ;
  23727. Blockly.updateToolbox = function (a) {
  23728. console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");
  23729. Blockly.getMainWorkspace().updateToolbox(a)
  23730. }
  23731. ;
  23732. Blockly.utils = {};
  23733. Blockly.addClass_ = function (a, b) {
  23734. var c = a.getAttribute("class") || "";
  23735. -1 == (" " + c + " ").indexOf(" " + b + " ") && (c && (c += " "),
  23736. a.setAttribute("class", c + b))
  23737. }
  23738. ;
  23739. Blockly.removeClass_ = function (a, b) {
  23740. var c = a.getAttribute("class");
  23741. if (-1 != (" " + c + " ").indexOf(" " + b + " ")) {
  23742. c = c.split(/\s+/);
  23743. for (var d = 0; d < c.length; d++)
  23744. c[d] && c[d] != b || (c.splice(d, 1),
  23745. d--);
  23746. c.length ? a.setAttribute("class", c.join(" ")) : a.removeAttribute("class")
  23747. }
  23748. }
  23749. ;
  23750. Blockly.hasClass_ = function (a, b) {
  23751. return -1 != (" " + a.getAttribute("class") + " ").indexOf(" " + b + " ")
  23752. }
  23753. ;
  23754. Blockly.bindEventWithChecks_ = function (a, b, c, d, e) {
  23755. var f = !1
  23756. , g = function (a) {
  23757. var b = !e;
  23758. a = Blockly.Touch.splitEventByTouches(a);
  23759. for (var g = 0, h; h = a[g]; g++)
  23760. if (!b || Blockly.Touch.shouldHandleEvent(h))
  23761. Blockly.Touch.setClientFromTouch(h),
  23762. c ? d.call(c, h) : d(h),
  23763. f = !0
  23764. };
  23765. a.addEventListener(b, g, !1);
  23766. var h = [[a, b, g]];
  23767. if (b in Blockly.Touch.TOUCH_MAP)
  23768. for (var k = function (a) {
  23769. g(a);
  23770. f && a.preventDefault()
  23771. }, m = 0, p; p = Blockly.Touch.TOUCH_MAP[b][m]; m++)
  23772. a.addEventListener(p, k, !1),
  23773. h.push([a, p, k]);
  23774. return h
  23775. }
  23776. ;
  23777. Blockly.bindEvent_ = function (a, b, c, d) {
  23778. var e = function (a) {
  23779. c ? d.call(c, a) : d(a)
  23780. };
  23781. a.addEventListener(b, e, !1);
  23782. var f = [[a, b, e]];
  23783. if (b in Blockly.Touch.TOUCH_MAP)
  23784. for (var g = function (a) {
  23785. if (1 == a.changedTouches.length) {
  23786. var b = a.changedTouches[0];
  23787. a.clientX = b.clientX;
  23788. a.clientY = b.clientY
  23789. }
  23790. e(a);
  23791. a.preventDefault()
  23792. }, h = 0, k; k = Blockly.Touch.TOUCH_MAP[b][h]; h++)
  23793. a.addEventListener(k, g, !1),
  23794. f.push([a, k, g]);
  23795. return f
  23796. }
  23797. ;
  23798. Blockly.unbindEvent_ = function (a) {
  23799. for (; a.length;) {
  23800. var b = a.pop()
  23801. , c = b[2];
  23802. b[0].removeEventListener(b[1], c, !1)
  23803. }
  23804. return c
  23805. }
  23806. ;
  23807. Blockly.noEvent = function (a) {
  23808. a.preventDefault();
  23809. a.stopPropagation()
  23810. }
  23811. ;
  23812. Blockly.isTargetInput_ = function (a) {
  23813. return "textarea" == a.target.type || "text" == a.target.type || "number" == a.target.type || "email" == a.target.type || "password" == a.target.type || "search" == a.target.type || "tel" == a.target.type || "url" == a.target.type || a.target.isContentEditable
  23814. }
  23815. ;
  23816. Blockly.getRelativeXY_ = function (a) {
  23817. var b = new goog.math.Coordinate(0, 0)
  23818. , c = a.getAttribute("x");
  23819. c && (b.x = parseInt(c, 10));
  23820. if (c = a.getAttribute("y"))
  23821. b.y = parseInt(c, 10);
  23822. if (a = (a = a.getAttribute("transform")) && a.match(Blockly.getRelativeXY_.XY_REGEXP_))
  23823. b.x += parseFloat(a[1]),
  23824. a[3] && (b.y += parseFloat(a[3]));
  23825. return b
  23826. }
  23827. ;
  23828. Blockly.getRelativeXY_.XY_REGEXP_ = /translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*\))?/;
  23829. Blockly.getSvgXY_ = function (a, b) {
  23830. var c = 0
  23831. , d = 0
  23832. , e = 1;
  23833. if (goog.dom.contains(b.getCanvas(), a) || goog.dom.contains(b.getBubbleCanvas(), a))
  23834. e = b.scale;
  23835. do {
  23836. var f = Blockly.getRelativeXY_(a);
  23837. if (a == b.getCanvas() || a == b.getBubbleCanvas())
  23838. e = 1;
  23839. c += f.x * e;
  23840. d += f.y * e;
  23841. a = a.parentNode
  23842. } while (a && a != b.getParentSvg()); return new goog.math.Coordinate(c, d)
  23843. }
  23844. ;
  23845. Blockly.createSvgElement = function (a, b, c, d) {
  23846. a = document.createElementNS(Blockly.SVG_NS, a);
  23847. for (var e in b)
  23848. a.setAttribute(e, b[e]);
  23849. document.body.runtimeStyle && (a.runtimeStyle = a.currentStyle = a.style);
  23850. c && c.appendChild(a);
  23851. return a
  23852. }
  23853. ;
  23854. Blockly.isRightButton = function (a) {
  23855. return a.ctrlKey && goog.userAgent.MAC ? !0 : 2 == a.button
  23856. }
  23857. ;
  23858. Blockly.mouseToSvg = function (a, b, c) {
  23859. var d = b.createSVGPoint();
  23860. d.x = a.clientX;
  23861. d.y = a.clientY;
  23862. c || (c = b.getScreenCTM().inverse());
  23863. return d.matrixTransform(c)
  23864. }
  23865. ;
  23866. Blockly.shortestStringLength = function (a) {
  23867. if (!a.length)
  23868. return 0;
  23869. for (var b = a[0].length, c = 1; c < a.length; c++)
  23870. b = Math.min(b, a[c].length);
  23871. return b
  23872. }
  23873. ;
  23874. Blockly.commonWordPrefix = function (a, b) {
  23875. if (!a.length)
  23876. return 0;
  23877. if (1 == a.length)
  23878. return a[0].length;
  23879. for (var c = 0, d = b || Blockly.shortestStringLength(a), e = 0; e < d; e++) {
  23880. for (var f = a[0][e], g = 1; g < a.length; g++)
  23881. if (f != a[g][e])
  23882. return c;
  23883. " " == f && (c = e + 1)
  23884. }
  23885. for (g = 1; g < a.length; g++)
  23886. if ((f = a[g][e]) && " " != f)
  23887. return c;
  23888. return d
  23889. }
  23890. ;
  23891. Blockly.commonWordSuffix = function (a, b) {
  23892. if (!a.length)
  23893. return 0;
  23894. if (1 == a.length)
  23895. return a[0].length;
  23896. for (var c = 0, d = b || Blockly.shortestStringLength(a), e = 0; e < d; e++) {
  23897. for (var f = a[0].substr(-e - 1, 1), g = 1; g < a.length; g++)
  23898. if (f != a[g].substr(-e - 1, 1))
  23899. return c;
  23900. " " == f && (c = e + 1)
  23901. }
  23902. for (g = 1; g < a.length; g++)
  23903. if ((f = a[g].charAt(a[g].length - e - 1)) && " " != f)
  23904. return c;
  23905. return d
  23906. }
  23907. ;
  23908. Blockly.isNumber = function (a) {
  23909. return !!a.match(/^\s*-?\d+(\.\d+)?\s*$/)
  23910. }
  23911. ;
  23912. Blockly.utils.tokenizeInterpolation = function (a) {
  23913. var b = [];
  23914. a = a.split("");
  23915. a.push("");
  23916. for (var c = 0, d = [], e = null, f = 0; f < a.length; f++) {
  23917. var g = a[f];
  23918. 0 == c ? "%" == g ? c = 1 : d.push(g) : 1 == c ? "%" == g ? (d.push(g),
  23919. c = 0) : "0" <= g && "9" >= g ? (c = 2,
  23920. e = g,
  23921. (g = d.join("")) && b.push(g),
  23922. d.length = 0) : (d.push("%", g),
  23923. c = 0) : 2 == c && ("0" <= g && "9" >= g ? e += g : (b.push(parseInt(e, 10)),
  23924. f--,
  23925. c = 0))
  23926. }
  23927. (g = d.join("")) && b.push(g);
  23928. return b
  23929. }
  23930. ;
  23931. Blockly.genUid = function () {
  23932. for (var a = Blockly.genUid.soup_.length, b = [], c = 0; 20 > c; c++)
  23933. b[c] = Blockly.genUid.soup_.charAt(Math.random() * a);
  23934. return b.join("")
  23935. }
  23936. ;
  23937. Blockly.genUid.soup_ = "!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  23938. Blockly.utils.wrap = function (a, b) {
  23939. for (var c = a.split("\n"), d = 0; d < c.length; d++)
  23940. c[d] = Blockly.utils.wrap_line_(c[d], b);
  23941. return c.join("\n")
  23942. }
  23943. ;
  23944. Blockly.utils.wrap_line_ = function (a, b) {
  23945. if (a.length <= b)
  23946. return a;
  23947. for (var c = a.trim().split(/\s+/), d = 0; d < c.length; d++)
  23948. c[d].length > b && (b = c[d].length);
  23949. d = -Infinity;
  23950. var e = 1;
  23951. do {
  23952. var f = d;
  23953. var g = a;
  23954. var h = []
  23955. , k = c.length / e
  23956. , m = 1;
  23957. for (d = 0; d < c.length - 1; d++)
  23958. m < (d + 1.5) / k ? (m++,
  23959. h[d] = !0) : h[d] = !1;
  23960. h = Blockly.utils.wrapMutate_(c, h, b);
  23961. d = Blockly.utils.wrapScore_(c, h, b);
  23962. a = Blockly.utils.wrapToText_(c, h);
  23963. e++
  23964. } while (d > f); return g
  23965. }
  23966. ;
  23967. Blockly.utils.wrapScore_ = function (a, b, c) {
  23968. for (var d = [0], e = [], f = 0; f < a.length; f++)
  23969. d[d.length - 1] += a[f].length,
  23970. !0 === b[f] ? (d.push(0),
  23971. e.push(a[f].charAt(a[f].length - 1))) : !1 === b[f] && d[d.length - 1]++;
  23972. a = Math.max.apply(Math, d);
  23973. for (f = b = 0; f < d.length; f++)
  23974. b -= 2 * Math.pow(Math.abs(c - d[f]), 1.5),
  23975. b -= Math.pow(a - d[f], 1.5),
  23976. -1 != ".?!".indexOf(e[f]) ? b += c / 3 : -1 != ",;)]}".indexOf(e[f]) && (b += c / 4);
  23977. 1 < d.length && d[d.length - 1] <= d[d.length - 2] && (b += .5);
  23978. return b
  23979. }
  23980. ;
  23981. Blockly.utils.wrapMutate_ = function (a, b, c) {
  23982. for (var d = Blockly.utils.wrapScore_(a, b, c), e, f = 0; f < b.length - 1; f++)
  23983. if (b[f] != b[f + 1]) {
  23984. var g = [].concat(b);
  23985. g[f] = !g[f];
  23986. g[f + 1] = !g[f + 1];
  23987. var h = Blockly.utils.wrapScore_(a, g, c);
  23988. h > d && (d = h,
  23989. e = g)
  23990. }
  23991. return e ? Blockly.utils.wrapMutate_(a, e, c) : b
  23992. }
  23993. ;
  23994. Blockly.utils.wrapToText_ = function (a, b) {
  23995. for (var c = [], d = 0; d < a.length; d++)
  23996. c.push(a[d]),
  23997. void 0 !== b[d] && c.push(b[d] ? "\n" : " ");
  23998. return c.join("")
  23999. }
  24000. ;
  24001. var CLOSURE_DEFINES = {
  24002. "goog.DEBUG": !1
  24003. };
  24004. Blockly.mainWorkspace = null;
  24005. Blockly.selected = null;
  24006. Blockly.highlightedConnection_ = null;
  24007. Blockly.localConnection_ = null;
  24008. Blockly.draggingConnections_ = [];
  24009. Blockly.clipboardXml_ = null;
  24010. Blockly.clipboardSource_ = null;
  24011. Blockly.dragMode_ = Blockly.DRAG_NONE;
  24012. Blockly.flyoutButtonCallbacks_ = {};
  24013. Blockly.registerButtonCallback = function (a, b) {
  24014. Blockly.flyoutButtonCallbacks_[a] = b
  24015. }
  24016. ;
  24017. Blockly.hueToRgb = function (a) {
  24018. return goog.color.hsvToHex(a, Blockly.HSV_SATURATION, 255 * Blockly.HSV_VALUE)
  24019. }
  24020. ;
  24021. Blockly.svgSize = function (a) {
  24022. return {
  24023. width: a.cachedWidth_,
  24024. height: a.cachedHeight_
  24025. }
  24026. }
  24027. ;
  24028. Blockly.resizeSvgContents = function (a) {
  24029. a.resizeContents()
  24030. }
  24031. ;
  24032. Blockly.svgResize = function (a) {
  24033. for (; a.options.parentWorkspace;)
  24034. a = a.options.parentWorkspace;
  24035. var b = a.getParentSvg()
  24036. , c = b.parentNode;
  24037. if (c) {
  24038. var d = c.offsetWidth;
  24039. c = c.offsetHeight;
  24040. b.cachedWidth_ != d && (b.setAttribute("width", d + "px"),
  24041. b.cachedWidth_ = d);
  24042. b.cachedHeight_ != c && (b.setAttribute("height", c + "px"),
  24043. b.cachedHeight_ = c);
  24044. a.resize()
  24045. }
  24046. }
  24047. ;
  24048. Blockly.onKeyDown_ = function (a) {
  24049. if (!Blockly.mainWorkspace.options.readOnly && !Blockly.isTargetInput_(a)) {
  24050. var b = !1;
  24051. if (27 == a.keyCode)
  24052. Blockly.hideChaff();
  24053. else if (8 == a.keyCode || 46 == a.keyCode)
  24054. a.preventDefault(),
  24055. Blockly.selected && Blockly.selected.isDeletable() && (b = !0);
  24056. else if (a.altKey || a.ctrlKey || a.metaKey)
  24057. Blockly.selected && Blockly.selected.isDeletable() && Blockly.selected.isMovable() && (67 == a.keyCode ? (Blockly.hideChaff(),
  24058. Blockly.copy_(Blockly.selected)) : 88 == a.keyCode && (Blockly.copy_(Blockly.selected),
  24059. b = !0)),
  24060. // 86 == a.keyCode ? Blockly.clipboardXml_ && (Blockly.Events.setGroup(!0),
  24061. // Blockly.clipboardSource_.paste(Blockly.clipboardXml_),
  24062. // Blockly.Events.setGroup(!1)) :
  24063. 90 == a.keyCode && (Blockly.hideChaff(),
  24064. Blockly.mainWorkspace.undo(a.shiftKey));
  24065. b && (Blockly.Events.setGroup(!0),
  24066. Blockly.hideChaff(),
  24067. Blockly.selected.dispose(Blockly.dragMode_ != Blockly.DRAG_FREE, !0),
  24068. Blockly.highlightedConnection_ && (Blockly.highlightedConnection_.unhighlight(),
  24069. Blockly.highlightedConnection_ = null),
  24070. Blockly.Events.setGroup(!1))
  24071. }
  24072. };
  24073. Blockly.terminateDrag_ = function () {
  24074. Blockly.BlockSvg.terminateDrag();
  24075. Blockly.Flyout.terminateDrag_()
  24076. };
  24077. Blockly.copy_ = function (a) {
  24078. copyText('')
  24079. var b = Blockly.Xml.blockToDom(a);
  24080. Blockly.dragMode_ != Blockly.DRAG_FREE && Blockly.Xml.deleteNext(b);
  24081. var c = a.getRelativeToSurfaceXY();
  24082. b.setAttribute("x", a.RTL ? -c.x : c.x);
  24083. b.setAttribute("y", c.y);
  24084. copyText(Blockly.Xml.domToText(b))
  24085. Blockly.clipboardXml_ = b;
  24086. Blockly.clipboardSource_ = a.workspace
  24087. };
  24088. Blockly.duplicate_ = function (a) {
  24089. var b = Blockly.clipboardXml_
  24090. , c = Blockly.clipboardSource_;
  24091. Blockly.copy_(a);
  24092. a.workspace.paste(Blockly.clipboardXml_);
  24093. Blockly.clipboardXml_ = b;
  24094. Blockly.clipboardSource_ = c
  24095. }
  24096. ;
  24097. Blockly.onContextMenu_ = function (a) {
  24098. Blockly.isTargetInput_(a) || a.preventDefault()
  24099. }
  24100. ;
  24101. Blockly.hideChaff = function (a) {
  24102. Blockly.Tooltip.hide();
  24103. Blockly.WidgetDiv.hide();
  24104. a || (a = Blockly.getMainWorkspace(),
  24105. a.toolbox_ && a.toolbox_.flyout_ && a.toolbox_.flyout_.autoClose && a.toolbox_.clearSelection())
  24106. }
  24107. ;
  24108. Blockly.addChangeListener = function (a) {
  24109. console.warn("Deprecated call to Blockly.addChangeListener, use workspace.addChangeListener instead.");
  24110. return Blockly.getMainWorkspace().addChangeListener(a)
  24111. }
  24112. ;
  24113. Blockly.getMainWorkspace = function () {
  24114. return Blockly.mainWorkspace
  24115. }
  24116. ;
  24117. Blockly.alert = function (a, b) {
  24118. window.alert(a);
  24119. b && b()
  24120. }
  24121. ;
  24122. Blockly.confirm = function (a, b) {
  24123. b(window.confirm(a))
  24124. }
  24125. ;
  24126. Blockly.prompt = function (a, b, c) {
  24127. c(window.prompt(a, b))
  24128. }
  24129. ;
  24130. /**
  24131. * @license
  24132. * Copyright 2016 Google LLC
  24133. * SPDX-License-Identifier: Apache-2.0
  24134. */
  24135. /**
  24136. * An example implementation of how one might replace Blockly's browser
  24137. * dialogs. This is just an example, and applications are not encouraged to use
  24138. * it verbatim.
  24139. *
  24140. * @namespace
  24141. */
  24142. var CustomDialog = {};
  24143. /** Override Blockly.alert() with custom implementation. */
  24144. Blockly.alert = function (message, callback) {
  24145. console.log('Alert: ' + message);
  24146. CustomDialog.show('Alert', message, {
  24147. onCancel: callback
  24148. });
  24149. };
  24150. /** Override Blockly.confirm() with custom implementation. */
  24151. Blockly.confirm = function (message, callback) {
  24152. console.log('Confirm: ' + message);
  24153. CustomDialog.show('Confirm', message, {
  24154. showOkay: true,
  24155. onOkay: function () {
  24156. callback(true);
  24157. },
  24158. showCancel: true,
  24159. onCancel: function () {
  24160. callback(false);
  24161. }
  24162. });
  24163. };
  24164. /** Override Blockly.prompt() with custom implementation. */
  24165. Blockly.prompt = function (message, defaultValue, callback) {
  24166. console.log('Prompt: ' + message);
  24167. CustomDialog.show('Prompt', message, {
  24168. showInput: true,
  24169. showOkay: true,
  24170. onOkay: function () {
  24171. callback(CustomDialog.inputField.value);
  24172. },
  24173. showCancel: true,
  24174. onCancel: function () {
  24175. callback(null);
  24176. }
  24177. });
  24178. CustomDialog.inputField.value = defaultValue;
  24179. };
  24180. /** Hides any currently visible dialog. */
  24181. CustomDialog.hide = function () {
  24182. if (CustomDialog.backdropDiv_) {
  24183. CustomDialog.backdropDiv_.style.display = 'none';
  24184. CustomDialog.dialogDiv_.style.display = 'none';
  24185. }
  24186. };
  24187. /**
  24188. * Shows the dialog.
  24189. * Allowed options:
  24190. * - showOkay: Whether to show the OK button.
  24191. * - showCancel: Whether to show the Cancel button.
  24192. * - showInput: Whether to show the text input field.
  24193. * - onOkay: Callback to handle the okay button.
  24194. * - onCancel: Callback to handle the cancel button and backdrop clicks.
  24195. */
  24196. CustomDialog.show = function (title, message, options) {
  24197. var backdropDiv = CustomDialog.backdropDiv_;
  24198. var dialogDiv = CustomDialog.dialogDiv_;
  24199. if (!dialogDiv) {
  24200. // Generate HTML
  24201. backdropDiv = document.createElement('div');
  24202. backdropDiv.id = 'customDialogBackdrop';
  24203. backdropDiv.style.cssText =
  24204. 'position: absolute;' +
  24205. 'top: 0; left: 0; right: 0; bottom: 0;' +
  24206. 'background-color: rgba(0, 0, 0, .7);' +
  24207. 'z-index: 100;';
  24208. document.body.appendChild(backdropDiv);
  24209. dialogDiv = document.createElement('div');
  24210. dialogDiv.id = 'customDialog';
  24211. dialogDiv.style.cssText =
  24212. 'background-color: #fff;' +
  24213. 'width: 400px;' +
  24214. 'margin: 20px auto 0;' +
  24215. 'border-radius: 5px;' +
  24216. 'padding: 10px;';
  24217. backdropDiv.appendChild(dialogDiv);
  24218. dialogDiv.onclick = function (event) {
  24219. event.stopPropagation();
  24220. };
  24221. CustomDialog.backdropDiv_ = backdropDiv;
  24222. CustomDialog.dialogDiv_ = dialogDiv;
  24223. }
  24224. backdropDiv.style.display = 'block';
  24225. dialogDiv.style.display = 'block';
  24226. var cancelText = localStorage.getItem("handPyLanguage") == "zh-hans" ? "取消" : (localStorage.getItem("handPyLanguage") == "zh-hant" ? "取消" : 'Cancel')
  24227. var okText = localStorage.getItem("handPyLanguage") == "zh-hans" ? "确定" : (localStorage.getItem("handPyLanguage") == "zh-hant" ? "確定" : 'OK')
  24228. var zhuyi = localStorage.getItem("handPyLanguage") == "zh-hans" ? "<b>注意:<br/>1.变量名由英文字母、下划线_、中文或数字组成,并且第一个字符必须是英文字母或下划线。<br/>2.变量名不能是 Python 关键字,如True,False,and等。</b>" :
  24229. (localStorage.getItem("handPyLanguage") == "zh-hant" ? "<b>注意:<br/>1.變量名由英文字母、下劃線_、中文或數字組成,並且第一個字符必須是英文字母或下劃線。<br/>2.變量名不能是 Python 關鍵字,如True,False,and等。</b>" : "<b>Note:<br/>1. The variable name consists of English letters, underscore _,ChineseCX or numbers, and the first character must be an English letter or underscore.<br/>2. The variable name cannot be a Python keyword, such as True, False, and.</b>")
  24230. dialogDiv.innerHTML =
  24231. // '<header class="customDialogTitle"></header>' +
  24232. '<p class="customDialogMessage"></p>' +
  24233. (options.showInput ? '<div style="width:100%;"><input id="customDialogInput"></div>' : '') +
  24234. '<div style="font-size:8px;color:red;">' + zhuyi + '</div>' +
  24235. '<div class="customDialogButtons" style="text-align:right;margin-top:10px;">' +
  24236. (options.showOkay ? '<button id="customDialogOkay" class="customOkayButton" style="margin-right:10px;">' + okText + '</button>' : '') +
  24237. (options.showCancel ? '<button id="customDialogCancel" class="customCancelButton">' + cancelText + '</button>' : '') +
  24238. '</div>';
  24239. // dialogDiv.getElementsByClassName('customDialogTitle')[0]
  24240. // .appendChild(document.createTextNode(title));
  24241. dialogDiv.getElementsByClassName('customDialogMessage')[0]
  24242. .appendChild(document.createTextNode(message));
  24243. var onOkay = function (event) {
  24244. CustomDialog.hide();
  24245. options.onOkay && options.onOkay();
  24246. event && event.stopPropagation();
  24247. };
  24248. var onCancel = function (event) {
  24249. CustomDialog.hide();
  24250. options.onCancel && options.onCancel();
  24251. event && event.stopPropagation();
  24252. };
  24253. var dialogInput = document.getElementById('customDialogInput');
  24254. CustomDialog.inputField = dialogInput;
  24255. if (dialogInput) {
  24256. dialogInput.focus();
  24257. dialogInput.onkeyup = function (event) {
  24258. if (event.keyCode == 13) {
  24259. // Process as OK when user hits enter.
  24260. onOkay();
  24261. return false;
  24262. } else if (event.keyCode == 27) {
  24263. // Process as cancel when user hits esc.
  24264. onCancel();
  24265. return false;
  24266. }
  24267. };
  24268. } else {
  24269. var okay = document.getElementById('customDialogOkay');
  24270. okay && okay.focus();
  24271. }
  24272. if (options.showOkay) {
  24273. document.getElementById('customDialogOkay')
  24274. .addEventListener('click', onOkay);
  24275. }
  24276. if (options.showCancel) {
  24277. document.getElementById('customDialogCancel')
  24278. .addEventListener('click', onCancel);
  24279. }
  24280. backdropDiv.onclick = onCancel;
  24281. };
  24282. Blockly.jsonInitFactory_ = function (a) {
  24283. return function () {
  24284. this.jsonInit(a)
  24285. }
  24286. }
  24287. ;
  24288. Blockly.defineBlocksWithJsonArray = function (a) {
  24289. for (var b = 0, c; c = a[b]; b++)
  24290. Blockly.Blocks[c.type] = {
  24291. init: Blockly.jsonInitFactory_(c)
  24292. }
  24293. }
  24294. ;
  24295. goog.global.console || (goog.global.console = {
  24296. log: function () { },
  24297. warn: function () { }
  24298. });
  24299. goog.global.Blockly || (goog.global.Blockly = {});
  24300. goog.global.Blockly.getMainWorkspace = Blockly.getMainWorkspace;
  24301. goog.global.Blockly.addChangeListener = Blockly.addChangeListener;